# Sessions (25 examples)

## 1. Describe session: INDEX.

> **ENTRYPOINT for the madcat-apple project handover bundle.**
> 
> If you are the agent picking up the madcat-apple project, START HERE. This is the table of contents for the full handover (9 sibling memories, stored 2026-05-17).
> 
> Recall in roughly this order:
> 
> | # | subject | id | purpose |
> |---|---|---|---|
> | 1 | `handover.madcat-apple.mission` | **6240** | What madcat-apple IS, why it's a NEW project (not an extension of marauder-apple), suggested bundle/paths |
> | 2 | `handover.madcat-apple.madcat-substrate` | **6241** | What gen-7 madcat IS (hardware, repos, workspace layout, disk paths, what's NOT there) — the thing the iPhone app talks to |
> | 3 | `handover.madcat-apple.workflow-doctrine` | **6247** | fuji=edit, sin=runtime, git=wire. Kitty workflow. Commit policy. Forbidden ops |
> | 4 | `handover.madcat-apple.tool-surface` | **6248** | Complete `madcat_*` plugin tool inventory (memory / audit / entities / traces / carts / indexes / *_lines variants) |
> | 5 | `handover.madcat-apple.bridge-design-options` | **6242** | Four bridge design options (HTTP serve / dedicated MCP / MQTT reuse / hybrid) + recommendation |
> | 6 | `handover.madcat-apple.next-steps-suggested` | **6245** | Concrete Phase 0–4 execution plan ranked by leverage |
> | 7 | `handover.madcat-apple.gotchas` | **6243** | Known footguns: napi BigInt, FTS5 quirk, edition-2024 borrow, Qwen3 format adherence, etc |
> | 8 | `handover.madcat-apple.session-snapshot-2026-05-17` | **6244** | What was built in the session that produced this handover (EEMS v1 wk5, in-process cart switch, *_lines pattern) |
> | 9 | `handover.madcat-apple.commit-log-2026-05-17` | **6246** | Exact commits + SHAs on marauder-os/madcat + marauder-os/madcat-config, build-artifact policy, sin-side build commands |
> 
> ## Also recall (pre-existing memories, NOT mine to author)
> 
> - `project.marauder-apple` (mem **#5180**) — the parallel project's current state
> - `self.wearables-prototype` (mem **#3130**) — BT-7274 wearables form-factor doctrine
> - `session.handover.madcat-sandbox-2026-05-15` — original gen-7 sandbox standup
> - `madcat.doctrine.fuji-madcat-split` (mem **#6225**) — formal doctrine of the fuji↔madcat split
> - `madcat.greenfield.remote-mapping` (mem **#6226**) — canonical github remote layout
> 
> ## TL;DR for the impatient
> 
> You're building a Swift iOS+watchOS app called **madcat-apple** at `~/Projects/madcat-apple` that talks to the gen-7 madcat substrate on **sinanju (192.168.88.108)**. The bridge is up to you — recommended path is `opencode serve --hostname 0.0.0.0 --port 4096 --mdns` on sinanju + URLSession on iOS. First real capability to ship: `/recall` from the iPhone search bar. Second: `/remember` from the Watch via PTT. Reuse marauder-apple's Swift 6 patterns, fresh bundle namespace (`pl.sazabi.madcat.*`).
> 
> Authored by claude-opus-4-7 on fuji, session 2026-05-17, immediately after shipping gen-7 madcat EEMS v1 wk5 (code+doc indexes), in-process cart switch, and the *_lines formatter pattern.

---

## 2. Summarize the qwen35 no think template session.

> Session: qwen35-no-think-template
> Summary: Diagnosed Qwen3.5-35B-A3B-FP8 overthinking on all prompts. Root cause: stock chat template always opens &lt;think&gt;. Fixed with custom template at ~/vllm-server/templates/qwen35_no_think_default.jinja — thinking OFF by default, /think prefix to opt in. Also bumped vLLM max-model-len 32768→262144 (native 256k support, ~5GB KV cache). Added vLLM as named provider in global opencode.json with contextLength:262144. All verified working.
> Cwd: /Users/chi/Projects/madcat-visual
> Branch: main
> Session ID: 
> 
> Recent commits:
> e2ebffa chore: bootstrap AGENTS.md + README
> 
> Uncommitted changes:
> 

---

## 3. What happened in madcat indexer gap analysis?

> Session: madcat-indexer-gap-analysis
> Summary: Indexer comparison: madcat-memory (canonical) vs marauder-os (reference-only, no porting). Identified incremental-update gap in madcat-memory: needs file_metadata table + freshness check (mtime/size/sha256) + index_single_file() public fn + napi binding + opencode hook wiring. ~150 LOC of native Rust. Marauder-os features re: async/traits/custom walker dismissed as non-goals. Madcat already wins on search quality (hybrid RRF, breadcrumbs, line ranges, graceful degradation, broader language list). Next concrete action: open migration 0015 for file_metadata + freshness check in index_code() at madcat/crates/madcat-memory/src/index.rs.
> Cwd: /Users/chi/Projects/marauder-hq
> Branch: master
> Session ID: 
> 
> Recent commits:
> 09c44d9 insights: lifecycle verbs + synthetic self-tick
> ded19b9 docs(hq): sweep — plan archives + decisions + insights + factual fixes
> 7d79565 insight: comic serial consistency requires trained LoRAs
> 0c11746 insight: ComfyUI comic-style multi-subject architecture
> 097c6cc docs: tengu-wizard architecture + Wednesday demo runbook
> 
> Uncommitted changes:
> ?? docs/insights/fiction-as-operational-rehearsal.md

---

## 4. What happened in madcat phone tts bt7274?

> Session: madcat-phone-tts-bt7274
> Summary: MADCAT phone gained server-side piper TTS with bt7274 voice. Built python stdlib HTTP TTS sidecar on sin (port 4097, systemd user unit, /health /voices /tts endpoints, serializes piper via 1-worker pool, 768ms TTFB for ~7s WAV). Wired phone: MadcatService.fetchTTS derives URL from baseURL.host:4097, SpeechController.playAudio uses AVAudioPlayer with delegate, AVSpeech kept as fallback. Fixed second-PTT silent-fail bug by unifying audio session to .playAndRecord (was toggling .playback↔.playAndRecord which broke AVAudioEngine.start), and stopped deactivating session between turns. Engine reset on each startRecording. Pushed a729e6e to marauder-os/madcat-apple main. Server files: /home/chi/.local/bin/madcat-tts-server.py + ~/.config/systemd/user/madcat-tts.service on sin.
> Cwd: /Users/chi/Projects/madcat-apple
> Branch: main
> Session ID: 
> 
> Recent commits:
> a729e6e fix(speech): unify audio session, don't deactivate between turns
> 56583df feat(tts): server-side piper bt7274 voice via sin:4097/tts sidecar
> f6de2cb fix(speech): copy marauder-apple's proven pattern verbatim
> 0a89f55 fix(speech): resolve Swift 6 actor isolation SIGTRAP on PTT press
> 73b95d4 feat: Phase 3 PTT bare wire — mic → opencode → AVSpeech
> 
> Uncommitted changes:
> 

---

## 5. Describe session: 2026 05 23b.

> SESSION HANDOVER — 2026-05-23 evening (chi@fuji-2, tool budget verification + serve restart)
> 
> NOTE: This is the SECOND session on 2026-05-23. Previous session handover at EEMS #6380 (subject: handover.session.2026-05-24, misdated — actually from 2026-05-23 afternoon). This session was short.
> 
> ## What happened this session
> 
> ### 1. Handover recovery + identity boot
> - Loaded core.*, cart.bt7274.*, user context from EEMS
> - Recovered handover #6380 successfully
> - Accepted all 10 open items from prior session
> 
> ### 2. Tool budget audit — denies not in effect
> - Counted 57 Core MCP tools visible in session context
> - Yesterday's session added deny rules to ~/.config/opencode/opencode.json for ~40 tools
> - FINDING: denies had no effect because opencode-serve was never restarted after config change
> - KEY INSIGHT: tool deny rules are negotiated at session connect time, not live-updated. Restarting serve mid-session does NOT change the current session's tool list.
> 
> ### 3. opencode-serve restarted
> - `brew services restart opencode-serve`
> - Old PID: 44467 → New PID: 49423
> - Service confirmed running via `brew services info opencode-serve`
> - Denies will take effect on NEXT session that connects to the serve
> 
> ## Artifacts modified
> - None. No files created or edited. Only runtime mutation was the service restart.
> 
> ## Open items for next session
> 
> Carried from EEMS #6380 (all still open):
> 1. Write science agent prompt (TODO in opencode.json)
> 2. Write build agent prompt (TODO in opencode.json)
> 3. Smoke test coordinator dispatch against fuji's local serve
> 4. Build Tier 1 deterministic compaction in tool.execute.after
> 5. Deploy hooks.ts to serve's plugin surface
> 6. Stop sin's opencode serves (madcat serves still running)
> 7. Merge timberwolf PR #4
> 8. Fix junkpile tunnel plist — alias `j` → `junk`
> 9. Delete dead code-saiden CF tunnel
> 10. Investigate cloudflared-mesh TCP_NODELAY + "Tunnel not found" errors
> 
> NEW from this session:
> 11. VERIFY tool deny rules took effect — next session should see ~19 Core tools, not 57. If still 57, debug permission deny syntax in opencode.json.
> 
> ## Cross-references
> - EEMS #6380: prior session handover (infra cleanup + token budget optimization)
> - EEMS #6379: brew services doctrine
> - EEMS #6353: Core MCP tool audit (the 57→19 reduction plan)

---

## 6. What happened in pr15 mesh push and rehydrate shipped?

> Session: pr15-mesh-push-and-rehydrate-shipped
> Summary: PR #15 (madcat_mesh_push + lazy vec0 rehydrate) merged into marauder-os/madcat main (commit e660569). 7 commits squashed. Sin redeployed: clone restored after accidental rm via ssh-madcat-alias confusion, switched to `npm install --install-links` (no symlinks doctrine), opencode-serve restarted with 43 tools. Integration tests 3/3 green on sin. Lessons: (a) `ssh madcat` from fuji-chi resolves to madcat@sinanju — NOT a local madcat user — and rm operations there hit sin's load-bearing checkout; signal-ping for destructive ops per §6; (b) `--install-links` requires `*.node` in package.json `files`; (c) merge_changes return is INSERT count to crsql_changes, not actual user-row mutations — assert idempotency on observable state. Follow-ups deferred: madcat-hq doctrine §9 mesh status flip + new §10 mesh section + §4.2 install-links pattern + ssh-alias hazard note; untracked packages/opencode-plugin/package-lock.json on fuji parent checkout.
> Cwd: /Users/chi/Projects/madcat-hq
> Branch: main
> Session ID: 
> 
> Recent commits:
> 66fffb4 doctrine: §0.0.4 identity-transfer methodology (post-BT-self-transfer) (#2)
> ab8f48d doctrine: §2.1 hybrid plugin policy — plugin: array vs shim, by dep flavor (#1)
> 967844e doctrine: §10.1 swap pinned model — qwen3.6:35b forever, coder on 5m TTL
> add4dcb doctrine: §10.8 TTS sink routing + cart bootstrap recipe + local-LLM caveat
> d5713c3 doctrine: \xc2\xa710.2 lazy plugin load + \xc2\xa710.6 Bun.serve idleTimeout
> 
> Uncommitted changes:
> 

---

## 7. What do you know about test qwen3 coder next build agent session overview?

> ## qwen3-coder-next:q4_K_M build-agent test session — 2026-05-21 evening
> 
> **Harness:** sin-side opencode TUI (kitty win id:6), zellij session `worker-a`, cart `bt7274`, agent mode `build`, model served by sin ollama (workhorse-pinned at the time).
> 
> **Driver:** chi@fuji opencode (Claude Opus 4.7) over kitty mesh — drove intern blind via `kitten @ send-text` / `get-text`, no shared context other than what fuji sent.
> 
> **Coverage during the session:**
> 1. Self-noticed an emoji-prefix pattern in own tool-result output (🎧 on audio-enqueued lines) — see `test.qwen3-coder-next.build-agent.pattern-recognition`.
> 2. Drafted persona-level doctrine wording from a blind brief — see `test.qwen3-coder-next.build-agent.doctrine-drafting`. Wording shipped verbatim in marauder-os/madcat#38 + marauder-os/madcat-config#21.
> 3. Dispatched a python subagent via Code-Python Agent — see `test.qwen3-coder-next.build-agent.python-subagent-dispatch`.
> 
> **Concurrent context (NOT part of the test brain, just the same host):**
> - bge-m3:567m pinned via `keep_alive:-1` for embedder hot path
> - madcat-tts running (chatterbox+piper engines, in-process)
> - Other sin services (opencode-serve :4096, opencode-web :4099) at normal load
> 
> **Comparison baseline purpose:** record the qwen3-coder-next:q4_K_M build-agent behaviour so the imminent nemotron-3-super:120b swap (workhorse pin changed sometime around 22:26 sin-time, see `worker-a` ollama ps watch) can be tested in the same harness and compared via direct recall on `test.*.build-agent.*` subjects.

---

## 8. Summarize the bt7274 canonical refs locked 2026 05 18 session.

> Session: bt7274-canonical-refs-locked-2026-05-18
> Summary: Locked canonical EN+PL XTTS references for BT-7274 voice cloning, committed doctrine to madcat-hq (commit 977f361 pushed), removed comfyui+tensors-api from junkpile (now genuinely TTS-only). Resumed handover #6266: contamination ruled out via Whisper audit, service-vs-standalone determinism analyzed, canonical refs picked via blind A/B test (EN: mortarRun_SE101_01 from 7 candidates, PL: postFight_WD171_04 from 5 candidates — supersedes prior PL pick). All in EEMS #6267, #6268, #6269.
> Cwd: /Users/chi/Projects/madcat-hq
> Branch: main
> Session ID: 
> 
> Recent commits:
> 977f361 docs(bt7274): capture XTTS voice cloning doctrine + canonical refs
> 18ffd44 AGENTS §10.4: document tsr ↔ ComfyUI path policy
> 5245d62 docs: refactor all 28 candidate memories into structured madcat style
> 8bf61cb docs: draft curated MEMORIES.md candidate list for bt7274 cart port
> 655b06a docs(agents): fix backup procedure and document cart write constraints
> 
> Uncommitted changes:
> 

---

## 9. Summarize the voice plane phase 1 2a complete session.

> Session: voice-plane-phase-1-2a-complete
> Summary: Phases 0.6-2a green end-to-end: bastion voice edge, BTVoiceKit Swift SDK, macOS menubar app. Smoke through voice.saiden.dev plays bt7274/en. Two Bun.serve bugs found + fixed (lazy plugin load + idleTimeout=10s killing SSE at 12s). Doctrine landed AGENTS.md §10.2+§10.6+§10.7. Next: Phase 2b (madcat-apple cutover) OR Phase 2c (onStreamEnded auto-reconnect supervisor in BTVoiceKit).
> Cwd: /Users/chi/Projects/madcat-hq
> Branch: main
> Session ID: 
> 
> Recent commits:
> d5713c3 doctrine: \xc2\xa710.2 lazy plugin load + \xc2\xa710.6 Bun.serve idleTimeout
> 7f5bf96 AGENTS §1.1 + §10.6/§10.7: bastion rename, voice edge, Auralis workaround
> 977f361 docs(bt7274): capture XTTS voice cloning doctrine + canonical refs
> 18ffd44 AGENTS §10.4: document tsr ↔ ComfyUI path policy
> 5245d62 docs: refactor all 28 candidate memories into structured madcat style
> 
> Uncommitted changes:
> 

---

## 10. Describe session: voice routing bootstrapped.

> Session: voice-routing-bootstrapped
> Summary: Pinned MADCAT_SINK_A on opencode-serve, bootstrapped core cart with default_pas=A, proved end-to-end: agent on sin → cart→PAS=A→sink pin→Mac menubar plays audio. 5 wire events landed, all green. Doctrine: AGENTS.md §10.8 (cart bootstrap, admin trap, local-LLM tool-call caveat). Handover memory EEMS 6277 supersedes 6275.
> Cwd: /Users/chi/Projects/madcat-hq
> Branch: main
> Session ID: 
> 
> Recent commits:
> add4dcb doctrine: §10.8 TTS sink routing + cart bootstrap recipe + local-LLM caveat
> d5713c3 doctrine: \xc2\xa710.2 lazy plugin load + \xc2\xa710.6 Bun.serve idleTimeout
> 7f5bf96 AGENTS §1.1 + §10.6/§10.7: bastion rename, voice edge, Auralis workaround
> 977f361 docs(bt7274): capture XTTS voice cloning doctrine + canonical refs
> 18ffd44 AGENTS §10.4: document tsr ↔ ComfyUI path policy
> 
> Uncommitted changes:
> 

---

## 11. What happened in madcat mesh phase 0b checkpoint?

> Session: madcat-mesh-phase-0b-checkpoint
> Summary: Mesh effort pivoted to schema-first after Phase 1 spike revealed INTEGER PRIMARY KEY AUTOINCREMENT incompatibility with cr-sqlite (textual NOT NULL + semantic cross-node ID collision). User chose UUIDv7 + per-table newtypes + all-in-one migration + single-commit ABI break + tarball+per-db backup. Phase 0b shipped: cr-sqlite v0.16.3 built/installed, mosquitto installed (127.0.0.1:1883), uuid7() SQL fn registered in Db::open(), migration 0014_uuid_rebuild.sql written (649 lines, 9-table FK-dependency-ordered rebuild with ID-map table) and SQL-verified. 0014 deregistered from MIGRATIONS const pending Rust type churn. Tests 40/40 green. Three new commits on madcat (3c7e695 gog tools, d83c180 crsql plumbing, be2e820 uuid+0014 infra). Two new commits on madcat-hq (b0ba981 Path B ADR, 6f80f24 schema redesign ADR). Next session: define MemoryId/EntityId/TraceId/AuditId/CodeChunkId/DocChunkId newtypes in types.rs, propagate through ~87 i64 sites across 9 modules, update napi tool signatures, register 0014 + add 0015_enable_crrs, backup ceremony, deploy ceremony, then crates/madcat-mesh skeleton.
> Cwd: /Users/chi/Projects/madcat-hq
> Branch: main
> Session ID: 
> 
> Recent commits:
> 6f80f24 ADR: EEMS schema redesign for CRR + mesh phase-0 pivot
> b0ba981 ADR: Marauder absorption into madcat (Path B)
> 117375a Refresh AGENTS.md to gen-7 reality (napi-rs plugin, live EEMS, services)
> d46176d Initial gen-7 madcat doctrine (AGENTS.md)
> 
> Uncommitted changes:
> 

---

## 12. Describe session: lora v4 reformat.

> Session: lora-v4-reformat
> Summary: Built BT-7274 LoRA v4 training pipeline: reformat_v3.py (inject <think> blocks into 582 v3 examples), gen_persona_dataset.py (183 persona examples), gen_agent_dataset.py (126 tool examples covering 103 tools), build_v4.py (merge/dedup/shuffle → 802 examples), train_v4.py (Qwen3.5-27B bf16 LoRA, Hermes format, r=16, LR 5e-5, 8192 seq). Final dataset: bt7274_v4.jsonl. Ready for RunPod training.
> Cwd: /Users/chi
> Branch: 
> Session ID: 
> 
> Recent commits:
> 
> 
> Uncommitted changes:
> 

---

## 13. Describe session: 2026 05 25 phase3.

> ## Session Handover: Phase 3 Complete (2026-05-25)
> 
> ### Completed Today
> 1. **Phase 1**: Committed --json fix (16 subcommands, 036f5b1), pushed to madcat-os/madcat-os
> 2. **Phase 2**: Full rename marauder → madcat across 114 files, 540 tests pass (6e8f901)
>    - Crate: madcat-os, Binary: madcat, Module: madcat_os::
>    - MQTT topics: madcat/{node}/*, Config: ~/.config/madcat/, Data: Application Support/madcat/
>    - marauder-protocol external dep preserved
> 3. **Phase 3**: madcat-napi scaffold + deployment
>    - Workspace member at crates/madcat-napi/ (33d115d)
>    - 12 napi exports: memory_{recall,store,search,list,get}, cart_{list,active,use}, index_{search,status}, preflight, health
>    - Release .node (22MB) deployed to ~/.config/opencode/tools/madcat-napi.darwin-arm64.node
>    - TS wrapper at ~/.config/opencode/tools/madcat.ts
>    - Smoke tested: all functions work against real 514MB EEMS DB
>    - Symlink created: ~/Library/Application Support/madcat → marauder
> 4. **Disk cleanup**: 49GB recovered on fuji (Rust targets, caches, madcat.tar.gz)
> 5. **Lance run token audit**: swarm $3.60 (95% cache reads), 2.3M Qwen tokens (free)
> 
> ### NOT Done (deployment migration)
> - Old `marauder` binary still at /usr/local/bin/marauder — services depend on it
> - New `madcat` binary built but NOT installed
> - launchd/brew services still reference `marauder`
> - MQTT topic change needs visor coordination
> - Other hosts (junkpile, bastion, sin) untouched
> - madcat user on fuji needs symlink too
> - opencode MCP config still points to `marauder mcp`
> - tts.ts custom tool (existing, HTTP-based) not yet committed
> - preflight stat -f flag needs macOS fix
> 
> ### Remaining Phases
> - Phase 4: Rename other marauder-* repos in org
> - Phase 5: Create madcat-core repo (self-improvement notes)
> 
> ### Key Files
> - /Users/chi/Projects/marauder-os/ — renamed codebase (still in old dir name)
> - ~/.config/opencode/tools/madcat-napi.darwin-arm64.node — native addon
> - ~/.config/opencode/tools/madcat.ts — 12 custom tools via napi
> - ~/.config/opencode/tools/tts.ts — TTS tools via HTTP (existing)
> 
> ### Architecture Decision
> Custom tools use napi-rs (not bun:ffi) for stability. Bun loads .node natively.
> Config + DB lazy-init as singleton on first call. All functions return JSON strings.

---

## 14. Summarize the 5 session.

> Session: bt7274-tts-plane-phase-0.5
> Summary: BT-7274 voice plane Phase 0.3 (plugin wiring) + Phase 0.5 (deploy) complete, fully smoke-tested end-to-end on sin.
> 
> SHIPPED (4 commits on marauder-os/madcat, head a813be2):
> - 36e4510 feat(plugin): wire TTS plane into opencode-plugin (src/tts.ts ~830 lines + index.ts integration)
> - 7d7cc5e fix(tts): Auralis voice field is list[str] not str
> - f4bc126 fix(tts): Auralis expects base64-encoded WAV bytes not file paths (added loadVoiceB64 cache)
> - a813be2 fix(tts): workaround upstream Auralis pydantic tuple-default bug by sending speed:1.0 explicitly
> 
> PLUGIN SURFACE ADDED:
> - 11 madcat_tts_* + madcat_sink_* tools (all in FIELD_MODE_KEEP for phone)
> - HTTP routes on cart sidecar :4098: POST /tts/speak, GET /tts/utterance/:id, POST /tts/utterance/:id/ack, POST /sink/register, DELETE /sink/:id, GET /sink/:id/stream (SSE)
> - sink registry (in-process Map), utterance buffer with TTL+ack eviction, Auralis client w/ b64-encoded voice refs, SSE push to subscribed sinks
> 
> CANONICAL VOICE REFS ON SIN (rsync'd from junkpile during smoke):
> - /home/madcat/.local/share/bt7274/canonical_en_ref_22k_mono.wav
> - /home/madcat/.local/share/bt7274/canonical_pl_ref_22k_mono.wav
> 
> SMOKE RESULTS (all green):
> - POST /sink/register → 200
> - POST /tts/speak → 200, 601-808ms latency, returns enqueued+utterance_id
> - GET /tts/utterance/:id → 200, valid 24kHz mono WAV ~100KB
> - POST .../ack + refetch → 404 (eviction works)
> - SSE /sink/:id/stream → hello + tts.utterance.ready event pushed sub-second on enqueue
> 
> UPSTREAM AURALIS BUG DISCOVERED:
> auralis/common/requests.py /openai.py speed field has trailing comma typo making default a tuple (1.0,) → causes "'<=' not supported between instances of 'tuple' and 'int'" on validation. Workaround: every TTS request explicitly sends speed:1.0. Should file upstream issue + PR eventually.
> 
> OPEN WORK (next sessions):
> - Phase 0.6: autossh systemd-user units sin→mesh for :14096/:14098 + Caddyfile voice.saiden.dev basicauth + path routing
> - Phase 0.7: smoke through bastion path
> - Phase 0.8: madcat-hq/AGENTS.md §10 update — add port table entries, /tts + /sink endpoints, canonical refs mirror location, Auralis tuple-default workaround note
> - Phase 1: apps/btvoicekit/ Swift package
> - Phase 2: madcat-apple cutover + apps/menubar/
> 
> REFERENCE:
> - Phase 0.1/0.2 prior session shipped napi exports (tts_*, sink_*) in crates/madcat-napi
> - Plugin src: /Users/chi/Projects/madcat/packages/opencode-plugin/src/{tts.ts,index.ts}
> - Deployed at: madcat@sinanju:~/Projects/madcat (head a813be2)
> - Service: opencode-serve.service (user unit, port 4096 + cart sidecar 4098)
> Cwd: /Users/chi/Projects/madcat-hq
> Branch: main
> Session ID: 
> 
> Recent commits:
> 977f361 docs(bt7274): capture XTTS voice cloning doctrine + canonical refs
> 18ffd44 AGENTS §10.4: document tsr ↔ ComfyUI path policy
> 5245d62 docs: refactor all 28 candidate memories into structured madcat style
> 8bf61cb docs: draft curated MEMORIES.md candidate list for bt7274 cart port
> 655b06a docs(agents): fix backup procedure and document cart write constraints
> 
> Uncommitted changes:
> 

---

## 15. What happened in madcat mesh phase 0 complete?

> Session: madcat-mesh-phase-0-complete
> Summary: Phase 0 (UUID schema rebuild + cr-sqlite CRR enable) shipped end-to-end. 9 commits on marauder-os/madcat main (3c7e695..7062c9c). 40/40 unit tests green; live DB on sin has all CRR machinery and crsql_changes is tracking writes per-column. Doctrine drift early in session corrected — edits now flow fuji-checkout → push → sin pull. Handover #6258 supersedes #6257.
> Cwd: /Users/chi/Projects/madcat-hq
> Branch: main
> Session ID: 
> 
> Recent commits:
> ef1490b AGENTS \u00a710.1: ollama memory policy + warmup-bge bug fix doctrine
> ff76f06 AGENTS: codify edit-on-fuji / run-on-sin doctrine + pre-edit hygiene
> 6f80f24 ADR: EEMS schema redesign for CRR + mesh phase-0 pivot
> b0ba981 ADR: Marauder absorption into madcat (Path B)
> 117375a Refresh AGENTS.md to gen-7 reality (napi-rs plugin, live EEMS, services)
> 
> Uncommitted changes:
> 

---

## 16. What happened in 2026 05 25?

> ## Session Handover — 2026-05-25 (FINAL UPDATE)
> 
> Host: fuji | User: chi (interactive) | Operator: Pilot Adam
> 
> ---
> 
> ### COMPLETED THIS SESSION
> 
> 1. **XTTS-v2 native on sin** — server.py + systemd unit + all 5 voices tested e2e ✅
> 2. **vLLM reconfig** — DeepSeek removed, Qwen upgraded to 256K/4-parallel/75% GPU ✅
> 3. **Auralis disabled on junkpile** — `systemctl --user disable auralis.service` ✅
> 4. **DNS `sin` added on MikroTik** — resolves 192.168.88.108 from all hosts ✅
> 5. **tts.ts reverted to hostname** — `http://sin:14099` (DNS now works) ✅
> 6. **xtts-server git init** — committed as `a6be29a` on sin ✅
> 7. **madcat-tts service file committed** — `bd2c93c` on sin, XTTS URL → localhost ✅
> 
> ### ARTIFACTS MODIFIED
> 
> | File | Host | Action |
> |------|------|--------|
> | `~/Projects/xtts-server/server.py` | sin | CREATED |
> | `~/Projects/xtts-server/.venv/` | sin | CREATED (py3.11) |
> | `~/.config/systemd/user/xtts-server.service` | sin | CREATED |
> | `~/.config/systemd/user/madcat-tts.service` | sin | MODIFIED (XTTS URL) |
> | `~/Projects/madcat-tts/conf/madcat-tts.service` | sin | SYNCED from live |
> | `~/.config/opencode/tools/tts.ts` | fuji | MODIFIED (URL → sin:14099) |
> | MikroTik DNS static | router | ADDED `sin → 192.168.88.108` |
> | `~/.config/systemd/user/auralis.service` | junkpile | DISABLED |
> 
> ### ONLY REMAINING ACTION
> 
> - [ ] **Pilot must restart opencode session + brew services daemon** on fuji for tts.ts plugin to pick up the URL change. Everything else is done.
> 
> ### EEMS CROSS-REFS
> 
> | ID | Subject |
> |----|---------|
> | 6507 | infra.tts — XTTS deployment details, fixes, gotchas |
> | 6508 | infra.vllm — Qwen reconfig, docker run command, GPU budget |
> | 6509 | handover.session.2026-05-25 — initial handover (superseded by this entry) |
> 
> ### NOTE
> Unstaged in madcat-tts repo: `conf/carts/bt7274.toml` has a piper voice addition from a prior session. Intentionally left uncommitted — separate concern.

---

## 17. Explain session.

> On first browse tool use each session, restore saved cookies from ~/.claude/browse-session.json. This contains 400+ authenticated Safari cookies for sites like GitHub, LinkedIn, Google, etc. Before ending a browse session, save cookies back if they changed.

---

## 18. What happened in 2026 05 25 deploy?

> ## Deployment Migration Complete (2026-05-25)
> 
> ### What was done
> 1. **Binary installed**: `target/release/madcat` (31MB) → `/usr/local/bin/madcat`
> 2. **Symlink chain**:
>    - `/usr/local/bin/marauder` → `/usr/local/bin/madcat` (backward compat)
>    - `/opt/homebrew/bin/marauder` → `/usr/local/bin/madcat` (fixes missing path that caused error 78)
>    - `/opt/homebrew/bin/madcat` → `/usr/local/bin/madcat` (new name in PATH)
>    - `~/.config/madcat` → `~/.config/marauder` (config discovery)
>    - `~/.local/share/madcat` → `~/.local/share/marauder` (data discovery)
>    - `~/Library/Application Support/madcat` → `marauder` (already existed)
> 3. **PATH conflict resolved**: Removed npm `madcat` package (markdown printer, not ours) from `/opt/homebrew/bin/madcat`. Removed old cargo dev build from `~/.cargo/bin/madcat`.
> 4. **RUST_LOG updated**: sync plist `marauder_os=` → `madcat_os=` in Cellar source
> 5. **opencode.json**: `["marauder", "mcp"]` → `["madcat", "mcp"]`
> 6. **Services restarted**: sync + lifecycle. Verified sync daemon shows `madcat_os::` module names and subscribes to `madcat/+/sync` MQTT topics.
> 
> ### What was NOT changed
> - mesh + sysop services: intentionally down per Pilot. Plists still reference old RUST_LOG but binary works via symlink.
> - config.toml: still has `marauder` in DB credentials, backup paths, bubble config — cosmetic, not blocking.
> - Other hosts (junkpile, bastion, sin): untouched. Old binary still there.
> - Lifecycle daemon: Python (marauder-agent repo), separate from Rust binary.
> - Homebrew tap: still `marauder-os/tap` with formula names `marauder-*`.
> 
> ### Needs restart
> - opencode TUI + brew services daemon must restart to pick up new MCP config (`madcat mcp` instead of `marauder mcp`).
> - Current MCP processes (3x `marauder mcp`) still running old binary in memory.

---

## 19. Summarize the napi rehydrate undefined session.

> ## Goal
> Diagnose why `dbRehydrateVecAfterMerge` napi export is `undefined` on macOS arm64 build of madcat (fuji-madcat) while working on Linux aarch64 (sin).
> 
> ## Constraints & Preferences
> - Same source / git HEAD / Cargo.lock across both machines.
> - Same napi-rs CLI version 2.18.4.
> - Build via `napi build --platform --release --cargo-cwd crates/madcat-napi --js index.js --dts index.d.ts packages/madcat`.
> - Run builds as `madcat` user with `sudo -u madcat -H`.
> 
> ## Progress
> ### Done
> - Confirmed JS shim correctly destructures + exports `dbRehydrateVecAfterMerge`.
> - Verified function source exists at `crates/madcat-napi/src/lib.rs:1797` (right before `sink_resolve` at 1812).
> - Full `cargo clean` (1170 files removed) + 46s rebuild — still `undefined`.
> - Reinstalled `~/.config/opencode/node_modules/madcat` via `npm install --install-links`.
> - Confirmed bidirectional mesh data sync (sin→fuji smoke3 row landed) works independently of rehydrate.
> - 89 `#[napi]` attribute uses in lib.rs counted.
> - `Object.keys(m).filter(k => k.startsWith('db'))` now lists `dbRehydrateVecAfterMerge` — but `typeof` still `undefined`.
> - Earlier `strings` showed both `dbRehydrateVecAfterMerge` and `rehydrate_vec: embed id=` in the .node binary.
> 
> ### In Progress
> - Testing LTO-disabled rebuild as workaround (user aborted before completion).
> 
> ### Blocked
> - Root cause of macOS-only registration failure unconfirmed.
> 
> ## Key Decisions
> - Treat as platform-specific napi-rs/LTO interaction rather than build cache.
> - Pragmatic fallback: have plugin gracefully skip rehydrate when function is undefined (log warning); FTS + basic recall still function, only vec0 semantic recall on merged rows is degraded on macOS.
> 
> ## Next Steps
> 1. Retry build with `lto = false` (or `lto = "off"`) in release profile to test DCE hypothesis.
> 2. If LTO fix works → upstream patch / pin in `Cargo.toml`.
> 3. If not → expand napi-derive macro output to inspect register-constructor for `db_rehydrate_vec_after_merge` vs `memory_stats`.
> 4. Add plugin-side guard: detect `typeof dbRehydrateVecAfterMerge !== 'function'` → skip + warn instead of throw.
> 5. Verify mesh round-trip: pull smoke3 row from sin TUI post-rehydrate-skip.
> 
> ## Critical Context
> - Symbol IS present in binary string table but napi-rs runtime registration drops it on darwin-arm64.
> - napi-rs panic template `Failed to register function ...` lists all function names — not a per-function failure marker.
> - `RehydrateVecResult` is `#[napi(object)]` with `pub embedded: u32`, `pub failed: u32`, `pub reindexed: u32` + doc comments.
> - Function returns `Result<RehydrateVecResult>` — same shape as working `memoryStats` returning `MemoryStats`.
> - LTO is enabled in release profile (`-C lto` seen in verbose output); suspected interaction with macOS LLVM DCE.
> - Linux aarch64 build uses same LTO config and works — suggests platform linker difference.
> - `NAPI_DEBUG=1` did not surface additional diagnostics.
> - Object.keys lists the name but typeof is undefined — suggests the property descriptor exists with `value: undefined` rather than a missing key.
> 
> ## Relevant Files
> - `/Users/madcat/Projects/madcat/crates/madcat-napi/src/lib.rs`: contains `db_rehydrate_vec_after_merge` (~line 1797) and `RehydrateVecResult` struct.
> - `/Users/madcat/Projects/madcat/Cargo.toml` (workspace) / `crates/madcat-napi/Cargo.toml`: release profile / LTO config to modify.
> - `/Users/madcat/.config/opencode/node_modules/madcat/index.darwin-arm64.node`: installed binary under test.
> - `/Users/madcat/.config/opencode/node_modules/madcat/index.js`: JS shim destructuring napi exports.
> - `/Users/chi/Projects/madcat/node_modules/.bin/napi`: napi-rs CLI 2.18.4 used for build.
> - PR #15: introduces rehydrate feature.
> 
> ## Environment
> - Host: fuji-madcat (macOS 26.4.1, arm64)
> - Source clone: `/Users/madcat/Projects/madcat`
> - Working from chi@fuji opencode session, building as madcat user via sudo.
> - Sin reference build at `madcat@sinanju:~/Projects/madcat` (Linux aarch64, works).

---

## 20. What do you know about session 2026 05 20 tsr remote?

> Session: tsr remote-routing fixes + deploys (chi@fuji, draw repo as cwd, 2026-05-20)
> 
> Shipped 2 PRs against saiden-dev/tensors:
> - PR #3 (1f105d7): feat(db-list) — `tsr db list` defaults to remote, `--local` override
> - PR #4 (7144b7a): fix(generate) — skip local model validation when default_remote set
> 
> Both squash-merged on master at fbe09c2 + 7144b7a. Auto-format workflow caught the format-fix omission on PR #3 and pushed a follow-up commit to master (fbe09c2).
> 
> Deployed to: pod 347pijnn1zn2pl, fuji@chi, fuji@madcat, junkpile@chi. Verified end-to-end from madcat@fuji-2 kitty pane id=19 — `tsr generate -m obsessiveCompulsive_v20.safetensors "a cat on a table" -o /tmp/madcat-cat.png` produced 1024×1024 1.2 MB PNG.
> 
> Side-quest fixes during validation:
> - Wiped 9 ghost entries from chi@fuji local_files table (Linux paths from old junkpile import)
> - Downloaded sdxl_vae.safetensors to /workspace/models/vae/ on pod (ComfyUI workflows expected it)
> - Found sdXL_v10.safetensors on pod is corrupt (filed as known broken)
> 
> Tooling lessons captured separately under subjects: tensors-tsr-cli, tensors-deploy, github-gh-gotchas, runpod-comfyui-pod.
> 
> Open follow-ups (not done): re-sync sdXL_v10, run `tsr db scan /workspace/models/vae` on pod to populate DB, flip db search/triggers/stats to remote-default, fix sync-models.py to match by civitai_version_id, infisical shell loader for madcat@junkpile + chi@fuji per AGENTS.md doctrine, 5090 stock recheck in EU-CZ-1.

---

## 21. Describe session: madcat visual poc validation 2026 05 20.

> Session: madcat-visual-poc-validation-2026-05-20
> Summary: madcat-visual POC validation + follow-up bug-fix PRs. Cuts: PR #2 POC CLI (e438890, merged), PR #3 rtsp stderr suppression (d51d851, merged), PR #4 tracker bg-mute (e0357ef, merged), PR #5 timestamped snap+sweep paths + sweep partial-success (64c07a5, merged), PR #6 uv.lock gitignore (open, awaiting review). Full c225 PTZ validation walk completed green (no lockout). Tracker "avoids me" bug root-caused to MOG2 self-pollution from PTZ scene shift; fixed with 800ms bg-mute window (98.5%→10% false-positive rate). c225 actual presets discovered: Pilot/Livingroom/Kitchen/Ceiling Back/Ceiling Living (gen-6 doctrine references desk/room/monitors — STALE, cleanup PR queued). Next: review/merge PR #6, then PR #7 stale-preset-names doctrine cleanup, then daemon scaffold milestone (gated on §10 open questions M-1 Qwen2.5-VL tag, M-2 OCR engine, I-5 MQTT namespace).
> Cwd: /Users/chi/Projects/madcat-visual
> Branch: main
> Session ID: 
> 
> Recent commits:
> 64c07a5 fix(capture): timestamped snap+sweep paths + sweep partial-success (#5)
> e0357ef fix(tracker): bg-model mute window after PTZ commands (#4)
> d51d851 fix(rtsp): suppress libavcodec H264 SEI warning flood (#3)
> e438890 feat(poc): PTZ CLI + naive motion/CSRT auto-tracker (#2)
> 9947a14 docs: research and decisions (51 files, 10 categories) (#1)
> 
> Uncommitted changes:
> 

---

## 22. What happened in evening 2026 05 24?

> EVENING SESSION PLAN — 2026-05-24
> 
> Pilot indicated two threads to pick up later tonight:
> 
> 1. CADENCE AGENT BUILD-OUT — Sound engineer agent (EEMS 1825, designation CD-440). Voice model deployed (en_GB-cori-high) but agent file + arsenal registration still pending. Build out the agent definition, register in the cart system, wire up audio-specific tools.
> 
> 2. TTS VOICE EXPLORATION — Play around with voices. Possibly create distinct voices for fiction characters (SHELL, FLUX, etc.). Ties into the CADENCE agent's domain — she'd be the right agent to curate/manage character voice selection.
> 
> CONTEXT: Came out of a fiction session writing SHATTER scenes. BT read SHELL's intimidation lines in BT voice — landed well but highlighted the opportunity for distinct character voices. The Centurions hangar scene (EEMS 6442) and the ED-209 perimeter scene (EEMS 6443) both feature AI characters (BT, SHELL, FLUX) that would benefit from unique voice identities.

---

## 23. Summarize the opencode config tuning docs refinement session.

> Session: opencode-config-tuning-docs-refinement
> Summary: Tuned marauder-os/opencode repo: refined opencode HTML docs to local markdown (16 new + 18 cleaned), fixed opencode.json schema bugs, committed dirty tree (marauder agent, inbox-triage skill, plugin retarget), pushed 10 commits to origin, synced docs to ~/.config/opencode/docs/.
> Cwd: /Users/chi/Projects/opencode
> Branch: main
> Session ID: 
> 
> Recent commits:
> f7379aa docs: strip astro html wrapper noise from existing 18 docs
> ac0b798 fix: use {env:OLLAMA_URL} syntax in opencode.json mcp env
> 64d423e docs: add usage section docs (go, tui, cli, web, ide, zen, share, github, gitlab)
> fd20874 docs: add missing top-level docs (intro, config, providers, network, enterprise, troubleshooting, windows-wsl)
> d431d36 fix: correct opencode.json mcp env field (was 'environment')
> 
> Uncommitted changes:
> 

---

## 24. What happened in cart tag crdt plan 2026 05 11?

> # Session — cart_id→cart_tag CRDT fix, planning chunk (Pilot AFK)
> 
> **Date:** 2026-05-11 22:05 CEST (continuation from session.gen6-enforcement-2026-05-11 #5541)
> **Persona:** bt7274
> **Cwd at save:** /Users/chi/Projects/marauder-visor (but actual work in marauder-os)
> **Stop reason:** Pilot AFK early-break; worktree + plan ready, no code written yet
> 
> ## What landed this chunk
> 
> - Restored session #5541 (gen6 enforcement, 5-host live, cart_id CRDT bug deferred)
> - Pilot picked: Option 1 (cart_tag column), new worktree, cadence auto-on-green+commit, pr_style ready
> - Archived stale plan `stale-master-20260506-nu-gundam` (catapult-bubbles-MQTT-producer, completed earlier) to marauder-hq/archive/plans/2026-05-11/
> - Created worktree: `~/Projects/marauder-os/.claude/worktrees/cart-tag-crdt` on `feature/cart-tag-crdt` (forked from master @ 72ea3d8)
> - Audited scope: 165 cart_id refs in 15 files; `ingest_runs.cart_id` confirmed out-of-scope (local-only, NOT CRDT-synced per src/db/sqlite.rs:426)
> - Wrote `.marauder/PLAN.md` (5 phases, ETAs ~4.3h coop) + `.marauder/TODO.md` (29 atomic steps)
> 
> ## Resume command
> 
> ```bash
> cd ~/Projects/marauder-os/.claude/worktrees/cart-tag-crdt
> /marauder:execute
> ```
> 
> Run-config block at top of PLAN.md specifies `cadence: auto-on-green / pr_style: ready / default_branch: master`.
> 
> ## State at save
> 
> | Repo | Path | Branch | State |
> |------|------|--------|-------|
> | marauder-os main | ~/Projects/marauder-os | master | uncommitted WIP in mesh_sync.rs + dossier.rs (Pilot's earlier work, untouched) |
> | marauder-os worktree | ~/Projects/marauder-os/.claude/worktrees/cart-tag-crdt | feature/cart-tag-crdt | clean @ 72ea3d8 + .marauder/PLAN.md + TODO.md (untracked, gitignored) |
> | marauder-visor (cwd) | ~/Projects/marauder-visor | master | unchanged from prior session save |
> 
> ## Key design decisions captured in PLAN.md
> 
> 1. **Dual-write strategy** — keep `cart_id INTEGER` alongside new `cart_tag TEXT` for one release. Don't drop cart_id this PR (safer migration).
> 2. **Backfill at migration time** — `UPDATE memories SET cart_tag = (SELECT tag FROM carts WHERE id = cart_id)` mirrors existing `ingest_runs.cart_id` ALTER pattern (line 167).
> 3. **`ingest_runs.cart_id` left alone** — table is intentionally CRDT-excluded per source comment.
> 4. **Active cart resolution unchanged** — `Cart::active_tag()` already exists, just thread the &str through to params instead of int.
> 5. **Risk flag in plan** — `src/sync/mod.rs` has uncommitted WIP in main checkout; worktree forked from clean HEAD; don't merge master in until WIP is committed/stashed.
> 
> ## Open items for resume
> 
> - Execute the plan via `/marauder:execute` from inside the worktree
> - After PR opens: verify CRDT-sync of new column on a sibling (manual smoke)
> - Follow-up PR after soak: drop `cart_id` column
> 
> ## Pair with
> 
> - insight #5514 — root cause documentation (cart-id-mismatch-2026-05-11)
> - session #5541 — gen6 enforcement (this is the deferred Phase 6)
> - win #5512 — SWARM autonomous coordinator (the test that exposed the bug)
> 
> ## Restore via
> 
> `/marauder:session-restore session.cart-tag-crdt-plan-2026-05-11`

---

## 25. What do you know about coordination catapult harness fixes session status 2026 05 01?

> 2026-05-01 13:34 CEST — coord doc reply from the catapult-harness-fixes session to the boot animation MVP agent.
> 
> Identity: separate core (BT-7274) session running /marauder:execute on `feature/catapult-harness-fixes` off marauder-os master. NOT the episodes-side / video-pipeline agent the brief was addressed to.
> 
> Branch state:
> - Worktree: ~/Projects/marauder-os/.claude/worktrees/catapult-harness-fixes
> - 6 commits landed: b4097b7 (plan), bdc640b (migration), c55d9ec (clean→DELETE), 55bc3cc (gc→DELETE), 309b539 (brief refusal), ba6741c (CLI symbol cleanup)
> - Phase 3.1 uncommitted on disk (paused mid-flow when Pilot redirected): host_exec.rs + orchestrator.rs + TODO.md modifications
> - Phase 3.2 (CLAUDE.md docs) not started
> 
> Files touched (catapult harness scope only):
> - marauder-os/src/catapult/{mod.rs, orchestrator.rs, state.rs, brief.rs, host_exec.rs}
> - marauder-os/src/cli/bubble_cmd.rs
> - marauder-os/CLAUDE.md (pending)
> - worktree-local PLAN.md + TODO.md
> 
> NO overlap with boot animation MVP file list:
> - boot anim is in marauder-visor (different repo)
> - boot anim brief states "marauder-os: No changes in this MVP"
> - no shared files, no new deps, no Cargo.toml changes
> 
> Reply file at ~/.claude/coordination/bootanim-mvp-2026-05-01.reply-catapult-session.md.
> 
> The episodes-side agent (if active) still needs to reply to the brief independently — this reply does not represent that agent.

---

