feat(continuity): wire §6.3 shared-docs staleness notice

MarkdownChanges was deleted as dead code, but the underlying spec
requirement wasn't abandoned — rebuilt it independently. Adds
continuity.ConventionsHash for AGENTS.md/CLAUDE.md/VOCAB.md, tracks a
per-session snapshot on herdr.Session, and adds
Coordinator.checkConventions (run every Monitor tick) which compares
each active session's snapshot against its project's base repo and
pushes an in-pane notice via a new herdr.ConventionsNotifier
capability when they drift.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W1rkJ2hBMybnJctPbcy4tT
This commit is contained in:
kami
2026-07-27 22:25:53 +04:00
parent 3fe3aee5b7
commit 0ca78243b9
7 changed files with 225 additions and 8 deletions
+26 -8
View File
@@ -708,14 +708,32 @@ cooperation):
confirmed by reading `cmd/orchestra/main.go`); an earlier draft of this
prompt invented that endpoint and was corrected before landing, which is
exactly the class of bug this audit exists to catch.
3. **Item 6 — `MarkdownChanges` deleted, not wired.** Confirmed zero
callers anywhere (including its own tests — there were none, despite
being listed as "believed accurate" in a prior progress.md snapshot).
Wiring it for real needs a design for what "adjacent task" means and
where the notice surfaces (brief? a new event type?), which is a real
feature, not a wiring fix — AUDIT.md explicitly allows "delete it and
record the deviation" as the alternative to half-implementing that. Taking
that option rather than bolting on an undesigned notification path.
3. **Item 6 — `MarkdownChanges` deleted 2026-07-27, then §6.3 rewired from
scratch 2026-07-27 (later same day).** The original `MarkdownChanges`
function had zero callers and zero tests (confirmed by grep before
deleting), so it was removed rather than half-wired, per this doc's own
"delete and record the deviation" option. A real implementation of §6.3
("on update, the orchestra injects a notice to agents whose current task
is adjacent") was built separately, decoupled from the deleted function:
`continuity.ConventionsHash(root)` hashes whichever of
`AGENTS.md`/`CLAUDE.md`/`VOCAB.md` exist at a path; `herdr.Session` gained
`ConventionsHash`, snapshotted from the fresh worktree at
`Coordinator.Start`; a new `Coordinator.checkConventions`, run every
`Monitor` tick, recomputes the hash of the *project's base repo* (via
`WorktreeSpec.Spec`, i.e. "adjacent" = same project) for every leased
session and compares it against that session's stored snapshot — a
mismatch means the shared docs were updated upstream since this session
started. On mismatch it calls a new optional `herdr.ConventionsNotifier`
capability (`CLIAdapter.NotifyConventionsChanged`, an `agent.prompt` telling
the agent to re-read the docs) and updates the stored hash so the notice
fires once per drift, not every tick. Deliberately does not touch the
brief or add a new event type — the notice is a direct in-pane nudge, not
a projection, matching the spec's phrasing ("injects a notice to agents"),
so there was no event-schema question to resolve first. Covered by
`TestConventionsDriftNotifiesActiveSession`
(internal/orchestrator/rotation_test.go): asserts zero notifications while
the base repo's docs are unchanged, then a notification once they diverge.
`go build`/`go vet`/`go test ./...` all pass.
**Phase 4 item 2 — closed 2026-07-27.** The remaining gap after B5 was not
"which harness" (Release was always harness-agnostic) — it was that *nothing,