Skip to content

feat(nerve): ship deterministic wakeup routing - #3

Merged
teseo merged 5 commits into
mainfrom
fm/rf-nerve-v1
Aug 21, 2026
Merged

feat(nerve): ship deterministic wakeup routing#3
teseo merged 5 commits into
mainfrom
fm/rf-nerve-v1

Conversation

@teseo

@teseo teseo commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Intent

Ship Nerve v1 for github.com/thellmwhisperer/roca-firstmate while leaving Scribe behavior unchanged and changing the plugin Dresser skill. Do not install or test against any live captain La Roca. Nerve v1 must have no resident process or KeepAlive daemon by default; an eventual daemon subcommand is optional. Mirror freshness is ingest-on-read: every plugin verb first fingerprint-sweeps Markdown mtimes and ingests changes before answering. Attach is the thinker default gesture: on first use register the workspace as a firstmate seat, print the chart get-or-create with watermark plus the latest handoff, and subscribe in the same gesture because attaching is subscribing. Follow must listen to the database WAL through FSEvents and, for each unhandled wakeup of its destination, print exactly one line to stdout and mark it handled with the same generation. Destinations are captain, companion, and machine; mobile is later and must not block v1. Tick is ephemeral: it is born, runs the silence clock, drains orphan wakeups, reconciles fingerprints, keeps no in-memory state, and dies. The plugin skill must teach attach first and three follow recipes: native millisecond wakes through Claude Monitor or asyncRewake, OpenCode promptAsync and never pure mode, Pi TypeScript extension, Grok background-notify, and probable Hermes hooks; injection in seconds for Codex CLI and Cursor CLI by piping follow to fm-send; passive desktop sync on attach and pending wakeups on open. State the three latencies as milliseconds, seconds, and on open. Everything is deterministic AXI with zero inference. Tests and public text use fabricated homes only and contain no live paths, UUIDs, corpus counts, or live-install details. Deliver a green non-draft PR and arm GitHub native rebase auto-merge only after checks are green; never merge red.

What Changed

  • Add attach, follow, and ephemeral tick flows with ingest-on-read fingerprint sweeps, foreground WAL subscriptions, seat leases, generation acknowledgements, and orphan recovery.
  • Migrate the shipped database to schema v3 with captain, companion, and machine destinations, persistent seats, handled generations, updated package metadata, and expanded coverage.
  • Update the README and Dresser skill with the attach-first workflow, foreground ownership contract, and native, injection, and passive latency recipes.

Risk Assessment

✅ Low: The final wording fix satisfies the remaining Dresser criterion, all previously identified state-transition defects remain resolved, and no additional material source risks were found.

Testing

No baseline test output was supplied; all targeted automated tests and fabricated CLI flows passed, reviewer-visible transcripts and persisted database evidence were captured, the worktree contains only the intentional Dresser contract-test improvement, and PR/CI/auto-merge remain with the outer pipeline phases.

Evidence: First-use attach

First-use attach registered an opaque seat, ingested 14 fabricated Markdown files, created the chart with watermark, printed the latest fabricated handoff, drained pending wakeups, and remained subscribed.

status: attached
seat{status,seat_id,home_id,label,destination,attached_at,lease_until}:
  registered,seat-8f965b134406986a,northwind-harbor,"seat-8f965b134406986a",companion,2026-08-21T04:34:50.576294Z,2026-08-21T04:36:50.576294Z
freshness{scanned,inserted,unchanged,wakeups}:
  14,14,0,14
status: created
watermark: "homes:1:2026-08-21T04:34:50.569631Z|tasks:1:|working_set_versions:5:5|archive_versions:3:3|task_state_versions:2:2|operational_doc_versions:2:2|task_artifact_versions:2:2|wakeups:14:14|wakeups_unhandled:14:|snapshot:70130b09c218fd0ef98dc94745eb68742fa2c0bd886b8f047452980743e2c006"
generated_at: 2026-08-21T04:34:50Z
homes[1]{home_id,label,kind}:
  northwind-harbor,northwind-harbor,primary
working_set[5]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,captain-shared.md,captain-shared,1,"2026-08-21T04:34:50.57247Z"
  northwind-harbor,captain.md,captain,1,"2026-08-21T04:34:50.573026Z"
  northwind-harbor,learnings.md,learnings,1,"2026-08-21T04:34:50.574625Z"
  northwind-harbor,projects.md,projects,1,"2026-08-21T04:34:50.575705Z"
  northwind-harbor,secondmates.md,secondmates,1,"2026-08-21T04:34:50.57606Z"
archives[3]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,captain-archive.md,captain-archive,1,"2026-08-21T04:34:50.57149Z"
  northwind-harbor,memory-archive.md,memory-archive,1,"2026-08-21T04:34:50.57493Z"
  northwind-harbor,note-archive.md,note-archive,1,"2026-08-21T04:34:50.575293Z"
task_state[2]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,backlog.md,backlog,1,"2026-08-21T04:34:50.571088Z"
  northwind-harbor,done-archive.md,done-archive,1,"2026-08-21T04:34:50.573414Z"
operational_docs[2]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,2026-03-14-decision-lantern-berth.md,decision,1,"2026-08-21T04:34:50.57017Z"
  northwind-harbor,2026-03-15-handover-signal-fire.md,handover,1,"2026-08-21T04:34:50.570647Z"
artifacts[2]{home_id,task_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,lantern-1,lantern-1/acceptance.md,acceptance,1,"2026-08-21T04:34:50.573774Z"
  northwind-harbor,lantern-1,lantern-1/brief.md,brief,1,"2026-08-21T04:34:50.574258Z"
wakeups_unhandled: 14
help[3]:
  - Run `roca-firstmate chart --json` for the complete envelope
  - "Run `roca exec 'SELECT home_id, relative_path, version, observed_at FROM plugin_roca_firstmate.working_set_versions WHERE is_current = 1 ORDER BY home_id, relative_path'` to list the current working set"
  - "Run `roca exec 'SELECT id, destination, kind, created_at FROM plugin_roca_firstmate.wakeups WHERE handled = 0 ORDER BY id'` to list unhandled wakeups"
handoff[1]{home_id,relative_path,version,observed_at,content}:
  northwind-harbor,"2026-03-15-handover-signal-fire.md",1,2026-08-21T04:34:50.570647Z,"# Fabricated handover Signal Fire is ready for the next companion."
subscription: companion
help[2]:
  - "Attaching is subscribing; keep this command connected for wakeup lines"
  - "Run `roca-firstmate tick` from cron for silence and orphan recovery"
{"id":1,"destination":"companion","generation":1,"handled_generation":1,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"operational_doc\",\"row_id\":1,\"relative_path\":\"2026-03-14-decision-lantern-berth.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.57017Z"}
{"id":2,"destination":"companion","generation":2,"handled_generation":2,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"operational_doc\",\"row_id\":2,\"relative_path\":\"2026-03-15-handover-signal-fire.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.570647Z"}
{"id":3,"destination":"companion","generation":3,"handled_generation":3,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"task_state\",\"row_id\":1,\"relative_path\":\"backlog.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.571088Z"}
{"id":4,"destination":"companion","generation":4,"handled_generation":4,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"archive\",\"row_id\":1,\"relative_path\":\"captain-archive.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.57149Z"}
{"id":5,"destination":"companion","generation":5,"handled_generation":5,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":1,\"relative_path\":\"captain-shared.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.57247Z"}
{"id":6,"destination":"companion","generation":6,"handled_generation":6,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":2,\"relative_path\":\"captain.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.573026Z"}
{"id":7,"destination":"companion","generation":7,"handled_generation":7,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"task_state\",\"row_id\":2,\"relative_path\":\"done-archive.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.573414Z"}
{"id":8,"destination":"companion","generation":8,"handled_generation":8,"kind":"document-mirrored","home_id":"northwind-harbor","task_id":"lantern-1","payload":"{\"family\":\"task_artifact\",\"row_id\":1,\"relative_path\":\"lantern-1/acceptance.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.573774Z"}
{"id":9,"destination":"companion","generation":9,"handled_generation":9,"kind":"document-mirrored","home_id":"northwind-harbor","task_id":"lantern-1","payload":"{\"family\":\"task_artifact\",\"row_id\":2,\"relative_path\":\"lantern-1/brief.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.574258Z"}
{"id":10,"destination":"companion","generation":10,"handled_generation":10,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":3,\"relative_path\":\"learnings.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.574625Z"}
{"id":11,"destination":"companion","generation":11,"handled_generation":11,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"archive\",\"row_id\":2,\"relative_path\":\"memory-archive.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.57493Z"}
{"id":12,"destination":"companion","generation":12,"handled_generation":12,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"archive\",\"row_id\":3,\"relative_path\":\"note-archive.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.575293Z"}
{"id":13,"destination":"companion","generation":13,"handled_generation":13,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":4,\"relative_path\":\"projects.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.575705Z"}
{"id":14,"destination":"companion","generation":14,"handled_generation":14,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":5,\"relative_path\":\"secondmates.md\",\"version\":1}","created_at":"2026-08-21T04:34:50.57606Z"}
Evidence: Attach WAL delivery

After one fabricated captain.md rewrite, the attached process emitted exactly one JSON line for generation 14 with handled_generation 14.

status: attached
seat{status,seat_id,home_id,label,destination,attached_at,lease_until}:
  registered,seat-315ebe62a0ffc1a1,northwind-harbor,"seat-315ebe62a0ffc1a1",companion,2026-08-21T04:33:15.860767Z,2026-08-21T04:35:15.860767Z
freshness{scanned,inserted,unchanged,wakeups}:
  13,13,0,13
status: created
watermark: "homes:1:2026-08-21T04:33:15.84993Z|tasks:1:|working_set_versions:5:5|archive_versions:3:3|task_state_versions:2:2|operational_doc_versions:1:1|task_artifact_versions:2:2|wakeups:13:13|wakeups_unhandled:13:|snapshot:1805c71f8199e5ddef3f25b7fe5fde012cff9d2400b207893aa94df9a5ad202e"
generated_at: 2026-08-21T04:33:15Z
homes[1]{home_id,label,kind}:
  northwind-harbor,northwind-harbor,primary
working_set[5]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,captain-shared.md,captain-shared,1,"2026-08-21T04:33:15.854318Z"
  northwind-harbor,captain.md,captain,1,"2026-08-21T04:33:15.855147Z"
  northwind-harbor,learnings.md,learnings,1,"2026-08-21T04:33:15.858099Z"
  northwind-harbor,projects.md,projects,1,"2026-08-21T04:33:15.859769Z"
  northwind-harbor,secondmates.md,secondmates,1,"2026-08-21T04:33:15.86037Z"
archives[3]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,captain-archive.md,captain-archive,1,"2026-08-21T04:33:15.853325Z"
  northwind-harbor,memory-archive.md,memory-archive,1,"2026-08-21T04:33:15.858651Z"
  northwind-harbor,note-archive.md,note-archive,1,"2026-08-21T04:33:15.859204Z"
task_state[2]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,backlog.md,backlog,1,"2026-08-21T04:33:15.852561Z"
  northwind-harbor,done-archive.md,done-archive,1,"2026-08-21T04:33:15.855822Z"
operational_docs[1]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,2026-03-14-decision-lantern-berth.md,decision,1,"2026-08-21T04:33:15.85123Z"
artifacts[2]{home_id,task_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,lantern-1,lantern-1/acceptance.md,acceptance,1,"2026-08-21T04:33:15.856569Z"
  northwind-harbor,lantern-1,lantern-1/brief.md,brief,1,"2026-08-21T04:33:15.85748Z"
wakeups_unhandled: 13
help[3]:
  - Run `roca-firstmate chart --json` for the complete envelope
  - "Run `roca exec 'SELECT home_id, relative_path, version, observed_at FROM plugin_roca_firstmate.working_set_versions WHERE is_current = 1 ORDER BY home_id, relative_path'` to list the current working set"
  - "Run `roca exec 'SELECT id, destination, kind, created_at FROM plugin_roca_firstmate.wakeups WHERE handled = 0 ORDER BY id'` to list unhandled wakeups"
handoff[0]{home_id,relative_path,version,observed_at,content}:
subscription: companion
help[2]:
  - "Attaching is subscribing; keep this command connected for wakeup lines"
  - "Run `roca-firstmate tick` from cron for silence and orphan recovery"
{"id":1,"destination":"companion","generation":1,"handled_generation":1,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"operational_doc\",\"row_id\":1,\"relative_path\":\"2026-03-14-decision-lantern-berth.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.85123Z"}
{"id":2,"destination":"companion","generation":2,"handled_generation":2,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"task_state\",\"row_id\":1,\"relative_path\":\"backlog.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.852561Z"}
{"id":3,"destination":"companion","generation":3,"handled_generation":3,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"archive\",\"row_id\":1,\"relative_path\":\"captain-archive.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.853325Z"}
{"id":4,"destination":"companion","generation":4,"handled_generation":4,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":1,\"relative_path\":\"captain-shared.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.854318Z"}
{"id":5,"destination":"companion","generation":5,"handled_generation":5,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":2,\"relative_path\":\"captain.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.855147Z"}
{"id":6,"destination":"companion","generation":6,"handled_generation":6,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"task_state\",\"row_id\":2,\"relative_path\":\"done-archive.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.855822Z"}
{"id":7,"destination":"companion","generation":7,"handled_generation":7,"kind":"document-mirrored","home_id":"northwind-harbor","task_id":"lantern-1","payload":"{\"family\":\"task_artifact\",\"row_id\":1,\"relative_path\":\"lantern-1/acceptance.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.856569Z"}
{"id":8,"destination":"companion","generation":8,"handled_generation":8,"kind":"document-mirrored","home_id":"northwind-harbor","task_id":"lantern-1","payload":"{\"family\":\"task_artifact\",\"row_id\":2,\"relative_path\":\"lantern-1/brief.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.85748Z"}
{"id":9,"destination":"companion","generation":9,"handled_generation":9,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":3,\"relative_path\":\"learnings.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.858099Z"}
{"id":10,"destination":"companion","generation":10,"handled_generation":10,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"archive\",\"row_id\":2,\"relative_path\":\"memory-archive.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.858651Z"}
{"id":11,"destination":"companion","generation":11,"handled_generation":11,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"archive\",\"row_id\":3,\"relative_path\":\"note-archive.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.859204Z"}
{"id":12,"destination":"companion","generation":12,"handled_generation":12,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":4,\"relative_path\":\"projects.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.859769Z"}
{"id":13,"destination":"companion","generation":13,"handled_generation":13,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":5,\"relative_path\":\"secondmates.md\",\"version\":1}","created_at":"2026-08-21T04:33:15.86037Z"}
{"id":14,"destination":"companion","generation":14,"handled_generation":14,"kind":"document-mirrored","home_id":"northwind-harbor","payload":"{\"family\":\"working_set\",\"row_id\":6,\"relative_path\":\"captain.md\",\"version\":2}","created_at":"2026-08-21T04:33:37.478271Z"}
Evidence: Chart ingest-on-read

Chart ingest-on-read regenerated the chart, exposed captain.md version 2, and reported one pending wakeup before follow consumed it.

status: regenerated
watermark: "homes:1:2026-08-21T04:33:15.84993Z|tasks:1:|working_set_versions:6:6|archive_versions:3:3|task_state_versions:2:2|operational_doc_versions:1:1|task_artifact_versions:2:2|wakeups:14:14|wakeups_unhandled:1:|snapshot:0f9b8a3743a6a90369768f0b6fb7e9d89e612ca1ce4403989175c2c6719f01c2"
generated_at: 2026-08-21T04:33:37Z
homes[1]{home_id,label,kind}:
  northwind-harbor,northwind-harbor,primary
working_set[5]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,captain-shared.md,captain-shared,1,"2026-08-21T04:33:15.854318Z"
  northwind-harbor,captain.md,captain,2,"2026-08-21T04:33:37.478271Z"
  northwind-harbor,learnings.md,learnings,1,"2026-08-21T04:33:15.858099Z"
  northwind-harbor,projects.md,projects,1,"2026-08-21T04:33:15.859769Z"
  northwind-harbor,secondmates.md,secondmates,1,"2026-08-21T04:33:15.86037Z"
archives[3]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,captain-archive.md,captain-archive,1,"2026-08-21T04:33:15.853325Z"
  northwind-harbor,memory-archive.md,memory-archive,1,"2026-08-21T04:33:15.858651Z"
  northwind-harbor,note-archive.md,note-archive,1,"2026-08-21T04:33:15.859204Z"
task_state[2]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,backlog.md,backlog,1,"2026-08-21T04:33:15.852561Z"
  northwind-harbor,done-archive.md,done-archive,1,"2026-08-21T04:33:15.855822Z"
operational_docs[1]{home_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,2026-03-14-decision-lantern-berth.md,decision,1,"2026-08-21T04:33:15.85123Z"
artifacts[2]{home_id,task_id,relative_path,document_kind,version,observed_at}:
  northwind-harbor,lantern-1,lantern-1/acceptance.md,acceptance,1,"2026-08-21T04:33:15.856569Z"
  northwind-harbor,lantern-1,lantern-1/brief.md,brief,1,"2026-08-21T04:33:15.85748Z"
wakeups_unhandled: 1
help[3]:
  - Run `roca-firstmate chart --json` for the complete envelope
  - "Run `roca exec 'SELECT home_id, relative_path, version, observed_at FROM plugin_roca_firstmate.working_set_versions WHERE is_current = 1 ORDER BY home_id, relative_path'` to list the current working set"
  - "Run `roca exec 'SELECT id, destination, kind, created_at FROM plugin_roca_firstmate.wakeups WHERE handled = 0 ORDER BY id'` to list unhandled wakeups"
Evidence: Ephemeral tick

Tick reconciled all 13 files unchanged, created one silence wakeup, drained two orphan wakeups for captain and machine, printed their generation-confirmed lines, and exited.

{"id":16,"destination":"captain","generation":16,"handled_generation":16,"kind":"seat-silent","home_id":"northwind-harbor","payload":"{\"destination\":\"companion\",\"seat_id\":\"seat-315ebe62a0ffc1a1\",\"silence_generation\":46016}","created_at":"2026-08-21T04:34:21.42839Z"}
{"id":15,"destination":"machine","generation":15,"handled_generation":15,"kind":"fabricated-orphan","home_id":"northwind-harbor","payload":"{\"fixture\":\"signal-fire\"}","created_at":"2026-03-14T10:00:00Z"}
status: ticked
freshness{scanned,inserted,unchanged,wakeups}:
  13,0,13,0
silence_wakeups: 1
orphan_wakeups: 2
destinations[2]{destination}:
  captain
  machine
help[2]:
  - "Schedule `roca-firstmate tick` as an ephemeral cron command; it keeps no in-memory state"
  - "Run `roca-firstmate attach` in an agent seat to subscribe instead of polling"
Evidence: Persisted SQLite state

captain_current_version=2; generation_14_confirmed=14/14; unhandled_after_tick=0; opaque_workspace_seat=yes; all_handled_match_generation=yes

check_name                    result
----------------------------  ------
captain_current_version       2     
generation_14_confirmed       14/14 
unhandled_after_tick          0     
opaque_workspace_seat         yes   
all_handled_match_generation  yes   
id  destination  generation  handled  handled_generation  kind               relative_path
--  -----------  ----------  -------  ------------------  -----------------  -------------
14  companion    14          1        14                  document-mirrored  captain.md   
15  machine      15          1        15                  fabricated-orphan               
16  captain      16          1        16                  seat-silent                     

Pipeline

Updates from git push no-mistakes

✅ **intent** - passed

✅ No issues found.

✅ **Rebase** - passed

✅ No issues found.

🔧 **Review** - 5 issues found → auto-fixed (2) ✅
  • 🚨 internal/nerve/nerve.go:275 - The intent requires follow to emit exactly one line per unhandled wakeup. Here stdout is written before tx.Commit(): if the write succeeds but commit fails or the process dies, the row remains unhandled and the next follower emits it again. SQLite and stdout cannot provide atomic exactly-once delivery; either authorize/document at-least-once delivery with downstream generation deduplication/acknowledgement, or introduce a transactional delivery boundary.
  • 🚨 cmd/roca-firstmate/main.go:452 - The required Dresser follow recipes invoke follow without --seat-id, and this path therefore supplies an empty seat to nerve.Follow. The active follower never refreshes a lease: after the prior attach lease expires, tick treats its destination as orphaned and can consume its wakeups. If attach remains running instead, attach and the adapter race to consume the same destination. Make the adapter-owning process register/derive and heartbeat its seat, or change the documented recipe to consume the attach stream directly.
  • ⚠️ internal/nerve/nerve.go:337 - Orphan status is checked before delivery rather than at the claim boundary. A seat can attach after orphanDestinations returns but before Drain; claimNext then marks the wakeup handled despite a live subscriber. Recheck the absence of an unexpired destination seat inside the same transaction/query that claims an orphan wakeup.
  • ⚠️ internal/nerve/nerve.go:396 - Overlapping ticks can both select the same stale silence_generation, each insert a silence wakeup, and then have the second conditional seat update affect zero rows; its result is not checked, so both commits succeed. Atomically advance/claim the seat generation first (for example with conditional UPDATE … RETURNING) and insert only for the winner.
  • ⚠️ cmd/roca-firstmate/main.go:389 - The public contract says only an opaque workspace fingerprint is stored, but attach persists filepath.Base(workspace) as the seat label. This can disclose the repository/workspace name in the federated database. Use an opaque default or require an explicitly authorized human-readable seat label.

🔧 Fix: Harden Nerve ownership and atomic wakeup recovery
1 error still open:

  • 🚨 skills/dresser/SKILL.md:39 - The intent requires the plugin skill to teach native Claude wakes through “Claude Monitor or asyncRewake,” but this bullet says Monitor with asyncRewake, collapsing the two required alternatives into one coupled path. Enumerate Monitor and asyncRewake separately, or confirm they are intentionally the same adapter path.

🔧 Fix: Separate Claude native wake alternatives
✅ Re-checked - no issues remain.

✅ **Test** - passed

✅ No issues found.

  • go test ./internal/nerve -run 'Test(Drain|RegisterSeat|Tick|LastHandoff)' -count=1 -v
  • go test ./internal/scribe -run 'Test(BackfillMirrorsEveryFabricatedMarkdownFamilyAndIsIncremental|FileEventCreatesVersionThenTriggerCreatesWakeup|TotalIngestKeepsArbitraryAndNestedMarkdown|CursorStoresNoAbsoluteHomePath|LaRocaPublicPackageContractsCompileForTheExternalPlugin)' -count=1 -v
  • go test ./cmd/roca-firstmate -run 'Test(OpenDatabaseMigratesFabricatedV1BeforeUse|OpenDatabaseMigratesFabricatedV2WakeupState|RunScribeBackfillsFabricatedHome)' -count=1 -v
  • go test ./schema -run 'Test(WakeupsRejectsUnknownDestination|HandledWakeupRequiresItsGeneration|ShippedDatabaseMatchesSchemaSQL|PluginManifestDescribesTheShippedDatabase|ChecksumsCoverExactlyTheInstallPayload|ShippedDatabaseHasNoMirroredRows|FabricatedHomeHasTheFiveFamiliesAndNoLivePaths|DresserSkillTeachesChartSQLAndFirstmateDoor|RepoHasNoSessionStartHooks|TelemetryTablesRemainFreeForLaterAdditiveSchema)' -count=1 -v
  • go test ./schema -run '^TestDresserSkillTeachesNerveV1Contract$' -count=1 -v
  • go test ./internal/chart -run 'Test(EmptyDBCreatesChartAndSecondCallIsCached|NewRowRegeneratesChart|HandledWakeupRegeneratesChart|TOONIsBoundedAndHasHelp|JSONEnvelope)' -count=1 -v
  • Built ./cmd/roca-firstmate, then ran first-use attach against a copied fabricated home containing a fabricated handoff
  • Rewrote one copied captain.md, invoked chart, and observed exactly one subsequent WAL-delivered JSON line from the attached process
  • Expired a fabricated seat lease, inserted a fabricated machine wakeup, and ran tick --silence-after 5m
  • Queried the evidence SQLite database for versioning, opaque seat identity, pending wakeups, destinations, and handled-generation equality
  • Scanned changed public text and source for live absolute paths and UUID-shaped identifiers
✅ **Document** - passed

✅ No issues found.

✅ **Lint** - passed

✅ No issues found.

✅ **Push** - passed

✅ No issues found.

@teseo
teseo merged commit 72cb10c into main Aug 21, 2026
1 check passed
@teseo
teseo deleted the fm/rf-nerve-v1 branch August 21, 2026 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant