{"name":"decision-journal","title":"Keep a decision journal","description":"Record a decision and the alternatives it rejected, anchored to evidence, so the reasoning survives the session — append-only, retractable, with show/trace/digest to read it back. Symptoms: we considered X and rejected it, why is this like this, what did we already rule out, I'm assuming Y without checking, that turned out to be wrong, write this down before you compact. Records the choice, not the diff — for what a change did, use describe-changes.","compatibility":"Any harness that can run a shell command, plus Node.js 22+ for the CLI it carries. Hooks capture actions automatically where the harness exposes them — Claude Code, Codex, Cursor and Gemini do; Cowork and ChatGPT Work do not, and there the agent records entries itself and the journal says so. Without a filesystem it degrades to structured blocks in the transcript. Git raises what a claim can point at but is not required: a design or ops journal anchors to tool calls, in a weaker voice.","allowedTools":"Read Write Grep Glob Bash","license":"MIT","kind":"general","useWhen":"a choice was made that a reasonable person could have made differently","group":"workflow","lifecycle":"release","version":"1.0.0","author":"crissmoldovan","install":["npx skills add crissmoldovan/agent-skills --skill decision-journal","node <skill-folder>/scripts/install-cli.mjs   # its CLI, once, so hooks and your shell find it"],"asks":[],"commands":["agent-journal record --workspace api --kind decision \\\n  --question \"how do we bound the retry queue?\" \\\n  --chosen \"in-process ring buffer, 256 entries\" \\\n  --rationale \"backpressure is observable and the failure mode is dropping oldest, which we can measure\" \\\n  --rejected \"redis list — needs a broker we do not run in this environment\" \\\n  --rejected \"kafka — three days of setup for one queue\"","agent-journal record --workspace api --kind assumption \\\n  --assumed \"the upstream call is idempotent\" \\\n  --ifWrong \"a retry double-charges the customer\" \\\n  --checked no","agent-journal invalidate 7f3a --workspace api \\\n  --reason \"the 107 test failures were a wrong interpreter on PATH; the regression never existed\""],"documents":[{"path":"references/adapters.md","slug":"adapters","title":"The observation plane: what hooks capture, and what they don't","body":"# The observation plane: what hooks capture, and what they don't\n\nThis document covers **Plane A** — the record of what the agent *did*, captured by a\nharness's own hook system and written by `agent-journal observe`. It is a different\nthing from everything else in this skill, which is Plane B: the record of what the\nagent *decided*, written by `agent-journal record`. Confusing the two is the single\neasiest way to misread a journal.\n\n## Why this exists, and why it is not the agent's own account\n\nEvery entry `record` writes is self-reported. The agent says what it read, what it ran,\nwhat it chose. That is exactly what makes an anchor valuable and exactly what limits it\n— [references/anchors.md](anchors.md) already covers the general case (anchoring proves\na decision happened, not that its premise was true), but observations sharpen the same\npoint in one specific way: a `tool_use` anchor is currently only as good as the agent's\nmemory of what it ran. If the agent is wrong about that — misremembers a flag, elides a\nfailed attempt, asserts a call it never actually made — nothing in Plane B catches it,\nbecause Plane B *is* the agent's testimony.\n\nHooks are a second, independent witness. A harness's own hook system fires from the\nharness's own code, not from the model's account of its own actions, so a `tool_call` /\n`tool_result` observation exists whether or not the agent later describes that call\naccurately — or describes it at all. This is the entire value proposition of the\nobservation plane: **it lets a later reader check the agent's account against something\nthe agent did not author.**\n\nIt is not a stronger record than Plane B. It is a *different* one, with its own gaps —\nsee \"What is not captured\" below — and the two are meant to be read together, not as a\nreplacement for each other. An observation with no matching decision entry just means\nthe agent acted without narrating why; a decision entry with no matching observations\n(on a harness that has hooks wired) is itself worth noticing.\n\n## Getting an adapter — it does not arrive with this skill\n\n**The adapters are not part of this skill's installed files.** `npx skills add\ncrissmoldovan/agent-skills --skill decision-journal` delivers `skills/decision-journal/`\n— which carries the `agent-journal` CLI itself, as `scripts/agent-journal.mjs` — and\nnothing else; the adapters and their harness-configuration fragments live elsewhere in\nthe same repository. Earlier revisions of this page and of [the main skill file](../SKILL.md)\nsent readers to `adapters/claude-code/` as though it were alongside them. It is not, and\nnothing installed by the skill leads anywhere useful. Get them from the repository:\n\n```bash\ngit clone https://github.com/crissmoldovan/agent-skills.git\ncd agent-skills\n```\n\nThe two adapters are then at `adapters/claude-code/` and `adapters/codex/`, each a\nself-contained POSIX `sh` script plus a Node mapping script plus a fragment of harness\nconfiguration, and browsable without cloning at\n<https://github.com/crissmoldovan/agent-skills/tree/main/adapters>. The CLI they call\nis the one this skill carries; its source is `packages/agent-journal` in the same checkout.\n\nEach adapter's own README (`adapters/claude-code/README.md`,\n`adapters/codex/README.md`) is the install guide — read it before wiring anything,\nbecause the two harnesses' installation stories are not identical (see \"Honest status\nof each adapter\" below for the sharpest difference: Codex requires an explicit\nhook-trust step that Claude Code does not).\n\nIn outline, for either adapter:\n\n1. Put `agent-journal` on PATH: `node scripts/install-cli.mjs`, from this skill's folder,\n   writes a small wrapper to `~/.local/bin` that runs the CLI this skill carries; re-run\n   it if the skill moves, as a plugin update does. A person runs it; an agent asks them\n   to. In a checkout you can instead build `packages/agent-journal`, or point\n   `AGENT_JOURNAL_CMD` at the source.\n2. Copy the adapter's settings/hooks fragment into the harness's own hook\n   configuration, merging rather than replacing any hooks already configured.\n3. Replace the placeholder workspace id and the placeholder absolute path to the\n   checkout you just made.\n4. Run a real session with that harness, then check `agent-journal coverage` (next\n   section) to confirm something actually arrived.\n\nEvery mapped hook event costs two subprocess spawns (`journal-hook.sh` → `node\njournal-hook.mjs` → `agent-journal observe`) — see \"What this costs\" below before\nwiring every event on every tool call in a latency-sensitive setting.\n\n## Verifying observations are actually arriving\n\nDo not trust that a hook fired because the configuration looks right. Run a real\nsession against the harness, then:\n\n```bash\nagent-journal show --workspace <id>\n```\n\n**`show` is the command that answers this, not `coverage`.** `coverage` reports on\nsessions, and a session that recorded one hand-written entry and a session that\nrecorded four hundred observations both print `sessions: 1` — it cannot tell you a\nhook fired. `show` lists what is actually in the journal: if observation kinds\n(`tool_call`, `session_start`, …) appear there with `provenance: \"hook\"`, a hook\nfired. A hooks-configuration file that merely parses is not proof of anything.\n\n`coverage` is still worth reading alongside it, under the same honesty rule [the main\nskill file](../SKILL.md) teaches for the decision plane: `sessions`,\n`sessionsWithNoEntries` and `voids` are real counts; `null` fields\n(`sessionsWithNoEvents`, `downgradedAnchors`) mean **not assessed**, not **assessed and\nclean**. One caveat specific to this plane: **`sequenceGaps` is permanently `0` here.**\nIt counts gaps in a writer's declared `--seq`, and neither adapter emits one — there is\nno safe stateless counter in a hook. So it cannot surface a dropped hook, and a `0`\nthere means nothing was measured, not that nothing was lost.\n\nIf coverage shows nothing after a real session with hooks configured, check in this\norder, cheapest first:\n\n1. **Is `AGENT_JOURNAL_WORKSPACE` actually set** in the hook `command` string, and does\n   it match the `--workspace` you're querying?\n2. **Is `agent-journal` resolvable** from wherever the harness invokes the hook —\n   `PATH`, or `AGENT_JOURNAL_CMD`? A hook that can't find the binary exits 0 and writes\n   nothing, per the adapters' own first rule (below) — silently, by design. A harness\n   launched from a desktop app may not inherit your shell's `PATH`; if `~/.local/bin`\n   is not on it, set `AGENT_JOURNAL_CMD` to the absolute path `install-cli.mjs` printed.\n3. **Codex only: is the hook trusted?** Codex's documented trust model means an\n   unreviewed hook simply does not run at all — see the \"Installing it\" section of\n   `adapters/codex/README.md` (in the repository root, outside this skill's own\n   directory, so referenced by path rather than by link here). This has no equivalent\n   step on Claude Code and is the single likeliest cause of \"I configured it and\n   nothing shows up\" on Codex specifically.\n4. **Was the AGENT_JOURNAL_ROOT the coverage command reads the same one the hook\n   wrote to?** A mismatched root looks identical to a hook that never fired.\n\n## Citing an observation: capture, find, cite\n\nThis is the whole point of the plane, and until recently it was unreachable from any\ndocumented command. `record --anchor tool_use:<id>` always worked *if you already knew\nthe id* — and nothing printed one. `observe` took no `--subject`, so `trace Bash` came\nback empty; `show` rendered id/kind/time/outcome/live and no `data`, so two `tool_call`\nobservations looked identical. Reading raw JSONL was the only way through, and that is\nnot a command this skill teaches. Both gaps are closed; the loop below is the path, and\nevery block in it was run in this order against one scratch journal.\n\n**1. Capture.** Nothing to do — the hook fires and writes. Here, a `PreToolUse` /\n`PostToolUse` pair for `pnpm test` and one more `PreToolUse` for `ls`, so there is a\nwrong observation available to pick by mistake.\n\n**2. Find it, by the tool name — which is what you actually know.** Adapters set the\nobservation's `subject` to the tool name for `tool_call` and `tool_result`, and to the\nagent id for `subagent_start` / `subagent_stop`:\n\n```bash\nagent-journal trace Bash --workspace demo\n```\n\n```json\n{\n  \"matched\": [\n    { \"id\": \"05b0d085-3b10-4385-9bd6-5b2f6e20e489\", \"via\": \"subject\" },\n    { \"id\": \"f7d4c283-35cb-4d74-94f4-d6d753f2abb2\", \"via\": \"subject\" },\n    { \"id\": \"617fb58e-eb4f-4ad5-81b4-8820ca5ed3c0\", \"via\": \"subject\" }\n  ]\n}\n```\n\n`via: \"subject\"` says these matched because they are *about* Bash, as distinct from an\nentry that merely cites Bash somewhere — see [the tracing section of the main skill\nfile](../SKILL.md). The subject is the tool name exactly, never `Bash:toolu_01A`:\n`trace` matches keys exactly and never as a substring, so a richer subject would be a\nkey nobody could guess.\n\n**3. Pick the right one.** Three ids, and the tool name cannot separate them. `show`\nrenders `subject` and `data`, which can:\n\n```bash\nagent-journal show --workspace demo\n```\n\n```json\n{ \"id\": \"05b0d085-…\", \"kind\": \"tool_call\",   \"subject\": \"Bash\",\n  \"data\": { \"tool\": \"Bash\", \"input\": \"{\\\"command\\\":\\\"pnpm test\\\"}\", \"callId\": \"toolu_01A\" } }\n{ \"id\": \"f7d4c283-…\", \"kind\": \"tool_result\", \"subject\": \"Bash\",\n  \"data\": { \"tool\": \"Bash\", \"callId\": \"toolu_01A\", \"summary\": \"{\\\"stdout\\\":\\\"350 pass, 0 fail\\\"}\" } }\n{ \"id\": \"617fb58e-…\", \"kind\": \"tool_call\",   \"subject\": \"Bash\",\n  \"data\": { \"tool\": \"Bash\", \"input\": \"{\\\"command\\\":\\\"ls\\\"}\", \"callId\": \"toolu_01B\" } }\n```\n\n`callId` is what pairs a call with its result; `input` and `summary` are what tell the\n`pnpm test` call apart from the `ls` one. A `subject` of `null` means the event names\nnone — never `\"\"`, which would claim one was assessed and found empty.\n\n**4. Cite it.** The observation id goes in a `tool_use` anchor like any other reference:\n\n```bash\nagent-journal record --workspace demo --kind finding \\\n  --claim='the suite passes on this checkout' --scope=workspace \\\n  --evidence='350 tests, 0 failures' \\\n  --anchor=tool_use:f7d4c283-35cb-4d74-94f4-d6d753f2abb2\n```\n\nUse the `--flag=value` form for anything that might begin with `--` or span lines. Both\nforms parse, but `--claim ---` reads as a valueless `--claim` and exits 2 — the\nadapters emit `=` exclusively for exactly that reason.\n\n**5. Read it back from either end.** Tracing the observation id returns both the\nobservation (`via: \"id\"`) and the entry that cites it (`via: \"anchor\"`):\n\n```bash\nagent-journal trace f7d4c283-35cb-4d74-94f4-d6d753f2abb2 --workspace demo\n```\n\n```json\n{\n  \"matched\": [\n    { \"id\": \"f7d4c283-35cb-4d74-94f4-d6d753f2abb2\", \"via\": \"id\" },\n    { \"id\": \"67b49b81-1bc0-44c6-b062-3c9e4584aa3f\", \"via\": \"anchor\" }\n  ]\n}\n```\n\nThat last step is what makes the anchor a second witness rather than a decoration: the\nentry says the suite passed, and the thing it points at was written by the harness's\nown hook, not by the agent that made the claim.\n\n## What is not captured — and therefore which anchors stay hand-typed\n\nThe observation plane is not a transcript. It is exactly as complete as the events a\nharness's hooks expose, and no more. Both adapters were built to say plainly what falls\noutside that, rather than let a reader assume completeness:\n\n**A dropped hook leaves no trace.** `coverage`'s `sequenceGaps` is the field that would\ncatch one, and it is permanently `0` on this plane: it counts gaps in a writer's\ndeclared `--seq`, and neither adapter emits one, because a hook has no safe stateless\ncounter to derive it from. So if a hook fails to fire — a crash, a misconfigured\nmatcher, a harness that renamed an event — nothing anywhere reports the loss. That is\nthe plane's sharpest limit, and it is why an observation's absence must never be read\nas evidence that the thing did not happen.\n\n- **`heartbeat` is wired on neither adapter, structurally, not by omission.** Every\n  event either harness exposes fires because the agent acted or a phase changed — there\n  is no hook that fires because time passed and nothing happened. A session that is\n  open and idle between turns is indistinguishable, from hooks alone, from one that has\n  ended. Spec §7.3's active/stale/ended liveness classification and §7.6's path-claim\n  TTL both already route around this; this document just names the mechanical cause:\n  no hook-based harness can emit a true heartbeat, by construction.\n- **`environment` anchors are not produced by either adapter.** They come from a\n  separate capture path (`agent-journal observe --kind environment`, self-populating\n  from the process that runs the CLI) that a hook script can invoke but neither\n  adapter currently wires into a specific event. An entry that wants to anchor its\n  premise to the toolchain that actually ran ([anchors.md](anchors.md)'s own worked\n  example) still needs that called explicitly, or hand-typed as a `runtime` anchor if\n  it wasn't.\n- **`path_claim` is written by you, not by a hook.** See \"Two observation kinds you\n  write yourself\" below. No harness event announces \"I am about to work in this\n  checkout\", so nothing can capture it automatically.\n- **`permission` is wired on neither adapter, for two different reasons that both\n  matter.** On Claude Code, `PermissionRequest` was attempted directly and never fired\n  in any captured session — there is no confirmed source to wire. On Codex, the\n  opposite problem: its documentation confirms the event exists and describes its hook\n  output as able to allow or deny the request it fires for, which is a live steering\n  mechanism this project has no way to test safely without a real Codex install. Either\n  way, a decision entry that wants to say a specific permission was granted or denied\n  still needs a hand-typed `tool_use` anchor to whatever record of that decision exists\n  outside the observation plane.\n- **`tool_failure` is unresolved on Claude Code and undocumented on Codex.** A Claude\n  Code probe run produced a model reply quoting an exact tool error with no\n  corresponding hook event of any kind in the log — genuinely unknown whether the\n  harness suppresses the hook for a client-validated failure, or the model asserted a\n  call it never made. Codex's own published hooks documentation does not name a\n  distinct failure event at all; a failed call there is assumed (not confirmed) to\n  arrive folded into `PostToolUse`'s own `tool_response`. Either way, a claim that a\n  specific tool call failed for a specific reason is not something either adapter can\n  currently back with an observation — anchor it by hand, or to the transcript.\n- **`UserPromptSubmit` (Claude Code) and its close Codex analogue of the same name are\n  observed/documented and real, but map to none of the fourteen observation kinds.**\n  Both fire at the *start* of a turn; `turn_end` is defined as the end of one, and no\n  kind was invented to cover the gap. If a decision hinges on exactly what the user\n  asked for, cite the prompt directly (a `message` anchor) rather than expecting an\n  observation to carry it.\n- **A tool call made from inside a running subagent may not be attributable to that\n  subagent.** Neither adapter has ever captured a `PreToolUse`/`PostToolUse` payload\n  fired from inside a dispatched subagent, so it is unconfirmed whether such a payload\n  even carries an agent identifier either adapter could route on. Every current mapping\n  assumes the top-level session identity for tool events.\n\nNone of this is a defect to route around quietly. It is the reason Plane B's\n`--anchor` flag stays manual for these cases rather than the skill quietly implying\n\"the hook would have caught this\" for a class of claim no hook here actually reaches.\n\n## Two observation kinds you write yourself\n\nTwelve of the fourteen observation kinds come from hooks. Two do not, and neither is\nreachable unless something tells you its fields — `agent-journal help` now lists every\nobservation kind's own flags, the same way it already did for `record`.\n\n**`environment`** — what actually ran. Self-populating: the fields come from the\nprocess executing the CLI, and an explicit flag overrides one (for a remote runner or\na container, where the CLI's own process is not the interesting one).\n\n```bash\nagent-journal observe --workspace=<id> --kind=environment\n# --interpreter --version --platform --packageManager --flags\n```\n\n**`path_claim`** — an advisory \"I am working in this checkout\", so a second session\ncan see it before touching the same files (spec §7.6).\n\n```bash\nagent-journal observe --workspace=<id> --kind=path_claim \\\n  --checkout=/abs/path/to/repo --worktree=feature-x --branch=feat/thing --ttlSeconds=7200\nagent-journal claims --workspace=<id>\n```\n\nThree things about it that a reader has to know before relying on it:\n\n- **`--checkout` is the whole claim.** A `path_claim` written without it is accepted\n  at exit 0 and then reported by nothing — `claims` skips a claim that claims no path.\n  If `claims` comes back empty right after you wrote one, that is the first thing to\n  check.\n- **`--ttlSeconds` is optional and defaults to one hour.** That default is what stops\n  a crashed session holding a claim forever; `expiresAt` is derived at read time from\n  the claim's own timestamp, so a reader evaluates it against its own clock rather\n  than trusting the writer's. A `ttlSeconds` that is present but unreadable keeps the\n  claim live and marks it `malformedTtl` — an unreadable lifetime fails toward keeping\n  a claim that may still be held, never toward discarding it.\n- **It is advisory, and nothing anywhere enforces it.** `claims` reports; it does not\n  block, wait, lock or refuse, and its payload says `advisory: true` in band so a\n  consumer cannot mistake it for a lock. A `session_end` for that session drops its\n  claims immediately, TTL or not.\n\n## What this costs, honestly\n\nEvery mapped hook event spawns two subprocesses. Measured directly for the Claude Code\nadapter — five back-to-back `PreToolUse` calls, `performance.now()` around the whole\n`sh journal-hook.sh` invocation, `AGENT_JOURNAL_CMD` pointing at the built\n`dist/bin.js`, on macOS 26.3.1 / arm64 / Node v26.7.0:\n\n| | per hook |\n| --- | --- |\n| warm — the steady state after the first call of a session | **68–78ms** |\n| the first call after a fresh build, cold caches | 168–327ms |\n| running from TypeScript source via `--experimental-strip-types` | 109–143ms |\n\nThat is two Node process starts, so it tracks whatever process-start costs on the\nmachine in question — re-measure before treating it as authoritative anywhere else,\nand certainly before treating it as a claim about Codex, where no equivalent\nmeasurement exists at all (see below). An earlier revision of this page claimed\n270–470ms from the same five-call method; re-running it produced the table above, and\nthe difference is almost entirely cold-versus-warm caches.\n\nThis cost is accepted, not a bug to file: it is the price of routing every observation\nthrough `agent-journal observe`'s own redaction rather than writing JSONL directly. See\neither adapter's README, \"Why it shells out instead of writing JSONL directly.\"\n\n## Honest status of each adapter\n\n| | Claude Code | Codex |\n| --- | --- | --- |\n| **Status** | Built and tested against **real captured payloads** from a throwaway probe session (`adapters/NOTES.md`), plus a black-box test suite that runs the actual `.sh` script. | **Unverified.** Codex is not installed on the machine that built this adapter — searched for plainly, not skipped (`adapters/NOTES.md`, Step 4). Built entirely from OpenAI's published hooks documentation. Nothing here has been run against a real Codex session. |\n| **Field names** | Taken from real JSON this project captured and pasted verbatim into `adapters/NOTES.md`. | A handful (`tool_input`, `tool_use_id`, `tool_response`, `session_id`, `cwd`, `hook_event_name`) are documented explicitly by OpenAI. The rest (`agent_id`, `agent_type`, `reason`, `trigger`, `last_assistant_message`) are **carried over from Claude Code's own naming by analogy** — a wrong guess degrades to \"field absent,\" never a crash, but \"does not crash\" is a much weaker claim than \"is correct.\" |\n| **Per-call cost** | Measured: 68–78ms warm, 168–327ms on the first cold call. | Not measured — no session to measure against. Extrapolated from the identical two-subprocess design. A documented Codex-specific risk: `SessionEnd`/`Interrupt` hooks are described with a much shorter default timeout than other events, tight enough that this adapter's own cost could exceed it under load. |\n| **`PermissionRequest`** | Unwired: attempted directly, never confirmed to fire. | Unwired: confirmed by Codex's own docs to exist and to be able to steer an allow/deny decision through its own hook output — left out as a **safety** decision, since this project cannot test that path without a real install. |\n| **Test suite** | `packages/agent-journal/test/adapter-claude-code.test.ts` — runs the real script against both real-shaped and adversarial input. | `packages/agent-journal/test/adapter-codex.test.ts` — runs the real script (so rules 1–3 are genuinely verified: exit codes, timeouts, and redaction do not depend on Codex's payload shapes being right), but the mapping tests use payloads *built from documentation*, not captured ones. A green test here proves the adapter does what its own documentation-derived model says Codex will send — not that Codex actually sends that. |\n\nAn adapter documented as tested when it was not is worse than one honestly labelled\nuntested — this project has already shipped one false \"verified\" claim and paid for\nit. The Codex row above is written to be uncomfortable to read, on purpose: closing the\ngap it describes means running this against a real Codex install and reporting back\nwhat actually happened, not finding more documentation to read.\n","bodyHtml":"<h2 id=\"the-observation-plane-what-hooks-capture-and-what-they-dont\">The observation plane: what hooks capture, and what they don&#39;t</h2>\n<p>This document covers <strong>Plane A</strong> — the record of what the agent <em>did</em>, captured by a\nharness&#39;s own hook system and written by <code>agent-journal observe</code>. It is a different\nthing from everything else in this skill, which is Plane B: the record of what the\nagent <em>decided</em>, written by <code>agent-journal record</code>. Confusing the two is the single\neasiest way to misread a journal.</p>\n<h3 id=\"why-this-exists-and-why-it-is-not-the-agents-own-account\">Why this exists, and why it is not the agent&#39;s own account</h3>\n<p>Every entry <code>record</code> writes is self-reported. The agent says what it read, what it ran,\nwhat it chose. That is exactly what makes an anchor valuable and exactly what limits it\n— <a href=\"anchors.md\">references/anchors.md</a> already covers the general case (anchoring proves\na decision happened, not that its premise was true), but observations sharpen the same\npoint in one specific way: a <code>tool_use</code> anchor is currently only as good as the agent&#39;s\nmemory of what it ran. If the agent is wrong about that — misremembers a flag, elides a\nfailed attempt, asserts a call it never actually made — nothing in Plane B catches it,\nbecause Plane B <em>is</em> the agent&#39;s testimony.</p>\n<p>Hooks are a second, independent witness. A harness&#39;s own hook system fires from the\nharness&#39;s own code, not from the model&#39;s account of its own actions, so a <code>tool_call</code> /\n<code>tool_result</code> observation exists whether or not the agent later describes that call\naccurately — or describes it at all. This is the entire value proposition of the\nobservation plane: <strong>it lets a later reader check the agent&#39;s account against something\nthe agent did not author.</strong></p>\n<p>It is not a stronger record than Plane B. It is a <em>different</em> one, with its own gaps —\nsee &quot;What is not captured&quot; below — and the two are meant to be read together, not as a\nreplacement for each other. An observation with no matching decision entry just means\nthe agent acted without narrating why; a decision entry with no matching observations\n(on a harness that has hooks wired) is itself worth noticing.</p>\n<h3 id=\"getting-an-adapter-it-does-not-arrive-with-this-skill\">Getting an adapter — it does not arrive with this skill</h3>\n<p><strong>The adapters are not part of this skill&#39;s installed files.</strong> <code>npx skills add crissmoldovan/agent-skills --skill decision-journal</code> delivers <code>skills/decision-journal/</code>\n— which carries the <code>agent-journal</code> CLI itself, as <code>scripts/agent-journal.mjs</code> — and\nnothing else; the adapters and their harness-configuration fragments live elsewhere in\nthe same repository. Earlier revisions of this page and of <a href=\"../SKILL.md\">the main skill file</a>\nsent readers to <code>adapters/claude-code/</code> as though it were alongside them. It is not, and\nnothing installed by the skill leads anywhere useful. Get them from the repository:</p>\n<pre><code class=\"language-bash\">git clone https://github.com/crissmoldovan/agent-skills.git\ncd agent-skills\n</code></pre>\n<p>The two adapters are then at <code>adapters/claude-code/</code> and <code>adapters/codex/</code>, each a\nself-contained POSIX <code>sh</code> script plus a Node mapping script plus a fragment of harness\nconfiguration, and browsable without cloning at\n<a href=\"https://github.com/crissmoldovan/agent-skills/tree/main/adapters\" target=\"_blank\" rel=\"noreferrer\">https://github.com/crissmoldovan/agent-skills/tree/main/adapters</a>. The CLI they call\nis the one this skill carries; its source is <code>packages/agent-journal</code> in the same checkout.</p>\n<p>Each adapter&#39;s own README (<code>adapters/claude-code/README.md</code>,\n<code>adapters/codex/README.md</code>) is the install guide — read it before wiring anything,\nbecause the two harnesses&#39; installation stories are not identical (see &quot;Honest status\nof each adapter&quot; below for the sharpest difference: Codex requires an explicit\nhook-trust step that Claude Code does not).</p>\n<p>In outline, for either adapter:</p>\n<ol>\n<li>Put <code>agent-journal</code> on PATH: <code>node scripts/install-cli.mjs</code>, from this skill&#39;s folder,\nwrites a small wrapper to <code>~/.local/bin</code> that runs the CLI this skill carries; re-run\nit if the skill moves, as a plugin update does. A person runs it; an agent asks them\nto. In a checkout you can instead build <code>packages/agent-journal</code>, or point\n<code>AGENT_JOURNAL_CMD</code> at the source.</li>\n<li>Copy the adapter&#39;s settings/hooks fragment into the harness&#39;s own hook\nconfiguration, merging rather than replacing any hooks already configured.</li>\n<li>Replace the placeholder workspace id and the placeholder absolute path to the\ncheckout you just made.</li>\n<li>Run a real session with that harness, then check <code>agent-journal coverage</code> (next\nsection) to confirm something actually arrived.</li>\n</ol>\n<p>Every mapped hook event costs two subprocess spawns (<code>journal-hook.sh</code> → <code>node journal-hook.mjs</code> → <code>agent-journal observe</code>) — see &quot;What this costs&quot; below before\nwiring every event on every tool call in a latency-sensitive setting.</p>\n<h3 id=\"verifying-observations-are-actually-arriving\">Verifying observations are actually arriving</h3>\n<p>Do not trust that a hook fired because the configuration looks right. Run a real\nsession against the harness, then:</p>\n<pre><code class=\"language-bash\">agent-journal show --workspace &lt;id&gt;\n</code></pre>\n<p><strong><code>show</code> is the command that answers this, not <code>coverage</code>.</strong> <code>coverage</code> reports on\nsessions, and a session that recorded one hand-written entry and a session that\nrecorded four hundred observations both print <code>sessions: 1</code> — it cannot tell you a\nhook fired. <code>show</code> lists what is actually in the journal: if observation kinds\n(<code>tool_call</code>, <code>session_start</code>, …) appear there with <code>provenance: &quot;hook&quot;</code>, a hook\nfired. A hooks-configuration file that merely parses is not proof of anything.</p>\n<p><code>coverage</code> is still worth reading alongside it, under the same honesty rule <a href=\"../SKILL.md\">the main\nskill file</a> teaches for the decision plane: <code>sessions</code>,\n<code>sessionsWithNoEntries</code> and <code>voids</code> are real counts; <code>null</code> fields\n(<code>sessionsWithNoEvents</code>, <code>downgradedAnchors</code>) mean <strong>not assessed</strong>, not <strong>assessed and\nclean</strong>. One caveat specific to this plane: <strong><code>sequenceGaps</code> is permanently <code>0</code> here.</strong>\nIt counts gaps in a writer&#39;s declared <code>--seq</code>, and neither adapter emits one — there is\nno safe stateless counter in a hook. So it cannot surface a dropped hook, and a <code>0</code>\nthere means nothing was measured, not that nothing was lost.</p>\n<p>If coverage shows nothing after a real session with hooks configured, check in this\norder, cheapest first:</p>\n<ol>\n<li><strong>Is <code>AGENT_JOURNAL_WORKSPACE</code> actually set</strong> in the hook <code>command</code> string, and does\nit match the <code>--workspace</code> you&#39;re querying?</li>\n<li><strong>Is <code>agent-journal</code> resolvable</strong> from wherever the harness invokes the hook —\n<code>PATH</code>, or <code>AGENT_JOURNAL_CMD</code>? A hook that can&#39;t find the binary exits 0 and writes\nnothing, per the adapters&#39; own first rule (below) — silently, by design. A harness\nlaunched from a desktop app may not inherit your shell&#39;s <code>PATH</code>; if <code>~/.local/bin</code>\nis not on it, set <code>AGENT_JOURNAL_CMD</code> to the absolute path <code>install-cli.mjs</code> printed.</li>\n<li><strong>Codex only: is the hook trusted?</strong> Codex&#39;s documented trust model means an\nunreviewed hook simply does not run at all — see the &quot;Installing it&quot; section of\n<code>adapters/codex/README.md</code> (in the repository root, outside this skill&#39;s own\ndirectory, so referenced by path rather than by link here). This has no equivalent\nstep on Claude Code and is the single likeliest cause of &quot;I configured it and\nnothing shows up&quot; on Codex specifically.</li>\n<li><strong>Was the AGENT_JOURNAL_ROOT the coverage command reads the same one the hook\nwrote to?</strong> A mismatched root looks identical to a hook that never fired.</li>\n</ol>\n<h3 id=\"citing-an-observation-capture-find-cite\">Citing an observation: capture, find, cite</h3>\n<p>This is the whole point of the plane, and until recently it was unreachable from any\ndocumented command. <code>record --anchor tool_use:&lt;id&gt;</code> always worked <em>if you already knew\nthe id</em> — and nothing printed one. <code>observe</code> took no <code>--subject</code>, so <code>trace Bash</code> came\nback empty; <code>show</code> rendered id/kind/time/outcome/live and no <code>data</code>, so two <code>tool_call</code>\nobservations looked identical. Reading raw JSONL was the only way through, and that is\nnot a command this skill teaches. Both gaps are closed; the loop below is the path, and\nevery block in it was run in this order against one scratch journal.</p>\n<p><strong>1. Capture.</strong> Nothing to do — the hook fires and writes. Here, a <code>PreToolUse</code> /\n<code>PostToolUse</code> pair for <code>pnpm test</code> and one more <code>PreToolUse</code> for <code>ls</code>, so there is a\nwrong observation available to pick by mistake.</p>\n<p><strong>2. Find it, by the tool name — which is what you actually know.</strong> Adapters set the\nobservation&#39;s <code>subject</code> to the tool name for <code>tool_call</code> and <code>tool_result</code>, and to the\nagent id for <code>subagent_start</code> / <code>subagent_stop</code>:</p>\n<pre><code class=\"language-bash\">agent-journal trace Bash --workspace demo\n</code></pre>\n<pre><code class=\"language-json\">{\n  &quot;matched&quot;: [\n    { &quot;id&quot;: &quot;05b0d085-3b10-4385-9bd6-5b2f6e20e489&quot;, &quot;via&quot;: &quot;subject&quot; },\n    { &quot;id&quot;: &quot;f7d4c283-35cb-4d74-94f4-d6d753f2abb2&quot;, &quot;via&quot;: &quot;subject&quot; },\n    { &quot;id&quot;: &quot;617fb58e-eb4f-4ad5-81b4-8820ca5ed3c0&quot;, &quot;via&quot;: &quot;subject&quot; }\n  ]\n}\n</code></pre>\n<p><code>via: &quot;subject&quot;</code> says these matched because they are <em>about</em> Bash, as distinct from an\nentry that merely cites Bash somewhere — see <a href=\"../SKILL.md\">the tracing section of the main skill\nfile</a>. The subject is the tool name exactly, never <code>Bash:toolu_01A</code>:\n<code>trace</code> matches keys exactly and never as a substring, so a richer subject would be a\nkey nobody could guess.</p>\n<p><strong>3. Pick the right one.</strong> Three ids, and the tool name cannot separate them. <code>show</code>\nrenders <code>subject</code> and <code>data</code>, which can:</p>\n<pre><code class=\"language-bash\">agent-journal show --workspace demo\n</code></pre>\n<pre><code class=\"language-json\">{ &quot;id&quot;: &quot;05b0d085-…&quot;, &quot;kind&quot;: &quot;tool_call&quot;,   &quot;subject&quot;: &quot;Bash&quot;,\n  &quot;data&quot;: { &quot;tool&quot;: &quot;Bash&quot;, &quot;input&quot;: &quot;{\\&quot;command\\&quot;:\\&quot;pnpm test\\&quot;}&quot;, &quot;callId&quot;: &quot;toolu_01A&quot; } }\n{ &quot;id&quot;: &quot;f7d4c283-…&quot;, &quot;kind&quot;: &quot;tool_result&quot;, &quot;subject&quot;: &quot;Bash&quot;,\n  &quot;data&quot;: { &quot;tool&quot;: &quot;Bash&quot;, &quot;callId&quot;: &quot;toolu_01A&quot;, &quot;summary&quot;: &quot;{\\&quot;stdout\\&quot;:\\&quot;350 pass, 0 fail\\&quot;}&quot; } }\n{ &quot;id&quot;: &quot;617fb58e-…&quot;, &quot;kind&quot;: &quot;tool_call&quot;,   &quot;subject&quot;: &quot;Bash&quot;,\n  &quot;data&quot;: { &quot;tool&quot;: &quot;Bash&quot;, &quot;input&quot;: &quot;{\\&quot;command\\&quot;:\\&quot;ls\\&quot;}&quot;, &quot;callId&quot;: &quot;toolu_01B&quot; } }\n</code></pre>\n<p><code>callId</code> is what pairs a call with its result; <code>input</code> and <code>summary</code> are what tell the\n<code>pnpm test</code> call apart from the <code>ls</code> one. A <code>subject</code> of <code>null</code> means the event names\nnone — never <code>&quot;&quot;</code>, which would claim one was assessed and found empty.</p>\n<p><strong>4. Cite it.</strong> The observation id goes in a <code>tool_use</code> anchor like any other reference:</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace demo --kind finding \\\n  --claim=&#39;the suite passes on this checkout&#39; --scope=workspace \\\n  --evidence=&#39;350 tests, 0 failures&#39; \\\n  --anchor=tool_use:f7d4c283-35cb-4d74-94f4-d6d753f2abb2\n</code></pre>\n<p>Use the <code>--flag=value</code> form for anything that might begin with <code>--</code> or span lines. Both\nforms parse, but <code>--claim ---</code> reads as a valueless <code>--claim</code> and exits 2 — the\nadapters emit <code>=</code> exclusively for exactly that reason.</p>\n<p><strong>5. Read it back from either end.</strong> Tracing the observation id returns both the\nobservation (<code>via: &quot;id&quot;</code>) and the entry that cites it (<code>via: &quot;anchor&quot;</code>):</p>\n<pre><code class=\"language-bash\">agent-journal trace f7d4c283-35cb-4d74-94f4-d6d753f2abb2 --workspace demo\n</code></pre>\n<pre><code class=\"language-json\">{\n  &quot;matched&quot;: [\n    { &quot;id&quot;: &quot;f7d4c283-35cb-4d74-94f4-d6d753f2abb2&quot;, &quot;via&quot;: &quot;id&quot; },\n    { &quot;id&quot;: &quot;67b49b81-1bc0-44c6-b062-3c9e4584aa3f&quot;, &quot;via&quot;: &quot;anchor&quot; }\n  ]\n}\n</code></pre>\n<p>That last step is what makes the anchor a second witness rather than a decoration: the\nentry says the suite passed, and the thing it points at was written by the harness&#39;s\nown hook, not by the agent that made the claim.</p>\n<h3 id=\"what-is-not-captured-and-therefore-which-anchors-stay-hand-typed\">What is not captured — and therefore which anchors stay hand-typed</h3>\n<p>The observation plane is not a transcript. It is exactly as complete as the events a\nharness&#39;s hooks expose, and no more. Both adapters were built to say plainly what falls\noutside that, rather than let a reader assume completeness:</p>\n<p><strong>A dropped hook leaves no trace.</strong> <code>coverage</code>&#39;s <code>sequenceGaps</code> is the field that would\ncatch one, and it is permanently <code>0</code> on this plane: it counts gaps in a writer&#39;s\ndeclared <code>--seq</code>, and neither adapter emits one, because a hook has no safe stateless\ncounter to derive it from. So if a hook fails to fire — a crash, a misconfigured\nmatcher, a harness that renamed an event — nothing anywhere reports the loss. That is\nthe plane&#39;s sharpest limit, and it is why an observation&#39;s absence must never be read\nas evidence that the thing did not happen.</p>\n<ul>\n<li><strong><code>heartbeat</code> is wired on neither adapter, structurally, not by omission.</strong> Every\nevent either harness exposes fires because the agent acted or a phase changed — there\nis no hook that fires because time passed and nothing happened. A session that is\nopen and idle between turns is indistinguishable, from hooks alone, from one that has\nended. Spec §7.3&#39;s active/stale/ended liveness classification and §7.6&#39;s path-claim\nTTL both already route around this; this document just names the mechanical cause:\nno hook-based harness can emit a true heartbeat, by construction.</li>\n<li><strong><code>environment</code> anchors are not produced by either adapter.</strong> They come from a\nseparate capture path (<code>agent-journal observe --kind environment</code>, self-populating\nfrom the process that runs the CLI) that a hook script can invoke but neither\nadapter currently wires into a specific event. An entry that wants to anchor its\npremise to the toolchain that actually ran (<a href=\"anchors.md\">anchors.md</a>&#39;s own worked\nexample) still needs that called explicitly, or hand-typed as a <code>runtime</code> anchor if\nit wasn&#39;t.</li>\n<li><strong><code>path_claim</code> is written by you, not by a hook.</strong> See &quot;Two observation kinds you\nwrite yourself&quot; below. No harness event announces &quot;I am about to work in this\ncheckout&quot;, so nothing can capture it automatically.</li>\n<li><strong><code>permission</code> is wired on neither adapter, for two different reasons that both\nmatter.</strong> On Claude Code, <code>PermissionRequest</code> was attempted directly and never fired\nin any captured session — there is no confirmed source to wire. On Codex, the\nopposite problem: its documentation confirms the event exists and describes its hook\noutput as able to allow or deny the request it fires for, which is a live steering\nmechanism this project has no way to test safely without a real Codex install. Either\nway, a decision entry that wants to say a specific permission was granted or denied\nstill needs a hand-typed <code>tool_use</code> anchor to whatever record of that decision exists\noutside the observation plane.</li>\n<li><strong><code>tool_failure</code> is unresolved on Claude Code and undocumented on Codex.</strong> A Claude\nCode probe run produced a model reply quoting an exact tool error with no\ncorresponding hook event of any kind in the log — genuinely unknown whether the\nharness suppresses the hook for a client-validated failure, or the model asserted a\ncall it never made. Codex&#39;s own published hooks documentation does not name a\ndistinct failure event at all; a failed call there is assumed (not confirmed) to\narrive folded into <code>PostToolUse</code>&#39;s own <code>tool_response</code>. Either way, a claim that a\nspecific tool call failed for a specific reason is not something either adapter can\ncurrently back with an observation — anchor it by hand, or to the transcript.</li>\n<li><strong><code>UserPromptSubmit</code> (Claude Code) and its close Codex analogue of the same name are\nobserved/documented and real, but map to none of the fourteen observation kinds.</strong>\nBoth fire at the <em>start</em> of a turn; <code>turn_end</code> is defined as the end of one, and no\nkind was invented to cover the gap. If a decision hinges on exactly what the user\nasked for, cite the prompt directly (a <code>message</code> anchor) rather than expecting an\nobservation to carry it.</li>\n<li><strong>A tool call made from inside a running subagent may not be attributable to that\nsubagent.</strong> Neither adapter has ever captured a <code>PreToolUse</code>/<code>PostToolUse</code> payload\nfired from inside a dispatched subagent, so it is unconfirmed whether such a payload\neven carries an agent identifier either adapter could route on. Every current mapping\nassumes the top-level session identity for tool events.</li>\n</ul>\n<p>None of this is a defect to route around quietly. It is the reason Plane B&#39;s\n<code>--anchor</code> flag stays manual for these cases rather than the skill quietly implying\n&quot;the hook would have caught this&quot; for a class of claim no hook here actually reaches.</p>\n<h3 id=\"two-observation-kinds-you-write-yourself\">Two observation kinds you write yourself</h3>\n<p>Twelve of the fourteen observation kinds come from hooks. Two do not, and neither is\nreachable unless something tells you its fields — <code>agent-journal help</code> now lists every\nobservation kind&#39;s own flags, the same way it already did for <code>record</code>.</p>\n<p><strong><code>environment</code></strong> — what actually ran. Self-populating: the fields come from the\nprocess executing the CLI, and an explicit flag overrides one (for a remote runner or\na container, where the CLI&#39;s own process is not the interesting one).</p>\n<pre><code class=\"language-bash\">agent-journal observe --workspace=&lt;id&gt; --kind=environment\n# --interpreter --version --platform --packageManager --flags\n</code></pre>\n<p><strong><code>path_claim</code></strong> — an advisory &quot;I am working in this checkout&quot;, so a second session\ncan see it before touching the same files (spec §7.6).</p>\n<pre><code class=\"language-bash\">agent-journal observe --workspace=&lt;id&gt; --kind=path_claim \\\n  --checkout=/abs/path/to/repo --worktree=feature-x --branch=feat/thing --ttlSeconds=7200\nagent-journal claims --workspace=&lt;id&gt;\n</code></pre>\n<p>Three things about it that a reader has to know before relying on it:</p>\n<ul>\n<li><strong><code>--checkout</code> is the whole claim.</strong> A <code>path_claim</code> written without it is accepted\nat exit 0 and then reported by nothing — <code>claims</code> skips a claim that claims no path.\nIf <code>claims</code> comes back empty right after you wrote one, that is the first thing to\ncheck.</li>\n<li><strong><code>--ttlSeconds</code> is optional and defaults to one hour.</strong> That default is what stops\na crashed session holding a claim forever; <code>expiresAt</code> is derived at read time from\nthe claim&#39;s own timestamp, so a reader evaluates it against its own clock rather\nthan trusting the writer&#39;s. A <code>ttlSeconds</code> that is present but unreadable keeps the\nclaim live and marks it <code>malformedTtl</code> — an unreadable lifetime fails toward keeping\na claim that may still be held, never toward discarding it.</li>\n<li><strong>It is advisory, and nothing anywhere enforces it.</strong> <code>claims</code> reports; it does not\nblock, wait, lock or refuse, and its payload says <code>advisory: true</code> in band so a\nconsumer cannot mistake it for a lock. A <code>session_end</code> for that session drops its\nclaims immediately, TTL or not.</li>\n</ul>\n<h3 id=\"what-this-costs-honestly\">What this costs, honestly</h3>\n<p>Every mapped hook event spawns two subprocesses. Measured directly for the Claude Code\nadapter — five back-to-back <code>PreToolUse</code> calls, <code>performance.now()</code> around the whole\n<code>sh journal-hook.sh</code> invocation, <code>AGENT_JOURNAL_CMD</code> pointing at the built\n<code>dist/bin.js</code>, on macOS 26.3.1 / arm64 / Node v26.7.0:</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>per hook</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>warm — the steady state after the first call of a session</td>\n<td><strong>68–78ms</strong></td>\n</tr>\n<tr>\n<td>the first call after a fresh build, cold caches</td>\n<td>168–327ms</td>\n</tr>\n<tr>\n<td>running from TypeScript source via <code>--experimental-strip-types</code></td>\n<td>109–143ms</td>\n</tr>\n</tbody></table>\n<p>That is two Node process starts, so it tracks whatever process-start costs on the\nmachine in question — re-measure before treating it as authoritative anywhere else,\nand certainly before treating it as a claim about Codex, where no equivalent\nmeasurement exists at all (see below). An earlier revision of this page claimed\n270–470ms from the same five-call method; re-running it produced the table above, and\nthe difference is almost entirely cold-versus-warm caches.</p>\n<p>This cost is accepted, not a bug to file: it is the price of routing every observation\nthrough <code>agent-journal observe</code>&#39;s own redaction rather than writing JSONL directly. See\neither adapter&#39;s README, &quot;Why it shells out instead of writing JSONL directly.&quot;</p>\n<h3 id=\"honest-status-of-each-adapter\">Honest status of each adapter</h3>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Claude Code</th>\n<th>Codex</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><strong>Status</strong></td>\n<td>Built and tested against <strong>real captured payloads</strong> from a throwaway probe session (<code>adapters/NOTES.md</code>), plus a black-box test suite that runs the actual <code>.sh</code> script.</td>\n<td><strong>Unverified.</strong> Codex is not installed on the machine that built this adapter — searched for plainly, not skipped (<code>adapters/NOTES.md</code>, Step 4). Built entirely from OpenAI&#39;s published hooks documentation. Nothing here has been run against a real Codex session.</td>\n</tr>\n<tr>\n<td><strong>Field names</strong></td>\n<td>Taken from real JSON this project captured and pasted verbatim into <code>adapters/NOTES.md</code>.</td>\n<td>A handful (<code>tool_input</code>, <code>tool_use_id</code>, <code>tool_response</code>, <code>session_id</code>, <code>cwd</code>, <code>hook_event_name</code>) are documented explicitly by OpenAI. The rest (<code>agent_id</code>, <code>agent_type</code>, <code>reason</code>, <code>trigger</code>, <code>last_assistant_message</code>) are <strong>carried over from Claude Code&#39;s own naming by analogy</strong> — a wrong guess degrades to &quot;field absent,&quot; never a crash, but &quot;does not crash&quot; is a much weaker claim than &quot;is correct.&quot;</td>\n</tr>\n<tr>\n<td><strong>Per-call cost</strong></td>\n<td>Measured: 68–78ms warm, 168–327ms on the first cold call.</td>\n<td>Not measured — no session to measure against. Extrapolated from the identical two-subprocess design. A documented Codex-specific risk: <code>SessionEnd</code>/<code>Interrupt</code> hooks are described with a much shorter default timeout than other events, tight enough that this adapter&#39;s own cost could exceed it under load.</td>\n</tr>\n<tr>\n<td><strong><code>PermissionRequest</code></strong></td>\n<td>Unwired: attempted directly, never confirmed to fire.</td>\n<td>Unwired: confirmed by Codex&#39;s own docs to exist and to be able to steer an allow/deny decision through its own hook output — left out as a <strong>safety</strong> decision, since this project cannot test that path without a real install.</td>\n</tr>\n<tr>\n<td><strong>Test suite</strong></td>\n<td><code>packages/agent-journal/test/adapter-claude-code.test.ts</code> — runs the real script against both real-shaped and adversarial input.</td>\n<td><code>packages/agent-journal/test/adapter-codex.test.ts</code> — runs the real script (so rules 1–3 are genuinely verified: exit codes, timeouts, and redaction do not depend on Codex&#39;s payload shapes being right), but the mapping tests use payloads <em>built from documentation</em>, not captured ones. A green test here proves the adapter does what its own documentation-derived model says Codex will send — not that Codex actually sends that.</td>\n</tr>\n</tbody></table>\n<p>An adapter documented as tested when it was not is worse than one honestly labelled\nuntested — this project has already shipped one false &quot;verified&quot; claim and paid for\nit. The Codex row above is written to be uncomfortable to read, on purpose: closing the\ngap it describes means running this against a real Codex install and reporting back\nwhat actually happened, not finding more documentation to read.</p>\n","words":3372},{"path":"references/anchors.md","slug":"anchors","title":"Anchors: what a claim can point at","body":"# Anchors: what a claim can point at\n\nAn anchor is a pointer from something you wrote to something a reader can check. It is\nwhat separates a decision record from a story about a decision.\n\n## Anchoring is one-directional\n\nThis is the most important idea in the skill, and the easiest to get wrong.\n\nAn anchor establishes that a decision **was taken**, when, and what it touched. It\nestablishes **nothing** about whether the premise the decision rested on was true.\n\nThe canonical failure looks like this. A session runs against the wrong interpreter on\n`PATH`. Tests fail for environmental reasons. An agent investigates them as a genuine\nregression and writes an entry that is *perfectly* formed — real tool-call anchors, a\nreal failing suite, a populated rejection list, an honest note that no source was\nconsulted, high stated confidence. Every rule in this document is satisfied. The\nconclusion is worthless.\n\nThat entry is worse than no entry, for three reasons:\n\n1. **It is citable.** A structured, evidence-linked wrong answer costs more to dislodge\n   than no answer at all.\n2. **It propagates.** Later sessions read the workspace's entries as context, so one\n   session's confident error becomes cited precedent for the next five.\n3. **It reads as verified.** For a reader who cannot check the code, an anchored claim\n   is a flattering narrative *with citations*.\n\nThe defence is not better anchoring. It is:\n\n- capturing the **environment** as an anchor class, so the premise itself is checkable;\n- re-checking premises separately from re-checking sources;\n- and marking an entry **invalidated** rather than merely superseded when its premise\n  turns out to be false, so everything resting on it is suppressed too.\n\n## Anchor classes, and what each proves\n\n| Class | Proves | Does not prove |\n| --- | --- | --- |\n| `commit` | This change entered history at this point | That the change was correct |\n| `file` | This path had this content | That the content was read correctly |\n| `environment` | The toolchain that actually ran — resolved interpreter, versions, flags | That the toolchain was the intended one |\n| `runtime` | A deployed config or flag value | That the value was reviewed |\n| `tool_use` | This command ran and returned this | That its output was interpreted correctly |\n| `message` | This was said, here | That it was true |\n| `url` / `external` | This source existed and said this at the time | That it still does |\n| `visual` | A design file at a version, a node, a screenshot | That the rendered result matched intent |\n\nTwo rows do the heavy lifting in practice. **`tool_use` and `message` are universal** —\nthey exist in every context, including one with no repository at all. So a journal\noutside version control still works; it proves something weaker, *the agent read X and\nthen chose Y* rather than *the code changed this way*, and that weaker claim must be\nrendered in a weaker voice rather than dressed up.\n\n**`environment` is the one people forget.** It is also the one that would have caught\nthe failure above.\n\n## Anchors versus influences\n\nThese are different axes and must not be merged.\n\n- **Anchors** prove the entry is honest. System-produced, verifiable: this commit\n  exists, this tool call is in the log. They point at *the record of the decision*.\n- **Influences** explain how it was reached. Agent-asserted, often unverifiable, prone\n  to rot. They point at *the inputs*.\n\nCollapse them and an entry can claim anchored status while resting only on a\nhalf-remembered URL — which destroys the one property the whole design provides.\n\nAn influence carries a role, and the role matters as much as the identity:\n\n- `decisive` — this is why\n- `supporting` — this agreed\n- `considered` — this was read and weighed\n- `contradicted` — **this was read and chosen against**\n\nThat last one pairs with the rejection list and is otherwise unrecoverable. \"I read the\nbenchmark and decided against what it recommended\" is a fact nobody can reconstruct from\nthe code.\n\n## Influences are selected, not recalled\n\nThe journal already recorded every fetch, search, read and query. So the candidate set\nfor a decision is derivable: it is the work between the previous entry and this one.\n\nYou are **selecting and ranking from that window**, not retyping URLs from memory. An\ninfluence chosen this way carries a tool-call anchor for free, which is how an asserted\ninfluence becomes a verifiable one.\n\nThe limit is worth stating: this works only where the tooling saw the inputs. For design\nwork and conversation-driven decisions the window is often empty — a call, a recording,\nframes never exported — and the field reverts to a memory exercise. Say so when it does.\n\n## Rot, and the check that is not rot\n\nTwo decay checks, and conflating them hides the dangerous one.\n\n**Rot** — did a source move or die? A URL 404s, a ticket closed, a referenced entry was\nsuperseded, a symbol no longer exists. Reported, never auto-resolved: a decision does not\nbecome wrong because a link broke.\n\n**Premise** — was the reasoning ever sound? Distinct, and the one that matters. Where an\nentry declares what must be true for it to hold, and an environment anchor exists, a\nre-check can ask whether that premise still reproduces.\n\n**Only half of that ships.** `agent-journal decay` compares the environment an entry was\nanchored to against the environment now; nothing reads `premise[]` at all. A `finding`\nwhose premises are plainly false today, on an unchanged interpreter, reports clean. The\ndesign intent above is the spec's; what runs is narrower, and\n[references/decay.md](decay.md) says exactly where the line falls.\n\nA source may be marked as *living* — a design file changes on every save, and flagging it\ndaily trains people to ignore rot flags entirely. **This is also design intent, not\nshipped behaviour**: `living` suppresses content-hash rot, and no hash-based check exists\nyet, so the marker would have nothing to suppress.\n\n## What good anchoring looks like\n\n- Every factual claim points at something, or is explicitly marked as pointing at\n  nothing.\n- The entry names what must be true for it to hold, so a later reader can test that\n  rather than take it on trust.\n- Where the context cannot produce strong anchors, the entry says which classes were\n  unavailable rather than implying they were checked and clean.\n","bodyHtml":"<h2 id=\"anchors-what-a-claim-can-point-at\">Anchors: what a claim can point at</h2>\n<p>An anchor is a pointer from something you wrote to something a reader can check. It is\nwhat separates a decision record from a story about a decision.</p>\n<h3 id=\"anchoring-is-one-directional\">Anchoring is one-directional</h3>\n<p>This is the most important idea in the skill, and the easiest to get wrong.</p>\n<p>An anchor establishes that a decision <strong>was taken</strong>, when, and what it touched. It\nestablishes <strong>nothing</strong> about whether the premise the decision rested on was true.</p>\n<p>The canonical failure looks like this. A session runs against the wrong interpreter on\n<code>PATH</code>. Tests fail for environmental reasons. An agent investigates them as a genuine\nregression and writes an entry that is <em>perfectly</em> formed — real tool-call anchors, a\nreal failing suite, a populated rejection list, an honest note that no source was\nconsulted, high stated confidence. Every rule in this document is satisfied. The\nconclusion is worthless.</p>\n<p>That entry is worse than no entry, for three reasons:</p>\n<ol>\n<li><strong>It is citable.</strong> A structured, evidence-linked wrong answer costs more to dislodge\nthan no answer at all.</li>\n<li><strong>It propagates.</strong> Later sessions read the workspace&#39;s entries as context, so one\nsession&#39;s confident error becomes cited precedent for the next five.</li>\n<li><strong>It reads as verified.</strong> For a reader who cannot check the code, an anchored claim\nis a flattering narrative <em>with citations</em>.</li>\n</ol>\n<p>The defence is not better anchoring. It is:</p>\n<ul>\n<li>capturing the <strong>environment</strong> as an anchor class, so the premise itself is checkable;</li>\n<li>re-checking premises separately from re-checking sources;</li>\n<li>and marking an entry <strong>invalidated</strong> rather than merely superseded when its premise\nturns out to be false, so everything resting on it is suppressed too.</li>\n</ul>\n<h3 id=\"anchor-classes-and-what-each-proves\">Anchor classes, and what each proves</h3>\n<table>\n<thead>\n<tr>\n<th>Class</th>\n<th>Proves</th>\n<th>Does not prove</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>commit</code></td>\n<td>This change entered history at this point</td>\n<td>That the change was correct</td>\n</tr>\n<tr>\n<td><code>file</code></td>\n<td>This path had this content</td>\n<td>That the content was read correctly</td>\n</tr>\n<tr>\n<td><code>environment</code></td>\n<td>The toolchain that actually ran — resolved interpreter, versions, flags</td>\n<td>That the toolchain was the intended one</td>\n</tr>\n<tr>\n<td><code>runtime</code></td>\n<td>A deployed config or flag value</td>\n<td>That the value was reviewed</td>\n</tr>\n<tr>\n<td><code>tool_use</code></td>\n<td>This command ran and returned this</td>\n<td>That its output was interpreted correctly</td>\n</tr>\n<tr>\n<td><code>message</code></td>\n<td>This was said, here</td>\n<td>That it was true</td>\n</tr>\n<tr>\n<td><code>url</code> / <code>external</code></td>\n<td>This source existed and said this at the time</td>\n<td>That it still does</td>\n</tr>\n<tr>\n<td><code>visual</code></td>\n<td>A design file at a version, a node, a screenshot</td>\n<td>That the rendered result matched intent</td>\n</tr>\n</tbody></table>\n<p>Two rows do the heavy lifting in practice. <strong><code>tool_use</code> and <code>message</code> are universal</strong> —\nthey exist in every context, including one with no repository at all. So a journal\noutside version control still works; it proves something weaker, <em>the agent read X and\nthen chose Y</em> rather than <em>the code changed this way</em>, and that weaker claim must be\nrendered in a weaker voice rather than dressed up.</p>\n<p><strong><code>environment</code> is the one people forget.</strong> It is also the one that would have caught\nthe failure above.</p>\n<h3 id=\"anchors-versus-influences\">Anchors versus influences</h3>\n<p>These are different axes and must not be merged.</p>\n<ul>\n<li><strong>Anchors</strong> prove the entry is honest. System-produced, verifiable: this commit\nexists, this tool call is in the log. They point at <em>the record of the decision</em>.</li>\n<li><strong>Influences</strong> explain how it was reached. Agent-asserted, often unverifiable, prone\nto rot. They point at <em>the inputs</em>.</li>\n</ul>\n<p>Collapse them and an entry can claim anchored status while resting only on a\nhalf-remembered URL — which destroys the one property the whole design provides.</p>\n<p>An influence carries a role, and the role matters as much as the identity:</p>\n<ul>\n<li><code>decisive</code> — this is why</li>\n<li><code>supporting</code> — this agreed</li>\n<li><code>considered</code> — this was read and weighed</li>\n<li><code>contradicted</code> — <strong>this was read and chosen against</strong></li>\n</ul>\n<p>That last one pairs with the rejection list and is otherwise unrecoverable. &quot;I read the\nbenchmark and decided against what it recommended&quot; is a fact nobody can reconstruct from\nthe code.</p>\n<h3 id=\"influences-are-selected-not-recalled\">Influences are selected, not recalled</h3>\n<p>The journal already recorded every fetch, search, read and query. So the candidate set\nfor a decision is derivable: it is the work between the previous entry and this one.</p>\n<p>You are <strong>selecting and ranking from that window</strong>, not retyping URLs from memory. An\ninfluence chosen this way carries a tool-call anchor for free, which is how an asserted\ninfluence becomes a verifiable one.</p>\n<p>The limit is worth stating: this works only where the tooling saw the inputs. For design\nwork and conversation-driven decisions the window is often empty — a call, a recording,\nframes never exported — and the field reverts to a memory exercise. Say so when it does.</p>\n<h3 id=\"rot-and-the-check-that-is-not-rot\">Rot, and the check that is not rot</h3>\n<p>Two decay checks, and conflating them hides the dangerous one.</p>\n<p><strong>Rot</strong> — did a source move or die? A URL 404s, a ticket closed, a referenced entry was\nsuperseded, a symbol no longer exists. Reported, never auto-resolved: a decision does not\nbecome wrong because a link broke.</p>\n<p><strong>Premise</strong> — was the reasoning ever sound? Distinct, and the one that matters. Where an\nentry declares what must be true for it to hold, and an environment anchor exists, a\nre-check can ask whether that premise still reproduces.</p>\n<p><strong>Only half of that ships.</strong> <code>agent-journal decay</code> compares the environment an entry was\nanchored to against the environment now; nothing reads <code>premise[]</code> at all. A <code>finding</code>\nwhose premises are plainly false today, on an unchanged interpreter, reports clean. The\ndesign intent above is the spec&#39;s; what runs is narrower, and\n<a href=\"decay.md\">references/decay.md</a> says exactly where the line falls.</p>\n<p>A source may be marked as <em>living</em> — a design file changes on every save, and flagging it\ndaily trains people to ignore rot flags entirely. <strong>This is also design intent, not\nshipped behaviour</strong>: <code>living</code> suppresses content-hash rot, and no hash-based check exists\nyet, so the marker would have nothing to suppress.</p>\n<h3 id=\"what-good-anchoring-looks-like\">What good anchoring looks like</h3>\n<ul>\n<li>Every factual claim points at something, or is explicitly marked as pointing at\nnothing.</li>\n<li>The entry names what must be true for it to hold, so a later reader can test that\nrather than take it on trust.</li>\n<li>Where the context cannot produce strong anchors, the entry says which classes were\nunavailable rather than implying they were checked and clean.</li>\n</ul>\n","words":1077},{"path":"references/authoring-floors.md","slug":"authoring-floors","title":"Authoring floors: when the journal asks first","body":"# Authoring floors: when the journal asks first\n\nEverything else in this skill is voluntary. You notice a decision, and you write it —\n[the main skill file](../SKILL.md)'s whole Procedure section is about getting better at\nnoticing. Spec §11.3's finding is the uncomfortable one: the set of things an agent\nnotices and writes down on its own is roughly *the complement* of the set that causes\nincidents. Nobody decides to flip an enforcement flag. Nobody schedules a moment to\nreflect on a secret rotation that went fine. The self-triggered loop (§11.1, unchanged\nby any of this) is real and worth keeping, and it is also, by its own nature, silent on\nexactly the calls that turn out to matter most.\n\nTwo floors sit beneath it — not a replacement, an addition. Both **prompt**: they ask a\nquestion, in the agent's own voice, about something the observation plane already saw.\nNeither writes an entry, and neither ever will; see \"Floors prompt, never author\" below.\n\n## What each one fires on\n\n| | Floor 2 — consequence (§11.3) | Floor 1 — compaction (§11.2) |\n| --- | --- | --- |\n| Fires on | `PostToolUse`, after a tool call returns | `PreCompact`, before the harness compacts context |\n| Command | `agent-journal floor --kind consequence` | `agent-journal floor --kind compaction` |\n| Asks | \"Was that consequence-bearing? If so, write it down.\" | \"Flush what's pending, and sweep for what you never checked.\" |\n| Wire shape | `hookSpecificOutput.additionalContext` | top-level `reason` / `systemMessage`, **never** `hookSpecificOutput` |\n\nThe two use genuinely different delivery mechanisms, not by choice but because the\nharness leaves no other option: `PreCompact` rejects `hookSpecificOutput` outright — the\nharness's own schema validation fails it, captured directly as the literal error banner\nin\n[`adapters/HOOK-OUTPUT-NOTES.md`](https://github.com/crissmoldovan/agent-skills/blob/main/adapters/HOOK-OUTPUT-NOTES.md) —\nso Floor 1 has to ride the generic top-level fields instead. That file, and\n[`adapters/claude-code/README.md`](https://github.com/crissmoldovan/agent-skills/blob/main/adapters/claude-code/README.md)'s\n\"Authoring floors\" section, are the primary record for the wire-level mechanics; this\npage covers what a user of the skill needs to know, not the transport.\n\nOnly the Claude Code adapter has either floor wired. Codex's floors are deliberately\nleft unwired pending a real Codex install to build and verify against — the same\ncaution [references/adapters.md](adapters.md) already applies to Codex's mapping work\ngenerally.\n\n## Trying a floor directly, without a hook\n\n`agent-journal floor` is a plain CLI command — you don't need a live Claude Code session\nto see what it says, only a journal with something in it. Nothing has happened yet, so\nthere is nothing to say:\n\n```bash\nagent-journal floor --kind consequence --workspace floors-demo\n```\n\nSilent, exit 0. That silence is deliberate and is the common case — see \"Why a false\npositive is the worse defect\" below. Now put something consequence-bearing in the\njournal — a `wrangler secret put` is exactly the shape §11.3 names — the same way a\n`PostToolUse` hook would, via `agent-journal observe`:\n\n```bash\nagent-journal observe --workspace floors-demo --kind tool_call --id obs-secret-put \\\n  --tool Bash --callId call-1 --input 'wrangler secret put API_KEY'\n```\n\nAsk again:\n\n```bash\nagent-journal floor --kind consequence --workspace floors-demo\n```\n\n```\nPlane A saw something here that nobody necessarily decided on purpose. That does not mean it\nneeds an entry — most tool calls do not — but it's worth a moment's thought before moving on:\n\n- mutation: wrangler secret put/delete/bulk changes a deployed Worker or Pages secret (observation obs-secret-put — cite it as `--anchor runtime:obs-secret-put`)\n\nIf this genuinely has a consequence, write down what happened, why, and what you assumed was\ntrue when you did it. If on reflection it does not, that is a legitimate answer too — just\nmake sure it was a real judgement, not a pass.\n```\n\nIt names the observation and hands you the exact anchor to cite — see \"The `runtime`\nanchor\" below for why that citation is the point of the whole exercise:\n\n```bash\nagent-journal record --workspace floors-demo --kind decision --id d-secret-rotate \\\n  --question \"should this secret actually be rotated here?\" \\\n  --chosen \"yes, it was an expired staging key\" \\\n  --anchor runtime:obs-secret-put\n```\n\nAnd Floor 1, against the same workspace — it has something to say too, because *any*\nunflushed activity is enough to trigger the flush half, regardless of whether it was\nconsequence-bearing:\n\n```bash\nagent-journal floor --kind compaction --workspace floors-demo\n```\n\n```\nContext is about to be compacted. Whatever is not written down before that happens does not\nsurvive it.\n\nFlush: is there a decision, a finding, a blocker, or a piece of progress from this session\nthat you have not recorded yet? If so, write it now — in your own words, from what actually\nhappened, not a summary of this message.\n\nAssumption sweep: separately from the above, what did you take on trust this session without\never checking it — about idempotency, about ordering, about the environment? Name each one\nyou can think of and write it as an `assumption` entry with `checked: no`. This is not a\nconfession of a mistake; it is a record of what stayed unverified, for whoever reads this\njournal next.\n```\n\nBoth commands accept `--since <timestamp>` to narrow what counts as \"since I last\nchecked\" (Floor 2's adapter wiring uses this — see the README's \"`--subject` and\n`--since`\" section for the exact heuristic and its own stated limits). Floor 2 also\ntakes `--subject <text>`, checked against every live `constraint`'s `scope` — the fourth\nof §11.3's triggers, `constraint-match`.\n\n## How to opt in — and why it defaults off\n\nNeither floor speaks unless the workspace has explicitly turned them on:\n\n```\nAGENT_JOURNAL_FLOORS=1\n```\n\nset in the `PostToolUse` and `PreCompact` blocks' `command` strings in\n`~/.claude/settings.json` (see the adapter README's \"Installing it\" and\n\"Configuration\" sections for the exact fragment). Every other value — unset, blank,\n`0`, `true`, anything else — leaves both floors completely inert, which is also the\nstate of every workspace that predates this feature.\n\n**Why opt-in, not on by default:** a floor that starts talking into a session nobody\nasked it to talk into is a floor that gets the whole adapter uninstalled within a day.\nAn uninstalled adapter records nothing at all — not just the consequence-bearing calls\nthis feature exists to catch, but every observation the plane was already producing.\nThat is a strictly worse outcome than the gap these floors close.\n\n### Why a false positive is the worse defect\n\nThis is worth stating as its own rule, not folded into the paragraph above: **a floor\nthat fires on ordinary work is a worse defect than a floor that stays silent when it\nshould have spoken.** A false negative loses one entry that self-triggered authoring\nmight have caught anyway, or might not — the gap §11.1 already has. A false positive\ncosts the whole mechanism, for every future call, the moment someone decides the noise\nisn't worth it and turns the adapter off. That asymmetry is why `MUTATION_PATTERNS`\nbelow is deliberately conservative rather than broad, why both floor renderers return\n`null` — never an empty string that still prints a blank prompt — the moment there is\nnothing to say, and why opt-in exists at all instead of a default-on feature with an\nescape hatch.\n\n## Floors prompt, never author\n\nEvery renderer in `floors.ts` produces a question, never a filled-in entry and never a\n`record` invocation with the fields already chosen. The file's own header comment states\nthe reason plainly: an influence is supposed to be *selected from what the tooling saw*\n(§5.3), not handed to the agent pre-selected — a floor that hands over a draft skips\nthat selection step and manufactures exactly the perfunctory, unconsidered entry §11.3\nwarns a per-turn checkpoint would produce. If you ever see a floor's output contain a\ncomplete sentence that reads like it belongs in `--rationale` or `--chosen`, that is a\nbug in `floors.ts`, not a feature of it — file it as one.\n\n## What the classifier cannot see\n\n`consequencesIn` (`consequence.ts`) is a heuristic over what the observation plane\nhappened to capture, not a semantic understanding of what a tool call did. Three blind\nspots are worth knowing before you rely on it, because each shapes what silence from a\nfloor actually means:\n\n**`permission` matches nothing today, on this harness.** The rule itself is fully\nimplemented against a real observation kind (`permission`, with `tool` and `decision`\nfields) — the code is correct, and the day an adapter starts emitting one it works with\nno changes. But no adapter currently does: Claude Code's `PermissionRequest` hook was\nattempted directly and never observed to fire, on this harness version, even during a\nreal permission denial (`adapters/NOTES.md`). So a permission grant or denial today\nproduces no observation at all, and Floor 2 has nothing to classify. Silence here is not\nevidence the rule failed; it is evidence nothing fed it.\n\n**\"Unfamiliar\" means *absent from this journal*, never \"new to the world.\"**\n`unfamiliar-api` tracks every host a `tool_call` has named so far in this workspace's own\nhistory and flags the first appearance of each one. A host this project has called a\nhundred times from a different workspace, or that every other engineer already knows\nwell, still reads as unfamiliar the first time *this* journal sees it. Read the detail\nstring literally — \"first appearance of host X in this journal\" — not as a claim about\nthe host's actual novelty.\n\n**Mutation matching is a pattern table, and it is meant to be extended, not the matcher\naround it.** `MUTATION_PATTERNS` in `consequence.ts` is a deliberately explicit list —\n`wrangler secret put`, `gh secret set`, `aws secretsmanager …`, `terraform apply`, and\nthe rest — each naming a specific mutating subcommand, never a bare tool name, so a\nread-only sibling (`… list`, `… get`, `… status`) is never caught by accident. When a new\nCLI needs coverage, add a row there, following the same shape every existing row does;\nthe surrounding matcher (quote handling, comment stripping, preview-flag detection,\ncommand splitting) already applies to whatever you add.\n\n**One thing that matcher only sees for a shell tool.** Every guard above is written\nagainst a command line, so classification runs only for `Bash` and its siblings. That\nis not a limitation to work around — it is what stops a `Grep` for the literal text\n`gh secret set`, or a `Write` whose content mentions a URL, from being read as a config\nchange. It was a real bug: before the gate existed, writing a README with links in it\nprompted for a journal entry. A pattern you add here will never be tried against a\nnon-shell tool's payload, and should not be written as though it might.\n\nTwo things are deliberately **not** in the table, and adding them would trade a real\nproblem for a worse one: a bare `curl -X POST` against an arbitrary URL, and bare\n`wrangler deploy` / `kubectl apply`. All three share the same defect — their read-only\npreview form uses the identical verb, distinguishable from the real mutation only by a\nflag (`--dry-run`, `-o yaml --dry-run=client`, or nothing at all for `curl`, since an\nHTTP method flag alone says nothing about which URL is a feature-flags API and which\nmerely contains the word \"flags\" in its path). String matching alone cannot tell these\napart without either missing real mutations or firing on routine reads — exactly the\nfalse-positive risk \"Why a false positive is the worse defect\" above says is not worth\ntaking. If your workflow needs one of these covered, it needs a rule with more context\nthan a command string carries, not a broader regex here.\n\n## The three limits worth stating plainly\n\nEach of these was found or decided while verifying this feature end to end, not\ntheorized in advance. None is a caveat to read past — each changes what you should\nexpect a floor to do for you.\n\n### Floor 1 does not force a pre-compaction flush, despite what §11.2 says\n\n§11.2's own words are that `PreCompact` \"forces a flush **before** context is\ndestroyed.\" The mechanism does not do that, and the gap is structural, not a bug to\nfix later. `PreCompact`'s text reaches the agent *after* compaction has already run —\nconfirmed live, not inferred: a follow-up prompt in the same session, asked what special\ninstructions arrived around the compaction step, got the full flush-and-sweep text back\nverbatim, with the agent's own unprompted commentary that it \"reached me as\n`local-command-stdout` *after* compaction had completed, carrying the caveat 'DO NOT\nrespond to these messages… unless the user explicitly asks'\" — the harness's own\ncaveat, not this project's. As a prompt meant to trigger action *before* the loss, it\narrives too late to act on.\n\nWhat it *does* achieve is real, and worth having on its own terms: the flush and\nassumption-sweep instruction is folded into the compaction/summarization request\nitself, which means it becomes part of what *survives* compaction. The agent is\nreminded, afterward, to go write those entries — with whatever detail compaction\nalready discarded. Say both halves together. \"PreCompact fires, so nothing is lost\" is\nfalse; \"PreCompact fires, so the reminder to flush is itself one of the things that\nsurvives\" is true, and is the actual value this floor provides. Treat this the way\n`adapters/NOTES.md` treats `heartbeat`: a structural limit of the hook surface, stated\nin its own right, not a defect in this implementation to route around.\n\n### Floor 2 cannot see a failed tool call\n\n`PostToolUse` does not fire for a `Bash` call whose underlying command exits non-zero —\nconfirmed three separate ways in isolated sessions, each behind a debug wrapper that\nlogs every hook invocation verbatim: a missing binary (`command not found`, exit 127), a\nreal program erroring out on its own terms, and a bare `false`. In all three, exactly\none hook fired for the whole call — `PreToolUse` — and no `PostToolUse` invocation\nappears anywhere in the log, not merely one that produced empty output. Contrast-checked\nagainst an identical setup with a succeeding command, which fires both hooks every time.\n\nPractically: a denied permission, a half-applied change, or a mutating command that\nerrored partway through is invisible to Floor 2, structurally, regardless of how good\n`MUTATION_PATTERNS` gets. This is arguably the more common real case for exactly the\ncommands that table targets — `wrangler secret put`, `gh secret set`, `aws\nsecretsmanager …` — all commands that fail constantly on an expired token or a\nmisremembered flag. It also resolves an earlier open question: why `PostToolUseFailure`\nwas never observed to fire on this harness — `adapters/NOTES.md`'s own negative case was\nabout a *permission denial*, a different mechanism (the harness refusing the call before\nit runs), not a call that ran to completion and merely returned nonzero.\n\nNot established here: whether this is `is_error`-state-driven — the harness treating any\nnonzero Bash exit the same way it treats a denied call — specific to this harness\nversion, or something else entirely. A dedicated probe, isolated from everything else\nthis feature needed to verify, should settle that before anyone designs around it\nfurther.\n\n### The classifier is a heuristic with named blind spots\n\nCovered in full above, under \"What the classifier cannot see\" — restated here only so\nthis list names all three real limits in one place: `permission` matches nothing in\npractice today, \"unfamiliar\" means absent from this journal rather than new to the\nworld, and mutation matching is a pattern table with deliberately excluded classes\n(`curl -X POST`, bare `wrangler deploy` / `kubectl apply`) that a reader should expect\nto extend at `MUTATION_PATTERNS`, never at the matcher around it.\n\n## The `runtime` anchor\n\n[references/anchors.md](anchors.md) already defines `runtime`: it proves *a deployed\nconfig or flag value*, and — like every anchor — never proves the value was reviewed,\nonly that it existed. `record --anchor runtime:<observation-id>` has always worked; an\nearlier audit of this project briefly listed `runtime` as an anchor class with no\nproducer, which was wrong and got corrected on inspection — the CLI support was there\nthe whole time.\n\nWhat was actually missing was narrower: nothing helped an agent *notice* that a\nmutation had just happened, so nothing prompted it to think of citing a `runtime`\nanchor in the first place. That is what Floor 2 is for. Every `mutation`-rule line a\nFloor 2 prompt prints hands back exactly the anchor to use —\n`` `--anchor runtime:<id>` `` — as shown in \"Trying a floor directly\" above. Building\nFloor 2 closes the noticing gap as a side effect of closing the consequence gap; the\nanchor mechanics needed nothing new.\n\n## Further reading\n\n- [references/adapters.md](adapters.md) — the observation plane both floors read from:\n  what a hook captures automatically, what it can't, and how to verify one actually\n  fired.\n- `adapters/claude-code/README.md` and `adapters/HOOK-OUTPUT-NOTES.md`, in the\n  repository (outside this skill's own installed files — see adapters.md's \"Getting an\n  adapter\" section for why) — the primary record for the wire-level mechanics summarized\n  above: exact payload shapes, the `--since` lookback heuristic, the 8,000-character\n  truncation, and the JSON-safety guarantees.\n","bodyHtml":"<h2 id=\"authoring-floors-when-the-journal-asks-first\">Authoring floors: when the journal asks first</h2>\n<p>Everything else in this skill is voluntary. You notice a decision, and you write it —\n<a href=\"../SKILL.md\">the main skill file</a>&#39;s whole Procedure section is about getting better at\nnoticing. Spec §11.3&#39;s finding is the uncomfortable one: the set of things an agent\nnotices and writes down on its own is roughly <em>the complement</em> of the set that causes\nincidents. Nobody decides to flip an enforcement flag. Nobody schedules a moment to\nreflect on a secret rotation that went fine. The self-triggered loop (§11.1, unchanged\nby any of this) is real and worth keeping, and it is also, by its own nature, silent on\nexactly the calls that turn out to matter most.</p>\n<p>Two floors sit beneath it — not a replacement, an addition. Both <strong>prompt</strong>: they ask a\nquestion, in the agent&#39;s own voice, about something the observation plane already saw.\nNeither writes an entry, and neither ever will; see &quot;Floors prompt, never author&quot; below.</p>\n<h3 id=\"what-each-one-fires-on\">What each one fires on</h3>\n<table>\n<thead>\n<tr>\n<th></th>\n<th>Floor 2 — consequence (§11.3)</th>\n<th>Floor 1 — compaction (§11.2)</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Fires on</td>\n<td><code>PostToolUse</code>, after a tool call returns</td>\n<td><code>PreCompact</code>, before the harness compacts context</td>\n</tr>\n<tr>\n<td>Command</td>\n<td><code>agent-journal floor --kind consequence</code></td>\n<td><code>agent-journal floor --kind compaction</code></td>\n</tr>\n<tr>\n<td>Asks</td>\n<td>&quot;Was that consequence-bearing? If so, write it down.&quot;</td>\n<td>&quot;Flush what&#39;s pending, and sweep for what you never checked.&quot;</td>\n</tr>\n<tr>\n<td>Wire shape</td>\n<td><code>hookSpecificOutput.additionalContext</code></td>\n<td>top-level <code>reason</code> / <code>systemMessage</code>, <strong>never</strong> <code>hookSpecificOutput</code></td>\n</tr>\n</tbody></table>\n<p>The two use genuinely different delivery mechanisms, not by choice but because the\nharness leaves no other option: <code>PreCompact</code> rejects <code>hookSpecificOutput</code> outright — the\nharness&#39;s own schema validation fails it, captured directly as the literal error banner\nin\n<a href=\"https://github.com/crissmoldovan/agent-skills/blob/main/adapters/HOOK-OUTPUT-NOTES.md\" target=\"_blank\" rel=\"noreferrer\"><code>adapters/HOOK-OUTPUT-NOTES.md</code></a> —\nso Floor 1 has to ride the generic top-level fields instead. That file, and\n<a href=\"https://github.com/crissmoldovan/agent-skills/blob/main/adapters/claude-code/README.md\" target=\"_blank\" rel=\"noreferrer\"><code>adapters/claude-code/README.md</code></a>&#39;s\n&quot;Authoring floors&quot; section, are the primary record for the wire-level mechanics; this\npage covers what a user of the skill needs to know, not the transport.</p>\n<p>Only the Claude Code adapter has either floor wired. Codex&#39;s floors are deliberately\nleft unwired pending a real Codex install to build and verify against — the same\ncaution <a href=\"adapters.md\">references/adapters.md</a> already applies to Codex&#39;s mapping work\ngenerally.</p>\n<h3 id=\"trying-a-floor-directly-without-a-hook\">Trying a floor directly, without a hook</h3>\n<p><code>agent-journal floor</code> is a plain CLI command — you don&#39;t need a live Claude Code session\nto see what it says, only a journal with something in it. Nothing has happened yet, so\nthere is nothing to say:</p>\n<pre><code class=\"language-bash\">agent-journal floor --kind consequence --workspace floors-demo\n</code></pre>\n<p>Silent, exit 0. That silence is deliberate and is the common case — see &quot;Why a false\npositive is the worse defect&quot; below. Now put something consequence-bearing in the\njournal — a <code>wrangler secret put</code> is exactly the shape §11.3 names — the same way a\n<code>PostToolUse</code> hook would, via <code>agent-journal observe</code>:</p>\n<pre><code class=\"language-bash\">agent-journal observe --workspace floors-demo --kind tool_call --id obs-secret-put \\\n  --tool Bash --callId call-1 --input &#39;wrangler secret put API_KEY&#39;\n</code></pre>\n<p>Ask again:</p>\n<pre><code class=\"language-bash\">agent-journal floor --kind consequence --workspace floors-demo\n</code></pre>\n<pre><code>Plane A saw something here that nobody necessarily decided on purpose. That does not mean it\nneeds an entry — most tool calls do not — but it&#39;s worth a moment&#39;s thought before moving on:\n\n- mutation: wrangler secret put/delete/bulk changes a deployed Worker or Pages secret (observation obs-secret-put — cite it as `--anchor runtime:obs-secret-put`)\n\nIf this genuinely has a consequence, write down what happened, why, and what you assumed was\ntrue when you did it. If on reflection it does not, that is a legitimate answer too — just\nmake sure it was a real judgement, not a pass.\n</code></pre>\n<p>It names the observation and hands you the exact anchor to cite — see &quot;The <code>runtime</code>\nanchor&quot; below for why that citation is the point of the whole exercise:</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace floors-demo --kind decision --id d-secret-rotate \\\n  --question &quot;should this secret actually be rotated here?&quot; \\\n  --chosen &quot;yes, it was an expired staging key&quot; \\\n  --anchor runtime:obs-secret-put\n</code></pre>\n<p>And Floor 1, against the same workspace — it has something to say too, because <em>any</em>\nunflushed activity is enough to trigger the flush half, regardless of whether it was\nconsequence-bearing:</p>\n<pre><code class=\"language-bash\">agent-journal floor --kind compaction --workspace floors-demo\n</code></pre>\n<pre><code>Context is about to be compacted. Whatever is not written down before that happens does not\nsurvive it.\n\nFlush: is there a decision, a finding, a blocker, or a piece of progress from this session\nthat you have not recorded yet? If so, write it now — in your own words, from what actually\nhappened, not a summary of this message.\n\nAssumption sweep: separately from the above, what did you take on trust this session without\never checking it — about idempotency, about ordering, about the environment? Name each one\nyou can think of and write it as an `assumption` entry with `checked: no`. This is not a\nconfession of a mistake; it is a record of what stayed unverified, for whoever reads this\njournal next.\n</code></pre>\n<p>Both commands accept <code>--since &lt;timestamp&gt;</code> to narrow what counts as &quot;since I last\nchecked&quot; (Floor 2&#39;s adapter wiring uses this — see the README&#39;s &quot;<code>--subject</code> and\n<code>--since</code>&quot; section for the exact heuristic and its own stated limits). Floor 2 also\ntakes <code>--subject &lt;text&gt;</code>, checked against every live <code>constraint</code>&#39;s <code>scope</code> — the fourth\nof §11.3&#39;s triggers, <code>constraint-match</code>.</p>\n<h3 id=\"how-to-opt-in-and-why-it-defaults-off\">How to opt in — and why it defaults off</h3>\n<p>Neither floor speaks unless the workspace has explicitly turned them on:</p>\n<pre><code>AGENT_JOURNAL_FLOORS=1\n</code></pre>\n<p>set in the <code>PostToolUse</code> and <code>PreCompact</code> blocks&#39; <code>command</code> strings in\n<code>~/.claude/settings.json</code> (see the adapter README&#39;s &quot;Installing it&quot; and\n&quot;Configuration&quot; sections for the exact fragment). Every other value — unset, blank,\n<code>0</code>, <code>true</code>, anything else — leaves both floors completely inert, which is also the\nstate of every workspace that predates this feature.</p>\n<p><strong>Why opt-in, not on by default:</strong> a floor that starts talking into a session nobody\nasked it to talk into is a floor that gets the whole adapter uninstalled within a day.\nAn uninstalled adapter records nothing at all — not just the consequence-bearing calls\nthis feature exists to catch, but every observation the plane was already producing.\nThat is a strictly worse outcome than the gap these floors close.</p>\n<h4 id=\"why-a-false-positive-is-the-worse-defect\">Why a false positive is the worse defect</h4>\n<p>This is worth stating as its own rule, not folded into the paragraph above: <strong>a floor\nthat fires on ordinary work is a worse defect than a floor that stays silent when it\nshould have spoken.</strong> A false negative loses one entry that self-triggered authoring\nmight have caught anyway, or might not — the gap §11.1 already has. A false positive\ncosts the whole mechanism, for every future call, the moment someone decides the noise\nisn&#39;t worth it and turns the adapter off. That asymmetry is why <code>MUTATION_PATTERNS</code>\nbelow is deliberately conservative rather than broad, why both floor renderers return\n<code>null</code> — never an empty string that still prints a blank prompt — the moment there is\nnothing to say, and why opt-in exists at all instead of a default-on feature with an\nescape hatch.</p>\n<h3 id=\"floors-prompt-never-author\">Floors prompt, never author</h3>\n<p>Every renderer in <code>floors.ts</code> produces a question, never a filled-in entry and never a\n<code>record</code> invocation with the fields already chosen. The file&#39;s own header comment states\nthe reason plainly: an influence is supposed to be <em>selected from what the tooling saw</em>\n(§5.3), not handed to the agent pre-selected — a floor that hands over a draft skips\nthat selection step and manufactures exactly the perfunctory, unconsidered entry §11.3\nwarns a per-turn checkpoint would produce. If you ever see a floor&#39;s output contain a\ncomplete sentence that reads like it belongs in <code>--rationale</code> or <code>--chosen</code>, that is a\nbug in <code>floors.ts</code>, not a feature of it — file it as one.</p>\n<h3 id=\"what-the-classifier-cannot-see\">What the classifier cannot see</h3>\n<p><code>consequencesIn</code> (<code>consequence.ts</code>) is a heuristic over what the observation plane\nhappened to capture, not a semantic understanding of what a tool call did. Three blind\nspots are worth knowing before you rely on it, because each shapes what silence from a\nfloor actually means:</p>\n<p><strong><code>permission</code> matches nothing today, on this harness.</strong> The rule itself is fully\nimplemented against a real observation kind (<code>permission</code>, with <code>tool</code> and <code>decision</code>\nfields) — the code is correct, and the day an adapter starts emitting one it works with\nno changes. But no adapter currently does: Claude Code&#39;s <code>PermissionRequest</code> hook was\nattempted directly and never observed to fire, on this harness version, even during a\nreal permission denial (<code>adapters/NOTES.md</code>). So a permission grant or denial today\nproduces no observation at all, and Floor 2 has nothing to classify. Silence here is not\nevidence the rule failed; it is evidence nothing fed it.</p>\n<p><strong>&quot;Unfamiliar&quot; means <em>absent from this journal</em>, never &quot;new to the world.&quot;</strong>\n<code>unfamiliar-api</code> tracks every host a <code>tool_call</code> has named so far in this workspace&#39;s own\nhistory and flags the first appearance of each one. A host this project has called a\nhundred times from a different workspace, or that every other engineer already knows\nwell, still reads as unfamiliar the first time <em>this</em> journal sees it. Read the detail\nstring literally — &quot;first appearance of host X in this journal&quot; — not as a claim about\nthe host&#39;s actual novelty.</p>\n<p><strong>Mutation matching is a pattern table, and it is meant to be extended, not the matcher\naround it.</strong> <code>MUTATION_PATTERNS</code> in <code>consequence.ts</code> is a deliberately explicit list —\n<code>wrangler secret put</code>, <code>gh secret set</code>, <code>aws secretsmanager …</code>, <code>terraform apply</code>, and\nthe rest — each naming a specific mutating subcommand, never a bare tool name, so a\nread-only sibling (<code>… list</code>, <code>… get</code>, <code>… status</code>) is never caught by accident. When a new\nCLI needs coverage, add a row there, following the same shape every existing row does;\nthe surrounding matcher (quote handling, comment stripping, preview-flag detection,\ncommand splitting) already applies to whatever you add.</p>\n<p><strong>One thing that matcher only sees for a shell tool.</strong> Every guard above is written\nagainst a command line, so classification runs only for <code>Bash</code> and its siblings. That\nis not a limitation to work around — it is what stops a <code>Grep</code> for the literal text\n<code>gh secret set</code>, or a <code>Write</code> whose content mentions a URL, from being read as a config\nchange. It was a real bug: before the gate existed, writing a README with links in it\nprompted for a journal entry. A pattern you add here will never be tried against a\nnon-shell tool&#39;s payload, and should not be written as though it might.</p>\n<p>Two things are deliberately <strong>not</strong> in the table, and adding them would trade a real\nproblem for a worse one: a bare <code>curl -X POST</code> against an arbitrary URL, and bare\n<code>wrangler deploy</code> / <code>kubectl apply</code>. All three share the same defect — their read-only\npreview form uses the identical verb, distinguishable from the real mutation only by a\nflag (<code>--dry-run</code>, <code>-o yaml --dry-run=client</code>, or nothing at all for <code>curl</code>, since an\nHTTP method flag alone says nothing about which URL is a feature-flags API and which\nmerely contains the word &quot;flags&quot; in its path). String matching alone cannot tell these\napart without either missing real mutations or firing on routine reads — exactly the\nfalse-positive risk &quot;Why a false positive is the worse defect&quot; above says is not worth\ntaking. If your workflow needs one of these covered, it needs a rule with more context\nthan a command string carries, not a broader regex here.</p>\n<h3 id=\"the-three-limits-worth-stating-plainly\">The three limits worth stating plainly</h3>\n<p>Each of these was found or decided while verifying this feature end to end, not\ntheorized in advance. None is a caveat to read past — each changes what you should\nexpect a floor to do for you.</p>\n<h4 id=\"floor-1-does-not-force-a-pre-compaction-flush-despite-what-112-says\">Floor 1 does not force a pre-compaction flush, despite what §11.2 says</h4>\n<p>§11.2&#39;s own words are that <code>PreCompact</code> &quot;forces a flush <strong>before</strong> context is\ndestroyed.&quot; The mechanism does not do that, and the gap is structural, not a bug to\nfix later. <code>PreCompact</code>&#39;s text reaches the agent <em>after</em> compaction has already run —\nconfirmed live, not inferred: a follow-up prompt in the same session, asked what special\ninstructions arrived around the compaction step, got the full flush-and-sweep text back\nverbatim, with the agent&#39;s own unprompted commentary that it &quot;reached me as\n<code>local-command-stdout</code> <em>after</em> compaction had completed, carrying the caveat &#39;DO NOT\nrespond to these messages… unless the user explicitly asks&#39;&quot; — the harness&#39;s own\ncaveat, not this project&#39;s. As a prompt meant to trigger action <em>before</em> the loss, it\narrives too late to act on.</p>\n<p>What it <em>does</em> achieve is real, and worth having on its own terms: the flush and\nassumption-sweep instruction is folded into the compaction/summarization request\nitself, which means it becomes part of what <em>survives</em> compaction. The agent is\nreminded, afterward, to go write those entries — with whatever detail compaction\nalready discarded. Say both halves together. &quot;PreCompact fires, so nothing is lost&quot; is\nfalse; &quot;PreCompact fires, so the reminder to flush is itself one of the things that\nsurvives&quot; is true, and is the actual value this floor provides. Treat this the way\n<code>adapters/NOTES.md</code> treats <code>heartbeat</code>: a structural limit of the hook surface, stated\nin its own right, not a defect in this implementation to route around.</p>\n<h4 id=\"floor-2-cannot-see-a-failed-tool-call\">Floor 2 cannot see a failed tool call</h4>\n<p><code>PostToolUse</code> does not fire for a <code>Bash</code> call whose underlying command exits non-zero —\nconfirmed three separate ways in isolated sessions, each behind a debug wrapper that\nlogs every hook invocation verbatim: a missing binary (<code>command not found</code>, exit 127), a\nreal program erroring out on its own terms, and a bare <code>false</code>. In all three, exactly\none hook fired for the whole call — <code>PreToolUse</code> — and no <code>PostToolUse</code> invocation\nappears anywhere in the log, not merely one that produced empty output. Contrast-checked\nagainst an identical setup with a succeeding command, which fires both hooks every time.</p>\n<p>Practically: a denied permission, a half-applied change, or a mutating command that\nerrored partway through is invisible to Floor 2, structurally, regardless of how good\n<code>MUTATION_PATTERNS</code> gets. This is arguably the more common real case for exactly the\ncommands that table targets — <code>wrangler secret put</code>, <code>gh secret set</code>, <code>aws secretsmanager …</code> — all commands that fail constantly on an expired token or a\nmisremembered flag. It also resolves an earlier open question: why <code>PostToolUseFailure</code>\nwas never observed to fire on this harness — <code>adapters/NOTES.md</code>&#39;s own negative case was\nabout a <em>permission denial</em>, a different mechanism (the harness refusing the call before\nit runs), not a call that ran to completion and merely returned nonzero.</p>\n<p>Not established here: whether this is <code>is_error</code>-state-driven — the harness treating any\nnonzero Bash exit the same way it treats a denied call — specific to this harness\nversion, or something else entirely. A dedicated probe, isolated from everything else\nthis feature needed to verify, should settle that before anyone designs around it\nfurther.</p>\n<h4 id=\"the-classifier-is-a-heuristic-with-named-blind-spots\">The classifier is a heuristic with named blind spots</h4>\n<p>Covered in full above, under &quot;What the classifier cannot see&quot; — restated here only so\nthis list names all three real limits in one place: <code>permission</code> matches nothing in\npractice today, &quot;unfamiliar&quot; means absent from this journal rather than new to the\nworld, and mutation matching is a pattern table with deliberately excluded classes\n(<code>curl -X POST</code>, bare <code>wrangler deploy</code> / <code>kubectl apply</code>) that a reader should expect\nto extend at <code>MUTATION_PATTERNS</code>, never at the matcher around it.</p>\n<h3 id=\"the-runtime-anchor\">The <code>runtime</code> anchor</h3>\n<p><a href=\"anchors.md\">references/anchors.md</a> already defines <code>runtime</code>: it proves <em>a deployed\nconfig or flag value</em>, and — like every anchor — never proves the value was reviewed,\nonly that it existed. <code>record --anchor runtime:&lt;observation-id&gt;</code> has always worked; an\nearlier audit of this project briefly listed <code>runtime</code> as an anchor class with no\nproducer, which was wrong and got corrected on inspection — the CLI support was there\nthe whole time.</p>\n<p>What was actually missing was narrower: nothing helped an agent <em>notice</em> that a\nmutation had just happened, so nothing prompted it to think of citing a <code>runtime</code>\nanchor in the first place. That is what Floor 2 is for. Every <code>mutation</code>-rule line a\nFloor 2 prompt prints hands back exactly the anchor to use —\n<code>`--anchor runtime:&lt;id&gt;`</code> — as shown in &quot;Trying a floor directly&quot; above. Building\nFloor 2 closes the noticing gap as a side effect of closing the consequence gap; the\nanchor mechanics needed nothing new.</p>\n<h3 id=\"further-reading\">Further reading</h3>\n<ul>\n<li><a href=\"adapters.md\">references/adapters.md</a> — the observation plane both floors read from:\nwhat a hook captures automatically, what it can&#39;t, and how to verify one actually\nfired.</li>\n<li><code>adapters/claude-code/README.md</code> and <code>adapters/HOOK-OUTPUT-NOTES.md</code>, in the\nrepository (outside this skill&#39;s own installed files — see adapters.md&#39;s &quot;Getting an\nadapter&quot; section for why) — the primary record for the wire-level mechanics summarized\nabove: exact payload shapes, the <code>--since</code> lookback heuristic, the 8,000-character\ntruncation, and the JSON-safety guarantees.</li>\n</ul>\n","words":2810},{"path":"references/decay.md","slug":"decay","title":"Decay: checking a journal against the world it described","body":"# Decay: checking a journal against the world it described\n\nAn entry does not stay true because it was true once. The file it cites gets deleted.\nThe ticket it cites gets closed. The interpreter it ran under is not the one on `PATH`\ntoday. `decay` is the command that asks, of everything already in the journal, *does\nthe world still look like this said it did* — and reports what it finds without acting\non any of it.\n\n[references/anchors.md](anchors.md) introduces the distinction between **rot** (did a\nsource move or die) and **premise** (was the reasoning ever sound) in brief. This\ndocument is the full reference: every status `decay` can report, exactly what it does\nand does not look at, and the two limits worth knowing before you trust its output.\n\n## Running it\n\n```bash\nagent-journal decay --workspace <id> [--repo <path>]\n```\n\n`--repo` is the only thing beyond `--workspace`, and it is optional — see \"The\n`codebase` ref convention\" below for what omitting it means. Like every other command\nhere, an unrecognised flag is refused rather than silently ignored.\n\n`decay` exits 0 whenever the journal itself could read cleanly, **regardless of what\nthe findings say** — a report full of `failing` entries exits the same as a report\nfull of `passing` ones. That is not an oversight; see \"Nothing is auto-resolved\" below.\nExit 1 means the journal was damaged (unreadable segments, malformed lines), the same\nfloor-not-total warning `coverage`, `show` and `trace` already give — and is unrelated\nto any individual finding's status.\n\n## Five statuses, and what each one commits to\n\n| Status | Says | Never means |\n| --- | --- | --- |\n| `passing` | Checked. The source still holds. | — |\n| `failing` | Checked. The source no longer holds, or the citation was broken to begin with. | \"It probably still holds\" |\n| `drifted` | Checked. It differs — but the difference is a question for a human, not a verdict. | \"It is wrong\" |\n| `not-checkable` | Nothing could ever check this, or the tools to check it were not supplied for this run. | \"It is fine\" |\n| `not-implemented` | A checker could exist for this. This release does not ship one. | \"It is fine\", or \"it can never be checked\" |\n\nThe two that get confused are `not-checkable` and `passing`. They must never collapse\ninto each other — a `person` influence that comes back anything other than\n`not-checkable` is a bug, because nothing in this tool can re-interview a person. Read\n`not-checkable` as *silence*, not as *clean*.\n\nThe other confusable pair is `drifted` and `failing`, and the difference is deliberate\nrather than cosmetic — see \"Environment drift\" below for why it exists as a fifth\nstatus instead of folding into `failing`.\n\n## What decay actually looks at\n\nTwo things, and only two:\n\n- Every live entry's `influences` — the nine types in\n  [references/anchors.md](anchors.md#anchors-versus-influences): `journal`,\n  `tool_result`, `codebase`, `url`, `ticket`, `document`, `person`, `model_knowledge`,\n  `conversation`.\n- `environment`-class anchors specifically.\n\n**Every other anchor class is not decay-checked in this release.** `commit`, `file`,\n`visual`, `runtime`, `tool_use`, `message`, `url` and `external` anchors produce no\nfinding at all — not `not-checkable`, not anything. Citing one is still valuable (it is\nwhat [references/anchors.md](anchors.md) is about), but `decay` has nothing to say\nabout it. Do not read a clean decay report as \"every anchor on this entry was\nverified\"; read it as \"every influence, and any `environment` anchor, was verified.\"\n\n### What `journal` and `tool_result` each verify\n\nBoth resolve their `ref` inside this journal, and both check the **kind** of what they\nfind, because a citation that points the wrong way is a defect in the entry rather\nthan decay in a source:\n\n- **`journal`** — the ref must name an *entry*, and that entry must still be live. It\n  reports `failing` if the entry is absent, superseded, invalidated, a `void`, or an\n  observation (cite an observation as `tool_result` instead).\n- **`tool_result`** — the ref must name an *observation*, and this is a **presence\n  check only**. It confirms the observation is still in the journal. It does **not**\n  confirm that what the tool reported then is still true now. A `tool_result` reading\n  `passing` means \"that row is still there\", never \"that command would still print\n  this\". Nothing in this release re-runs anything.\n\nCiting a `void` fails on both. A `void` is the journal's own record that a write was\n*refused* — reading it as a surviving source would say \"your evidence still holds\"\nabout a row whose entire content is that nothing was written.\n\nAn entry that was itself directly superseded or invalidated is skipped — its own\nsources stopped mattering the moment it stopped counting. An entry that merely *cites*\na casualty through a `journal` influence is not skipped: that citation is exactly what\nreports `failing`, which is how a reader learns the entry's reasoning now rests on\nsomething withdrawn.\n\n## The `codebase` ref convention, and its honest limit\n\nA `codebase` influence's ref is either a bare path or `path:symbolName`:\n\n```bash\nagent-journal record --workspace decay-demo --kind decision --id d-decay-check \\\n  --question \"how does decay check a codebase influence?\" \\\n  --chosen \"existence, plus a text-contains scan for a named symbol\" \\\n  --influence codebase:decisive:packages/agent-journal/src/decay.ts \\\n  --influence codebase:supporting:packages/agent-journal/src/decay.ts:computeDecay\n```\n\n`packages/agent-journal/src/decay.ts` alone checks that the file exists.\n`packages/agent-journal/src/decay.ts:computeDecay` additionally requires the text\n`computeDecay` to appear somewhere in that file.\n\n**That second check is a grep, not a parse.** It catches a deleted file. It catches a\nrenamed or removed symbol — `computeDecay` gone from the text reports `failing`. It\ndoes **not** catch a symbol that kept its name and changed what it does. If\n`computeDecay`'s signature or behaviour changed while the identifier stayed exactly as\nit is, this check has no way to know, and the finding would still read `passing`. A\n`passing` `codebase` finding means *the name is still there*, never *the code still\nmeans what the entry said it meant*. Overclaiming here — parsing every language a\njournal might cite, understanding renames, tracking behaviour — is not a thing this\nrelease attempts, and the reference says so rather than implying otherwise.\n\n`--repo` is what makes any of this checkable at all, and it defaults to nothing:\n\n```bash\nagent-journal decay --workspace decay-demo\n```\n\n```json\n{\n  \"findings\": [\n    { \"entryId\": \"d-decay-check\", \"type\": \"codebase\",\n      \"ref\": \"packages/agent-journal/src/decay.ts\",\n      \"status\": \"not-checkable\", \"detail\": \"no codebase index was provided for this run\" },\n    { \"entryId\": \"d-decay-check\", \"type\": \"codebase\",\n      \"ref\": \"packages/agent-journal/src/decay.ts:computeDecay\",\n      \"status\": \"not-checkable\", \"detail\": \"no codebase index was provided for this run\" }\n  ],\n  \"checked\": 0, \"notCheckable\": 2, \"notImplemented\": 0, \"drifted\": 0\n}\n```\n\nThat is deliberate, not a missing default. Silently scanning whatever directory the\ncaller happens to be standing in is a surprise; `not-checkable` is the honest status\nfor \"nobody told this run where to look.\" Point it at a checkout and the same refs\nresolve — run from the root of this repository, `--repo .` names it:\n\n```bash\nagent-journal decay --workspace decay-demo --repo .\n```\n\n```json\n{\n  \"findings\": [\n    { \"entryId\": \"d-decay-check\", \"type\": \"codebase\",\n      \"ref\": \"packages/agent-journal/src/decay.ts\",\n      \"status\": \"passing\", \"detail\": \"\\\"packages/agent-journal/src/decay.ts\\\" is present in the codebase\" },\n    { \"entryId\": \"d-decay-check\", \"type\": \"codebase\",\n      \"ref\": \"packages/agent-journal/src/decay.ts:computeDecay\",\n      \"status\": \"passing\", \"detail\": \"\\\"packages/agent-journal/src/decay.ts:computeDecay\\\" is present in the codebase\" }\n  ],\n  \"checked\": 2, \"notCheckable\": 0, \"notImplemented\": 0, \"drifted\": 0\n}\n```\n\n`--repo` is not remembered between runs — omit it on the next invocation and these two\nfindings go back to `not-checkable`, not to whatever they were last time. A ref that\nresolves outside `--repo` (by `..`, a symlink, or an absolute path pointing elsewhere)\nis refused the same way: omitted from what gets checked, reported `not-checkable`\nrather than guessed at either direction.\n\n## Environment drift: why this check exists at all\n\nThis is not a feature that happened to get added. It is the reason the plan exists.\n\nThe design's canonical failure looks like this: a session runs against the wrong\ninterpreter on `PATH`. Tests fail for environmental reasons. An agent investigates them\nas a genuine regression and writes an entry that is *perfectly* formed — real anchors,\na real failing suite, an honest note that nothing was consulted beyond the failure\nitself, high stated confidence. Every anchoring rule this skill teaches is satisfied.\nThe conclusion is worthless. Anchoring proves a decision happened; it says nothing\nabout whether the premise it rested on was true, and a well-anchored entry built on a\nfalse premise is more dangerous than an unanchored one, because it reads as verified.\n\nAn `environment` anchor is what makes that premise checkable after the fact. Capture\none, and a decision can point at the toolchain it actually ran under:\n\n```bash\nagent-journal observe --workspace decay-demo --kind environment --id obs-node-pin \\\n  --interpreter /opt/build/bin/node --version v18.20.4\n```\n\n```\nobserved obs-node-pin\n```\n\n`observe` takes `--id` the same way `record` does — passed here so this example needs\nno id copied out of the previous command's output. Omit it in practice and `observe`\ngenerates one, printed the same way.\n\n```bash\nagent-journal record --workspace decay-demo --kind decision --id d-node-pin \\\n  --question \"which interpreter must the suite run under?\" \\\n  --chosen \"the version pinned in package.json engines\" \\\n  --anchor environment:obs-node-pin\n```\n\n`decay` compares that observation's `interpreter` and `version` against the machine\n`decay` itself is running on right now:\n\n```bash\nagent-journal decay --workspace decay-demo\n```\n\n```json\n{ \"entryId\": \"d-node-pin\", \"type\": \"environment\",\n  \"ref\": \"obs-node-pin\",\n  \"status\": \"drifted\",\n  \"detail\": \"environment drifted: recorded /opt/build/bin/node@v18.20.4, now /[REDACTED]/.local/share/node/bin/node@v26.7.0\" }\n```\n\n(The live interpreter path is redacted before it ever reaches stdout — the same\nmachine-identifying-path rule spec §4.3 requires for a *stored* environment\nobservation applies here to a freshly captured one, since this is the one place a raw\n`process.execPath` could otherwise leak straight into a report.)\n\n**This is `drifted`, deliberately never `failing`.** A moved *source* is broken — a\ndeleted file, a closed ticket, a superseded entry. A moved *environment* may simply be\na different machine: a laptop instead of CI, a container instead of bare metal, a\nnewer patch release nobody needs to worry about. Collapsing the two would train people\nto ignore the flag exactly the way §10.1 already warns against for a `living` source\nflagged on every save — except here what would get trained away is the one check this\nwhole plan was built to have. `drifted` is surfaced for a human to judge, never\nauto-invalidated: it says *the ground under this entry has moved, go look*, not *this\nentry is wrong*.\n\nA structurally broken anchor — no observation matching the ref, because it was never\nrecorded or was mistyped — is `failing`, not `drifted`. That is a dead citation, the\nsame class of problem a broken `journal` or `tool_result` reference is, and belongs\nwith those, not with a legitimate machine difference.\n\n**The comparison is narrower than the whole `Environment` shape.** Only `interpreter`\nand `version` are compared. `platform`, `packageManager` and `flags` can all differ\nbetween the recorded observation and the machine running `decay` without ever\nproducing a `drifted` finding — those fields are captured and stored, but this check\ndoes not read them. A `container` field or a CI-runner label changing is invisible to\nthis specific check.\n\n## Nothing is auto-resolved\n\nA `failing` finding does not invalidate the entry that cited the broken source. A\n`drifted` finding does not mark anything wrong. Spec §10.1, verbatim: *a decision does\nnot become wrong because a source moved.* `decay` reports; a human, or\n[`agent-journal invalidate`](../SKILL.md#5-retract-what-turns-out-to-be-wrong), acts.\n\nOne report shows the whole shape at once — a broken citation, a deferred type on every\nrow, a genuine drift, and two passing codebase refs, side by side, one exit code:\n\n```bash\nagent-journal record --workspace decay-demo --kind finding --id f-cites-ghost \\\n  --claim \"the interpreter pin still matches production\" \\\n  --influence journal:decisive:d-does-not-exist\nagent-journal decay --workspace decay-demo --repo .\n```\n\n```json\n{\n  \"findings\": [\n    { \"entryId\": \"d-decay-check\", \"type\": \"codebase\", \"status\": \"passing\", \"...\": \"…\" },\n    { \"entryId\": \"d-decay-check\", \"type\": \"codebase\", \"status\": \"passing\", \"...\": \"…\" },\n    { \"entryId\": \"d-node-pin\", \"type\": \"environment\", \"status\": \"drifted\", \"...\": \"…\" },\n    { \"entryId\": \"f-cites-ghost\", \"type\": \"journal\", \"ref\": \"d-does-not-exist\",\n      \"status\": \"failing\", \"detail\": \"cited entry \\\"d-does-not-exist\\\" is not present in this journal\" }\n  ],\n  \"checked\": 3, \"notCheckable\": 0, \"notImplemented\": 0, \"drifted\": 1\n}\n```\n\nExit code `0`. Nothing here blocked the write above it, and nothing here will block\nthe next one — `decay` is a report to read, not a gate.\n\n(`record` gives one warning earlier and independently of `decay`: citing a `journal`\ninfluence or a retraction edge whose id is not yet in the workspace prints\n`WARNING: no entry with id … is present in this workspace` to stderr at write time,\nexit 0. It is not refused, because across replicas the target can legitimately arrive\nlater. `decay`, run afterward, is what catches the same break once enough time has\npassed that \"not yet synced\" is no longer the likely explanation.)\n\n## Deferred, and why — not a property of the source\n\n`checked` (`passing` + `failing`) plus `notCheckable` plus `notImplemented` plus\n`drifted` account for every finding; each finding lands in exactly one of the four\ncounters, never zero and never two:\n\n```bash\nagent-journal record --workspace decay-demo --kind decision --id d-deferred-sources \\\n  --question \"which sources back this decision?\" \\\n  --chosen \"a mix, and the record says which kind each one is\" \\\n  --influence url:supporting:https://example.com/bench \\\n  --influence ticket:supporting:JIRA-1102 \\\n  --influence document:supporting:design-doc-v3 \\\n  --influence person:considered:reviewer \\\n  --influence model_knowledge:decisive \\\n  --influence conversation:considered:standup-2026-09-01\nagent-journal decay --workspace decay-demo\n```\n\n| Influence type | Status | Why |\n| --- | --- | --- |\n| `url` | `not-implemented` | Checking it means fetching it — network egress this release does not perform. |\n| `ticket` | `not-implemented` | Checking it means calling a tracker's API — a credential this release does not hold. |\n| `document` | `not-implemented` | There is no ref convention yet for what a \"document\" points at or how to resolve it. |\n| `person` | `not-checkable` | Nothing can re-interview a person. This is permanent, not a future release. |\n| `model_knowledge` | `not-checkable` | There is nothing to point at — that is the claim it makes. Permanent. |\n\n### `premise[]` is deferred too\n\n§10.1 conditions the premise re-check on a `finding` declaring `premise[]` **and** an\nenvironment anchor. Only the environment half ships. A `finding` whose premises are now\nplainly false, but whose interpreter has not moved, reports clean — because nothing\nreads `premise[]` at all.\n\nThis is named here rather than left silent for the same reason `visual` and `living`\nare: a gap a reader can see is a gap they can work around. Re-checking a premise means\nre-running the reasoning that produced it, and this release does not attempt that.\nEnvironment drift is the one premise check that can be made deterministic, which is why\nit is the one that shipped.\n| `conversation` | `not-checkable` | This journal does not keep transcripts to re-check against. Permanent. |\n\nThe line that matters: `url`, `ticket` and `document` are **`not-implemented`** — a\nproperty of *this release*, and a future one could add a checker for any of them.\n`person`, `model_knowledge` and `conversation` are **`not-checkable`** — a property of\n*the source itself*, and no future checker changes that. Confusing \"we haven't built\nit yet\" with \"it cannot be built\" understates the first and overstates the second.\n\nTwo more things named in the spec are deferred for reasons worth stating rather than\nleaving as a silent gap:\n\n- **`visual` anchors are not decay-checked at all**, for the same reason listed under\n  \"What decay actually looks at\" above — nothing in this release even attempts it —\n  and separately, nothing in this release *writes* one either. §10.1 describes\n  comparing a design file's version id at decision-relevant granularity; no adapter or\n  command here produces that observation yet, so there is nothing to compare even in\n  principle.\n- **`living` does not exist as a flag in this release.** Spec §10.1 describes marking a\n  source `living` to exempt it from content-hash rot — a design file changes on every\n  save, and flagging that daily trains people to ignore rot flags entirely. But no\n  content-hash rot check ships here at all; `codebase`'s check is existence and a text\n  scan, never a hash. A `living` flag would have nothing to suppress. Adding one now\n  would be a flag whose only stored effect is to be stored — worse than not having it,\n  because it would look like it did something.\n","bodyHtml":"<h2 id=\"decay-checking-a-journal-against-the-world-it-described\">Decay: checking a journal against the world it described</h2>\n<p>An entry does not stay true because it was true once. The file it cites gets deleted.\nThe ticket it cites gets closed. The interpreter it ran under is not the one on <code>PATH</code>\ntoday. <code>decay</code> is the command that asks, of everything already in the journal, <em>does\nthe world still look like this said it did</em> — and reports what it finds without acting\non any of it.</p>\n<p><a href=\"anchors.md\">references/anchors.md</a> introduces the distinction between <strong>rot</strong> (did a\nsource move or die) and <strong>premise</strong> (was the reasoning ever sound) in brief. This\ndocument is the full reference: every status <code>decay</code> can report, exactly what it does\nand does not look at, and the two limits worth knowing before you trust its output.</p>\n<h3 id=\"running-it\">Running it</h3>\n<pre><code class=\"language-bash\">agent-journal decay --workspace &lt;id&gt; [--repo &lt;path&gt;]\n</code></pre>\n<p><code>--repo</code> is the only thing beyond <code>--workspace</code>, and it is optional — see &quot;The\n<code>codebase</code> ref convention&quot; below for what omitting it means. Like every other command\nhere, an unrecognised flag is refused rather than silently ignored.</p>\n<p><code>decay</code> exits 0 whenever the journal itself could read cleanly, <strong>regardless of what\nthe findings say</strong> — a report full of <code>failing</code> entries exits the same as a report\nfull of <code>passing</code> ones. That is not an oversight; see &quot;Nothing is auto-resolved&quot; below.\nExit 1 means the journal was damaged (unreadable segments, malformed lines), the same\nfloor-not-total warning <code>coverage</code>, <code>show</code> and <code>trace</code> already give — and is unrelated\nto any individual finding&#39;s status.</p>\n<h3 id=\"five-statuses-and-what-each-one-commits-to\">Five statuses, and what each one commits to</h3>\n<table>\n<thead>\n<tr>\n<th>Status</th>\n<th>Says</th>\n<th>Never means</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>passing</code></td>\n<td>Checked. The source still holds.</td>\n<td>—</td>\n</tr>\n<tr>\n<td><code>failing</code></td>\n<td>Checked. The source no longer holds, or the citation was broken to begin with.</td>\n<td>&quot;It probably still holds&quot;</td>\n</tr>\n<tr>\n<td><code>drifted</code></td>\n<td>Checked. It differs — but the difference is a question for a human, not a verdict.</td>\n<td>&quot;It is wrong&quot;</td>\n</tr>\n<tr>\n<td><code>not-checkable</code></td>\n<td>Nothing could ever check this, or the tools to check it were not supplied for this run.</td>\n<td>&quot;It is fine&quot;</td>\n</tr>\n<tr>\n<td><code>not-implemented</code></td>\n<td>A checker could exist for this. This release does not ship one.</td>\n<td>&quot;It is fine&quot;, or &quot;it can never be checked&quot;</td>\n</tr>\n</tbody></table>\n<p>The two that get confused are <code>not-checkable</code> and <code>passing</code>. They must never collapse\ninto each other — a <code>person</code> influence that comes back anything other than\n<code>not-checkable</code> is a bug, because nothing in this tool can re-interview a person. Read\n<code>not-checkable</code> as <em>silence</em>, not as <em>clean</em>.</p>\n<p>The other confusable pair is <code>drifted</code> and <code>failing</code>, and the difference is deliberate\nrather than cosmetic — see &quot;Environment drift&quot; below for why it exists as a fifth\nstatus instead of folding into <code>failing</code>.</p>\n<h3 id=\"what-decay-actually-looks-at\">What decay actually looks at</h3>\n<p>Two things, and only two:</p>\n<ul>\n<li>Every live entry&#39;s <code>influences</code> — the nine types in\n<a href=\"anchors.md#anchors-versus-influences\">references/anchors.md</a>: <code>journal</code>,\n<code>tool_result</code>, <code>codebase</code>, <code>url</code>, <code>ticket</code>, <code>document</code>, <code>person</code>, <code>model_knowledge</code>,\n<code>conversation</code>.</li>\n<li><code>environment</code>-class anchors specifically.</li>\n</ul>\n<p><strong>Every other anchor class is not decay-checked in this release.</strong> <code>commit</code>, <code>file</code>,\n<code>visual</code>, <code>runtime</code>, <code>tool_use</code>, <code>message</code>, <code>url</code> and <code>external</code> anchors produce no\nfinding at all — not <code>not-checkable</code>, not anything. Citing one is still valuable (it is\nwhat <a href=\"anchors.md\">references/anchors.md</a> is about), but <code>decay</code> has nothing to say\nabout it. Do not read a clean decay report as &quot;every anchor on this entry was\nverified&quot;; read it as &quot;every influence, and any <code>environment</code> anchor, was verified.&quot;</p>\n<h4 id=\"what-journal-and-tool_result-each-verify\">What <code>journal</code> and <code>tool_result</code> each verify</h4>\n<p>Both resolve their <code>ref</code> inside this journal, and both check the <strong>kind</strong> of what they\nfind, because a citation that points the wrong way is a defect in the entry rather\nthan decay in a source:</p>\n<ul>\n<li><strong><code>journal</code></strong> — the ref must name an <em>entry</em>, and that entry must still be live. It\nreports <code>failing</code> if the entry is absent, superseded, invalidated, a <code>void</code>, or an\nobservation (cite an observation as <code>tool_result</code> instead).</li>\n<li><strong><code>tool_result</code></strong> — the ref must name an <em>observation</em>, and this is a <strong>presence\ncheck only</strong>. It confirms the observation is still in the journal. It does <strong>not</strong>\nconfirm that what the tool reported then is still true now. A <code>tool_result</code> reading\n<code>passing</code> means &quot;that row is still there&quot;, never &quot;that command would still print\nthis&quot;. Nothing in this release re-runs anything.</li>\n</ul>\n<p>Citing a <code>void</code> fails on both. A <code>void</code> is the journal&#39;s own record that a write was\n<em>refused</em> — reading it as a surviving source would say &quot;your evidence still holds&quot;\nabout a row whose entire content is that nothing was written.</p>\n<p>An entry that was itself directly superseded or invalidated is skipped — its own\nsources stopped mattering the moment it stopped counting. An entry that merely <em>cites</em>\na casualty through a <code>journal</code> influence is not skipped: that citation is exactly what\nreports <code>failing</code>, which is how a reader learns the entry&#39;s reasoning now rests on\nsomething withdrawn.</p>\n<h3 id=\"the-codebase-ref-convention-and-its-honest-limit\">The <code>codebase</code> ref convention, and its honest limit</h3>\n<p>A <code>codebase</code> influence&#39;s ref is either a bare path or <code>path:symbolName</code>:</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace decay-demo --kind decision --id d-decay-check \\\n  --question &quot;how does decay check a codebase influence?&quot; \\\n  --chosen &quot;existence, plus a text-contains scan for a named symbol&quot; \\\n  --influence codebase:decisive:packages/agent-journal/src/decay.ts \\\n  --influence codebase:supporting:packages/agent-journal/src/decay.ts:computeDecay\n</code></pre>\n<p><code>packages/agent-journal/src/decay.ts</code> alone checks that the file exists.\n<code>packages/agent-journal/src/decay.ts:computeDecay</code> additionally requires the text\n<code>computeDecay</code> to appear somewhere in that file.</p>\n<p><strong>That second check is a grep, not a parse.</strong> It catches a deleted file. It catches a\nrenamed or removed symbol — <code>computeDecay</code> gone from the text reports <code>failing</code>. It\ndoes <strong>not</strong> catch a symbol that kept its name and changed what it does. If\n<code>computeDecay</code>&#39;s signature or behaviour changed while the identifier stayed exactly as\nit is, this check has no way to know, and the finding would still read <code>passing</code>. A\n<code>passing</code> <code>codebase</code> finding means <em>the name is still there</em>, never <em>the code still\nmeans what the entry said it meant</em>. Overclaiming here — parsing every language a\njournal might cite, understanding renames, tracking behaviour — is not a thing this\nrelease attempts, and the reference says so rather than implying otherwise.</p>\n<p><code>--repo</code> is what makes any of this checkable at all, and it defaults to nothing:</p>\n<pre><code class=\"language-bash\">agent-journal decay --workspace decay-demo\n</code></pre>\n<pre><code class=\"language-json\">{\n  &quot;findings&quot;: [\n    { &quot;entryId&quot;: &quot;d-decay-check&quot;, &quot;type&quot;: &quot;codebase&quot;,\n      &quot;ref&quot;: &quot;packages/agent-journal/src/decay.ts&quot;,\n      &quot;status&quot;: &quot;not-checkable&quot;, &quot;detail&quot;: &quot;no codebase index was provided for this run&quot; },\n    { &quot;entryId&quot;: &quot;d-decay-check&quot;, &quot;type&quot;: &quot;codebase&quot;,\n      &quot;ref&quot;: &quot;packages/agent-journal/src/decay.ts:computeDecay&quot;,\n      &quot;status&quot;: &quot;not-checkable&quot;, &quot;detail&quot;: &quot;no codebase index was provided for this run&quot; }\n  ],\n  &quot;checked&quot;: 0, &quot;notCheckable&quot;: 2, &quot;notImplemented&quot;: 0, &quot;drifted&quot;: 0\n}\n</code></pre>\n<p>That is deliberate, not a missing default. Silently scanning whatever directory the\ncaller happens to be standing in is a surprise; <code>not-checkable</code> is the honest status\nfor &quot;nobody told this run where to look.&quot; Point it at a checkout and the same refs\nresolve — run from the root of this repository, <code>--repo .</code> names it:</p>\n<pre><code class=\"language-bash\">agent-journal decay --workspace decay-demo --repo .\n</code></pre>\n<pre><code class=\"language-json\">{\n  &quot;findings&quot;: [\n    { &quot;entryId&quot;: &quot;d-decay-check&quot;, &quot;type&quot;: &quot;codebase&quot;,\n      &quot;ref&quot;: &quot;packages/agent-journal/src/decay.ts&quot;,\n      &quot;status&quot;: &quot;passing&quot;, &quot;detail&quot;: &quot;\\&quot;packages/agent-journal/src/decay.ts\\&quot; is present in the codebase&quot; },\n    { &quot;entryId&quot;: &quot;d-decay-check&quot;, &quot;type&quot;: &quot;codebase&quot;,\n      &quot;ref&quot;: &quot;packages/agent-journal/src/decay.ts:computeDecay&quot;,\n      &quot;status&quot;: &quot;passing&quot;, &quot;detail&quot;: &quot;\\&quot;packages/agent-journal/src/decay.ts:computeDecay\\&quot; is present in the codebase&quot; }\n  ],\n  &quot;checked&quot;: 2, &quot;notCheckable&quot;: 0, &quot;notImplemented&quot;: 0, &quot;drifted&quot;: 0\n}\n</code></pre>\n<p><code>--repo</code> is not remembered between runs — omit it on the next invocation and these two\nfindings go back to <code>not-checkable</code>, not to whatever they were last time. A ref that\nresolves outside <code>--repo</code> (by <code>..</code>, a symlink, or an absolute path pointing elsewhere)\nis refused the same way: omitted from what gets checked, reported <code>not-checkable</code>\nrather than guessed at either direction.</p>\n<h3 id=\"environment-drift-why-this-check-exists-at-all\">Environment drift: why this check exists at all</h3>\n<p>This is not a feature that happened to get added. It is the reason the plan exists.</p>\n<p>The design&#39;s canonical failure looks like this: a session runs against the wrong\ninterpreter on <code>PATH</code>. Tests fail for environmental reasons. An agent investigates them\nas a genuine regression and writes an entry that is <em>perfectly</em> formed — real anchors,\na real failing suite, an honest note that nothing was consulted beyond the failure\nitself, high stated confidence. Every anchoring rule this skill teaches is satisfied.\nThe conclusion is worthless. Anchoring proves a decision happened; it says nothing\nabout whether the premise it rested on was true, and a well-anchored entry built on a\nfalse premise is more dangerous than an unanchored one, because it reads as verified.</p>\n<p>An <code>environment</code> anchor is what makes that premise checkable after the fact. Capture\none, and a decision can point at the toolchain it actually ran under:</p>\n<pre><code class=\"language-bash\">agent-journal observe --workspace decay-demo --kind environment --id obs-node-pin \\\n  --interpreter /opt/build/bin/node --version v18.20.4\n</code></pre>\n<pre><code>observed obs-node-pin\n</code></pre>\n<p><code>observe</code> takes <code>--id</code> the same way <code>record</code> does — passed here so this example needs\nno id copied out of the previous command&#39;s output. Omit it in practice and <code>observe</code>\ngenerates one, printed the same way.</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace decay-demo --kind decision --id d-node-pin \\\n  --question &quot;which interpreter must the suite run under?&quot; \\\n  --chosen &quot;the version pinned in package.json engines&quot; \\\n  --anchor environment:obs-node-pin\n</code></pre>\n<p><code>decay</code> compares that observation&#39;s <code>interpreter</code> and <code>version</code> against the machine\n<code>decay</code> itself is running on right now:</p>\n<pre><code class=\"language-bash\">agent-journal decay --workspace decay-demo\n</code></pre>\n<pre><code class=\"language-json\">{ &quot;entryId&quot;: &quot;d-node-pin&quot;, &quot;type&quot;: &quot;environment&quot;,\n  &quot;ref&quot;: &quot;obs-node-pin&quot;,\n  &quot;status&quot;: &quot;drifted&quot;,\n  &quot;detail&quot;: &quot;environment drifted: recorded /opt/build/bin/node@v18.20.4, now /[REDACTED]/.local/share/node/bin/node@v26.7.0&quot; }\n</code></pre>\n<p>(The live interpreter path is redacted before it ever reaches stdout — the same\nmachine-identifying-path rule spec §4.3 requires for a <em>stored</em> environment\nobservation applies here to a freshly captured one, since this is the one place a raw\n<code>process.execPath</code> could otherwise leak straight into a report.)</p>\n<p><strong>This is <code>drifted</code>, deliberately never <code>failing</code>.</strong> A moved <em>source</em> is broken — a\ndeleted file, a closed ticket, a superseded entry. A moved <em>environment</em> may simply be\na different machine: a laptop instead of CI, a container instead of bare metal, a\nnewer patch release nobody needs to worry about. Collapsing the two would train people\nto ignore the flag exactly the way §10.1 already warns against for a <code>living</code> source\nflagged on every save — except here what would get trained away is the one check this\nwhole plan was built to have. <code>drifted</code> is surfaced for a human to judge, never\nauto-invalidated: it says <em>the ground under this entry has moved, go look</em>, not <em>this\nentry is wrong</em>.</p>\n<p>A structurally broken anchor — no observation matching the ref, because it was never\nrecorded or was mistyped — is <code>failing</code>, not <code>drifted</code>. That is a dead citation, the\nsame class of problem a broken <code>journal</code> or <code>tool_result</code> reference is, and belongs\nwith those, not with a legitimate machine difference.</p>\n<p><strong>The comparison is narrower than the whole <code>Environment</code> shape.</strong> Only <code>interpreter</code>\nand <code>version</code> are compared. <code>platform</code>, <code>packageManager</code> and <code>flags</code> can all differ\nbetween the recorded observation and the machine running <code>decay</code> without ever\nproducing a <code>drifted</code> finding — those fields are captured and stored, but this check\ndoes not read them. A <code>container</code> field or a CI-runner label changing is invisible to\nthis specific check.</p>\n<h3 id=\"nothing-is-auto-resolved\">Nothing is auto-resolved</h3>\n<p>A <code>failing</code> finding does not invalidate the entry that cited the broken source. A\n<code>drifted</code> finding does not mark anything wrong. Spec §10.1, verbatim: <em>a decision does\nnot become wrong because a source moved.</em> <code>decay</code> reports; a human, or\n<a href=\"../SKILL.md#5-retract-what-turns-out-to-be-wrong\"><code>agent-journal invalidate</code></a>, acts.</p>\n<p>One report shows the whole shape at once — a broken citation, a deferred type on every\nrow, a genuine drift, and two passing codebase refs, side by side, one exit code:</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace decay-demo --kind finding --id f-cites-ghost \\\n  --claim &quot;the interpreter pin still matches production&quot; \\\n  --influence journal:decisive:d-does-not-exist\nagent-journal decay --workspace decay-demo --repo .\n</code></pre>\n<pre><code class=\"language-json\">{\n  &quot;findings&quot;: [\n    { &quot;entryId&quot;: &quot;d-decay-check&quot;, &quot;type&quot;: &quot;codebase&quot;, &quot;status&quot;: &quot;passing&quot;, &quot;...&quot;: &quot;…&quot; },\n    { &quot;entryId&quot;: &quot;d-decay-check&quot;, &quot;type&quot;: &quot;codebase&quot;, &quot;status&quot;: &quot;passing&quot;, &quot;...&quot;: &quot;…&quot; },\n    { &quot;entryId&quot;: &quot;d-node-pin&quot;, &quot;type&quot;: &quot;environment&quot;, &quot;status&quot;: &quot;drifted&quot;, &quot;...&quot;: &quot;…&quot; },\n    { &quot;entryId&quot;: &quot;f-cites-ghost&quot;, &quot;type&quot;: &quot;journal&quot;, &quot;ref&quot;: &quot;d-does-not-exist&quot;,\n      &quot;status&quot;: &quot;failing&quot;, &quot;detail&quot;: &quot;cited entry \\&quot;d-does-not-exist\\&quot; is not present in this journal&quot; }\n  ],\n  &quot;checked&quot;: 3, &quot;notCheckable&quot;: 0, &quot;notImplemented&quot;: 0, &quot;drifted&quot;: 1\n}\n</code></pre>\n<p>Exit code <code>0</code>. Nothing here blocked the write above it, and nothing here will block\nthe next one — <code>decay</code> is a report to read, not a gate.</p>\n<p>(<code>record</code> gives one warning earlier and independently of <code>decay</code>: citing a <code>journal</code>\ninfluence or a retraction edge whose id is not yet in the workspace prints\n<code>WARNING: no entry with id … is present in this workspace</code> to stderr at write time,\nexit 0. It is not refused, because across replicas the target can legitimately arrive\nlater. <code>decay</code>, run afterward, is what catches the same break once enough time has\npassed that &quot;not yet synced&quot; is no longer the likely explanation.)</p>\n<h3 id=\"deferred-and-why-not-a-property-of-the-source\">Deferred, and why — not a property of the source</h3>\n<p><code>checked</code> (<code>passing</code> + <code>failing</code>) plus <code>notCheckable</code> plus <code>notImplemented</code> plus\n<code>drifted</code> account for every finding; each finding lands in exactly one of the four\ncounters, never zero and never two:</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace decay-demo --kind decision --id d-deferred-sources \\\n  --question &quot;which sources back this decision?&quot; \\\n  --chosen &quot;a mix, and the record says which kind each one is&quot; \\\n  --influence url:supporting:https://example.com/bench \\\n  --influence ticket:supporting:JIRA-1102 \\\n  --influence document:supporting:design-doc-v3 \\\n  --influence person:considered:reviewer \\\n  --influence model_knowledge:decisive \\\n  --influence conversation:considered:standup-2026-09-01\nagent-journal decay --workspace decay-demo\n</code></pre>\n<table>\n<thead>\n<tr>\n<th>Influence type</th>\n<th>Status</th>\n<th>Why</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>url</code></td>\n<td><code>not-implemented</code></td>\n<td>Checking it means fetching it — network egress this release does not perform.</td>\n</tr>\n<tr>\n<td><code>ticket</code></td>\n<td><code>not-implemented</code></td>\n<td>Checking it means calling a tracker&#39;s API — a credential this release does not hold.</td>\n</tr>\n<tr>\n<td><code>document</code></td>\n<td><code>not-implemented</code></td>\n<td>There is no ref convention yet for what a &quot;document&quot; points at or how to resolve it.</td>\n</tr>\n<tr>\n<td><code>person</code></td>\n<td><code>not-checkable</code></td>\n<td>Nothing can re-interview a person. This is permanent, not a future release.</td>\n</tr>\n<tr>\n<td><code>model_knowledge</code></td>\n<td><code>not-checkable</code></td>\n<td>There is nothing to point at — that is the claim it makes. Permanent.</td>\n</tr>\n</tbody></table>\n<h4 id=\"premise-is-deferred-too\"><code>premise[]</code> is deferred too</h4>\n<p>§10.1 conditions the premise re-check on a <code>finding</code> declaring <code>premise[]</code> <strong>and</strong> an\nenvironment anchor. Only the environment half ships. A <code>finding</code> whose premises are now\nplainly false, but whose interpreter has not moved, reports clean — because nothing\nreads <code>premise[]</code> at all.</p>\n<p>This is named here rather than left silent for the same reason <code>visual</code> and <code>living</code>\nare: a gap a reader can see is a gap they can work around. Re-checking a premise means\nre-running the reasoning that produced it, and this release does not attempt that.\nEnvironment drift is the one premise check that can be made deterministic, which is why\nit is the one that shipped.\n| <code>conversation</code> | <code>not-checkable</code> | This journal does not keep transcripts to re-check against. Permanent. |</p>\n<p>The line that matters: <code>url</code>, <code>ticket</code> and <code>document</code> are <strong><code>not-implemented</code></strong> — a\nproperty of <em>this release</em>, and a future one could add a checker for any of them.\n<code>person</code>, <code>model_knowledge</code> and <code>conversation</code> are <strong><code>not-checkable</code></strong> — a property of\n<em>the source itself</em>, and no future checker changes that. Confusing &quot;we haven&#39;t built\nit yet&quot; with &quot;it cannot be built&quot; understates the first and overstates the second.</p>\n<p>Two more things named in the spec are deferred for reasons worth stating rather than\nleaving as a silent gap:</p>\n<ul>\n<li><strong><code>visual</code> anchors are not decay-checked at all</strong>, for the same reason listed under\n&quot;What decay actually looks at&quot; above — nothing in this release even attempts it —\nand separately, nothing in this release <em>writes</em> one either. §10.1 describes\ncomparing a design file&#39;s version id at decision-relevant granularity; no adapter or\ncommand here produces that observation yet, so there is nothing to compare even in\nprinciple.</li>\n<li><strong><code>living</code> does not exist as a flag in this release.</strong> Spec §10.1 describes marking a\nsource <code>living</code> to exempt it from content-hash rot — a design file changes on every\nsave, and flagging that daily trains people to ignore rot flags entirely. But no\ncontent-hash rot check ships here at all; <code>codebase</code>&#39;s check is existence and a text\nscan, never a hash. A <code>living</code> flag would have nothing to suppress. Adding one now\nwould be a flag whose only stored effect is to be stored — worse than not having it,\nbecause it would look like it did something.</li>\n</ul>\n","words":2702},{"path":"references/degraded-modes.md","slug":"degraded-modes","title":"Degraded modes","body":"# Degraded modes\n\nThe journal works in environments that cannot support all of it. What matters is that it\nsays which one it is in, rather than producing output that looks identical either way.\n\n## What each environment actually gives you\n\n| Environment | Filesystem | Hooks | MCP |\n| --- | --- | --- | --- |\n| Claude Code, Codex, Cursor, Gemini (local) | yes | yes | yes |\n| Claude Code cloud / web | ephemeral | repo and org settings only | yes |\n| Managed agents | persistent | no | yes |\n| Cowork | **no** | no | yes |\n| ChatGPT Work / agent mode | ephemeral terminal only | no | yes |\n\n**The universal denominator is MCP — not the filesystem, and not hooks.** That is why\nthe write path is a sink interface rather than a file API: the CLI is one transport, not\nthe architecture.\n\n## The ladder\n\nEach rung records which one produced an event, so a reader can weigh it.\n\n**1. Filesystem and CLI.** Full fidelity, offline, cheapest. Hooks capture actions\nautomatically; the agent records entries through the same validated path.\n\n**2. Filesystem, no CLI.** Append JSONL directly. Entries are flagged unvalidated and a\nlater normalise pass repairs them. Schema conformance is on the honour system of the\nentity being audited, which is exactly the weakness the CLI exists to remove — so treat\nthis as a bridge, not a destination.\n\n**3. No filesystem.** An HTTP or MCP sink, same envelope. This is the only option in\nCowork and ChatGPT Work.\n\n**4. Nothing at all.** The agent emits entries as marked structured blocks **into its own\ntranscript**, harvested later from anywhere with storage.\n\nRung 4 is worth taking seriously rather than treating as a joke. Every hosted product\nretains conversation history, so the transcript *is* durable storage — it is simply not\n*queryable* storage. Emitting in a machine-parseable form now means the reasoning can be\nharvested into a real journal whenever that conversation is next touched from somewhere\nwith a filesystem.\n\nThe practical consequence: the skill degrades to \"still records decisions\" rather than\n\"does nothing\", even in a bare chat with no tools.\n\n## The honesty rule\n\nEvery rung below the first weakens what the record can claim, and the record must say so.\n\n- On rung 2, entries are unvalidated. A later reader must be able to tell.\n- On rung 3, the sink is remote. Whoever runs it can see the candid plane.\n- On rung 4, **the agent authors both the actions and the reasoning**. The separation\n  that makes the first rung trustworthy — evidence the agent does not write — does not\n  exist. An entry from rung 4 is a claim, not a record, and should read as one.\n\n## Without version control\n\nNot a degraded mode so much as a different set of anchors. A design, ops or research\ncontext has no commits and no diffs, and the journal still works — it proves *the agent\nread X and then chose Y* rather than *the code changed this way*.\n\nTwo things follow:\n\n- **Declare which anchor classes are available.** Preserve \"unknown\" rather than\n  inferring optimistic defaults. A context that cannot produce a commit anchor must not\n  render as though it checked and found none.\n- **Renderers must degrade out loud.** A weaker claim presented in the same voice as a\n  strong one is the failure this whole design exists to prevent.\n\n## Without hooks\n\nWhere the harness exposes no hook system, nothing captures actions automatically, so\nthere is no evidence plane the agent did not author.\n\nRecord entries anyway — the reasoning is still worth keeping — but understand what\nchanged: anchoring now rests on the agent's own account of what it did. Prefer anchors\nthat are checkable after the fact regardless of who wrote them, such as a commit or a\nfile hash, over ones that are not, such as a tool call nobody else observed.\n\n## Reading a journal that used several rungs\n\nA long-lived workspace will contain entries from more than one. The coverage report is\nwhere that becomes legible: it names sessions that recorded nothing, refused writes,\nsequence gaps, paths it could not read, lines that did not parse, and — importantly —\nreturns `null` rather than an empty array for anything it never assessed.\n\nThe distinction is not pedantry. `[]` means looked and found nothing. `null` means never\nlooked. Rendering the second as the first turns an unexamined gap into a clean bill of\nhealth, which is the precise dishonesty the report exists to prevent.\n","bodyHtml":"<h2 id=\"degraded-modes\">Degraded modes</h2>\n<p>The journal works in environments that cannot support all of it. What matters is that it\nsays which one it is in, rather than producing output that looks identical either way.</p>\n<h3 id=\"what-each-environment-actually-gives-you\">What each environment actually gives you</h3>\n<table>\n<thead>\n<tr>\n<th>Environment</th>\n<th>Filesystem</th>\n<th>Hooks</th>\n<th>MCP</th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Claude Code, Codex, Cursor, Gemini (local)</td>\n<td>yes</td>\n<td>yes</td>\n<td>yes</td>\n</tr>\n<tr>\n<td>Claude Code cloud / web</td>\n<td>ephemeral</td>\n<td>repo and org settings only</td>\n<td>yes</td>\n</tr>\n<tr>\n<td>Managed agents</td>\n<td>persistent</td>\n<td>no</td>\n<td>yes</td>\n</tr>\n<tr>\n<td>Cowork</td>\n<td><strong>no</strong></td>\n<td>no</td>\n<td>yes</td>\n</tr>\n<tr>\n<td>ChatGPT Work / agent mode</td>\n<td>ephemeral terminal only</td>\n<td>no</td>\n<td>yes</td>\n</tr>\n</tbody></table>\n<p><strong>The universal denominator is MCP — not the filesystem, and not hooks.</strong> That is why\nthe write path is a sink interface rather than a file API: the CLI is one transport, not\nthe architecture.</p>\n<h3 id=\"the-ladder\">The ladder</h3>\n<p>Each rung records which one produced an event, so a reader can weigh it.</p>\n<p><strong>1. Filesystem and CLI.</strong> Full fidelity, offline, cheapest. Hooks capture actions\nautomatically; the agent records entries through the same validated path.</p>\n<p><strong>2. Filesystem, no CLI.</strong> Append JSONL directly. Entries are flagged unvalidated and a\nlater normalise pass repairs them. Schema conformance is on the honour system of the\nentity being audited, which is exactly the weakness the CLI exists to remove — so treat\nthis as a bridge, not a destination.</p>\n<p><strong>3. No filesystem.</strong> An HTTP or MCP sink, same envelope. This is the only option in\nCowork and ChatGPT Work.</p>\n<p><strong>4. Nothing at all.</strong> The agent emits entries as marked structured blocks <strong>into its own\ntranscript</strong>, harvested later from anywhere with storage.</p>\n<p>Rung 4 is worth taking seriously rather than treating as a joke. Every hosted product\nretains conversation history, so the transcript <em>is</em> durable storage — it is simply not\n<em>queryable</em> storage. Emitting in a machine-parseable form now means the reasoning can be\nharvested into a real journal whenever that conversation is next touched from somewhere\nwith a filesystem.</p>\n<p>The practical consequence: the skill degrades to &quot;still records decisions&quot; rather than\n&quot;does nothing&quot;, even in a bare chat with no tools.</p>\n<h3 id=\"the-honesty-rule\">The honesty rule</h3>\n<p>Every rung below the first weakens what the record can claim, and the record must say so.</p>\n<ul>\n<li>On rung 2, entries are unvalidated. A later reader must be able to tell.</li>\n<li>On rung 3, the sink is remote. Whoever runs it can see the candid plane.</li>\n<li>On rung 4, <strong>the agent authors both the actions and the reasoning</strong>. The separation\nthat makes the first rung trustworthy — evidence the agent does not write — does not\nexist. An entry from rung 4 is a claim, not a record, and should read as one.</li>\n</ul>\n<h3 id=\"without-version-control\">Without version control</h3>\n<p>Not a degraded mode so much as a different set of anchors. A design, ops or research\ncontext has no commits and no diffs, and the journal still works — it proves <em>the agent\nread X and then chose Y</em> rather than <em>the code changed this way</em>.</p>\n<p>Two things follow:</p>\n<ul>\n<li><strong>Declare which anchor classes are available.</strong> Preserve &quot;unknown&quot; rather than\ninferring optimistic defaults. A context that cannot produce a commit anchor must not\nrender as though it checked and found none.</li>\n<li><strong>Renderers must degrade out loud.</strong> A weaker claim presented in the same voice as a\nstrong one is the failure this whole design exists to prevent.</li>\n</ul>\n<h3 id=\"without-hooks\">Without hooks</h3>\n<p>Where the harness exposes no hook system, nothing captures actions automatically, so\nthere is no evidence plane the agent did not author.</p>\n<p>Record entries anyway — the reasoning is still worth keeping — but understand what\nchanged: anchoring now rests on the agent&#39;s own account of what it did. Prefer anchors\nthat are checkable after the fact regardless of who wrote them, such as a commit or a\nfile hash, over ones that are not, such as a tool call nobody else observed.</p>\n<h3 id=\"reading-a-journal-that-used-several-rungs\">Reading a journal that used several rungs</h3>\n<p>A long-lived workspace will contain entries from more than one. The coverage report is\nwhere that becomes legible: it names sessions that recorded nothing, refused writes,\nsequence gaps, paths it could not read, lines that did not parse, and — importantly —\nreturns <code>null</code> rather than an empty array for anything it never assessed.</p>\n<p>The distinction is not pedantry. <code>[]</code> means looked and found nothing. <code>null</code> means never\nlooked. Rendering the second as the first turns an unexamined gap into a clean bill of\nhealth, which is the precise dishonesty the report exists to prevent.</p>\n","words":771},{"path":"references/digest-and-disclosure.md","slug":"digest-and-disclosure","title":"Digest and disclosure: rendering a journal for someone who cannot read all of it","body":"# Digest and disclosure: rendering a journal for someone who cannot read all of it\n\nA journal accumulates entries an agent wrote for itself, mid-session, with whatever\ncandour that required. Nothing in that origin makes every entry fit for a document a\nteam reviews or a customer sees. Disclosure is the control that lets the same journal\nserve both audiences without either editing history or hiding that anything was\nwithheld.\n\n## The three classes\n\n```\nprivate   →   team   →   published\n```\n\nSpec §13.3 orders them most closed to most open. Every entry carries exactly one.\n\n| Class | Shows up in a digest rendered at `--level …` |\n| --- | --- |\n| `private` | Only `private`. Never `team`, never `published`. |\n| `team` | `private` and `team`. Not `published`. |\n| `published` | `private`, `team` and `published` — the version meant to leave the room. |\n\nAn entry's class is readable at a requested level when the class is **at least as\nopen** as the level: `readableAt(entry, level)` is `rank(entry.disclosure) >=\nrank(level)`. So a `published` digest — the default — shows only `published` entries; a\n`team` digest shows `team` and `published`; a `private` digest, meaningful only as an\ninternal, unredacted view, shows everything. More open classes are supersets of more\nclosed ones, never the reverse.\n\n## Setting it\n\n```bash\nagent-journal record --workspace api --kind decision --id dg-bound \\\n  --question \"how do we bound the retry queue?\" --chosen \"in-process ring buffer, 256 entries\" \\\n  --disclosure published\n```\n\n`--disclosure` takes `record` and `invalidate`, nowhere else — it is a property of an\nentry, not of a workspace or a query. An unrecognised value — `--disclosure public`, say\n— is refused outright, exit 2, naming the three real classes in the error rather than\nsilently containing it to `private`; see the next section for why that refusal, not a\nquiet downgrade, is the correct response here.\n\n## The write default and the parse default disagree, on purpose\n\nOmit `--disclosure` on a write this CLI performs and the entry lands as `team`. Read a\nrecord — any record, including one this same CLI wrote — where the `disclosure` field\nis absent or holds something unrecognised, and it parses as `private`.\n\nThose look contradictory side by side, and the plan they came out of said so directly:\nsay this, because it *is* the subtlest asymmetry in the disclosure design, not an\ninconsistency to quietly reconcile.\n\nThey are not the same decision. They answer two different questions:\n\n- **Writing, with a caller present:** *what did this caller mean?* A caller who typed\n  nothing meant the ordinary case, not silence — `team`, shareable inside the\n  organisation but not shipped externally. Silently downgrading their unstated intent to\n  `private` would be the same coercion this CLI already removed once from `--author`.\n- **Parsing, with no caller to ask:** *what can this record be assumed to permit?* A\n  line read from disk — possibly hand-edited, possibly from a version of this tool that\n  never had the field, possibly corrupted — carries no author to consult. Here the two\n  mistakes do not cost the same: treating an ambiguous record as more open than intended\n  publishes something that should have stayed contained, and that is not a mistake a\n  later correction undoes. Treating it as more closed than intended just means someone\n  notices an omission and asks. `private` is the only default that fails toward the\n  recoverable error.\n\nThe same instinct governs `Capabilities` elsewhere in this package — preserve `unknown`\nrather than assume availability — and lands on the opposite literal here because the\nharm runs the opposite direction: understating a capability costs nothing but useful\ninformation; overstating disclosure costs the entry's own contents.\n\n## Disclosure is containment, not curation\n\nIt is tempting to describe `private`/`team`/`published` as an editorial ladder — draft,\nreviewed, publishable — the way a document workflow might. Resist that. Spec §6.4\nrejects \"curated in-repo\" as a description of any part of this journal precisely because\nit names no curator and no rule: nobody is elected to decide what counts as ready, and\nnothing enforces that a `published` entry was ever reviewed by a person before a digest\npicked it up.\n\nDisclosure names **where an entry may be exposed**, never **whether it is any good**. A\n`published` entry can rest on `model_knowledge` alone, contradict what a later entry\nsays, or belong to a decision that gets invalidated an hour later — the digest will\nstill show it to anyone entitled to see `published` material, flagged and ordered like\nany other entry, because disclosure and quality are unrelated axes. Confusing them would\nrecreate exactly the unaccountable, undocumented gate the spec calls out by name.\n\n## A private entry never reaches a digest — but invalidation is never gated\n\n`renderDigest` computes outcomes over **every** event passed to it — `project(events)`\nruns before the disclosure filter, not after — and only then filters which entries make\nit into the printed list. The consequence: an entry's disclosure controls whether its\nown text is shown, never whether the fact it recorded took effect.\n\nConcretely, a `private` `invalidate` still suppresses its target for a `team` or\n`published` reader. The retraction's reasoning stays hidden; the fact that the target is\nnow `invalidated` does not.\n\n```bash\nagent-journal record --workspace api --kind decision --id d-secret-source \\\n  --question \"how do we route the queue's dead letters?\" --chosen \"a side table\" \\\n  --disclosure published\nagent-journal invalidate d-secret-source --workspace api \\\n  --reason \"the vendor named in the postmortem cannot appear in a published digest\" \\\n  --disclosure private\nagent-journal digest --workspace api --level team\n```\n\nThe `team`-level digest shows `d-secret-source` with `outcome: invalidated` — the\nquestion is still there, the fact that it was retracted is still there — and nowhere in\nthat output does the withheld reason appear. Rendering it at `--level private` is the\nonly way to see the retraction record itself, title and reason included.\n\nGet this backwards — filter by disclosure first, project second — and a private\nretraction stops suppressing anything for a less-privileged reader: the invalidated\nentry would read as live, which hides that anything happened at all. That is worse than\na retraction with a hidden reason, because a hidden reason at least announces itself as\nhidden.\n\n## Ordering: by consequence, not by time\n\nA digest is not a timeline. Entries are sorted so the reader hits the things that most\nchange what they should do first:\n\n1. `invalidated` outcome before anything else.\n2. Among the rest, by `reversibility`: `one-way`, then `hard`, then `moderate`, then\n   `trivial`, then entries with no `reversibility` at all.\n3. Within a tie on the above, an entry with a `blastRadius` before one without.\n4. Any remaining tie breaks on `id`, lexicographically.\n\nThat fourth rule exists so two renders of the same journal are byte-identical — a\ncommitted digest that reordered itself on every regeneration would make review diffs\nnoise instead of signal.\n\n`rejected[]` renders in full for every decision that has it; nothing is truncated or\nsummarised. An entry whose influences are **only** `model_knowledge` — not merely one\nof several — gets a visible flag:\n\n```\n> **No source consulted** — this rested on `model_knowledge` alone.\n```\n\nA mixed entry, one `model_knowledge` influence alongside a real citation, does not carry\nthat flag: the signal is \"nothing checkable was consulted,\" not \"priors were involved at\nall.\"\n\n## Every digest carries a coverage statement\n\nThe tail of every rendered digest is the same coverage block `agent-journal coverage`\nproduces on its own, folded in rather than left for the reader to cross-reference\nseparately:\n\n```\n## Coverage\n\n- sessions observed: 2\n- sessions that recorded nothing: 0\n- sessions with no events at all: not assessed\n- refused writes (voids): 0\n- sequence gaps: 0\n- downgraded anchors: not assessed\n\n`not assessed` is not `none` — it means nothing computed the figure.\n```\n\n`sessionsWithNoEvents` and `downgradedAnchors` are the two fields this package will only\never compute when a caller supplies extra input the CLI's plain `digest` invocation does\nnot (a known-sessions list; a retention pass). Where that input was never supplied, the\nfield is `null`, and the digest renders `not assessed` — never `0`. A `0` there would\nclaim a real count of zero; `not assessed` says nobody looked, and a reader can tell the\ndifference without cross-referencing anything.\n\n## `digest` refuses on a damaged journal; every other command warns and continues\n\n`coverage`, `show` and `trace` all take the same stance toward a journal they could not\nfully read: they render whatever they could parse, exit non-zero, and print a warning\nthat the result is a floor, not a total. `digest` does not. A damaged journal makes it\nrefuse outright — no partial output on stdout, and `--out` writes nothing to disk. Where\none unreadable path and no malformed lines makes `coverage` print its report with a\nwarning appended, the same damage makes `digest --out <path>` print nothing at all,\nwrite nothing to `<path>`, and exit 1 with `refusing to render: <N> unreadable path(s),\n<M> malformed line(s)` on stderr.\n\nThe other commands exist to be read interactively, by someone who will also see the\nwarning line next to the JSON. A digest is different in kind: it is the artifact that\ngets committed, attached to a review, or handed to someone who was not in the room when\nit was generated — and by the time they read it, the warning that would have explained\nits gaps may not be attached to it at all. A digest that renders successfully with a\nwarning invites exactly that: a partial document with no visible sign, once separated\nfrom its stderr, that it is partial. Refusing outright is the only version of this\ncommand that cannot produce a silently-incomplete artifact.\n\n## `--out` refuses to write inside any workspace's segment tree\n\nPoint `--out` at a path under `$AGENT_JOURNAL_ROOT/workspaces/<id>/segments/` — the tree\n`agent-journal` itself writes entries into — and the command exits 2 before rendering\nanything, naming that directory and explaining why: *a digest written there becomes\njournal input on the next read*.\n\nEvery read of a workspace walks every `.jsonl` file under its `segments/` tree. A digest\nwritten into that tree becomes journal input the next time anything reads the workspace\n— parsed as an entry, or as a malformed line if its extension happens to match and its\ncontent does not parse as one, either way corrupting the record it was rendered from.\n\nThis is not scoped to the workspace named by `--workspace`. `--out` may name a\n*different* workspace's segment tree —\n`agent-journal digest --workspace ws --out $AGENT_JOURNAL_ROOT/workspaces/other/segments/p.jsonl`\n— and that sibling is refused too, even one that has never been written to before and\nhas no `segments/` directory on disk yet. Only a path outside every workspace's segment\ntree is left alone; writing at `$AGENT_JOURNAL_ROOT/digest.md`, or elsewhere under a\nworkspace's own directory that is not its `segments/` tree, is odd but harmless and is\nnot refused.\n\nThe check resolves both the segment root and `--out` through the filesystem —\n`realpath` on the parent chain, `lstat` on the final component — not string comparison,\nso a relative path, a `..` traversal, or a symlink pointing back into the tree is caught\nthe same way a direct path would be. That includes a **dangling** symlink — one whose\ntarget does not exist yet, the shape `ln -s $ROOT/workspaces/ws/segments/poison.jsonl\n./out.md` produces. `realpath` alone cannot resolve a target that is not there yet, so\nthe check follows the link itself (`readlink`, resolved against the link's own\ndirectory) rather than treating \"the target doesn't exist\" as \"this whole path doesn't\nexist, so it must be fine\": both are refused identically, exit 2, before anything is\nwritten.\n\n## `--out` refuses at `--level private`\n\nSpec §13.3, verbatim: *\"private never leaves the local journal — not to sync, not to a\nhosted sink, not to a digest.\"* Printing a private-level digest to stdout is reading the\nlocal journal; writing it to a file is leaving it. So `--level private` combined with\n`--out` is refused outright, exit 2, before anything is read or rendered:\n\n```\n$ agent-journal digest --workspace api --level private --out ./digest.md\n--out is refused with --level private; private entries are not written to a file\n(spec 13.3) — omit --out and read the digest from stdout for local inspection\n```\n\nDrop `--out` and the same `--level private` render still works — stdout is local\ninspection, not leaving the journal, and stays available:\n\n```bash\nagent-journal digest --workspace api --level private\n```\n\n## A digest is a rendered artifact, never the source of truth\n\nThe journal's segment files are the record. A digest is a projection of them at one\ndisclosure level, at one moment — literally stamped `As of <timestamp>` on its first\nline. Treat a stale digest as evidence of anything beyond what the journal looked like\nwhen it was rendered, and you have reintroduced the exact problem coverage exists to\nname: an artifact that looks authoritative and is quietly out of date.\n\n## When to render one: with the pull request that caused it\n\n§17.4 left the cadence undecided, and noted what that costs — *\"an undecided cadence\nmeans no digest reaches anyone.\"* Everything upstream of §6.4's committed digest works\nand lands nowhere. Decided 2026-09-09: **per pull request.**\n\nBefore opening a PR that changed something worth reconstructing later, render the\ndigest into the repo and commit it with the change:\n\n```bash\nagent-journal digest --workspace api --level published --out docs/decisions/api.md\n```\n\nIt lands where a reviewer already is, while the entries are still fresh enough to\nargue with. Per release batches too much into one document to be read; on demand\nmeans nobody runs it.\n\n### Why CI cannot do this for you\n\nIt is worth knowing why this step is yours rather than a job's. §6.2 keeps the journal\nat `~/.agents/journal/` — on the machine that wrote it, deliberately outside the repo,\nbecause segments carry hostnames and home paths. A CI runner has no journal to render\nfrom. A workflow calling `digest` would produce an empty document, which is worse than\nnone: it reads as *\"no decisions were made\"*.\n\nWhat CI does instead is validate what was committed. The\n[source repository](https://github.com/crissmoldovan/agent-skills) carries a digest\nchecker in its own verify chain — it is not part of this skill's installed files — and\nit confirms that every digest under `docs/decisions/` is **intact**: not empty, not\ntruncated mid-write, still carrying its `## Coverage` block, with nothing appended by\nhand and no second forged coverage block above the real one. Any repository adopting\nthis cadence wants the same check; the shape above is what it looks for.\n\n**It cannot check freshness, and does not claim to.** A passing run means \"this digest\nis intact\", never \"this digest is current\" — the runner has no journal to compare\nagainst. A digest that is three weeks stale passes every check. That is a real limit\nof this arrangement, and the reason the rendering step above is a habit rather than a\ngate.\n\n## Tracing from a symptom: `trace <key> --workspace <id>`\n\nSpec §10.2 is explicit that support and debugging questions do not start with an entry\nid — they start with a ticket number, a file that misbehaves, a flag someone flipped, or\na decision id someone already has in hand. `trace` indexes all four the same way:\n\n| Source | Example |\n| --- | --- |\n| `id` | the entry's own id |\n| `subject` | `--subject src/queue.ts` on the entry that recorded it |\n| anchor ref | `--anchor runtime:flags/retry-backpressure=on` |\n| influence ref | `--influence url:supporting:JIRA-4821` |\n\n```bash\nagent-journal record --workspace api --kind decision --id d-queue \\\n  --subject \"src/queue.ts\" \\\n  --question \"how do we bound the retry queue?\" --chosen \"in-process ring buffer, 256 entries\" \\\n  --disclosure published\nagent-journal record --workspace api --kind finding --id f-ticket \\\n  --claim \"the bound matches the SLA in the ticket\" \\\n  --influence url:supporting:JIRA-4821 --disclosure published\nagent-journal record --workspace api --kind decision --id d-flag \\\n  --question \"should retry backpressure ship dark?\" --chosen \"yes, behind a flag\" \\\n  --anchor \"runtime:flags/retry-backpressure=on\" --disclosure published\nagent-journal record --workspace api --kind finding --id f-depends \\\n  --claim \"the 256 bound is never reached\" \\\n  --influence journal:decisive:d-queue --disclosure published\n```\n\n```bash\nagent-journal trace src/queue.ts --workspace api\nagent-journal trace JIRA-4821 --workspace api\nagent-journal trace flags/retry-backpressure=on --workspace api\n```\n\nEach reports one match: `d-queue` via `subject`, `f-ticket` via `influence`, `d-flag` via\n`anchor`. Every match carries `via`, naming which of the four sources produced it, in\nprecedence order `id` > `subject` > `anchor` > `influence` when more than one would\napply to the same entry — an entry whose id happens to equal the key is what was asked\nfor; that it might also cite the key elsewhere is secondary and never shown instead.\n`agent-journal trace d-queue --workspace api` shows this with two entries at once: it\nreports `d-queue` itself via `id`, and, separately, `f-depends` via `influence` — the\nsame key, matched for two different reasons, each labelled with the reason it matched.\n\n### Lookup is exact, never a substring\n\n```bash\nagent-journal trace queue --workspace api\n```\n\nThis reports no match — exit 0, an empty `matched` array, and\n`no entry is indexed under \"queue\" in this workspace` on stderr — even though the\nworkspace above has an entry whose `subject` is `src/queue.ts`. Keys are trimmed and\nlower-cased, but never partially matched — a fuzzy index would hand back candidates a\nreader then has to rule out one by one, which is the adjudication this lookup exists to\navoid. Ask for the exact string that appears in the subject, the anchor, the influence,\nor the id.\n\n### The walk goes backwards, and does not stop at an invalidated entry\n\nPast the initial match, `trace` follows three edge types backwards — `journal`-typed\n`influences`, `supersedes`, and `invalidates` — building a chain that says, for every\nstep past the first, which edge led there:\n\n```bash\nagent-journal invalidate d-queue --workspace api \\\n  --reason \"the SLA changed; the bound is no longer sufficient\"\nagent-journal trace f-depends --workspace api\n```\n\n```json\n{\n  \"matched\": [{ \"id\": \"f-depends\", \"via\": \"id\" }],\n  \"chain\": [\n    { \"id\": \"f-depends\", \"via\": null },\n    { \"id\": \"d-queue\", \"via\": \"influences\" }\n  ]\n}\n```\n\n`d-queue` is now `invalidated`, and the walk reaches it anyway. That is deliberate, not\nan oversight the disclosure work should have closed off: \"why is this like this\" very\noften ends at a decision that turned out to be wrong, and hiding invalidated entries\nfrom the walk would make the one traversal built for root-causing unable to reach root\ncauses. `trace` answers a different question than `show`'s `live` flag — reachable,\nnot currently in force — and conflating the two would break the tool support questions\nare supposed to use.\n","bodyHtml":"<h2 id=\"digest-and-disclosure-rendering-a-journal-for-someone-who-cannot-read-all-of-it\">Digest and disclosure: rendering a journal for someone who cannot read all of it</h2>\n<p>A journal accumulates entries an agent wrote for itself, mid-session, with whatever\ncandour that required. Nothing in that origin makes every entry fit for a document a\nteam reviews or a customer sees. Disclosure is the control that lets the same journal\nserve both audiences without either editing history or hiding that anything was\nwithheld.</p>\n<h3 id=\"the-three-classes\">The three classes</h3>\n<pre><code>private   →   team   →   published\n</code></pre>\n<p>Spec §13.3 orders them most closed to most open. Every entry carries exactly one.</p>\n<table>\n<thead>\n<tr>\n<th>Class</th>\n<th>Shows up in a digest rendered at <code>--level …</code></th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>private</code></td>\n<td>Only <code>private</code>. Never <code>team</code>, never <code>published</code>.</td>\n</tr>\n<tr>\n<td><code>team</code></td>\n<td><code>private</code> and <code>team</code>. Not <code>published</code>.</td>\n</tr>\n<tr>\n<td><code>published</code></td>\n<td><code>private</code>, <code>team</code> and <code>published</code> — the version meant to leave the room.</td>\n</tr>\n</tbody></table>\n<p>An entry&#39;s class is readable at a requested level when the class is <strong>at least as\nopen</strong> as the level: <code>readableAt(entry, level)</code> is <code>rank(entry.disclosure) &gt;= rank(level)</code>. So a <code>published</code> digest — the default — shows only <code>published</code> entries; a\n<code>team</code> digest shows <code>team</code> and <code>published</code>; a <code>private</code> digest, meaningful only as an\ninternal, unredacted view, shows everything. More open classes are supersets of more\nclosed ones, never the reverse.</p>\n<h3 id=\"setting-it\">Setting it</h3>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind decision --id dg-bound \\\n  --question &quot;how do we bound the retry queue?&quot; --chosen &quot;in-process ring buffer, 256 entries&quot; \\\n  --disclosure published\n</code></pre>\n<p><code>--disclosure</code> takes <code>record</code> and <code>invalidate</code>, nowhere else — it is a property of an\nentry, not of a workspace or a query. An unrecognised value — <code>--disclosure public</code>, say\n— is refused outright, exit 2, naming the three real classes in the error rather than\nsilently containing it to <code>private</code>; see the next section for why that refusal, not a\nquiet downgrade, is the correct response here.</p>\n<h3 id=\"the-write-default-and-the-parse-default-disagree-on-purpose\">The write default and the parse default disagree, on purpose</h3>\n<p>Omit <code>--disclosure</code> on a write this CLI performs and the entry lands as <code>team</code>. Read a\nrecord — any record, including one this same CLI wrote — where the <code>disclosure</code> field\nis absent or holds something unrecognised, and it parses as <code>private</code>.</p>\n<p>Those look contradictory side by side, and the plan they came out of said so directly:\nsay this, because it <em>is</em> the subtlest asymmetry in the disclosure design, not an\ninconsistency to quietly reconcile.</p>\n<p>They are not the same decision. They answer two different questions:</p>\n<ul>\n<li><strong>Writing, with a caller present:</strong> <em>what did this caller mean?</em> A caller who typed\nnothing meant the ordinary case, not silence — <code>team</code>, shareable inside the\norganisation but not shipped externally. Silently downgrading their unstated intent to\n<code>private</code> would be the same coercion this CLI already removed once from <code>--author</code>.</li>\n<li><strong>Parsing, with no caller to ask:</strong> <em>what can this record be assumed to permit?</em> A\nline read from disk — possibly hand-edited, possibly from a version of this tool that\nnever had the field, possibly corrupted — carries no author to consult. Here the two\nmistakes do not cost the same: treating an ambiguous record as more open than intended\npublishes something that should have stayed contained, and that is not a mistake a\nlater correction undoes. Treating it as more closed than intended just means someone\nnotices an omission and asks. <code>private</code> is the only default that fails toward the\nrecoverable error.</li>\n</ul>\n<p>The same instinct governs <code>Capabilities</code> elsewhere in this package — preserve <code>unknown</code>\nrather than assume availability — and lands on the opposite literal here because the\nharm runs the opposite direction: understating a capability costs nothing but useful\ninformation; overstating disclosure costs the entry&#39;s own contents.</p>\n<h3 id=\"disclosure-is-containment-not-curation\">Disclosure is containment, not curation</h3>\n<p>It is tempting to describe <code>private</code>/<code>team</code>/<code>published</code> as an editorial ladder — draft,\nreviewed, publishable — the way a document workflow might. Resist that. Spec §6.4\nrejects &quot;curated in-repo&quot; as a description of any part of this journal precisely because\nit names no curator and no rule: nobody is elected to decide what counts as ready, and\nnothing enforces that a <code>published</code> entry was ever reviewed by a person before a digest\npicked it up.</p>\n<p>Disclosure names <strong>where an entry may be exposed</strong>, never <strong>whether it is any good</strong>. A\n<code>published</code> entry can rest on <code>model_knowledge</code> alone, contradict what a later entry\nsays, or belong to a decision that gets invalidated an hour later — the digest will\nstill show it to anyone entitled to see <code>published</code> material, flagged and ordered like\nany other entry, because disclosure and quality are unrelated axes. Confusing them would\nrecreate exactly the unaccountable, undocumented gate the spec calls out by name.</p>\n<h3 id=\"a-private-entry-never-reaches-a-digest-but-invalidation-is-never-gated\">A private entry never reaches a digest — but invalidation is never gated</h3>\n<p><code>renderDigest</code> computes outcomes over <strong>every</strong> event passed to it — <code>project(events)</code>\nruns before the disclosure filter, not after — and only then filters which entries make\nit into the printed list. The consequence: an entry&#39;s disclosure controls whether its\nown text is shown, never whether the fact it recorded took effect.</p>\n<p>Concretely, a <code>private</code> <code>invalidate</code> still suppresses its target for a <code>team</code> or\n<code>published</code> reader. The retraction&#39;s reasoning stays hidden; the fact that the target is\nnow <code>invalidated</code> does not.</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind decision --id d-secret-source \\\n  --question &quot;how do we route the queue&#39;s dead letters?&quot; --chosen &quot;a side table&quot; \\\n  --disclosure published\nagent-journal invalidate d-secret-source --workspace api \\\n  --reason &quot;the vendor named in the postmortem cannot appear in a published digest&quot; \\\n  --disclosure private\nagent-journal digest --workspace api --level team\n</code></pre>\n<p>The <code>team</code>-level digest shows <code>d-secret-source</code> with <code>outcome: invalidated</code> — the\nquestion is still there, the fact that it was retracted is still there — and nowhere in\nthat output does the withheld reason appear. Rendering it at <code>--level private</code> is the\nonly way to see the retraction record itself, title and reason included.</p>\n<p>Get this backwards — filter by disclosure first, project second — and a private\nretraction stops suppressing anything for a less-privileged reader: the invalidated\nentry would read as live, which hides that anything happened at all. That is worse than\na retraction with a hidden reason, because a hidden reason at least announces itself as\nhidden.</p>\n<h3 id=\"ordering-by-consequence-not-by-time\">Ordering: by consequence, not by time</h3>\n<p>A digest is not a timeline. Entries are sorted so the reader hits the things that most\nchange what they should do first:</p>\n<ol>\n<li><code>invalidated</code> outcome before anything else.</li>\n<li>Among the rest, by <code>reversibility</code>: <code>one-way</code>, then <code>hard</code>, then <code>moderate</code>, then\n<code>trivial</code>, then entries with no <code>reversibility</code> at all.</li>\n<li>Within a tie on the above, an entry with a <code>blastRadius</code> before one without.</li>\n<li>Any remaining tie breaks on <code>id</code>, lexicographically.</li>\n</ol>\n<p>That fourth rule exists so two renders of the same journal are byte-identical — a\ncommitted digest that reordered itself on every regeneration would make review diffs\nnoise instead of signal.</p>\n<p><code>rejected[]</code> renders in full for every decision that has it; nothing is truncated or\nsummarised. An entry whose influences are <strong>only</strong> <code>model_knowledge</code> — not merely one\nof several — gets a visible flag:</p>\n<pre><code>&gt; **No source consulted** — this rested on `model_knowledge` alone.\n</code></pre>\n<p>A mixed entry, one <code>model_knowledge</code> influence alongside a real citation, does not carry\nthat flag: the signal is &quot;nothing checkable was consulted,&quot; not &quot;priors were involved at\nall.&quot;</p>\n<h3 id=\"every-digest-carries-a-coverage-statement\">Every digest carries a coverage statement</h3>\n<p>The tail of every rendered digest is the same coverage block <code>agent-journal coverage</code>\nproduces on its own, folded in rather than left for the reader to cross-reference\nseparately:</p>\n<pre><code>## Coverage\n\n- sessions observed: 2\n- sessions that recorded nothing: 0\n- sessions with no events at all: not assessed\n- refused writes (voids): 0\n- sequence gaps: 0\n- downgraded anchors: not assessed\n\n`not assessed` is not `none` — it means nothing computed the figure.\n</code></pre>\n<p><code>sessionsWithNoEvents</code> and <code>downgradedAnchors</code> are the two fields this package will only\never compute when a caller supplies extra input the CLI&#39;s plain <code>digest</code> invocation does\nnot (a known-sessions list; a retention pass). Where that input was never supplied, the\nfield is <code>null</code>, and the digest renders <code>not assessed</code> — never <code>0</code>. A <code>0</code> there would\nclaim a real count of zero; <code>not assessed</code> says nobody looked, and a reader can tell the\ndifference without cross-referencing anything.</p>\n<h3 id=\"digest-refuses-on-a-damaged-journal-every-other-command-warns-and-continues\"><code>digest</code> refuses on a damaged journal; every other command warns and continues</h3>\n<p><code>coverage</code>, <code>show</code> and <code>trace</code> all take the same stance toward a journal they could not\nfully read: they render whatever they could parse, exit non-zero, and print a warning\nthat the result is a floor, not a total. <code>digest</code> does not. A damaged journal makes it\nrefuse outright — no partial output on stdout, and <code>--out</code> writes nothing to disk. Where\none unreadable path and no malformed lines makes <code>coverage</code> print its report with a\nwarning appended, the same damage makes <code>digest --out &lt;path&gt;</code> print nothing at all,\nwrite nothing to <code>&lt;path&gt;</code>, and exit 1 with <code>refusing to render: &lt;N&gt; unreadable path(s), &lt;M&gt; malformed line(s)</code> on stderr.</p>\n<p>The other commands exist to be read interactively, by someone who will also see the\nwarning line next to the JSON. A digest is different in kind: it is the artifact that\ngets committed, attached to a review, or handed to someone who was not in the room when\nit was generated — and by the time they read it, the warning that would have explained\nits gaps may not be attached to it at all. A digest that renders successfully with a\nwarning invites exactly that: a partial document with no visible sign, once separated\nfrom its stderr, that it is partial. Refusing outright is the only version of this\ncommand that cannot produce a silently-incomplete artifact.</p>\n<h3 id=\"--out-refuses-to-write-inside-any-workspaces-segment-tree\"><code>--out</code> refuses to write inside any workspace&#39;s segment tree</h3>\n<p>Point <code>--out</code> at a path under <code>$AGENT_JOURNAL_ROOT/workspaces/&lt;id&gt;/segments/</code> — the tree\n<code>agent-journal</code> itself writes entries into — and the command exits 2 before rendering\nanything, naming that directory and explaining why: <em>a digest written there becomes\njournal input on the next read</em>.</p>\n<p>Every read of a workspace walks every <code>.jsonl</code> file under its <code>segments/</code> tree. A digest\nwritten into that tree becomes journal input the next time anything reads the workspace\n— parsed as an entry, or as a malformed line if its extension happens to match and its\ncontent does not parse as one, either way corrupting the record it was rendered from.</p>\n<p>This is not scoped to the workspace named by <code>--workspace</code>. <code>--out</code> may name a\n<em>different</em> workspace&#39;s segment tree —\n<code>agent-journal digest --workspace ws --out $AGENT_JOURNAL_ROOT/workspaces/other/segments/p.jsonl</code>\n— and that sibling is refused too, even one that has never been written to before and\nhas no <code>segments/</code> directory on disk yet. Only a path outside every workspace&#39;s segment\ntree is left alone; writing at <code>$AGENT_JOURNAL_ROOT/digest.md</code>, or elsewhere under a\nworkspace&#39;s own directory that is not its <code>segments/</code> tree, is odd but harmless and is\nnot refused.</p>\n<p>The check resolves both the segment root and <code>--out</code> through the filesystem —\n<code>realpath</code> on the parent chain, <code>lstat</code> on the final component — not string comparison,\nso a relative path, a <code>..</code> traversal, or a symlink pointing back into the tree is caught\nthe same way a direct path would be. That includes a <strong>dangling</strong> symlink — one whose\ntarget does not exist yet, the shape <code>ln -s $ROOT/workspaces/ws/segments/poison.jsonl ./out.md</code> produces. <code>realpath</code> alone cannot resolve a target that is not there yet, so\nthe check follows the link itself (<code>readlink</code>, resolved against the link&#39;s own\ndirectory) rather than treating &quot;the target doesn&#39;t exist&quot; as &quot;this whole path doesn&#39;t\nexist, so it must be fine&quot;: both are refused identically, exit 2, before anything is\nwritten.</p>\n<h3 id=\"--out-refuses-at---level-private\"><code>--out</code> refuses at <code>--level private</code></h3>\n<p>Spec §13.3, verbatim: <em>&quot;private never leaves the local journal — not to sync, not to a\nhosted sink, not to a digest.&quot;</em> Printing a private-level digest to stdout is reading the\nlocal journal; writing it to a file is leaving it. So <code>--level private</code> combined with\n<code>--out</code> is refused outright, exit 2, before anything is read or rendered:</p>\n<pre><code>$ agent-journal digest --workspace api --level private --out ./digest.md\n--out is refused with --level private; private entries are not written to a file\n(spec 13.3) — omit --out and read the digest from stdout for local inspection\n</code></pre>\n<p>Drop <code>--out</code> and the same <code>--level private</code> render still works — stdout is local\ninspection, not leaving the journal, and stays available:</p>\n<pre><code class=\"language-bash\">agent-journal digest --workspace api --level private\n</code></pre>\n<h3 id=\"a-digest-is-a-rendered-artifact-never-the-source-of-truth\">A digest is a rendered artifact, never the source of truth</h3>\n<p>The journal&#39;s segment files are the record. A digest is a projection of them at one\ndisclosure level, at one moment — literally stamped <code>As of &lt;timestamp&gt;</code> on its first\nline. Treat a stale digest as evidence of anything beyond what the journal looked like\nwhen it was rendered, and you have reintroduced the exact problem coverage exists to\nname: an artifact that looks authoritative and is quietly out of date.</p>\n<h3 id=\"when-to-render-one-with-the-pull-request-that-caused-it\">When to render one: with the pull request that caused it</h3>\n<p>§17.4 left the cadence undecided, and noted what that costs — <em>&quot;an undecided cadence\nmeans no digest reaches anyone.&quot;</em> Everything upstream of §6.4&#39;s committed digest works\nand lands nowhere. Decided 2026-09-09: <strong>per pull request.</strong></p>\n<p>Before opening a PR that changed something worth reconstructing later, render the\ndigest into the repo and commit it with the change:</p>\n<pre><code class=\"language-bash\">agent-journal digest --workspace api --level published --out docs/decisions/api.md\n</code></pre>\n<p>It lands where a reviewer already is, while the entries are still fresh enough to\nargue with. Per release batches too much into one document to be read; on demand\nmeans nobody runs it.</p>\n<h4 id=\"why-ci-cannot-do-this-for-you\">Why CI cannot do this for you</h4>\n<p>It is worth knowing why this step is yours rather than a job&#39;s. §6.2 keeps the journal\nat <code>~/.agents/journal/</code> — on the machine that wrote it, deliberately outside the repo,\nbecause segments carry hostnames and home paths. A CI runner has no journal to render\nfrom. A workflow calling <code>digest</code> would produce an empty document, which is worse than\nnone: it reads as <em>&quot;no decisions were made&quot;</em>.</p>\n<p>What CI does instead is validate what was committed. The\n<a href=\"https://github.com/crissmoldovan/agent-skills\" target=\"_blank\" rel=\"noreferrer\">source repository</a> carries a digest\nchecker in its own verify chain — it is not part of this skill&#39;s installed files — and\nit confirms that every digest under <code>docs/decisions/</code> is <strong>intact</strong>: not empty, not\ntruncated mid-write, still carrying its <code>## Coverage</code> block, with nothing appended by\nhand and no second forged coverage block above the real one. Any repository adopting\nthis cadence wants the same check; the shape above is what it looks for.</p>\n<p><strong>It cannot check freshness, and does not claim to.</strong> A passing run means &quot;this digest\nis intact&quot;, never &quot;this digest is current&quot; — the runner has no journal to compare\nagainst. A digest that is three weeks stale passes every check. That is a real limit\nof this arrangement, and the reason the rendering step above is a habit rather than a\ngate.</p>\n<h3 id=\"tracing-from-a-symptom-trace-key---workspace-id\">Tracing from a symptom: <code>trace &lt;key&gt; --workspace &lt;id&gt;</code></h3>\n<p>Spec §10.2 is explicit that support and debugging questions do not start with an entry\nid — they start with a ticket number, a file that misbehaves, a flag someone flipped, or\na decision id someone already has in hand. <code>trace</code> indexes all four the same way:</p>\n<table>\n<thead>\n<tr>\n<th>Source</th>\n<th>Example</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>id</code></td>\n<td>the entry&#39;s own id</td>\n</tr>\n<tr>\n<td><code>subject</code></td>\n<td><code>--subject src/queue.ts</code> on the entry that recorded it</td>\n</tr>\n<tr>\n<td>anchor ref</td>\n<td><code>--anchor runtime:flags/retry-backpressure=on</code></td>\n</tr>\n<tr>\n<td>influence ref</td>\n<td><code>--influence url:supporting:JIRA-4821</code></td>\n</tr>\n</tbody></table>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind decision --id d-queue \\\n  --subject &quot;src/queue.ts&quot; \\\n  --question &quot;how do we bound the retry queue?&quot; --chosen &quot;in-process ring buffer, 256 entries&quot; \\\n  --disclosure published\nagent-journal record --workspace api --kind finding --id f-ticket \\\n  --claim &quot;the bound matches the SLA in the ticket&quot; \\\n  --influence url:supporting:JIRA-4821 --disclosure published\nagent-journal record --workspace api --kind decision --id d-flag \\\n  --question &quot;should retry backpressure ship dark?&quot; --chosen &quot;yes, behind a flag&quot; \\\n  --anchor &quot;runtime:flags/retry-backpressure=on&quot; --disclosure published\nagent-journal record --workspace api --kind finding --id f-depends \\\n  --claim &quot;the 256 bound is never reached&quot; \\\n  --influence journal:decisive:d-queue --disclosure published\n</code></pre>\n<pre><code class=\"language-bash\">agent-journal trace src/queue.ts --workspace api\nagent-journal trace JIRA-4821 --workspace api\nagent-journal trace flags/retry-backpressure=on --workspace api\n</code></pre>\n<p>Each reports one match: <code>d-queue</code> via <code>subject</code>, <code>f-ticket</code> via <code>influence</code>, <code>d-flag</code> via\n<code>anchor</code>. Every match carries <code>via</code>, naming which of the four sources produced it, in\nprecedence order <code>id</code> &gt; <code>subject</code> &gt; <code>anchor</code> &gt; <code>influence</code> when more than one would\napply to the same entry — an entry whose id happens to equal the key is what was asked\nfor; that it might also cite the key elsewhere is secondary and never shown instead.\n<code>agent-journal trace d-queue --workspace api</code> shows this with two entries at once: it\nreports <code>d-queue</code> itself via <code>id</code>, and, separately, <code>f-depends</code> via <code>influence</code> — the\nsame key, matched for two different reasons, each labelled with the reason it matched.</p>\n<h4 id=\"lookup-is-exact-never-a-substring\">Lookup is exact, never a substring</h4>\n<pre><code class=\"language-bash\">agent-journal trace queue --workspace api\n</code></pre>\n<p>This reports no match — exit 0, an empty <code>matched</code> array, and\n<code>no entry is indexed under &quot;queue&quot; in this workspace</code> on stderr — even though the\nworkspace above has an entry whose <code>subject</code> is <code>src/queue.ts</code>. Keys are trimmed and\nlower-cased, but never partially matched — a fuzzy index would hand back candidates a\nreader then has to rule out one by one, which is the adjudication this lookup exists to\navoid. Ask for the exact string that appears in the subject, the anchor, the influence,\nor the id.</p>\n<h4 id=\"the-walk-goes-backwards-and-does-not-stop-at-an-invalidated-entry\">The walk goes backwards, and does not stop at an invalidated entry</h4>\n<p>Past the initial match, <code>trace</code> follows three edge types backwards — <code>journal</code>-typed\n<code>influences</code>, <code>supersedes</code>, and <code>invalidates</code> — building a chain that says, for every\nstep past the first, which edge led there:</p>\n<pre><code class=\"language-bash\">agent-journal invalidate d-queue --workspace api \\\n  --reason &quot;the SLA changed; the bound is no longer sufficient&quot;\nagent-journal trace f-depends --workspace api\n</code></pre>\n<pre><code class=\"language-json\">{\n  &quot;matched&quot;: [{ &quot;id&quot;: &quot;f-depends&quot;, &quot;via&quot;: &quot;id&quot; }],\n  &quot;chain&quot;: [\n    { &quot;id&quot;: &quot;f-depends&quot;, &quot;via&quot;: null },\n    { &quot;id&quot;: &quot;d-queue&quot;, &quot;via&quot;: &quot;influences&quot; }\n  ]\n}\n</code></pre>\n<p><code>d-queue</code> is now <code>invalidated</code>, and the walk reaches it anyway. That is deliberate, not\nan oversight the disclosure work should have closed off: &quot;why is this like this&quot; very\noften ends at a decision that turned out to be wrong, and hiding invalidated entries\nfrom the walk would make the one traversal built for root-causing unable to reach root\ncauses. <code>trace</code> answers a different question than <code>show</code>&#39;s <code>live</code> flag — reachable,\nnot currently in force — and conflating the two would break the tool support questions\nare supposed to use.</p>\n","words":3105},{"path":"references/entry-kinds.md","slug":"entry-kinds","title":"Entry kinds","body":"# Entry kinds\n\nSix kinds. Choosing the wrong one is not fatal, but each carries different fields and is\nread differently, so the choice affects what a later reader can ask.\n\nAll six share the same envelope, the same anchors and influences, the same retraction\nedges, and the same disclosure class. Every kind takes\n`--disclosure private|team|published` on `record` (and `invalidate` takes it too) — the\nwrite default is `team`, and an unrecognised value is refused rather than silently\ncontained. See [references/digest-and-disclosure.md](digest-and-disclosure.md) for what\nthe class controls, and the asymmetry between what a write defaults to and what a parse\ndefaults to.\n\nSeparate from disclosure, and with no flag of its own because no kind opts out of it:\nevery write also passes through automatic secret redaction. A recognised credential\nappearing in free text is masked in place before the entry is stored; a payload the\nredactor cannot scan at all — oversized, or too deeply nested — is refused outright.\nThat runs identically whichever disclosure class the entry is headed for; a `private`\nentry gets no less scrutiny than a `published` one.\n\nEvery kind takes its own fields through `record`, and only its own — passing a field\nthat belongs to another kind is refused with a message naming what this kind does take,\nrather than being silently dropped. `--rejected`, `--evidence` and `--premise` are\nrepeatable and store arrays.\n\n## `decision`\n\nA choice between options that a reasonable person could have made differently.\n\n| Field | Holds |\n| --- | --- |\n| `question` | What was being decided |\n| `chosen` | What was picked |\n| `rejected[]` | Alternatives and why not — **the field nothing else captures** |\n| `rationale` | Why |\n| `reversibility` | `trivial` / `moderate` / `hard` / `one-way` |\n| `blastRadius` | Who or what is affected when it takes effect |\n\n```bash\nagent-journal record --workspace api --kind decision --id d1 \\\n  --question \"how do we bound the retry queue?\" \\\n  --chosen \"in-process ring buffer, 256 entries\" \\\n  --rejected \"redis list — needs a broker we do not run\" \\\n  --rejected \"kafka — three days of setup for one queue\"\n```\n\n**`reversibility` and `blastRadius` are not the same thing**, and conflating them is a\nreal error. Flipping an enforcement flag is `trivial` to reverse — unset it and redeploy\n— while its blast radius is every user currently signed in. The rollback cost and the\nuser cost are unrelated, and the trivial score is precisely the wrong signal.\n\n## `finding`\n\nSomething you learned that was not obvious, and that changes what someone should do.\n\n| Field | Holds |\n| --- | --- |\n| `claim` | What you found |\n| `evidence[]` | What supports it |\n| `premise[]` | **What must be true for this to hold** |\n| `scope` | This machine / this workspace / general |\n\n```bash\nagent-journal record --workspace api --kind finding --id f2 \\\n  --claim \"the 256 bound is never reached in practice\" \\\n  --evidence \"two weeks of queue-depth samples\" \\\n  --premise \"traffic stays within its current envelope\" \\\n  --scope workspace\n```\n\n`scope` here is one of `machine`, `workspace` or `general` — a `constraint`'s `scope` is\nfree text, because it names a subject rather than a reach.\n\n`premise` is what makes a premise re-check possible later. `scope` prevents the most\ncommon failure with findings: a fact true of one laptop's `PATH` propagating as a fact\nabout the project. If you are not certain a finding generalises, scope it narrowly — a\nfinding wrongly marked general is worse than one wrongly marked local.\n\n## `assumption`\n\nSomething you proceeded as though were true, without checking.\n\n| Field | Holds |\n| --- | --- |\n| `assumed` | What you took to be true |\n| `ifWrong` | What breaks if it is not |\n| `checked` | `yes` / `no` |\n\n```bash\nagent-journal record --workspace api --kind assumption --id a1 \\\n  --assumed \"the upstream call is idempotent\" \\\n  --ifWrong \"retries double-charge\" --checked no\n```\n\nThese are the entries people are least inclined to write and that pay off most. Every\nincident worth the name has one of these at its root, unrecorded. When context is about\nto be compacted, sweeping for assumptions is the highest-value thing you can do with the\nremaining tokens.\n\n## `blocker`\n\nWork that cannot proceed, and what would unblock it.\n\n| Field | Holds |\n| --- | --- |\n| `blocked` | What cannot proceed |\n| `on` | What it waits for |\n| `owner` | Who can clear it |\n| `clearedBy` | What actually cleared it, once it is |\n\n## `progress`\n\nA checkpoint. Use sparingly — if you have a tracker, this duplicates it, and a journal\nfull of progress notes buries the entries that carry judgement. Bind it to an existing\nticket id rather than restating status.\n\n## `constraint`\n\nA standing obligation that later work must respect. The only forward-looking kind.\n\n| Field | Holds |\n| --- | --- |\n| `statement` | The obligation |\n| `origin` | Who imposed it |\n| `scope` | Where it applies |\n| `expiry` | When it lapses, if it does |\n| `enforcement` | `advisory` or `blocking` |\n\n```bash\nagent-journal record --workspace api --kind constraint --id c1 \\\n  --statement \"never a third-party sink for this telemetry\" \\\n  --origin \"client contract\" --scope telemetry --enforcement blocking\n```\n\nEverything else in the journal points backwards: this decision replaced that one, this\nfinding rests on that evidence. A constraint points forward — *never a third-party sink\nfor this client's telemetry*, *this control is fixed-height by decision, not oversight*,\n*do not edit that checkout*.\n\nConstraints are **checked at projection, never at write time**. A new decision whose\nsubject matches a live constraint is surfaced for a human. Nothing blocks and nothing\nauto-resolves — the point is that the obligation becomes visible at the moment it is\nrelevant, not that a machine adjudicates it.\n\n## Outcome and retraction\n\nEvery kind carries an outcome: `unknown`, `held`, `reverted`, `invalidated`. This is a\nschema field the CLI does not yet write directly — no kind takes an `--outcome` flag, so\n`reverted` and `invalidated` are reached only through `--supersedes`/`--invalidates`, and\n`held` is not reachable through `record` at all.\n\n**`unknown` is displayed, never hidden.** An entry nobody revisited stays `unknown`, and\nthat is itself the signal — \"nobody checked whether this held\" is information a reader\nneeds. Silently rendering it as fine would be the single most misleading thing the\njournal could do.\n\nTwo retraction edges, and the difference carries real weight:\n\n| | `supersedes` | `invalidates` |\n| --- | --- | --- |\n| Means | A later decision replaced this | This entry's premise was false |\n| The original was | Reasonable at the time | Never sound |\n| Effect on descendants | None | **Suppressed, transitively** |\n| In a digest | `outcome reverted` | `outcome invalidated` |\n\nInvalidation propagates through `influences` links of type `journal`, walked at the\nprojection layer. If B records that it rests on A and A is invalidated, B goes too — and\nanything resting on B. That is the whole reason the two edges are separate: superseding\na decision does not cast doubt on the work built atop it, and invalidating one does.\n\nRecord the edge with `--influence journal:<role>:<id>`. `agent-journal show` reports the\nresult: an entry that declared a dependence on an invalidated one reads\n`outcome: invalidated, live: false` without being named in the retraction.\n\nNeither edge deletes. Both are appended events that change how the record projects.\n","bodyHtml":"<h2 id=\"entry-kinds\">Entry kinds</h2>\n<p>Six kinds. Choosing the wrong one is not fatal, but each carries different fields and is\nread differently, so the choice affects what a later reader can ask.</p>\n<p>All six share the same envelope, the same anchors and influences, the same retraction\nedges, and the same disclosure class. Every kind takes\n<code>--disclosure private|team|published</code> on <code>record</code> (and <code>invalidate</code> takes it too) — the\nwrite default is <code>team</code>, and an unrecognised value is refused rather than silently\ncontained. See <a href=\"digest-and-disclosure.md\">references/digest-and-disclosure.md</a> for what\nthe class controls, and the asymmetry between what a write defaults to and what a parse\ndefaults to.</p>\n<p>Separate from disclosure, and with no flag of its own because no kind opts out of it:\nevery write also passes through automatic secret redaction. A recognised credential\nappearing in free text is masked in place before the entry is stored; a payload the\nredactor cannot scan at all — oversized, or too deeply nested — is refused outright.\nThat runs identically whichever disclosure class the entry is headed for; a <code>private</code>\nentry gets no less scrutiny than a <code>published</code> one.</p>\n<p>Every kind takes its own fields through <code>record</code>, and only its own — passing a field\nthat belongs to another kind is refused with a message naming what this kind does take,\nrather than being silently dropped. <code>--rejected</code>, <code>--evidence</code> and <code>--premise</code> are\nrepeatable and store arrays.</p>\n<h3 id=\"decision\"><code>decision</code></h3>\n<p>A choice between options that a reasonable person could have made differently.</p>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Holds</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>question</code></td>\n<td>What was being decided</td>\n</tr>\n<tr>\n<td><code>chosen</code></td>\n<td>What was picked</td>\n</tr>\n<tr>\n<td><code>rejected[]</code></td>\n<td>Alternatives and why not — <strong>the field nothing else captures</strong></td>\n</tr>\n<tr>\n<td><code>rationale</code></td>\n<td>Why</td>\n</tr>\n<tr>\n<td><code>reversibility</code></td>\n<td><code>trivial</code> / <code>moderate</code> / <code>hard</code> / <code>one-way</code></td>\n</tr>\n<tr>\n<td><code>blastRadius</code></td>\n<td>Who or what is affected when it takes effect</td>\n</tr>\n</tbody></table>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind decision --id d1 \\\n  --question &quot;how do we bound the retry queue?&quot; \\\n  --chosen &quot;in-process ring buffer, 256 entries&quot; \\\n  --rejected &quot;redis list — needs a broker we do not run&quot; \\\n  --rejected &quot;kafka — three days of setup for one queue&quot;\n</code></pre>\n<p><strong><code>reversibility</code> and <code>blastRadius</code> are not the same thing</strong>, and conflating them is a\nreal error. Flipping an enforcement flag is <code>trivial</code> to reverse — unset it and redeploy\n— while its blast radius is every user currently signed in. The rollback cost and the\nuser cost are unrelated, and the trivial score is precisely the wrong signal.</p>\n<h3 id=\"finding\"><code>finding</code></h3>\n<p>Something you learned that was not obvious, and that changes what someone should do.</p>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Holds</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>claim</code></td>\n<td>What you found</td>\n</tr>\n<tr>\n<td><code>evidence[]</code></td>\n<td>What supports it</td>\n</tr>\n<tr>\n<td><code>premise[]</code></td>\n<td><strong>What must be true for this to hold</strong></td>\n</tr>\n<tr>\n<td><code>scope</code></td>\n<td>This machine / this workspace / general</td>\n</tr>\n</tbody></table>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind finding --id f2 \\\n  --claim &quot;the 256 bound is never reached in practice&quot; \\\n  --evidence &quot;two weeks of queue-depth samples&quot; \\\n  --premise &quot;traffic stays within its current envelope&quot; \\\n  --scope workspace\n</code></pre>\n<p><code>scope</code> here is one of <code>machine</code>, <code>workspace</code> or <code>general</code> — a <code>constraint</code>&#39;s <code>scope</code> is\nfree text, because it names a subject rather than a reach.</p>\n<p><code>premise</code> is what makes a premise re-check possible later. <code>scope</code> prevents the most\ncommon failure with findings: a fact true of one laptop&#39;s <code>PATH</code> propagating as a fact\nabout the project. If you are not certain a finding generalises, scope it narrowly — a\nfinding wrongly marked general is worse than one wrongly marked local.</p>\n<h3 id=\"assumption\"><code>assumption</code></h3>\n<p>Something you proceeded as though were true, without checking.</p>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Holds</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>assumed</code></td>\n<td>What you took to be true</td>\n</tr>\n<tr>\n<td><code>ifWrong</code></td>\n<td>What breaks if it is not</td>\n</tr>\n<tr>\n<td><code>checked</code></td>\n<td><code>yes</code> / <code>no</code></td>\n</tr>\n</tbody></table>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind assumption --id a1 \\\n  --assumed &quot;the upstream call is idempotent&quot; \\\n  --ifWrong &quot;retries double-charge&quot; --checked no\n</code></pre>\n<p>These are the entries people are least inclined to write and that pay off most. Every\nincident worth the name has one of these at its root, unrecorded. When context is about\nto be compacted, sweeping for assumptions is the highest-value thing you can do with the\nremaining tokens.</p>\n<h3 id=\"blocker\"><code>blocker</code></h3>\n<p>Work that cannot proceed, and what would unblock it.</p>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Holds</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>blocked</code></td>\n<td>What cannot proceed</td>\n</tr>\n<tr>\n<td><code>on</code></td>\n<td>What it waits for</td>\n</tr>\n<tr>\n<td><code>owner</code></td>\n<td>Who can clear it</td>\n</tr>\n<tr>\n<td><code>clearedBy</code></td>\n<td>What actually cleared it, once it is</td>\n</tr>\n</tbody></table>\n<h3 id=\"progress\"><code>progress</code></h3>\n<p>A checkpoint. Use sparingly — if you have a tracker, this duplicates it, and a journal\nfull of progress notes buries the entries that carry judgement. Bind it to an existing\nticket id rather than restating status.</p>\n<h3 id=\"constraint\"><code>constraint</code></h3>\n<p>A standing obligation that later work must respect. The only forward-looking kind.</p>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>Holds</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>statement</code></td>\n<td>The obligation</td>\n</tr>\n<tr>\n<td><code>origin</code></td>\n<td>Who imposed it</td>\n</tr>\n<tr>\n<td><code>scope</code></td>\n<td>Where it applies</td>\n</tr>\n<tr>\n<td><code>expiry</code></td>\n<td>When it lapses, if it does</td>\n</tr>\n<tr>\n<td><code>enforcement</code></td>\n<td><code>advisory</code> or <code>blocking</code></td>\n</tr>\n</tbody></table>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind constraint --id c1 \\\n  --statement &quot;never a third-party sink for this telemetry&quot; \\\n  --origin &quot;client contract&quot; --scope telemetry --enforcement blocking\n</code></pre>\n<p>Everything else in the journal points backwards: this decision replaced that one, this\nfinding rests on that evidence. A constraint points forward — <em>never a third-party sink\nfor this client&#39;s telemetry</em>, <em>this control is fixed-height by decision, not oversight</em>,\n<em>do not edit that checkout</em>.</p>\n<p>Constraints are <strong>checked at projection, never at write time</strong>. A new decision whose\nsubject matches a live constraint is surfaced for a human. Nothing blocks and nothing\nauto-resolves — the point is that the obligation becomes visible at the moment it is\nrelevant, not that a machine adjudicates it.</p>\n<h3 id=\"outcome-and-retraction\">Outcome and retraction</h3>\n<p>Every kind carries an outcome: <code>unknown</code>, <code>held</code>, <code>reverted</code>, <code>invalidated</code>. This is a\nschema field the CLI does not yet write directly — no kind takes an <code>--outcome</code> flag, so\n<code>reverted</code> and <code>invalidated</code> are reached only through <code>--supersedes</code>/<code>--invalidates</code>, and\n<code>held</code> is not reachable through <code>record</code> at all.</p>\n<p><strong><code>unknown</code> is displayed, never hidden.</strong> An entry nobody revisited stays <code>unknown</code>, and\nthat is itself the signal — &quot;nobody checked whether this held&quot; is information a reader\nneeds. Silently rendering it as fine would be the single most misleading thing the\njournal could do.</p>\n<p>Two retraction edges, and the difference carries real weight:</p>\n<table>\n<thead>\n<tr>\n<th></th>\n<th><code>supersedes</code></th>\n<th><code>invalidates</code></th>\n</tr>\n</thead>\n<tbody><tr>\n<td>Means</td>\n<td>A later decision replaced this</td>\n<td>This entry&#39;s premise was false</td>\n</tr>\n<tr>\n<td>The original was</td>\n<td>Reasonable at the time</td>\n<td>Never sound</td>\n</tr>\n<tr>\n<td>Effect on descendants</td>\n<td>None</td>\n<td><strong>Suppressed, transitively</strong></td>\n</tr>\n<tr>\n<td>In a digest</td>\n<td><code>outcome reverted</code></td>\n<td><code>outcome invalidated</code></td>\n</tr>\n</tbody></table>\n<p>Invalidation propagates through <code>influences</code> links of type <code>journal</code>, walked at the\nprojection layer. If B records that it rests on A and A is invalidated, B goes too — and\nanything resting on B. That is the whole reason the two edges are separate: superseding\na decision does not cast doubt on the work built atop it, and invalidating one does.</p>\n<p>Record the edge with <code>--influence journal:&lt;role&gt;:&lt;id&gt;</code>. <code>agent-journal show</code> reports the\nresult: an entry that declared a dependence on an invalidated one reads\n<code>outcome: invalidated, live: false</code> without being named in the retraction.</p>\n<p>Neither edge deletes. Both are appended events that change how the record projects.</p>\n","words":1263},{"path":"references/retention-and-deletion.md","slug":"retention-and-deletion","title":"Retention and deletion: tombstones, compaction, and what each does not do","body":"# Retention and deletion: tombstones, compaction, and what each does not do\n\nThe journal is a grow-only set. Nothing in it edits or removes anything in place —\nthat is what makes concurrent writers safe with no locking and no coordination\n(spec §7.1). It is also the problem: in a grow-only set, erasure has no mechanism at\nall. A leaked secret and a named person are, by default, exactly as permanent as\neverything else, and a local delete only returns on the next union with a replica\nthat still has the bytes.\n\n`tombstone` and `compact` are the two commands that exist to answer that problem\nhonestly — one records the decision that something must not exist, the other is the\none place in this package that actually destroys bytes. Read this before reaching for\neither, and before assuming an anchor pointing at removed content still reads as\ntrustworthy.\n\n## Tombstoning is not retraction\n\nThis is the distinction most likely to get blurred in practice, so state the rule\nbefore anything else: **`invalidate` and `tombstone` answer two different questions,\nand an entry can need either, both, or neither.**\n\n- **Was the reasoning wrong?** → `invalidate`. The premise the entry rested on turned\n  out to be false. The content stays on disk, fully readable — `show` still renders\n  it, marked `outcome: invalidated, live: false` — and everything that declared a\n  dependence on it is suppressed too, transitively. `invalidate` takes no position on\n  whether the content itself is fit to exist; it says the conclusion was wrong.\n- **Must the content not exist?** → `tombstone`. A credential got logged into a\n  `rationale`. A `finding` named a real person. The reasoning could be entirely\n  sound — the entry could even still be live — and the content still has to go. A\n  tombstone takes no position on whether the reasoning was sound; it says the bytes\n  themselves cannot stay.\n\nNeither implies the other, and the CLI never reads one to decide the other. An entry\ncan be tombstoned without ever being invalidated: a decision was completely correct\nand still leaked a colleague's name in its rationale, and deleting that says nothing\nabout whether the decision was right. An entry can be invalidated without being\ntombstoned, and usually is: the reasoning was wrong, but nothing in it needs actual\nerasure, and keeping the wrong reasoning on disk — visibly marked wrong — is the audit\ntrail `invalidate` exists to leave. Reach for `invalidate` when a later reader should\nbe able to see *what was believed and why it was wrong*. Reach for `tombstone` when no\nreader should be able to see the content at all, regardless of whether it was right.\n\n## Recording a tombstone\n\n```bash\nagent-journal tombstone <target-id> --reason <why> --workspace <id>\n```\n\n`--reason` is required, and a blank or whitespace-only value is refused exactly like\na missing one — exit 2, nothing written. This is deliberate, not a bureaucratic\nformality: an unexplained tombstone is indistinguishable from a mistake. A reader six\nmonths later, looking at a gap where an entry used to be, has no way to tell a\nconsidered deletion from an accident unless the reason is right there.\n\n```bash\nagent-journal record --workspace retention-demo --kind finding --id f1 \\\n  --claim \"leaked a live API key in its rationale\"\nagent-journal tombstone f1 --reason \"leaked a live API key in its rationale\" --workspace retention-demo\n```\n\n```\nrecorded f1\ntombstoned f1\n```\n\nWhat this command does NOT do: **it purges nothing.** It appends one event — author\n`human`, no session, the same shape `invalidate` uses for a retraction recorded out of\nsession — recording `target`, `reason`, and `purged: false`. The target's bytes stay\nexactly where they were; `f1` is still fully readable at `agent-journal show\n--workspace retention-demo --id f1`. Recording the decision and destroying the content\nare two separate acts on purpose; `compact` is the only thing that can ever flip\n`purged` to `true`, and only once it has actually removed the bytes.\n\nThe suppression takes effect immediately, though, everywhere a tombstone is checked\nfor: `show` and `digest` stop rendering the target, and a `trace` lookup **by the\ntarget's own id or subject** stops matching. A tombstoned id is invisible to every\nread path in this package well before anything is physically deleted — `compact` only\ncatches up the disk to what every reader has already been shown. (Tracing by\nsomething else that cites the target is a different question — see \"An anchor citing\npurged content\" below, where the answer is more surprising than \"gone\".)\n\nTombstoning is append-only, same as `invalidate`: naming a target that matches\nnothing yet known in this workspace is not an error, because the target may simply\nlive in a segment this replica has not synced. It still records, with a warning:\n\n```bash\nagent-journal tombstone ghost --reason \"preemptive; the entry is coming from another replica\" --workspace retention-demo\n```\n\n```\ntombstoned ghost\n```\n```\nWARNING: no entry with id ghost is present in this workspace\n```\n\n## What a tombstone costs\n\nSay this plainly, because the design pays it knowingly rather than hiding it: writing\na tombstone **forfeits pure CRDT convergence.**\n\nSuppression is derived by scanning the events a reader actually has — a tombstone\nsuppresses its target only where the tombstone event itself has been read. **A\nreplica that never sees the tombstone keeps the bytes.** A segment sitting unsynced on\na laptop, a digest already committed before the tombstone was written, a transcript\nalready forwarded, a backup taken the day before — none of those un-happen because an\nevent was appended after the fact. The tombstone travels through the same append-only,\neventually-converging channel as everything else in this journal, and until it\narrives everywhere the content already reached, the content is still there.\n\nThat is the honest price, and §13.2 argues — correctly — that it is worth paying: an\nappend-only store that has no way to erase a secret or a named person at all is not\ndefensible at a multi-year horizon. The alternative to accepting this gap is not a\ncleaner design; it is pretending erasure is complete when it structurally cannot be.\nTaking the cost now, with the limit stated, is cheaper than discovering it later by\nsomeone finding the \"deleted\" secret in a stale replica.\n\n## `compact`: the one command that deletes\n\n```bash\nagent-journal compact --workspace <id> [--entry-ttl-days <n>] [--observation-ttl-days <n>] [--apply]\n```\n\nEverything else in this package only ever appends or reads. `compact` is the sole\nexception, and its defaults are built around that: **it is a dry run unless `--apply`\nis given.**\n\n```bash\nagent-journal compact --workspace retention-demo\n```\n\nWithout `--apply`, `compact` reads the journal, computes exactly what it would do,\nand prints that as a report — `expired`, `tombstoned`, `pinned`, `downgraded`,\n`unclassified`, `tombstonesMarkedPurged` — while changing not one byte on disk. Run it\nagain with `--apply` and the same purge actually happens.\n\nThe reason the default is a dry run, and not a confirmation prompt: `agent-journal`\nhas no session and no terminal to prompt in when it matters most. This is a command\nmeant to run from a hook or a CI job on a schedule, unattended, exactly where nothing\nis present to answer a prompt. A destructive command whose default behaviour is\nirreversible would either need a human standing by every time it runs, or it would\ntrain whoever wires the automation to pass `--apply` by reflex — at which point the\ndefault bought nothing. A dry-run default means the routine, unattended case is safe\nby construction, and destruction is something a caller has to ask for by name, every\ntime.\n\n`--apply` takes no value — it is the one bare boolean flag in this CLI (every other\nflag treats a missing value as an error, never a default, for the same reason\n`--workspace $WS` with an unset variable must not silently write to a workspace named\n`true`). `--apply true` or `--apply=maybe` is refused outright rather than guessed at:\n\n```\n--apply takes no value; pass it as a bare flag\n```\n\n### It refuses outright on a damaged journal\n\nBefore computing anything, `compact` reads the whole journal and checks for\nunreadable paths or malformed lines — the same damage `coverage`, `show` and `trace`\nalready detect. Where those three commands render what they could parse and warn that\nthe result is a floor, `compact` does neither. It refuses completely, exit 1, no\npartial purge, not even under `--apply`:\n\n```\nrefusing to compact: 1 unreadable path(s), 0 malformed line(s) -- compacting a\npartial view could destroy content whose tombstone status was never seen\n```\n\nThis is the most important guard in the command, and it exists for one reason: a\nsegment that failed to parse might be the one holding the tombstone that protects\nsomething, or holding the content a tombstone elsewhere already names. Compacting on\nan incomplete read cannot tell \"this id is safe to purge\" from \"this id would not be\nsafe to purge if the segment that says so had loaded\" — and unlike every other\ncommand's floor-not-total warning, there is no way to walk a purge back once the bytes\nare gone. Refusing outright is the only version of this command that cannot destroy\nthe wrong thing on a partial read.\n\n### The other exit 1: a segment somebody was writing to\n\n`compact --apply` also exits 1 when it left one or more segments alone because a\nsession kept appending to them while it worked:\n\n```\n1 segment(s) were being written during compaction and were left untouched;\nre-run when writers are idle\n```\n\n**Nothing was lost.** The report is printed as usual, with an added `skipped` array\nnaming the files, and the purge has not happened for those segments. Any tombstone\nwhose target still sits in one of them keeps `purged: false`, because the content is\nstill there. Re-run when the session finishes.\n\n**Some of it may be half-done, and the report says which half.** A run rewrites\nsegments one at a time, so a skip partway through leaves earlier ones already purged.\n`tombstonesMarkedPurged` lists only the tombstones this run actually flipped, and\n`skipped` lists what it did not reach — read them together rather than assuming the\nrun was all-or-nothing.\n\nOne consequence worth knowing, and it is permanent: if a target's own segment was\npurged but the segment holding its *tombstone* was skipped, the bytes are gone while\nthat tombstone reads `purged: false` — **and no later run will ever correct it.**\nOnce the target's bytes are gone it is no longer in the journal, so nothing plans a\npurge for it, and nothing flips the flag. That tombstone reads `purged: false`\nforever, for content that really was erased.\n\nThe suppression is unaffected — the entry stays invisible either way — and the error\nis in the safe direction: `purged` never claims more than happened, only ever less.\nBut `false` on this flag means \"not known to be purged\", not \"still on disk\", and\nthis is the one case where those differ. To settle it, check the target's absence\nwith `agent-journal show` rather than trusting the flag.\n\nWhy it cannot simply be fixed: a later run sees only that the target is absent, and\nabsent has two causes it cannot tell apart — purged here, or never present on this\nreplica at all. Flipping the flag on absence alone would make it claim an erasure\nthat may never have happened, which is the failure this whole design is built to\navoid. A permanently conservative flag is the lesser of the two.\n\nTwo exit codes for two different conditions, and they are worth telling apart in a\nCI job: the damaged-journal refusal above means **stop and investigate** — something\nis wrong with the journal. This one means **try again later** — everything is fine,\nthe journal was simply busy. A job that treats every non-zero exit as a failure will\nalarm on the second, which is a normal outcome of running compaction against a\njournal that is actively in use — the exact thing the schedule above recommends.\n\nWhy skip rather than push through: a segment only ever grows, so a change in its size\nmid-compaction means an append landed. Rewriting it from the copy read a moment\nearlier would erase those events. The earlier version of this command did exactly\nthat, and a writer appending during a large compaction lost 27 of 73 events, silently\nand at exit 0.\n\n### What gets purged, and what never does\n\nA run purges exactly two sets: entries and observations that fell past their TTL\n(`expired`), and ids named by a well-formed tombstone found in the journal\n(`tombstoned`). The tombstone **events** themselves are never in either set — a\ntombstone is the record that a deletion happened, not the deletion's own target, and\nageing it out would silently un-delete its target the next time a replica reads a\nsegment that no longer carries a live tombstone for it.\n\nWhat happens to a tombstone event instead: `--apply` flips its `data.purged` field\nfrom `false` to `true`, but only for a tombstone whose *target was actually removed\nthis run*. A tombstone naming a target that never existed on this replica — the\n`ghost` example above — keeps `purged: false` forever, because nothing was ever there\nto purge for it. Flipping every tombstone's flag unconditionally would claim a\ndestruction that never happened.\n\n```bash\nagent-journal compact --workspace retention-demo --apply\n```\n\n```json\n{\n  \"apply\": true,\n  \"entryTtlDays\": null,\n  \"observationTtlDays\": null,\n  \"expired\": [],\n  \"tombstoned\": [\"f1\"],\n  \"pinned\": [],\n  \"downgraded\": [],\n  \"unclassified\": [],\n  \"tombstonesMarkedPurged\": [\"30164070-7cc6-4225-8995-95189689762b\"]\n}\n```\n\n(The dry run above prints the identical report — `apply: false` aside — because a dry\nrun computes the same plan; only `--apply` acts on it. The one divergence is a run\nthat skips a segment: a dry run has nothing to skip, so it lists everything it\n*would* do, while `--apply` reports what it *did*. `tombstonesMarkedPurged` names\nthe tombstone **event's own id**, generated by `tombstone`, not `f1` — a real run\nprints whatever id that command reported when it wrote the event.)\n\n## Why entries expire at all\n\nThrough the first five plans of this design, entries were kept forever and only\nobservations aged out. §13.2 names that plainly for what it was: *\"'Kept\nindefinitely' was a volume decision masquerading as a policy.\"* Entries are cheap in\nbytes compared to observations, so \"keep every entry\" was easy to default to — but\ncheap-to-store is not the same claim as should-be-permanent, and a journal that never\nlets an entry go accumulates every stale assumption and every abandoned line of\nreasoning right alongside what still matters, forever.\n\n`compact` now takes an independent TTL for each axis:\n\n```bash\nagent-journal compact --workspace retention-demo --entry-ttl-days 180 --observation-ttl-days 30 --apply\n```\n\nThe two windows are genuinely independent — entries commonly need to live far longer\nthan the tool calls that produced them, which is the whole reason `entryTtlMs` and\n`observationTtlMs` are two separate options rather than one applied twice. **Omit\neither flag and that axis never expires** — not \"expire everything,\" the opposite. A\n`compact --apply` run with no TTL flags at all purges only tombstoned content and\ntouches nothing for age, however old it is. The actual number of days on either axis\nis still an open question this design has not settled (§17.2) — what shipped here is\nthe mechanism, symmetric on both axes, not a chosen default. A caller has to pick the\nnumber and say so explicitly, every run.\n\n## Pinning: an anchor can keep evidence past its own window — until the entry citing it expires too\n\n§6.3's base rule: observations age out on the configured window. Its exception is not\noptional — **an observation cited by a live entry's `--anchor` is pinned, and survives\nits own TTL** for as long as that citation stands. Without this, \"age out\nobservations, keep entries forever\" quietly deleted the proof and kept the assertion:\nevery anchor became a citation to nothing, still rendering as if it were anchored.\n\n```bash\nagent-journal observe --workspace retention-demo --kind tool_call --id obs-migrate \\\n  --tool Bash --callId call-1\nagent-journal record --workspace retention-demo --kind decision --id d-migrate \\\n  --question \"how do we backfill the new column?\" \\\n  --chosen \"a one-off script run under a maintenance window\" \\\n  --anchor tool_use:obs-migrate\nagent-journal compact --workspace retention-demo --observation-ttl-days 0 --apply\n```\n\n```json\n{ \"expired\": [], \"pinned\": [\"obs-migrate\"], \"tombstoned\": [], \"downgraded\": [] }\n```\n\n`--observation-ttl-days 0` is the shortest real window there is — everything already\non disk is, by definition, at least a few milliseconds older than \"now\", so a `0`\nmeans every unpinned observation is due for expiry the instant this runs, no waiting\nrequired. `obs-migrate` survives it anyway, because `d-migrate` is live (its own\n`--entry-ttl-days` was omitted, so it never expires on its own) and cites it.\n\nThe second half of this rule is what entry TTL adds, and it is easy to miss: **an\nentry that has itself expired stops pinning what it cited.** Only entries that survive\nthe entry-TTL pass — not invalidated, not tombstoned, not itself past its own\n`entry-ttl-days` — contribute a pin. This was not in the original §6.3, written when\nentries never expired; leaving it out once entries could expire would have made entry\nretention nearly pointless. Observations outweigh entries by roughly 100× (§6.3's own\nfigure — a busy session is 500–2000 tool calls against 5–20 entries), so an expired\nentry that still pinned its anchors forever would free about a hundredth of what\nexpiring it implies, and the very observations an old decision justified would outlive\nevery decision that justified them.\n\n```bash\nagent-journal compact --workspace retention-demo --entry-ttl-days 0 --observation-ttl-days 0 --apply\n```\n\n```json\n{ \"expired\": [\"obs-migrate\", \"d-migrate\"], \"pinned\": [], \"tombstoned\": [], \"downgraded\": [] }\n```\n\nGive entries a same-instant window too, and `d-migrate` now falls outside its own\nwindow on this run — it stops contributing a pin, and `obs-migrate`, no longer\nprotected by anything, is purged alongside it. In practice the two TTLs are set to\nrealistic, very different numbers (entries living far longer than the tool calls that\nproduced them); `0` here exists only to make the mechanism reproducible without\nwaiting for a real window to pass. Had some *other*, still-live entry also anchored\n`obs-migrate`, that citation would have kept it pinned on its own, regardless of what\nhappened to `d-migrate`.\n\nOne ordering detail worth knowing: tombstone suppression is checked before the pin\ncheck, for every kind of event, not only observations. A pinned-and-tombstoned\nobservation is still purged. Citing a leaked credential in an anchor is not a way to\nmake it permanent.\n\n## An anchor citing purged content reads as `unknown`, never as intact\n\n§6.3: where an anchor's referent is genuinely gone, the anchor is downgraded to\n`unknown` in the §4.3 `known | unknown` vocabulary — an anchor that proves nothing is\nnever allowed to render as if it still proved something.\n\nConcretely, in this package: `compact`'s own report is where that downgrade is made\nvisible. Its `downgraded` field lists the ids of entries — still live, still on\ndisk — whose anchors reference something *this run* is removing, whether that\nreferent was tombstoned or simply aged past its TTL. A tombstoned referent is the\nreliable way to see it, because — as the pinning section above just established — a\n*live* entry's own citation protects its target from ordinary TTL expiry; the only\nway to remove something a live entry still cites is to name it directly:\n\n```bash\nagent-journal observe --workspace retention-demo --kind tool_call --id obs-vendor-call \\\n  --tool Bash --callId call-2\nagent-journal record --workspace retention-demo --kind finding --id f-vendor-latency \\\n  --claim \"the vendor call adds 40ms p50\" \\\n  --anchor tool_use:obs-vendor-call\nagent-journal tombstone obs-vendor-call --reason \"the callId embeds an internal vendor account id\" --workspace retention-demo\nagent-journal compact --workspace retention-demo --apply\n```\n\n```json\n{ \"expired\": [], \"tombstoned\": [\"obs-vendor-call\"], \"downgraded\": [\"f-vendor-latency\"] }\n```\n\n`compact` does not rewrite `f-vendor-latency`'s stored anchor — its `data.anchors`\nstill names `obs-vendor-call`, verbatim, and `f-vendor-latency` is still fully live.\nThe `downgraded` list is what tells a human reading the report which *still-live*\nentries are now carrying a reference like that, so it does not have to be\nrediscovered by noticing a dangling id by hand. Read a name in `downgraded` as *this\nclaim's evidence is gone*, never as *this claim is intact* — the entry itself is\nunchanged and still renders with whatever confidence it originally stated, so nothing\nabout its own text signals the loss on its own.\n\nWhat \"the reference resolves to nothing\" actually means is narrower than it sounds,\nand worth being exact about, because the obvious guess is wrong:\n\n```bash\nagent-journal show --workspace retention-demo --id obs-vendor-call\n```\n\n```json\n{ \"entries\": [], \"liveConstraints\": [], \"unreadable\": [], \"malformed\": [] }\n```\n\nThat much matches the obvious guess — `obs-vendor-call` no longer exists as an event,\nso asking for it *by its own id* finds nothing. But:\n\n```bash\nagent-journal trace obs-vendor-call --workspace retention-demo\n```\n\n```json\n{ \"matched\": [{ \"id\": \"f-vendor-latency\", \"via\": \"anchor\" }], \"chain\": [ { \"id\": \"f-vendor-latency\", \"via\": null } ] }\n```\n\n`trace` still finds `f-vendor-latency` — via `anchor`, not via `id`. `trace` indexes\nthe *strings* entries wrote down, and `f-vendor-latency`'s anchor still literally\ncontains the text `obs-vendor-call`; nothing rewrote it, so the string is still there\nto search for. This is arguably the more useful behaviour, not a bug: it is exactly\nhow a reader stumbles onto `downgraded`-style damage without already knowing to look\nfor it — search for the id you have, and the citing entry turns up on its own. Do not\nread a `trace` hit as evidence the target survived; read `via: \"anchor\"` pointing at\nan id `show --id` cannot find as the downgrade made visible a second way.\n\nTwo honest limits worth knowing before leaning on this field:\n\n- It is computed fresh each run, from what *that* run purges. An id already purged in\n  an earlier `compact --apply` is simply absent from the events this run reads — no\n  different, from where retention sits, than an id in a segment nobody loaded. That\n  case is deliberately not reported here a second time; re-validating every anchor in\n  the journal against everything ever purged is `decay`'s whole-journal job, not a\n  side effect of compaction.\n- `agent-journal coverage` and `agent-journal digest`, run on their own, do not surface\n  this. Their `downgradedAnchors` field reads `null` — not assessed — because neither\n  command runs a retention pass; nothing today wires `compact`'s findings into them.\n  The place this actually surfaces today is `compact`'s own report, dry run or\n  applied.\n","bodyHtml":"<h2 id=\"retention-and-deletion-tombstones-compaction-and-what-each-does-not-do\">Retention and deletion: tombstones, compaction, and what each does not do</h2>\n<p>The journal is a grow-only set. Nothing in it edits or removes anything in place —\nthat is what makes concurrent writers safe with no locking and no coordination\n(spec §7.1). It is also the problem: in a grow-only set, erasure has no mechanism at\nall. A leaked secret and a named person are, by default, exactly as permanent as\neverything else, and a local delete only returns on the next union with a replica\nthat still has the bytes.</p>\n<p><code>tombstone</code> and <code>compact</code> are the two commands that exist to answer that problem\nhonestly — one records the decision that something must not exist, the other is the\none place in this package that actually destroys bytes. Read this before reaching for\neither, and before assuming an anchor pointing at removed content still reads as\ntrustworthy.</p>\n<h3 id=\"tombstoning-is-not-retraction\">Tombstoning is not retraction</h3>\n<p>This is the distinction most likely to get blurred in practice, so state the rule\nbefore anything else: <strong><code>invalidate</code> and <code>tombstone</code> answer two different questions,\nand an entry can need either, both, or neither.</strong></p>\n<ul>\n<li><strong>Was the reasoning wrong?</strong> → <code>invalidate</code>. The premise the entry rested on turned\nout to be false. The content stays on disk, fully readable — <code>show</code> still renders\nit, marked <code>outcome: invalidated, live: false</code> — and everything that declared a\ndependence on it is suppressed too, transitively. <code>invalidate</code> takes no position on\nwhether the content itself is fit to exist; it says the conclusion was wrong.</li>\n<li><strong>Must the content not exist?</strong> → <code>tombstone</code>. A credential got logged into a\n<code>rationale</code>. A <code>finding</code> named a real person. The reasoning could be entirely\nsound — the entry could even still be live — and the content still has to go. A\ntombstone takes no position on whether the reasoning was sound; it says the bytes\nthemselves cannot stay.</li>\n</ul>\n<p>Neither implies the other, and the CLI never reads one to decide the other. An entry\ncan be tombstoned without ever being invalidated: a decision was completely correct\nand still leaked a colleague&#39;s name in its rationale, and deleting that says nothing\nabout whether the decision was right. An entry can be invalidated without being\ntombstoned, and usually is: the reasoning was wrong, but nothing in it needs actual\nerasure, and keeping the wrong reasoning on disk — visibly marked wrong — is the audit\ntrail <code>invalidate</code> exists to leave. Reach for <code>invalidate</code> when a later reader should\nbe able to see <em>what was believed and why it was wrong</em>. Reach for <code>tombstone</code> when no\nreader should be able to see the content at all, regardless of whether it was right.</p>\n<h3 id=\"recording-a-tombstone\">Recording a tombstone</h3>\n<pre><code class=\"language-bash\">agent-journal tombstone &lt;target-id&gt; --reason &lt;why&gt; --workspace &lt;id&gt;\n</code></pre>\n<p><code>--reason</code> is required, and a blank or whitespace-only value is refused exactly like\na missing one — exit 2, nothing written. This is deliberate, not a bureaucratic\nformality: an unexplained tombstone is indistinguishable from a mistake. A reader six\nmonths later, looking at a gap where an entry used to be, has no way to tell a\nconsidered deletion from an accident unless the reason is right there.</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace retention-demo --kind finding --id f1 \\\n  --claim &quot;leaked a live API key in its rationale&quot;\nagent-journal tombstone f1 --reason &quot;leaked a live API key in its rationale&quot; --workspace retention-demo\n</code></pre>\n<pre><code>recorded f1\ntombstoned f1\n</code></pre>\n<p>What this command does NOT do: <strong>it purges nothing.</strong> It appends one event — author\n<code>human</code>, no session, the same shape <code>invalidate</code> uses for a retraction recorded out of\nsession — recording <code>target</code>, <code>reason</code>, and <code>purged: false</code>. The target&#39;s bytes stay\nexactly where they were; <code>f1</code> is still fully readable at <code>agent-journal show --workspace retention-demo --id f1</code>. Recording the decision and destroying the content\nare two separate acts on purpose; <code>compact</code> is the only thing that can ever flip\n<code>purged</code> to <code>true</code>, and only once it has actually removed the bytes.</p>\n<p>The suppression takes effect immediately, though, everywhere a tombstone is checked\nfor: <code>show</code> and <code>digest</code> stop rendering the target, and a <code>trace</code> lookup <strong>by the\ntarget&#39;s own id or subject</strong> stops matching. A tombstoned id is invisible to every\nread path in this package well before anything is physically deleted — <code>compact</code> only\ncatches up the disk to what every reader has already been shown. (Tracing by\nsomething else that cites the target is a different question — see &quot;An anchor citing\npurged content&quot; below, where the answer is more surprising than &quot;gone&quot;.)</p>\n<p>Tombstoning is append-only, same as <code>invalidate</code>: naming a target that matches\nnothing yet known in this workspace is not an error, because the target may simply\nlive in a segment this replica has not synced. It still records, with a warning:</p>\n<pre><code class=\"language-bash\">agent-journal tombstone ghost --reason &quot;preemptive; the entry is coming from another replica&quot; --workspace retention-demo\n</code></pre>\n<pre><code>tombstoned ghost\n</code></pre>\n<pre><code>WARNING: no entry with id ghost is present in this workspace\n</code></pre>\n<h3 id=\"what-a-tombstone-costs\">What a tombstone costs</h3>\n<p>Say this plainly, because the design pays it knowingly rather than hiding it: writing\na tombstone <strong>forfeits pure CRDT convergence.</strong></p>\n<p>Suppression is derived by scanning the events a reader actually has — a tombstone\nsuppresses its target only where the tombstone event itself has been read. <strong>A\nreplica that never sees the tombstone keeps the bytes.</strong> A segment sitting unsynced on\na laptop, a digest already committed before the tombstone was written, a transcript\nalready forwarded, a backup taken the day before — none of those un-happen because an\nevent was appended after the fact. The tombstone travels through the same append-only,\neventually-converging channel as everything else in this journal, and until it\narrives everywhere the content already reached, the content is still there.</p>\n<p>That is the honest price, and §13.2 argues — correctly — that it is worth paying: an\nappend-only store that has no way to erase a secret or a named person at all is not\ndefensible at a multi-year horizon. The alternative to accepting this gap is not a\ncleaner design; it is pretending erasure is complete when it structurally cannot be.\nTaking the cost now, with the limit stated, is cheaper than discovering it later by\nsomeone finding the &quot;deleted&quot; secret in a stale replica.</p>\n<h3 id=\"compact-the-one-command-that-deletes\"><code>compact</code>: the one command that deletes</h3>\n<pre><code class=\"language-bash\">agent-journal compact --workspace &lt;id&gt; [--entry-ttl-days &lt;n&gt;] [--observation-ttl-days &lt;n&gt;] [--apply]\n</code></pre>\n<p>Everything else in this package only ever appends or reads. <code>compact</code> is the sole\nexception, and its defaults are built around that: <strong>it is a dry run unless <code>--apply</code>\nis given.</strong></p>\n<pre><code class=\"language-bash\">agent-journal compact --workspace retention-demo\n</code></pre>\n<p>Without <code>--apply</code>, <code>compact</code> reads the journal, computes exactly what it would do,\nand prints that as a report — <code>expired</code>, <code>tombstoned</code>, <code>pinned</code>, <code>downgraded</code>,\n<code>unclassified</code>, <code>tombstonesMarkedPurged</code> — while changing not one byte on disk. Run it\nagain with <code>--apply</code> and the same purge actually happens.</p>\n<p>The reason the default is a dry run, and not a confirmation prompt: <code>agent-journal</code>\nhas no session and no terminal to prompt in when it matters most. This is a command\nmeant to run from a hook or a CI job on a schedule, unattended, exactly where nothing\nis present to answer a prompt. A destructive command whose default behaviour is\nirreversible would either need a human standing by every time it runs, or it would\ntrain whoever wires the automation to pass <code>--apply</code> by reflex — at which point the\ndefault bought nothing. A dry-run default means the routine, unattended case is safe\nby construction, and destruction is something a caller has to ask for by name, every\ntime.</p>\n<p><code>--apply</code> takes no value — it is the one bare boolean flag in this CLI (every other\nflag treats a missing value as an error, never a default, for the same reason\n<code>--workspace $WS</code> with an unset variable must not silently write to a workspace named\n<code>true</code>). <code>--apply true</code> or <code>--apply=maybe</code> is refused outright rather than guessed at:</p>\n<pre><code>--apply takes no value; pass it as a bare flag\n</code></pre>\n<h4 id=\"it-refuses-outright-on-a-damaged-journal\">It refuses outright on a damaged journal</h4>\n<p>Before computing anything, <code>compact</code> reads the whole journal and checks for\nunreadable paths or malformed lines — the same damage <code>coverage</code>, <code>show</code> and <code>trace</code>\nalready detect. Where those three commands render what they could parse and warn that\nthe result is a floor, <code>compact</code> does neither. It refuses completely, exit 1, no\npartial purge, not even under <code>--apply</code>:</p>\n<pre><code>refusing to compact: 1 unreadable path(s), 0 malformed line(s) -- compacting a\npartial view could destroy content whose tombstone status was never seen\n</code></pre>\n<p>This is the most important guard in the command, and it exists for one reason: a\nsegment that failed to parse might be the one holding the tombstone that protects\nsomething, or holding the content a tombstone elsewhere already names. Compacting on\nan incomplete read cannot tell &quot;this id is safe to purge&quot; from &quot;this id would not be\nsafe to purge if the segment that says so had loaded&quot; — and unlike every other\ncommand&#39;s floor-not-total warning, there is no way to walk a purge back once the bytes\nare gone. Refusing outright is the only version of this command that cannot destroy\nthe wrong thing on a partial read.</p>\n<h4 id=\"the-other-exit-1-a-segment-somebody-was-writing-to\">The other exit 1: a segment somebody was writing to</h4>\n<p><code>compact --apply</code> also exits 1 when it left one or more segments alone because a\nsession kept appending to them while it worked:</p>\n<pre><code>1 segment(s) were being written during compaction and were left untouched;\nre-run when writers are idle\n</code></pre>\n<p><strong>Nothing was lost.</strong> The report is printed as usual, with an added <code>skipped</code> array\nnaming the files, and the purge has not happened for those segments. Any tombstone\nwhose target still sits in one of them keeps <code>purged: false</code>, because the content is\nstill there. Re-run when the session finishes.</p>\n<p><strong>Some of it may be half-done, and the report says which half.</strong> A run rewrites\nsegments one at a time, so a skip partway through leaves earlier ones already purged.\n<code>tombstonesMarkedPurged</code> lists only the tombstones this run actually flipped, and\n<code>skipped</code> lists what it did not reach — read them together rather than assuming the\nrun was all-or-nothing.</p>\n<p>One consequence worth knowing, and it is permanent: if a target&#39;s own segment was\npurged but the segment holding its <em>tombstone</em> was skipped, the bytes are gone while\nthat tombstone reads <code>purged: false</code> — <strong>and no later run will ever correct it.</strong>\nOnce the target&#39;s bytes are gone it is no longer in the journal, so nothing plans a\npurge for it, and nothing flips the flag. That tombstone reads <code>purged: false</code>\nforever, for content that really was erased.</p>\n<p>The suppression is unaffected — the entry stays invisible either way — and the error\nis in the safe direction: <code>purged</code> never claims more than happened, only ever less.\nBut <code>false</code> on this flag means &quot;not known to be purged&quot;, not &quot;still on disk&quot;, and\nthis is the one case where those differ. To settle it, check the target&#39;s absence\nwith <code>agent-journal show</code> rather than trusting the flag.</p>\n<p>Why it cannot simply be fixed: a later run sees only that the target is absent, and\nabsent has two causes it cannot tell apart — purged here, or never present on this\nreplica at all. Flipping the flag on absence alone would make it claim an erasure\nthat may never have happened, which is the failure this whole design is built to\navoid. A permanently conservative flag is the lesser of the two.</p>\n<p>Two exit codes for two different conditions, and they are worth telling apart in a\nCI job: the damaged-journal refusal above means <strong>stop and investigate</strong> — something\nis wrong with the journal. This one means <strong>try again later</strong> — everything is fine,\nthe journal was simply busy. A job that treats every non-zero exit as a failure will\nalarm on the second, which is a normal outcome of running compaction against a\njournal that is actively in use — the exact thing the schedule above recommends.</p>\n<p>Why skip rather than push through: a segment only ever grows, so a change in its size\nmid-compaction means an append landed. Rewriting it from the copy read a moment\nearlier would erase those events. The earlier version of this command did exactly\nthat, and a writer appending during a large compaction lost 27 of 73 events, silently\nand at exit 0.</p>\n<h4 id=\"what-gets-purged-and-what-never-does\">What gets purged, and what never does</h4>\n<p>A run purges exactly two sets: entries and observations that fell past their TTL\n(<code>expired</code>), and ids named by a well-formed tombstone found in the journal\n(<code>tombstoned</code>). The tombstone <strong>events</strong> themselves are never in either set — a\ntombstone is the record that a deletion happened, not the deletion&#39;s own target, and\nageing it out would silently un-delete its target the next time a replica reads a\nsegment that no longer carries a live tombstone for it.</p>\n<p>What happens to a tombstone event instead: <code>--apply</code> flips its <code>data.purged</code> field\nfrom <code>false</code> to <code>true</code>, but only for a tombstone whose <em>target was actually removed\nthis run</em>. A tombstone naming a target that never existed on this replica — the\n<code>ghost</code> example above — keeps <code>purged: false</code> forever, because nothing was ever there\nto purge for it. Flipping every tombstone&#39;s flag unconditionally would claim a\ndestruction that never happened.</p>\n<pre><code class=\"language-bash\">agent-journal compact --workspace retention-demo --apply\n</code></pre>\n<pre><code class=\"language-json\">{\n  &quot;apply&quot;: true,\n  &quot;entryTtlDays&quot;: null,\n  &quot;observationTtlDays&quot;: null,\n  &quot;expired&quot;: [],\n  &quot;tombstoned&quot;: [&quot;f1&quot;],\n  &quot;pinned&quot;: [],\n  &quot;downgraded&quot;: [],\n  &quot;unclassified&quot;: [],\n  &quot;tombstonesMarkedPurged&quot;: [&quot;30164070-7cc6-4225-8995-95189689762b&quot;]\n}\n</code></pre>\n<p>(The dry run above prints the identical report — <code>apply: false</code> aside — because a dry\nrun computes the same plan; only <code>--apply</code> acts on it. The one divergence is a run\nthat skips a segment: a dry run has nothing to skip, so it lists everything it\n<em>would</em> do, while <code>--apply</code> reports what it <em>did</em>. <code>tombstonesMarkedPurged</code> names\nthe tombstone <strong>event&#39;s own id</strong>, generated by <code>tombstone</code>, not <code>f1</code> — a real run\nprints whatever id that command reported when it wrote the event.)</p>\n<h3 id=\"why-entries-expire-at-all\">Why entries expire at all</h3>\n<p>Through the first five plans of this design, entries were kept forever and only\nobservations aged out. §13.2 names that plainly for what it was: <em>&quot;&#39;Kept\nindefinitely&#39; was a volume decision masquerading as a policy.&quot;</em> Entries are cheap in\nbytes compared to observations, so &quot;keep every entry&quot; was easy to default to — but\ncheap-to-store is not the same claim as should-be-permanent, and a journal that never\nlets an entry go accumulates every stale assumption and every abandoned line of\nreasoning right alongside what still matters, forever.</p>\n<p><code>compact</code> now takes an independent TTL for each axis:</p>\n<pre><code class=\"language-bash\">agent-journal compact --workspace retention-demo --entry-ttl-days 180 --observation-ttl-days 30 --apply\n</code></pre>\n<p>The two windows are genuinely independent — entries commonly need to live far longer\nthan the tool calls that produced them, which is the whole reason <code>entryTtlMs</code> and\n<code>observationTtlMs</code> are two separate options rather than one applied twice. <strong>Omit\neither flag and that axis never expires</strong> — not &quot;expire everything,&quot; the opposite. A\n<code>compact --apply</code> run with no TTL flags at all purges only tombstoned content and\ntouches nothing for age, however old it is. The actual number of days on either axis\nis still an open question this design has not settled (§17.2) — what shipped here is\nthe mechanism, symmetric on both axes, not a chosen default. A caller has to pick the\nnumber and say so explicitly, every run.</p>\n<h3 id=\"pinning-an-anchor-can-keep-evidence-past-its-own-window-until-the-entry-citing-it-expires-too\">Pinning: an anchor can keep evidence past its own window — until the entry citing it expires too</h3>\n<p>§6.3&#39;s base rule: observations age out on the configured window. Its exception is not\noptional — <strong>an observation cited by a live entry&#39;s <code>--anchor</code> is pinned, and survives\nits own TTL</strong> for as long as that citation stands. Without this, &quot;age out\nobservations, keep entries forever&quot; quietly deleted the proof and kept the assertion:\nevery anchor became a citation to nothing, still rendering as if it were anchored.</p>\n<pre><code class=\"language-bash\">agent-journal observe --workspace retention-demo --kind tool_call --id obs-migrate \\\n  --tool Bash --callId call-1\nagent-journal record --workspace retention-demo --kind decision --id d-migrate \\\n  --question &quot;how do we backfill the new column?&quot; \\\n  --chosen &quot;a one-off script run under a maintenance window&quot; \\\n  --anchor tool_use:obs-migrate\nagent-journal compact --workspace retention-demo --observation-ttl-days 0 --apply\n</code></pre>\n<pre><code class=\"language-json\">{ &quot;expired&quot;: [], &quot;pinned&quot;: [&quot;obs-migrate&quot;], &quot;tombstoned&quot;: [], &quot;downgraded&quot;: [] }\n</code></pre>\n<p><code>--observation-ttl-days 0</code> is the shortest real window there is — everything already\non disk is, by definition, at least a few milliseconds older than &quot;now&quot;, so a <code>0</code>\nmeans every unpinned observation is due for expiry the instant this runs, no waiting\nrequired. <code>obs-migrate</code> survives it anyway, because <code>d-migrate</code> is live (its own\n<code>--entry-ttl-days</code> was omitted, so it never expires on its own) and cites it.</p>\n<p>The second half of this rule is what entry TTL adds, and it is easy to miss: <strong>an\nentry that has itself expired stops pinning what it cited.</strong> Only entries that survive\nthe entry-TTL pass — not invalidated, not tombstoned, not itself past its own\n<code>entry-ttl-days</code> — contribute a pin. This was not in the original §6.3, written when\nentries never expired; leaving it out once entries could expire would have made entry\nretention nearly pointless. Observations outweigh entries by roughly 100× (§6.3&#39;s own\nfigure — a busy session is 500–2000 tool calls against 5–20 entries), so an expired\nentry that still pinned its anchors forever would free about a hundredth of what\nexpiring it implies, and the very observations an old decision justified would outlive\nevery decision that justified them.</p>\n<pre><code class=\"language-bash\">agent-journal compact --workspace retention-demo --entry-ttl-days 0 --observation-ttl-days 0 --apply\n</code></pre>\n<pre><code class=\"language-json\">{ &quot;expired&quot;: [&quot;obs-migrate&quot;, &quot;d-migrate&quot;], &quot;pinned&quot;: [], &quot;tombstoned&quot;: [], &quot;downgraded&quot;: [] }\n</code></pre>\n<p>Give entries a same-instant window too, and <code>d-migrate</code> now falls outside its own\nwindow on this run — it stops contributing a pin, and <code>obs-migrate</code>, no longer\nprotected by anything, is purged alongside it. In practice the two TTLs are set to\nrealistic, very different numbers (entries living far longer than the tool calls that\nproduced them); <code>0</code> here exists only to make the mechanism reproducible without\nwaiting for a real window to pass. Had some <em>other</em>, still-live entry also anchored\n<code>obs-migrate</code>, that citation would have kept it pinned on its own, regardless of what\nhappened to <code>d-migrate</code>.</p>\n<p>One ordering detail worth knowing: tombstone suppression is checked before the pin\ncheck, for every kind of event, not only observations. A pinned-and-tombstoned\nobservation is still purged. Citing a leaked credential in an anchor is not a way to\nmake it permanent.</p>\n<h3 id=\"an-anchor-citing-purged-content-reads-as-unknown-never-as-intact\">An anchor citing purged content reads as <code>unknown</code>, never as intact</h3>\n<p>§6.3: where an anchor&#39;s referent is genuinely gone, the anchor is downgraded to\n<code>unknown</code> in the §4.3 <code>known | unknown</code> vocabulary — an anchor that proves nothing is\nnever allowed to render as if it still proved something.</p>\n<p>Concretely, in this package: <code>compact</code>&#39;s own report is where that downgrade is made\nvisible. Its <code>downgraded</code> field lists the ids of entries — still live, still on\ndisk — whose anchors reference something <em>this run</em> is removing, whether that\nreferent was tombstoned or simply aged past its TTL. A tombstoned referent is the\nreliable way to see it, because — as the pinning section above just established — a\n<em>live</em> entry&#39;s own citation protects its target from ordinary TTL expiry; the only\nway to remove something a live entry still cites is to name it directly:</p>\n<pre><code class=\"language-bash\">agent-journal observe --workspace retention-demo --kind tool_call --id obs-vendor-call \\\n  --tool Bash --callId call-2\nagent-journal record --workspace retention-demo --kind finding --id f-vendor-latency \\\n  --claim &quot;the vendor call adds 40ms p50&quot; \\\n  --anchor tool_use:obs-vendor-call\nagent-journal tombstone obs-vendor-call --reason &quot;the callId embeds an internal vendor account id&quot; --workspace retention-demo\nagent-journal compact --workspace retention-demo --apply\n</code></pre>\n<pre><code class=\"language-json\">{ &quot;expired&quot;: [], &quot;tombstoned&quot;: [&quot;obs-vendor-call&quot;], &quot;downgraded&quot;: [&quot;f-vendor-latency&quot;] }\n</code></pre>\n<p><code>compact</code> does not rewrite <code>f-vendor-latency</code>&#39;s stored anchor — its <code>data.anchors</code>\nstill names <code>obs-vendor-call</code>, verbatim, and <code>f-vendor-latency</code> is still fully live.\nThe <code>downgraded</code> list is what tells a human reading the report which <em>still-live</em>\nentries are now carrying a reference like that, so it does not have to be\nrediscovered by noticing a dangling id by hand. Read a name in <code>downgraded</code> as <em>this\nclaim&#39;s evidence is gone</em>, never as <em>this claim is intact</em> — the entry itself is\nunchanged and still renders with whatever confidence it originally stated, so nothing\nabout its own text signals the loss on its own.</p>\n<p>What &quot;the reference resolves to nothing&quot; actually means is narrower than it sounds,\nand worth being exact about, because the obvious guess is wrong:</p>\n<pre><code class=\"language-bash\">agent-journal show --workspace retention-demo --id obs-vendor-call\n</code></pre>\n<pre><code class=\"language-json\">{ &quot;entries&quot;: [], &quot;liveConstraints&quot;: [], &quot;unreadable&quot;: [], &quot;malformed&quot;: [] }\n</code></pre>\n<p>That much matches the obvious guess — <code>obs-vendor-call</code> no longer exists as an event,\nso asking for it <em>by its own id</em> finds nothing. But:</p>\n<pre><code class=\"language-bash\">agent-journal trace obs-vendor-call --workspace retention-demo\n</code></pre>\n<pre><code class=\"language-json\">{ &quot;matched&quot;: [{ &quot;id&quot;: &quot;f-vendor-latency&quot;, &quot;via&quot;: &quot;anchor&quot; }], &quot;chain&quot;: [ { &quot;id&quot;: &quot;f-vendor-latency&quot;, &quot;via&quot;: null } ] }\n</code></pre>\n<p><code>trace</code> still finds <code>f-vendor-latency</code> — via <code>anchor</code>, not via <code>id</code>. <code>trace</code> indexes\nthe <em>strings</em> entries wrote down, and <code>f-vendor-latency</code>&#39;s anchor still literally\ncontains the text <code>obs-vendor-call</code>; nothing rewrote it, so the string is still there\nto search for. This is arguably the more useful behaviour, not a bug: it is exactly\nhow a reader stumbles onto <code>downgraded</code>-style damage without already knowing to look\nfor it — search for the id you have, and the citing entry turns up on its own. Do not\nread a <code>trace</code> hit as evidence the target survived; read <code>via: &quot;anchor&quot;</code> pointing at\nan id <code>show --id</code> cannot find as the downgrade made visible a second way.</p>\n<p>Two honest limits worth knowing before leaning on this field:</p>\n<ul>\n<li>It is computed fresh each run, from what <em>that</em> run purges. An id already purged in\nan earlier <code>compact --apply</code> is simply absent from the events this run reads — no\ndifferent, from where retention sits, than an id in a segment nobody loaded. That\ncase is deliberately not reported here a second time; re-validating every anchor in\nthe journal against everything ever purged is <code>decay</code>&#39;s whole-journal job, not a\nside effect of compaction.</li>\n<li><code>agent-journal coverage</code> and <code>agent-journal digest</code>, run on their own, do not surface\nthis. Their <code>downgradedAnchors</code> field reads <code>null</code> — not assessed — because neither\ncommand runs a retention pass; nothing today wires <code>compact</code>&#39;s findings into them.\nThe place this actually surfaces today is <code>compact</code>&#39;s own report, dry run or\napplied.</li>\n</ul>\n","words":3726}],"body":"# Keep a decision journal\n\nEvery agent harness now records what happened. None of them record why.\n\nA session leaves behind hundreds of tool calls — every file read, every command run,\nevery edit applied. Not one of them contains the sentence that matters: *we chose\nPostgres over SQLite because reconnect had to converge, and we ruled out the queue\nbecause it needed a broker we do not run.* That sentence lives in the model's context\nfor about an hour, and then compaction destroys it.\n\nSix months later somebody asks why the code is shaped this way. The commit history\nanswers *what*. The journal is where *why* survives — and, more valuably, where the\nalternatives you already rejected survive, so nobody spends a week rediscovering that\nthey do not work.\n\n## Quickstart\n\nThe CLI ships in this skill: `node scripts/agent-journal.mjs` works wherever\n`agent-journal` appears below. To put it on PATH for hooks and a bare shell, a person\nruns `node scripts/install-cli.mjs` once; an agent asks them to. Record one decision:\n\n```bash\nagent-journal record \\\n  --workspace my-project \\\n  --kind decision \\\n  --question \"how do sessions find their journal?\" \\\n  --chosen \"hash the git common directory\" \\\n  --rationale \"a worktree and its main checkout must share one journal, or collision warnings never fire\"\n```\n\nLater, someone finds that reasoning rested on a false premise. Retract it — **no session\nrequired**, which is the point; root causes are usually found in a bare shell:\n\n```bash\nagent-journal invalidate <entry-id> \\\n  --workspace my-project \\\n  --reason \"the interpreter on PATH was wrong; the failures were never real\"\n```\n\nAsk what the record does *not* cover, which is the question most audit trails cannot\nanswer:\n\n```bash\nagent-journal coverage --workspace my-project\n```\n\nThat prints sessions observed, sessions that recorded nothing, refused writes, sequence\ngaps — and `null`, not `[]`, for anything it never assessed. An empty array would claim\na clean bill of health it never established.\n\nIt also names what it could not read. A corrupt or unreadable journal exits non-zero and\nlists the `unreadable` paths and `malformed` lines, because an all-zero report from a\ndestroyed record and one from a quiet week must not look the same.\n\n## When to Use\n\n- A choice was made that a reasonable person could have made differently.\n- You rejected an option for a reason that is not obvious from the code.\n- Something surprised you, and the surprise changes what you would do next time.\n- A decision rests on something you did not verify — say so; that is the most valuable\n  entry in the journal, not the most embarrassing.\n- Work is about to be compacted, and the reasoning is still in context.\n\nDo not use it as a task log. Progress belongs in your tracker; this is not a Kanban\ncolumn. Do not narrate what a diff already shows — a decision entry that restates the\nchange adds noise and dilutes the entries that carry judgement. And do not record a\ndecision you have not actually made yet: this skill documents choices, it does not\nhelp you make them.\n\n## Prerequisites\n\n1. **The CLI runs.** `agent-journal help`, or `node scripts/agent-journal.mjs help`, exits 0.\n   **Complete when:** one does. If neither can, use [references/degraded-modes.md](references/degraded-modes.md) and say so.\n2. **A workspace id.** Everything is scoped to one. Pass `--workspace` explicitly; the\n   library can derive one from the git common directory, but the CLI does not guess.\n   **Complete when:** you have a stable string that will be the same next session.\n3. **Knowing what the journal can prove here.** In a code repository a claim can point\n   at a commit. In a design or ops context it cannot, and the entry must say so instead\n   of implying otherwise. See [references/anchors.md](references/anchors.md).\n   **Complete when:** you can name which anchor classes are available.\n4. **Knowing whether anything is watching automatically.** On a harness with hooks\n   wired, tool calls and session boundaries are observed independently of what you\n   write — a second witness to check your own account against, not a replacement for\n   it. Cite one with `--anchor tool_use:<observation-id>`; find the id with\n   `trace <tool-name>` and then `show`. The adapters are **not installed with this\n   skill** — they live in the repository, at\n   <https://github.com/crissmoldovan/agent-skills/tree/main/adapters>. Hooks do not\n   cover everything: no heartbeat, no confirmed permission events, and unattributed\n   tool calls from inside a subagent. See\n   [references/adapters.md](references/adapters.md) for the whole loop and before\n   assuming a class of claim is covered that isn't. **Complete when:** you know whether\n   this session's harness has an adapter wired, and — if it does — `agent-journal show`\n   shows observation kinds with `provenance: \"hook\"`. Use `show`, not `coverage`:\n   `coverage` counts sessions, so a hooked session and a hookless one both report\n   `sessions: 1` and it cannot tell you a hook fired.\n\n## Procedure\n\n### 1. Notice that a decision happened\n\nThis is the hard part, and it is where the skill earns its keep. The decisions worth\nrecording rarely announce themselves. In practice they hide in three shapes:\n\n- **A choice that did not feel like one.** You reached for a method because its name\n  read like a read. You set a flag because the ticket said to. Nobody deliberated, so\n  nobody wrote it down — and that is precisely the entry someone will want.\n- **A rejection.** You considered something and moved on. The moving-on is the record.\n- **An assumption.** You proceeded as though something were true without checking.\n\n**Complete when:** you can state the decision as a question someone else could have\nanswered differently.\n\n### 2. Write the entry\n\n```bash\nagent-journal record --workspace <id> --kind decision \\\n  --question \"<what was being decided>\" \\\n  --chosen \"<what you picked>\" \\\n  --rationale \"<why>\"\n```\n\nA good entry answers three things and resists the fourth:\n\n| Field | What it holds | The failure mode |\n| --- | --- | --- |\n| `question` | What was actually being decided | Restating the change instead of the choice |\n| `chosen` | What you picked | Describing the implementation, not the decision |\n| `rationale` | Why, in terms that would persuade a stranger | Post-hoc justification of a foregone conclusion |\n| `rejected` | What you did not pick, and why not | **Omitting it.** This is the field nothing else captures |\n\n**Complete when:** the entry would let a stranger reconstruct your reasoning without\nreading the diff.\n\n### 3. Anchor the claim\n\nAn entry that cites nothing is a story. Anchors are the difference between *this\ndecision was taken* and *somebody says it was*.\n\nAnchors are **selected, not recalled** — the journal already recorded every file you\nread and every command you ran, so the candidate set is the work you just did. You are\nchoosing from it, not remembering it.\n\n**Anchoring proves the decision happened. It does not prove the decision was right.**\nThat distinction is the single most important thing in this skill, and it is covered in\n[references/anchors.md](references/anchors.md). A perfectly anchored entry resting on a\nfalse premise is worse than no entry, because it is citable.\n\n```bash\nagent-journal record --workspace <id> --kind decision \\\n  --question \"<what was being decided>\" --chosen \"<what you picked>\" \\\n  --anchor file:src/queue.ts:14 \\\n  --anchor commit:9f2c1ab\n```\n\n`--anchor <class>:<ref>` is repeatable and splits on the **first** colon, so a ref keeps\nits own — `file:src/queue.ts:14` records the path and line, not a truncation of it. The\nclasses are `commit`, `file`, `environment`, `visual`, `runtime`, `tool_use`, `message`,\n`url` and `external`; [references/anchors.md](references/anchors.md) says what each one\nproves and, more usefully, what it does not.\n\n**Citing an anchor marks its class available.** The entry's capability table records\n`file: known` once a file anchor is on it, and leaves every other class `unknown`. That\nis not optimism — the anchor *is* the evidence that the class is reachable here. What the\nrule forbids is the reverse: assuming a class is available because it usually is.\n\n**Complete when:** every factual claim in the entry points at something checkable, or is\nexplicitly marked as resting on nothing.\n\n### 4. Say when you consulted nothing\n\nIf a decision rested on your own priors and no source, record that. The schema has a\nfirst-class way to say it — an influence of type `model_knowledge` — and it is\ndeliberately not the absence of a field, because \"I consulted nothing\" and \"I forgot to\nrecord my sources\" must not look identical.\n\nThis feels like an admission. It is the most useful signal in the entire record: it\ntells a later reader which decisions were reasoned from evidence and which were reasoned\nfrom vibes, and no other tool surfaces that at all.\n\n```bash\nagent-journal record --workspace <id> --kind decision \\\n  --question \"...\" --chosen \"...\" \\\n  --influence model_knowledge:decisive\n```\n\n`model_knowledge` is the one influence type that needs no reference, because there is\nnothing to point at — that is the claim. Every other type takes\n`--influence <type>:<role>[:<ref>]`, splitting on the first two colons so a URL keeps\nits own: `--influence url:contradicted:https://example.com/bench?a=1:2`. The roles are\n`decisive`, `supporting`, `considered` and **`contradicted`** — the last meaning *I read\nthis and chose against it*, which pairs with `--rejected` and is otherwise unrecoverable.\n\n**Complete when:** an entry with no sources says so explicitly, as a value rather than an\nabsence.\n\n### 5. Retract what turns out to be wrong\n\nTwo different things can happen to a decision, and conflating them loses information:\n\n- **Superseded** — something newer replaced it. The original was reasonable at the time,\n  and everything built on it still stands.\n- **Invalidated** — the premise was false. It was never sound, and **everything resting\n  on it is suppressed too**, transitively.\n\n`invalidate` covers the second case. The first has no separate command — pass\n`--supersedes <id>` on the record that replaces it:\n\n```bash\nagent-journal record --workspace api --kind decision --id d-old \\\n  --question \"how do we bound the retry queue?\" --chosen \"fixed 256-entry buffer\"\nagent-journal record --workspace api --kind decision --id d-new \\\n  --question \"how do we bound the retry queue?\" \\\n  --chosen \"backpressure signal, no fixed bound\" --supersedes d-old\nagent-journal show --workspace api --id d-old\n```\n\n`d-old` now reads `outcome: reverted, live: false` in that output; `d-new` is\nunaffected — unlike invalidation, supersession never propagates to what was built on\nthe entry it replaces. `--id` on `show` narrows to one entry instead of the whole\nworkspace, which is the faster check once you know which id you are asking about.\n\n```bash\nagent-journal invalidate <id> --workspace <ws> --reason \"<what was actually true>\"\n```\n\nThis works with no session, deliberately. The canonical case is a root cause found in a\nshell hours after the agent that wrote the entry has gone.\n\n**Suppression follows the links you recorded.** An entry declares what it rests on with\n`--influence journal:<role>:<id>`, and the projection layer walks those to a fixed point.\nSo invalidating an entry suppresses everything that cited it, and everything that cited\n*those*:\n\n```bash\nagent-journal record --workspace api --kind decision --id d-bound \\\n  --question \"how do we bound the retry queue?\" \\\n  --chosen \"in-process ring buffer, 256 entries\"\nagent-journal record --workspace api --kind finding --id f1 \\\n  --claim \"the 256 bound is never reached\" --influence journal:decisive:d-bound\nagent-journal invalidate d-bound --workspace api --reason \"the bound was measured, not assumed\"\nagent-journal show --workspace api\n```\n\n`f1` now reads `outcome: invalidated, live: false` alongside `d-bound`, without being\nnamed in the retraction. An entry that rested on nothing you recorded is not reached —\nthe graph only knows the edges you gave it, which is the reason step 4 is worth the\nkeystrokes.\n\n**Complete when:** the wrong entry is marked wrong, and anything that declared a\ndependence on it went with it.\n\n### 6. Read the coverage before you trust the record\n\n```bash\nagent-journal coverage --workspace <id>\n```\n\nSilence in a journal is ambiguous — nothing decided, or nothing recorded? The coverage\nreport is what makes the difference legible: sessions that produced no entries, refused\nwrites, gaps in a source's sequence, and an explicit `null` for anything never assessed.\n\n**Complete when:** you can state what the journal does not cover, not just what it does.\n\n### 7. Render a digest, and trace from a symptom\n\n```bash\nagent-journal digest --workspace api --level team\n```\n\nA digest renders the journal as one markdown document, ordered by consequence rather\nthan time — invalidated first — with the coverage report folded onto the end. It\ndefaults to `--level published`, the version meant to leave the room, and it is a\nsnapshot stamped with the moment it was rendered, never the source of truth. See\n[references/digest-and-disclosure.md](references/digest-and-disclosure.md) for what\ndisclosure does and does not gate: a private entry never appears in a digest, but its\ninvalidation of something else always does.\n\n```bash\nagent-journal trace f1 --workspace api\n```\n\n`trace` starts from whatever a support question actually hands you — a file, a ticket,\na runtime flag, or an entry id, indexed equally — and walks backwards through what an\nentry rests on. Lookup is exact, never a substring. The walk does not stop at an\ninvalidated entry: `f1` rests on `d-bound`, invalidated two steps back, and the walk\nreaches it anyway, because that is frequently where \"why is this like this\" ends.\n\n**Complete when:** you know what a reader at a given disclosure level will and will not\nsee, and a symptom traces back to the decision it actually depends on, not just the\nentry that happens to mention it.\n\n### 8. Check what has decayed\n\nEntries do not stay true because they were true once. A cited file gets deleted, a\nticket closes, an interpreter on `PATH` is not the one a decision was made under.\n\n```bash\nagent-journal decay --workspace api --repo .\n```\n\nThis reports two different things, never resolves either, and exits `0` regardless of\nwhat it finds — a `failing` finding does not invalidate anything, and a `drifted`\nfinding is not a verdict. `--repo` defaults to nothing on purpose: without it every\n`codebase` influence reads `not-checkable` rather than this command silently scanning\nwhatever directory you happened to be standing in.\n\n**Know the honest limit before you trust a `passing` codebase finding**: `path:symbol`\nchecks that the symbol's name still appears in the file's text — a grep, not a parse.\nIt catches a deleted or renamed symbol. It does not catch one that kept its name and\nchanged what it does. See [references/decay.md](references/decay.md) for the full\nreference — every status, what `decay` does and does not look at, and why an\n`environment` anchor's drift is reported as `drifted` rather than `failing`.\n\n**Complete when:** you can name which of the five statuses a finding carries and what\neach one does and does not commit to, and you know that reading the report is not the\nsame as acting on it.\n\n### 9. Delete something that must not exist\n\nA decision can be entirely sound and still contain a leaked credential or a named\nperson. `invalidate` is the wrong tool for that — it says the reasoning was wrong, and\nthis content might not be. `tombstone` takes no position on the reasoning at all; it\nsays the content itself must not exist.\n\n```bash\nagent-journal tombstone <id> --reason \"<why this must not exist>\" --workspace <id>\n```\n\nThat appends an event and purges nothing. `compact` is the only command in this\npackage that deletes, and it is a dry run unless `--apply` is given — this is the one\ncommand meant to run unattended, from a hook or CI, with nobody there to confirm it:\n\n```bash\nagent-journal compact --workspace <id> [--entry-ttl-days <n>] [--observation-ttl-days <n>] [--apply]\n```\n\nAn omitted TTL flag means that axis never expires, not \"expire everything,\" and\n`compact` refuses outright on a journal it could not fully read rather than risk\npurging on an incomplete view. Neither command reaches into a replica that has not\nseen the tombstone yet — that replica keeps the bytes until it does; §13.2 states this\nas the honest price of being able to erase anything at all. See\n[references/retention-and-deletion.md](references/retention-and-deletion.md) for the\nfull mechanics, including what an anchor citing purged content renders as afterward.\n\n**Complete when:** you can say, for content that must go, whether `invalidate` or\n`tombstone` is the right tool — and, if it is `tombstone`, that you ran `compact`\nwithout `--apply` first and read what it would do before adding the flag.\n\n### 10. Let a floor catch what self-triggering misses\n\nStep 1's \"notice\" is voluntary; §11.3's finding is that what an agent notices on its own\nis roughly *the complement* of what causes incidents. Two **authoring floors** narrow\nthat by prompting, never writing: one on a consequence-bearing observation (a mutating\ncommand, an unfamiliar host, a matching constraint), one before compaction.\n\n```bash\nagent-journal floor --kind consequence --workspace <id> [--since <ts>] [--subject <s>]\nagent-journal floor --kind compaction --workspace <id> [--since <ts>]\n```\n\n**Opt-in per workspace** (`AGENT_JOURNAL_FLOORS=1`) — an unasked floor gets the adapter\nuninstalled. See [references/authoring-floors.md](references/authoring-floors.md) for\nwhat the classifier misses, why Floor 1 can't force a flush, and Floor 2's blind spot.\n\n**Complete when:** you know whether floors are on here, and treat one as a question,\nnever an entry to accept as written.\n\n## Usage Examples\n\n**Recording a rejection, which is the entry nothing else captures:**\n\n```bash\nagent-journal record --workspace api --kind decision \\\n  --question \"how do we bound the retry queue?\" \\\n  --chosen \"in-process ring buffer, 256 entries\" \\\n  --rationale \"backpressure is observable and the failure mode is dropping oldest, which we can measure\" \\\n  --rejected \"redis list — needs a broker we do not run in this environment\" \\\n  --rejected \"kafka — three days of setup for one queue\"\n```\n\n**Recording an assumption you did not verify:**\n\n```bash\nagent-journal record --workspace api --kind assumption \\\n  --assumed \"the upstream call is idempotent\" \\\n  --ifWrong \"a retry double-charges the customer\" \\\n  --checked no\n```\n\nThat entry is what turns a future incident from *nobody knows why* into *here is exactly\nwhat we assumed and never confirmed*.\n\n**A human retracting an agent's finding, from a bare shell:**\n\n```bash\nagent-journal invalidate 7f3a --workspace api \\\n  --reason \"the 107 test failures were a wrong interpreter on PATH; the regression never existed\"\n```\n\n## Pitfalls\n\n- **Recording what the diff already says.** \"Changed the timeout to 30s\" is not a\n  decision; \"chose 30s because the p99 upstream is 22s and we would rather fail than\n  queue\" is.\n- **Treating an anchor as proof of correctness.** It proves the decision happened. A\n  well-anchored entry built on a false premise is the most dangerous artefact this\n  system can produce, because it reads as verified.\n- **Writing entries only when things go well.** A journal of successes is a marketing\n  document. The rejections and the assumptions are what make it worth keeping.\n- **Letting the entry be a performance.** If entries are read in review, the temptation\n  is to attach a source you skimmed rather than admit you consulted nothing. That\n  converts the most valuable field in the record into decoration.\n- **Reading `[]` as \"none found\".** Where the journal never assessed something it says\n  `null`. An empty array means assessed and empty. Conflating them turns \"we did not\n  look\" into \"we looked and it was clean\".\n- **Assuming order implies causality.** Entries from different sources are ordered for\n  display, not for meaning. If one thing caused another, the edge between them says so —\n  the sequence in a list does not.\n- **Reading a `passing` `codebase` finding as \"the reasoning still holds\".** It means\n  the symbol's name is still in the file. `decay`'s `path:symbol` check is a grep, not\n  a parse — it says nothing about whether the symbol still does what the entry said it\n  did. See [references/decay.md](references/decay.md).\n\n## Verification\n\nBefore treating a journal as a record you can rely on:\n\n- **Every entry cites something, or admits it does not.** Read the entries and check.\n  `coverage` cannot answer this for you — it reports `downgradedAnchors: null`, meaning\n  *not assessed*, because it runs no retention pass. An entry that cites nothing and does\n  not say so is a story.\n- **The coverage report distinguishes `null` from `[]`.** If a field reads as an empty\n  array when nothing assessed it, the report is claiming a clean bill of health it never\n  earned. That is a bug, not a clean journal.\n- **A refused write left a trace.** A recognised secret is masked and the entry is\n  written; a payload the redactor cannot scan at all — oversized, or too deeply nested —\n  is refused outright, and that refusal is recorded as a void. If refusals vanish\n  silently, the gap they leave is invisible and the coverage report is lying by omission.\n- **The journal could be read at all.** `coverage` exits non-zero and lists `unreadable`\n  paths and `malformed` lines when the record is damaged. Zeroes from a damaged journal\n  mean \"we could not look\", not \"nothing happened\" — treat its counts as a floor.\n- **Retractions took effect.** `agent-journal show --workspace <ws>` reports `outcome`\n  and `live` per entry. An invalidated entry and everything that declared a dependence on\n  it both read `live: false`.\n- **You can tell a retraction from a decision.** `invalidate` appends its retraction as a\n  `decision` record, so a workspace with two entries and one retraction shows **three**\n  rows. The retraction is the one whose `retracts` field is populated; the entries it\n  acted on carry `retracts: null`. A count of live decisions that forgets this is wrong by\n  one per retraction, forever.\n- **`null` is not `[]` in `show` either.** `anchors`, `influences` and `retracts` read\n  `null` when the entry has none — not recorded, rather than assessed and empty.\n- **A `decay` report is something to read, not something that gates.** It exits `0`\n  whether every finding is `passing` or half of them are `failing` — treating a clean\n  exit code as \"nothing decayed\" skips the one field, `findings`, that actually says so.\n\n## Deeper reading\n\n- [references/anchors.md](references/anchors.md) — what a claim can point at, what each\n  anchor class actually proves, and why anchoring is one-directional.\n- [references/decay.md](references/decay.md) — the five statuses `decay` can report,\n  what it does and does not check, the `codebase` grep's honest limit, and why\n  environment drift is reported rather than resolved.\n- [references/entry-kinds.md](references/entry-kinds.md) — decision, finding,\n  assumption, blocker, progress, constraint: which to use and how they differ.\n- [references/digest-and-disclosure.md](references/digest-and-disclosure.md) — the\n  three disclosure classes, why the write default and the parse default differ, how a\n  digest orders and gates entries, and what `trace` can and cannot find.\n- [references/retention-and-deletion.md](references/retention-and-deletion.md) —\n  tombstones versus `invalidate`, why a tombstone forfeits pure CRDT convergence,\n  `compact`'s dry-run default and its refusal on a damaged journal, entry TTL, and the\n  pinning interaction between the two.\n- [references/degraded-modes.md](references/degraded-modes.md) — running without the\n  CLI, without a filesystem, or without hooks, and how to say so honestly.\n- [references/adapters.md](references/adapters.md) — the observation plane hooks feed\n  automatically: what it proves that self-reported entries can't, obtaining and\n  installing the Claude Code and Codex adapters (they ship in the repository, not with\n  this skill), verifying arrival with `coverage`, the capture → find → cite loop for\n  anchoring an entry to an observation, what still has to be hand-anchored, and the\n  honest, unequal status of each adapter.\n- [references/authoring-floors.md](references/authoring-floors.md) — the two floors\n  that prompt regardless of judgement: what fires each, opting in, what the classifier\n  misses, and why Floor 1 doesn't force a pre-compaction flush and Floor 2 misses a\n  failed tool call.\n","bodyHtml":"<h2 id=\"keep-a-decision-journal\">Keep a decision journal</h2>\n<p>Every agent harness now records what happened. None of them record why.</p>\n<p>A session leaves behind hundreds of tool calls — every file read, every command run,\nevery edit applied. Not one of them contains the sentence that matters: <em>we chose\nPostgres over SQLite because reconnect had to converge, and we ruled out the queue\nbecause it needed a broker we do not run.</em> That sentence lives in the model&#39;s context\nfor about an hour, and then compaction destroys it.</p>\n<p>Six months later somebody asks why the code is shaped this way. The commit history\nanswers <em>what</em>. The journal is where <em>why</em> survives — and, more valuably, where the\nalternatives you already rejected survive, so nobody spends a week rediscovering that\nthey do not work.</p>\n<h3 id=\"quickstart\">Quickstart</h3>\n<p>The CLI ships in this skill: <code>node scripts/agent-journal.mjs</code> works wherever\n<code>agent-journal</code> appears below. To put it on PATH for hooks and a bare shell, a person\nruns <code>node scripts/install-cli.mjs</code> once; an agent asks them to. Record one decision:</p>\n<pre><code class=\"language-bash\">agent-journal record \\\n  --workspace my-project \\\n  --kind decision \\\n  --question &quot;how do sessions find their journal?&quot; \\\n  --chosen &quot;hash the git common directory&quot; \\\n  --rationale &quot;a worktree and its main checkout must share one journal, or collision warnings never fire&quot;\n</code></pre>\n<p>Later, someone finds that reasoning rested on a false premise. Retract it — <strong>no session\nrequired</strong>, which is the point; root causes are usually found in a bare shell:</p>\n<pre><code class=\"language-bash\">agent-journal invalidate &lt;entry-id&gt; \\\n  --workspace my-project \\\n  --reason &quot;the interpreter on PATH was wrong; the failures were never real&quot;\n</code></pre>\n<p>Ask what the record does <em>not</em> cover, which is the question most audit trails cannot\nanswer:</p>\n<pre><code class=\"language-bash\">agent-journal coverage --workspace my-project\n</code></pre>\n<p>That prints sessions observed, sessions that recorded nothing, refused writes, sequence\ngaps — and <code>null</code>, not <code>[]</code>, for anything it never assessed. An empty array would claim\na clean bill of health it never established.</p>\n<p>It also names what it could not read. A corrupt or unreadable journal exits non-zero and\nlists the <code>unreadable</code> paths and <code>malformed</code> lines, because an all-zero report from a\ndestroyed record and one from a quiet week must not look the same.</p>\n<h3 id=\"when-to-use\">When to Use</h3>\n<ul>\n<li>A choice was made that a reasonable person could have made differently.</li>\n<li>You rejected an option for a reason that is not obvious from the code.</li>\n<li>Something surprised you, and the surprise changes what you would do next time.</li>\n<li>A decision rests on something you did not verify — say so; that is the most valuable\nentry in the journal, not the most embarrassing.</li>\n<li>Work is about to be compacted, and the reasoning is still in context.</li>\n</ul>\n<p>Do not use it as a task log. Progress belongs in your tracker; this is not a Kanban\ncolumn. Do not narrate what a diff already shows — a decision entry that restates the\nchange adds noise and dilutes the entries that carry judgement. And do not record a\ndecision you have not actually made yet: this skill documents choices, it does not\nhelp you make them.</p>\n<h3 id=\"prerequisites\">Prerequisites</h3>\n<ol>\n<li><strong>The CLI runs.</strong> <code>agent-journal help</code>, or <code>node scripts/agent-journal.mjs help</code>, exits 0.\n<strong>Complete when:</strong> one does. If neither can, use <a href=\"references/degraded-modes.md\">references/degraded-modes.md</a> and say so.</li>\n<li><strong>A workspace id.</strong> Everything is scoped to one. Pass <code>--workspace</code> explicitly; the\nlibrary can derive one from the git common directory, but the CLI does not guess.\n<strong>Complete when:</strong> you have a stable string that will be the same next session.</li>\n<li><strong>Knowing what the journal can prove here.</strong> In a code repository a claim can point\nat a commit. In a design or ops context it cannot, and the entry must say so instead\nof implying otherwise. See <a href=\"references/anchors.md\">references/anchors.md</a>.\n<strong>Complete when:</strong> you can name which anchor classes are available.</li>\n<li><strong>Knowing whether anything is watching automatically.</strong> On a harness with hooks\nwired, tool calls and session boundaries are observed independently of what you\nwrite — a second witness to check your own account against, not a replacement for\nit. Cite one with <code>--anchor tool_use:&lt;observation-id&gt;</code>; find the id with\n<code>trace &lt;tool-name&gt;</code> and then <code>show</code>. The adapters are <strong>not installed with this\nskill</strong> — they live in the repository, at\n<a href=\"https://github.com/crissmoldovan/agent-skills/tree/main/adapters\" target=\"_blank\" rel=\"noreferrer\">https://github.com/crissmoldovan/agent-skills/tree/main/adapters</a>. Hooks do not\ncover everything: no heartbeat, no confirmed permission events, and unattributed\ntool calls from inside a subagent. See\n<a href=\"references/adapters.md\">references/adapters.md</a> for the whole loop and before\nassuming a class of claim is covered that isn&#39;t. <strong>Complete when:</strong> you know whether\nthis session&#39;s harness has an adapter wired, and — if it does — <code>agent-journal show</code>\nshows observation kinds with <code>provenance: &quot;hook&quot;</code>. Use <code>show</code>, not <code>coverage</code>:\n<code>coverage</code> counts sessions, so a hooked session and a hookless one both report\n<code>sessions: 1</code> and it cannot tell you a hook fired.</li>\n</ol>\n<h3 id=\"procedure\">Procedure</h3>\n<h4 id=\"1-notice-that-a-decision-happened\">1. Notice that a decision happened</h4>\n<p>This is the hard part, and it is where the skill earns its keep. The decisions worth\nrecording rarely announce themselves. In practice they hide in three shapes:</p>\n<ul>\n<li><strong>A choice that did not feel like one.</strong> You reached for a method because its name\nread like a read. You set a flag because the ticket said to. Nobody deliberated, so\nnobody wrote it down — and that is precisely the entry someone will want.</li>\n<li><strong>A rejection.</strong> You considered something and moved on. The moving-on is the record.</li>\n<li><strong>An assumption.</strong> You proceeded as though something were true without checking.</li>\n</ul>\n<p><strong>Complete when:</strong> you can state the decision as a question someone else could have\nanswered differently.</p>\n<h4 id=\"2-write-the-entry\">2. Write the entry</h4>\n<pre><code class=\"language-bash\">agent-journal record --workspace &lt;id&gt; --kind decision \\\n  --question &quot;&lt;what was being decided&gt;&quot; \\\n  --chosen &quot;&lt;what you picked&gt;&quot; \\\n  --rationale &quot;&lt;why&gt;&quot;\n</code></pre>\n<p>A good entry answers three things and resists the fourth:</p>\n<table>\n<thead>\n<tr>\n<th>Field</th>\n<th>What it holds</th>\n<th>The failure mode</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>question</code></td>\n<td>What was actually being decided</td>\n<td>Restating the change instead of the choice</td>\n</tr>\n<tr>\n<td><code>chosen</code></td>\n<td>What you picked</td>\n<td>Describing the implementation, not the decision</td>\n</tr>\n<tr>\n<td><code>rationale</code></td>\n<td>Why, in terms that would persuade a stranger</td>\n<td>Post-hoc justification of a foregone conclusion</td>\n</tr>\n<tr>\n<td><code>rejected</code></td>\n<td>What you did not pick, and why not</td>\n<td><strong>Omitting it.</strong> This is the field nothing else captures</td>\n</tr>\n</tbody></table>\n<p><strong>Complete when:</strong> the entry would let a stranger reconstruct your reasoning without\nreading the diff.</p>\n<h4 id=\"3-anchor-the-claim\">3. Anchor the claim</h4>\n<p>An entry that cites nothing is a story. Anchors are the difference between <em>this\ndecision was taken</em> and <em>somebody says it was</em>.</p>\n<p>Anchors are <strong>selected, not recalled</strong> — the journal already recorded every file you\nread and every command you ran, so the candidate set is the work you just did. You are\nchoosing from it, not remembering it.</p>\n<p><strong>Anchoring proves the decision happened. It does not prove the decision was right.</strong>\nThat distinction is the single most important thing in this skill, and it is covered in\n<a href=\"references/anchors.md\">references/anchors.md</a>. A perfectly anchored entry resting on a\nfalse premise is worse than no entry, because it is citable.</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace &lt;id&gt; --kind decision \\\n  --question &quot;&lt;what was being decided&gt;&quot; --chosen &quot;&lt;what you picked&gt;&quot; \\\n  --anchor file:src/queue.ts:14 \\\n  --anchor commit:9f2c1ab\n</code></pre>\n<p><code>--anchor &lt;class&gt;:&lt;ref&gt;</code> is repeatable and splits on the <strong>first</strong> colon, so a ref keeps\nits own — <code>file:src/queue.ts:14</code> records the path and line, not a truncation of it. The\nclasses are <code>commit</code>, <code>file</code>, <code>environment</code>, <code>visual</code>, <code>runtime</code>, <code>tool_use</code>, <code>message</code>,\n<code>url</code> and <code>external</code>; <a href=\"references/anchors.md\">references/anchors.md</a> says what each one\nproves and, more usefully, what it does not.</p>\n<p><strong>Citing an anchor marks its class available.</strong> The entry&#39;s capability table records\n<code>file: known</code> once a file anchor is on it, and leaves every other class <code>unknown</code>. That\nis not optimism — the anchor <em>is</em> the evidence that the class is reachable here. What the\nrule forbids is the reverse: assuming a class is available because it usually is.</p>\n<p><strong>Complete when:</strong> every factual claim in the entry points at something checkable, or is\nexplicitly marked as resting on nothing.</p>\n<h4 id=\"4-say-when-you-consulted-nothing\">4. Say when you consulted nothing</h4>\n<p>If a decision rested on your own priors and no source, record that. The schema has a\nfirst-class way to say it — an influence of type <code>model_knowledge</code> — and it is\ndeliberately not the absence of a field, because &quot;I consulted nothing&quot; and &quot;I forgot to\nrecord my sources&quot; must not look identical.</p>\n<p>This feels like an admission. It is the most useful signal in the entire record: it\ntells a later reader which decisions were reasoned from evidence and which were reasoned\nfrom vibes, and no other tool surfaces that at all.</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace &lt;id&gt; --kind decision \\\n  --question &quot;...&quot; --chosen &quot;...&quot; \\\n  --influence model_knowledge:decisive\n</code></pre>\n<p><code>model_knowledge</code> is the one influence type that needs no reference, because there is\nnothing to point at — that is the claim. Every other type takes\n<code>--influence &lt;type&gt;:&lt;role&gt;[:&lt;ref&gt;]</code>, splitting on the first two colons so a URL keeps\nits own: <code>--influence url:contradicted:https://example.com/bench?a=1:2</code>. The roles are\n<code>decisive</code>, <code>supporting</code>, <code>considered</code> and <strong><code>contradicted</code></strong> — the last meaning <em>I read\nthis and chose against it</em>, which pairs with <code>--rejected</code> and is otherwise unrecoverable.</p>\n<p><strong>Complete when:</strong> an entry with no sources says so explicitly, as a value rather than an\nabsence.</p>\n<h4 id=\"5-retract-what-turns-out-to-be-wrong\">5. Retract what turns out to be wrong</h4>\n<p>Two different things can happen to a decision, and conflating them loses information:</p>\n<ul>\n<li><strong>Superseded</strong> — something newer replaced it. The original was reasonable at the time,\nand everything built on it still stands.</li>\n<li><strong>Invalidated</strong> — the premise was false. It was never sound, and <strong>everything resting\non it is suppressed too</strong>, transitively.</li>\n</ul>\n<p><code>invalidate</code> covers the second case. The first has no separate command — pass\n<code>--supersedes &lt;id&gt;</code> on the record that replaces it:</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind decision --id d-old \\\n  --question &quot;how do we bound the retry queue?&quot; --chosen &quot;fixed 256-entry buffer&quot;\nagent-journal record --workspace api --kind decision --id d-new \\\n  --question &quot;how do we bound the retry queue?&quot; \\\n  --chosen &quot;backpressure signal, no fixed bound&quot; --supersedes d-old\nagent-journal show --workspace api --id d-old\n</code></pre>\n<p><code>d-old</code> now reads <code>outcome: reverted, live: false</code> in that output; <code>d-new</code> is\nunaffected — unlike invalidation, supersession never propagates to what was built on\nthe entry it replaces. <code>--id</code> on <code>show</code> narrows to one entry instead of the whole\nworkspace, which is the faster check once you know which id you are asking about.</p>\n<pre><code class=\"language-bash\">agent-journal invalidate &lt;id&gt; --workspace &lt;ws&gt; --reason &quot;&lt;what was actually true&gt;&quot;\n</code></pre>\n<p>This works with no session, deliberately. The canonical case is a root cause found in a\nshell hours after the agent that wrote the entry has gone.</p>\n<p><strong>Suppression follows the links you recorded.</strong> An entry declares what it rests on with\n<code>--influence journal:&lt;role&gt;:&lt;id&gt;</code>, and the projection layer walks those to a fixed point.\nSo invalidating an entry suppresses everything that cited it, and everything that cited\n<em>those</em>:</p>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind decision --id d-bound \\\n  --question &quot;how do we bound the retry queue?&quot; \\\n  --chosen &quot;in-process ring buffer, 256 entries&quot;\nagent-journal record --workspace api --kind finding --id f1 \\\n  --claim &quot;the 256 bound is never reached&quot; --influence journal:decisive:d-bound\nagent-journal invalidate d-bound --workspace api --reason &quot;the bound was measured, not assumed&quot;\nagent-journal show --workspace api\n</code></pre>\n<p><code>f1</code> now reads <code>outcome: invalidated, live: false</code> alongside <code>d-bound</code>, without being\nnamed in the retraction. An entry that rested on nothing you recorded is not reached —\nthe graph only knows the edges you gave it, which is the reason step 4 is worth the\nkeystrokes.</p>\n<p><strong>Complete when:</strong> the wrong entry is marked wrong, and anything that declared a\ndependence on it went with it.</p>\n<h4 id=\"6-read-the-coverage-before-you-trust-the-record\">6. Read the coverage before you trust the record</h4>\n<pre><code class=\"language-bash\">agent-journal coverage --workspace &lt;id&gt;\n</code></pre>\n<p>Silence in a journal is ambiguous — nothing decided, or nothing recorded? The coverage\nreport is what makes the difference legible: sessions that produced no entries, refused\nwrites, gaps in a source&#39;s sequence, and an explicit <code>null</code> for anything never assessed.</p>\n<p><strong>Complete when:</strong> you can state what the journal does not cover, not just what it does.</p>\n<h4 id=\"7-render-a-digest-and-trace-from-a-symptom\">7. Render a digest, and trace from a symptom</h4>\n<pre><code class=\"language-bash\">agent-journal digest --workspace api --level team\n</code></pre>\n<p>A digest renders the journal as one markdown document, ordered by consequence rather\nthan time — invalidated first — with the coverage report folded onto the end. It\ndefaults to <code>--level published</code>, the version meant to leave the room, and it is a\nsnapshot stamped with the moment it was rendered, never the source of truth. See\n<a href=\"references/digest-and-disclosure.md\">references/digest-and-disclosure.md</a> for what\ndisclosure does and does not gate: a private entry never appears in a digest, but its\ninvalidation of something else always does.</p>\n<pre><code class=\"language-bash\">agent-journal trace f1 --workspace api\n</code></pre>\n<p><code>trace</code> starts from whatever a support question actually hands you — a file, a ticket,\na runtime flag, or an entry id, indexed equally — and walks backwards through what an\nentry rests on. Lookup is exact, never a substring. The walk does not stop at an\ninvalidated entry: <code>f1</code> rests on <code>d-bound</code>, invalidated two steps back, and the walk\nreaches it anyway, because that is frequently where &quot;why is this like this&quot; ends.</p>\n<p><strong>Complete when:</strong> you know what a reader at a given disclosure level will and will not\nsee, and a symptom traces back to the decision it actually depends on, not just the\nentry that happens to mention it.</p>\n<h4 id=\"8-check-what-has-decayed\">8. Check what has decayed</h4>\n<p>Entries do not stay true because they were true once. A cited file gets deleted, a\nticket closes, an interpreter on <code>PATH</code> is not the one a decision was made under.</p>\n<pre><code class=\"language-bash\">agent-journal decay --workspace api --repo .\n</code></pre>\n<p>This reports two different things, never resolves either, and exits <code>0</code> regardless of\nwhat it finds — a <code>failing</code> finding does not invalidate anything, and a <code>drifted</code>\nfinding is not a verdict. <code>--repo</code> defaults to nothing on purpose: without it every\n<code>codebase</code> influence reads <code>not-checkable</code> rather than this command silently scanning\nwhatever directory you happened to be standing in.</p>\n<p><strong>Know the honest limit before you trust a <code>passing</code> codebase finding</strong>: <code>path:symbol</code>\nchecks that the symbol&#39;s name still appears in the file&#39;s text — a grep, not a parse.\nIt catches a deleted or renamed symbol. It does not catch one that kept its name and\nchanged what it does. See <a href=\"references/decay.md\">references/decay.md</a> for the full\nreference — every status, what <code>decay</code> does and does not look at, and why an\n<code>environment</code> anchor&#39;s drift is reported as <code>drifted</code> rather than <code>failing</code>.</p>\n<p><strong>Complete when:</strong> you can name which of the five statuses a finding carries and what\neach one does and does not commit to, and you know that reading the report is not the\nsame as acting on it.</p>\n<h4 id=\"9-delete-something-that-must-not-exist\">9. Delete something that must not exist</h4>\n<p>A decision can be entirely sound and still contain a leaked credential or a named\nperson. <code>invalidate</code> is the wrong tool for that — it says the reasoning was wrong, and\nthis content might not be. <code>tombstone</code> takes no position on the reasoning at all; it\nsays the content itself must not exist.</p>\n<pre><code class=\"language-bash\">agent-journal tombstone &lt;id&gt; --reason &quot;&lt;why this must not exist&gt;&quot; --workspace &lt;id&gt;\n</code></pre>\n<p>That appends an event and purges nothing. <code>compact</code> is the only command in this\npackage that deletes, and it is a dry run unless <code>--apply</code> is given — this is the one\ncommand meant to run unattended, from a hook or CI, with nobody there to confirm it:</p>\n<pre><code class=\"language-bash\">agent-journal compact --workspace &lt;id&gt; [--entry-ttl-days &lt;n&gt;] [--observation-ttl-days &lt;n&gt;] [--apply]\n</code></pre>\n<p>An omitted TTL flag means that axis never expires, not &quot;expire everything,&quot; and\n<code>compact</code> refuses outright on a journal it could not fully read rather than risk\npurging on an incomplete view. Neither command reaches into a replica that has not\nseen the tombstone yet — that replica keeps the bytes until it does; §13.2 states this\nas the honest price of being able to erase anything at all. See\n<a href=\"references/retention-and-deletion.md\">references/retention-and-deletion.md</a> for the\nfull mechanics, including what an anchor citing purged content renders as afterward.</p>\n<p><strong>Complete when:</strong> you can say, for content that must go, whether <code>invalidate</code> or\n<code>tombstone</code> is the right tool — and, if it is <code>tombstone</code>, that you ran <code>compact</code>\nwithout <code>--apply</code> first and read what it would do before adding the flag.</p>\n<h4 id=\"10-let-a-floor-catch-what-self-triggering-misses\">10. Let a floor catch what self-triggering misses</h4>\n<p>Step 1&#39;s &quot;notice&quot; is voluntary; §11.3&#39;s finding is that what an agent notices on its own\nis roughly <em>the complement</em> of what causes incidents. Two <strong>authoring floors</strong> narrow\nthat by prompting, never writing: one on a consequence-bearing observation (a mutating\ncommand, an unfamiliar host, a matching constraint), one before compaction.</p>\n<pre><code class=\"language-bash\">agent-journal floor --kind consequence --workspace &lt;id&gt; [--since &lt;ts&gt;] [--subject &lt;s&gt;]\nagent-journal floor --kind compaction --workspace &lt;id&gt; [--since &lt;ts&gt;]\n</code></pre>\n<p><strong>Opt-in per workspace</strong> (<code>AGENT_JOURNAL_FLOORS=1</code>) — an unasked floor gets the adapter\nuninstalled. See <a href=\"references/authoring-floors.md\">references/authoring-floors.md</a> for\nwhat the classifier misses, why Floor 1 can&#39;t force a flush, and Floor 2&#39;s blind spot.</p>\n<p><strong>Complete when:</strong> you know whether floors are on here, and treat one as a question,\nnever an entry to accept as written.</p>\n<h3 id=\"usage-examples\">Usage Examples</h3>\n<p><strong>Recording a rejection, which is the entry nothing else captures:</strong></p>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind decision \\\n  --question &quot;how do we bound the retry queue?&quot; \\\n  --chosen &quot;in-process ring buffer, 256 entries&quot; \\\n  --rationale &quot;backpressure is observable and the failure mode is dropping oldest, which we can measure&quot; \\\n  --rejected &quot;redis list — needs a broker we do not run in this environment&quot; \\\n  --rejected &quot;kafka — three days of setup for one queue&quot;\n</code></pre>\n<p><strong>Recording an assumption you did not verify:</strong></p>\n<pre><code class=\"language-bash\">agent-journal record --workspace api --kind assumption \\\n  --assumed &quot;the upstream call is idempotent&quot; \\\n  --ifWrong &quot;a retry double-charges the customer&quot; \\\n  --checked no\n</code></pre>\n<p>That entry is what turns a future incident from <em>nobody knows why</em> into <em>here is exactly\nwhat we assumed and never confirmed</em>.</p>\n<p><strong>A human retracting an agent&#39;s finding, from a bare shell:</strong></p>\n<pre><code class=\"language-bash\">agent-journal invalidate 7f3a --workspace api \\\n  --reason &quot;the 107 test failures were a wrong interpreter on PATH; the regression never existed&quot;\n</code></pre>\n<h3 id=\"pitfalls\">Pitfalls</h3>\n<ul>\n<li><strong>Recording what the diff already says.</strong> &quot;Changed the timeout to 30s&quot; is not a\ndecision; &quot;chose 30s because the p99 upstream is 22s and we would rather fail than\nqueue&quot; is.</li>\n<li><strong>Treating an anchor as proof of correctness.</strong> It proves the decision happened. A\nwell-anchored entry built on a false premise is the most dangerous artefact this\nsystem can produce, because it reads as verified.</li>\n<li><strong>Writing entries only when things go well.</strong> A journal of successes is a marketing\ndocument. The rejections and the assumptions are what make it worth keeping.</li>\n<li><strong>Letting the entry be a performance.</strong> If entries are read in review, the temptation\nis to attach a source you skimmed rather than admit you consulted nothing. That\nconverts the most valuable field in the record into decoration.</li>\n<li><strong>Reading <code>[]</code> as &quot;none found&quot;.</strong> Where the journal never assessed something it says\n<code>null</code>. An empty array means assessed and empty. Conflating them turns &quot;we did not\nlook&quot; into &quot;we looked and it was clean&quot;.</li>\n<li><strong>Assuming order implies causality.</strong> Entries from different sources are ordered for\ndisplay, not for meaning. If one thing caused another, the edge between them says so —\nthe sequence in a list does not.</li>\n<li><strong>Reading a <code>passing</code> <code>codebase</code> finding as &quot;the reasoning still holds&quot;.</strong> It means\nthe symbol&#39;s name is still in the file. <code>decay</code>&#39;s <code>path:symbol</code> check is a grep, not\na parse — it says nothing about whether the symbol still does what the entry said it\ndid. See <a href=\"references/decay.md\">references/decay.md</a>.</li>\n</ul>\n<h3 id=\"verification\">Verification</h3>\n<p>Before treating a journal as a record you can rely on:</p>\n<ul>\n<li><strong>Every entry cites something, or admits it does not.</strong> Read the entries and check.\n<code>coverage</code> cannot answer this for you — it reports <code>downgradedAnchors: null</code>, meaning\n<em>not assessed</em>, because it runs no retention pass. An entry that cites nothing and does\nnot say so is a story.</li>\n<li><strong>The coverage report distinguishes <code>null</code> from <code>[]</code>.</strong> If a field reads as an empty\narray when nothing assessed it, the report is claiming a clean bill of health it never\nearned. That is a bug, not a clean journal.</li>\n<li><strong>A refused write left a trace.</strong> A recognised secret is masked and the entry is\nwritten; a payload the redactor cannot scan at all — oversized, or too deeply nested —\nis refused outright, and that refusal is recorded as a void. If refusals vanish\nsilently, the gap they leave is invisible and the coverage report is lying by omission.</li>\n<li><strong>The journal could be read at all.</strong> <code>coverage</code> exits non-zero and lists <code>unreadable</code>\npaths and <code>malformed</code> lines when the record is damaged. Zeroes from a damaged journal\nmean &quot;we could not look&quot;, not &quot;nothing happened&quot; — treat its counts as a floor.</li>\n<li><strong>Retractions took effect.</strong> <code>agent-journal show --workspace &lt;ws&gt;</code> reports <code>outcome</code>\nand <code>live</code> per entry. An invalidated entry and everything that declared a dependence on\nit both read <code>live: false</code>.</li>\n<li><strong>You can tell a retraction from a decision.</strong> <code>invalidate</code> appends its retraction as a\n<code>decision</code> record, so a workspace with two entries and one retraction shows <strong>three</strong>\nrows. The retraction is the one whose <code>retracts</code> field is populated; the entries it\nacted on carry <code>retracts: null</code>. A count of live decisions that forgets this is wrong by\none per retraction, forever.</li>\n<li><strong><code>null</code> is not <code>[]</code> in <code>show</code> either.</strong> <code>anchors</code>, <code>influences</code> and <code>retracts</code> read\n<code>null</code> when the entry has none — not recorded, rather than assessed and empty.</li>\n<li><strong>A <code>decay</code> report is something to read, not something that gates.</strong> It exits <code>0</code>\nwhether every finding is <code>passing</code> or half of them are <code>failing</code> — treating a clean\nexit code as &quot;nothing decayed&quot; skips the one field, <code>findings</code>, that actually says so.</li>\n</ul>\n<h3 id=\"deeper-reading\">Deeper reading</h3>\n<ul>\n<li><a href=\"references/anchors.md\">references/anchors.md</a> — what a claim can point at, what each\nanchor class actually proves, and why anchoring is one-directional.</li>\n<li><a href=\"references/decay.md\">references/decay.md</a> — the five statuses <code>decay</code> can report,\nwhat it does and does not check, the <code>codebase</code> grep&#39;s honest limit, and why\nenvironment drift is reported rather than resolved.</li>\n<li><a href=\"references/entry-kinds.md\">references/entry-kinds.md</a> — decision, finding,\nassumption, blocker, progress, constraint: which to use and how they differ.</li>\n<li><a href=\"references/digest-and-disclosure.md\">references/digest-and-disclosure.md</a> — the\nthree disclosure classes, why the write default and the parse default differ, how a\ndigest orders and gates entries, and what <code>trace</code> can and cannot find.</li>\n<li><a href=\"references/retention-and-deletion.md\">references/retention-and-deletion.md</a> —\ntombstones versus <code>invalidate</code>, why a tombstone forfeits pure CRDT convergence,\n<code>compact</code>&#39;s dry-run default and its refusal on a damaged journal, entry TTL, and the\npinning interaction between the two.</li>\n<li><a href=\"references/degraded-modes.md\">references/degraded-modes.md</a> — running without the\nCLI, without a filesystem, or without hooks, and how to say so honestly.</li>\n<li><a href=\"references/adapters.md\">references/adapters.md</a> — the observation plane hooks feed\nautomatically: what it proves that self-reported entries can&#39;t, obtaining and\ninstalling the Claude Code and Codex adapters (they ship in the repository, not with\nthis skill), verifying arrival with <code>coverage</code>, the capture → find → cite loop for\nanchoring an entry to an observation, what still has to be hand-anchored, and the\nhonest, unequal status of each adapter.</li>\n<li><a href=\"references/authoring-floors.md\">references/authoring-floors.md</a> — the two floors\nthat prompt regardless of judgement: what fires each, opting in, what the classifier\nmisses, and why Floor 1 doesn&#39;t force a pre-compaction flush and Floor 2 misses a\nfailed tool call.</li>\n</ul>\n","outline":["Quickstart","When to Use","Prerequisites","Procedure","Usage Examples","Pitfalls","Verification","Deeper reading"],"words":3872}
