Skip to content

Emit mutation event envelopes from the write path — live tail, revert, per-agent trust (extends #997) #1154

Description

@calebjpicker

Feature Description

Emit an event envelope for every knowledge-graph mutation (write_note, edit_note, deletes, moves) into the append-only inbox that #997 established. Each envelope records { actor, project, entity, operation, diff | pre_image, timestamp }. Three consumers, in ascending ambition: a live tail of writes as they land, a single-action revert primitive, and per-agent trust tiers whose write authority graduates on track record.

Problem This Feature Solves

Agent writes are silent. The write path emits nothing; visibility is retrospective and poll-based (recent_activity, the cloud activity feed, Teams presence) — no record at write time, no diff, no first-class undo. In practice the human is the only error detector, and detection is accidental: a wrong write surfaces only when the note collides with reality again.

Real numbers from one week of a multi-agent setup (several Claude instances writing to one project): five erroneous writes in a single evening, each costing a full conversational exchange to find and fix; one factual spec written wrong sat in the graph for 10 days and was caught by coincidence. Corrections land as supersession appends scattered across notes — future sessions must find and order the layers, and can miss one.

Proposed Solution

User workflow

  1. Agents write normally — nothing blocks, nothing asks permission.
  2. The user (optionally) watches a live feed: claude-research appended 3 lines to spec/Project Note.
  3. A wrong write gets undone in one action; the live graph converges to clean truth while the tape keeps the complete error-and-correction history.
  4. A newly connected agent's writes land flagged (staging/review); a proven agent's land silent (endorsed). Authority graduates on evidence: writes vs. reverts.

Interface design
CLI/API-first: bm hook tail --follow, bm revert <envelope-id>, bm agents trust <actor> --tier <staging|review|endorsed>. A desktop app can surface the same stream and revert affordances later.

Technical approach
Reuse #997's machinery — append-only, UUIDv7-ordered, redacted, fail-closed inbox — and add a mutation event class emitted at the write choke point (the note-write services). No new infrastructure: #997 built the recorder; this adds an event type. Redaction philosophy holds: envelopes carry event metadata and diffs, never conversations.

Alternative Solutions

  • Approval gate / plan-mode on every write — rejected: the human becomes the bottleneck for hundreds of writes a week, and it destroys the automatic-endorsement property that makes shared memory valuable. Error-correcting beats error-preventing.
  • An interactive editor with see-before-save — would cover the writes a human is present for; silent MCP writes happen outside any editor regardless. Complement, not substitute.
  • Status quo (retrospective polling + manual supersession appends) — no diffs, no undo, no per-agent record, and corrections accumulate as strata.

Additional Context

Continues a March 2026 Discord thread with Paul on catching generative errors around the knowledge base (draft status → approve → trust levels). Related work: #997 (closed — this rides its infrastructure), #1118 (session-layer receipts; this is the write layer), #993 (gates whether a write may happen; this records that it happened and makes it reversible), #869 (a review layer would consume exactly this substrate), #688 (envelopes carry actor, giving agent provenance a durable record). Composes with a companion proposal, "Retrieval inspector / chunk viewer" (#1155): that one instruments the read path, this one the write path.

Impact

Detection latency drops from time-until-reuse to write time. Correction cost drops from a conversational exchange plus scattered appends to one action, with full history preserved on the tape. Trust becomes per-agent and empirical — the precondition for multi-agent setups. And the envelope stream is the substrate for bulk pattern-correction: errors become queryable as a class, one query finds every copy of a wrong claim, one action patches the set with pre-image fidelity.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions