Semantic Compactor: Lossless Institutional Memory
The purpose of this skill is to make the normal development loop —
propose → implement → debug → test → refine → repeat —
have the property that no outcome of problem → solution is ever lost, without rote-recording
every word. It has two halves: a triage protocol (how to investigate a symptom without
re-solving solved problems) and a capture architecture (how to record knowledge so it
survives context loss).
Part 1 — Triage protocol (BEFORE theorizing about any bug)
When a symptom appears, in this order:
Search the record for the SYMPTOM, not the cause — and search git first.
git log --all --grep="<symptom words>" -i
grep -ri "<symptom words>" SYMPTOMS.md docs/ 2>/dev/null
Git is the most durable, highest-signal record available. Ten seconds here can save hours.
Never assert that knowledge was lost until you've proven it absent from git history,
the symptom index, and the decision ledger. Absence in one corpus is not absence.
"The fix must have been lost" is a hypothesis to falsify, not a premise.
A symptom is not a defect identity. When a symptom recurs, assume a new cause
until proven otherwise. Identical visual/behavioral signatures routinely have distinct
root causes. If the record shows a prior fix, verify the fix is still present and effective
before concluding it regressed.
Run the cheapest discriminating experiment before theorizing within a layer.
Bisect between layers (content vs. renderer vs. driver; app vs. library vs. OS) before
exploring hypotheses inside one layer. Ask: "what two-minute observation would eliminate
an entire branch?"
Weight direct human observation heavily. When the person with eyes on the system
contradicts your theory, update the theory, not the report.
Part 2 — Capture architecture
Compression principle: record only what cannot be re-derived
| Class |
Examples |
Durability |
| Ephemeral |
tool output, failed searches, reasoning traces |
zero — discard |
| Derivable |
current code, test counts, deploy state |
never record — regenerate from source of truth; recording it produces lies when it goes stale |
| Irreversible |
why a choice was made, what a symptom means, what was ruled out |
must be lossless |
The irreversible residue of even a very long session is typically a few pages. That is the
entire journaling burden.
The durability ladder
Push every piece of knowledge as far UP this ladder as it can go:
- Executable guard (test / assertion / script refusal) — fails loudly, cannot be ignored
- Comment at the danger point — read exactly when relevant
- Indexed document keyed by how a future investigator would search — findable on purpose
- Prose in a log — findable by luck
- Conversation / context window — lost
Anything left at levels 4–5 at the end of a debugging session is a regression waiting to happen.
Important knowledge should live at multiple levels simultaneously (guard + comment + index entry).
The four stores (each with exactly one job)
| Store |
Nature |
Content |
DECISIONS.md |
append-only, dated |
why a choice was made, including rejected alternatives |
SYMPTOMS.md |
append-only, keyed by observable |
symptom → known causes → discriminator → fix + commit ref → what was ruled out |
| Executable guards |
test suite / scripts |
every fix that can be asserted, is |
Dashboard (next_steps.md or similar) |
mutable, small |
current state, explicitly derived, regularly reconciled |
Critical rule: never mix append-only history with mutable state in one file.
Dated facts never become false; state rots. Ledger ≠ dashboard.
Tracked-home rule: a fact whose only home is a gitignored file (CLAUDE.md,
.claude/*, local scripts, device images) is not durable — it vanishes on a fresh clone.
Every irreversible fact needs a home in a tracked file; gitignored homes get a tracked
echo.
Staleness is the dual of loss. This architecture armors knowledge that would die with
the session; it must equally armor artifacts that survive the session and lie. Two rules:
(a) deletion is part of recording — when closing a session, remove or mark-done any claim
that HEAD now contradicts, in every artifact that will be re-surfaced (docs, checklists,
and especially auto-injected plan files); (b) verify-before-act — a surviving plan states
intent, not completion, so confirm any plan item's status against code/git log before
acting on it. "Derivable, don't record" is only safe when re-derivation before action is
enforced.
Before any compaction or handoff, run the full pre-compaction pass in
references/compaction-checklist.md — sweep, place, tracked-home check, question index,
stale-claim removal, auto-injected-artifact reconciliation, cold read, all-PASS acceptance
bar. After the compaction, the counterpart skill rehydrate restores state the safe
way: it re-derives the working state from the tracked files and live systems, verifying
every claim before anything acts on it, rather than trusting the injected summary.
SYMPTOMS.md is the store most likely to be missing from a repo — debugging knowledge is
otherwise homeless and scatters into commits, comments, and transcripts, recoverable only by
luck. Templates for both ledgers: references/templates.md.
The three habits
Resolve → Record, atomically. The moment a bug is solved or a decision made, write the
artifact before moving to the next task. Journal at state transitions, not continuously —
that's how you get journaling without transcription. Treat an unrecorded fix as an
unfinished fix.
Symptom: trailer in every fix commit. One line describing the observable, in the
words an operator would use to describe it:
Fix first-paint race in the renderer
Symptom: blank region on the display after startup
This makes git itself a self-maintaining symptom index — git log --grep on the symptom
then always works. Near-zero cost.
Productize-or-it-regresses. When a debugging session ends, ask: "could a script have
detected this symptom?" If yes, write the verifier before closing the session —
especially for failure classes whose only prior detector was a human (rendered output,
audio, hardware behavior). Design requirements — discriminator-based detection, tri-state
exit codes (observation failure must never masquerade as a pass), failure output that
points at the SYMPTOMS.md entry, invocation wired into state-transition checklists, and
proof in both directions (healthy → pass, fix stripped → fail) — are in
references/verifier-pattern.md, along with the closed-loop table showing which record
failure mode each artifact eliminates.
The guarantee mechanism: the cold-start test
Rules are aspirational; this is verifiable. Periodically (or after major debugging sessions),
run a context-free audit: a fresh agent with only the repo, asked the key questions —
"why does this odd construct exist?", "what causes symptom X and how do I discriminate the
causes?", "what has already been ruled out?" If it can't answer, the record is lossy — and you
found out cheaply instead of at hour three of a re-investigation. This is a falsifiable test
of losslessness. Full procedure and question-generation guidance: agents/cold-start-auditor.md.
Deployment modes
- As a standing skill: apply Part 1 automatically whenever debugging begins; apply Part 2
automatically whenever debugging ends or a decision is made.
- As a subagent (Claude Code): install
agents/regression-triage.md as a project agent
(.claude/agents/). Dispatch it when a symptom appears; it runs the triage protocol and
reports whether the symptom is known, before any main-line theorizing happens.
- As an audit: run the cold-start test from
agents/cold-start-auditor.md on demand or on
a schedule.
Bootstrap checklist (new or existing repo)
- Create
DECISIONS.md and SYMPTOMS.md from references/templates.md; seed SYMPTOMS.md
with every currently-known symptom.
- Audit existing docs: move any derivable state out of append-only files; move any history
out of mutable dashboards.
- For each known past fix, check whether an executable guard exists; write the missing ones —
with special attention to output the tests can't see but a human can (rendered screens,
audio, hardware behavior). If the only detector for a failure class is a human, build a
verifier for it per
references/verifier-pattern.md, and prove it in both directions.
- Adopt the
Symptom: commit trailer going forward.
- Run one cold-start test to baseline the record's losslessness.
1---2name: semantic-compactor3description: Institutional-memory discipline that guarantees no problem→solution outcome is ever lost across sessions, /compact operations, or agent restarts. Use this skill whenever: (1) a bug, symptom, or failure is being investigated — especially one that looks familiar or may have occurred before; (2) a bug is resolved or a design decision is made and its knowledge must be durably recorded; (3) the user mentions regressions, "we fixed this before", lost context, post-mortems, /compact losing information, or knowledge that "should have been written down"; (4) setting up or auditing a repo's knowledge-capture structure (DECISIONS.md, SYMPTOMS.md, regression guards). Also trigger proactively at the moment any debugging effort concludes, even if the user doesn't ask — Resolve → Record is atomic.4---56# Semantic Compactor: Lossless Institutional Memory78The purpose of this skill is to make the normal development loop —9**propose → implement → debug → test → refine → repeat** —10have the property that **no outcome of problem → solution is ever lost**, without rote-recording11every word. It has two halves: a **triage protocol** (how to investigate a symptom without12re-solving solved problems) and a **capture architecture** (how to record knowledge so it13survives context loss).1415---1617## Part 1 — Triage protocol (BEFORE theorizing about any bug)1819When a symptom appears, in this order:20211. **Search the record for the SYMPTOM, not the cause — and search git first.**22 ```bash23 git log --all --grep="<symptom words>" -i24 grep -ri "<symptom words>" SYMPTOMS.md docs/ 2>/dev/null25 ```26 Git is the most durable, highest-signal record available. Ten seconds here can save hours.27282. **Never assert that knowledge was lost until you've proven it absent** from git history,29 the symptom index, and the decision ledger. Absence in one corpus is not absence.30 "The fix must have been lost" is a hypothesis to falsify, not a premise.31323. **A symptom is not a defect identity.** When a symptom recurs, assume a **new cause**33 until proven otherwise. Identical visual/behavioral signatures routinely have distinct34 root causes. If the record shows a prior fix, verify the fix is still present and effective35 before concluding it regressed.36374. **Run the cheapest discriminating experiment before theorizing within a layer.**38 Bisect *between* layers (content vs. renderer vs. driver; app vs. library vs. OS) before39 exploring hypotheses *inside* one layer. Ask: "what two-minute observation would eliminate40 an entire branch?"41425. **Weight direct human observation heavily.** When the person with eyes on the system43 contradicts your theory, update the theory, not the report.4445## Part 2 — Capture architecture4647### Compression principle: record only what cannot be re-derived4849| Class | Examples | Durability |50|---|---|---|51| Ephemeral | tool output, failed searches, reasoning traces | zero — discard |52| Derivable | current code, test counts, deploy state | **never record** — regenerate from source of truth; recording it produces lies when it goes stale |53| Irreversible | why a choice was made, what a symptom means, what was ruled out | **must be lossless** |5455The irreversible residue of even a very long session is typically a few pages. That is the56entire journaling burden.5758### The durability ladder5960Push every piece of knowledge as far UP this ladder as it can go:61621. **Executable guard** (test / assertion / script refusal) — fails loudly, cannot be ignored632. **Comment at the danger point** — read exactly when relevant643. **Indexed document** keyed by how a future investigator would *search* — findable on purpose654. **Prose in a log** — findable by luck665. **Conversation / context window** — lost6768Anything left at levels 4–5 at the end of a debugging session is a regression waiting to happen.69Important knowledge should live at multiple levels simultaneously (guard + comment + index entry).7071### The four stores (each with exactly one job)7273| Store | Nature | Content |74|---|---|---|75| `DECISIONS.md` | append-only, dated | why a choice was made, **including rejected alternatives** |76| `SYMPTOMS.md` | append-only, keyed by *observable* | symptom → known causes → discriminator → fix + commit ref → **what was ruled out** |77| Executable guards | test suite / scripts | every fix that *can* be asserted, *is* |78| Dashboard (`next_steps.md` or similar) | mutable, small | current state, explicitly derived, regularly reconciled |7980**Critical rule: never mix append-only history with mutable state in one file.**81Dated facts never become false; state rots. Ledger ≠ dashboard.8283**Tracked-home rule:** a fact whose *only* home is a gitignored file (`CLAUDE.md`,84`.claude/*`, local scripts, device images) is not durable — it vanishes on a fresh clone.85Every irreversible fact needs a home in a **tracked** file; gitignored homes get a tracked86echo.8788**Staleness is the dual of loss.** This architecture armors knowledge that would *die* with89the session; it must equally armor artifacts that *survive* the session and lie. Two rules:90(a) deletion is part of recording — when closing a session, remove or mark-done any claim91that `HEAD` now contradicts, in every artifact that will be re-surfaced (docs, checklists,92and especially auto-injected plan files); (b) **verify-before-act** — a surviving plan states93intent, not completion, so confirm any plan item's status against code/`git log` before94acting on it. "Derivable, don't record" is only safe when re-derivation before action is95enforced.9697**Before any compaction or handoff**, run the full pre-compaction pass in98`references/compaction-checklist.md` — sweep, place, tracked-home check, question index,99stale-claim removal, auto-injected-artifact reconciliation, cold read, all-PASS acceptance100bar. **After the compaction**, the counterpart skill `rehydrate` restores state the safe101way: it re-derives the working state from the tracked files and live systems, verifying102every claim before anything acts on it, rather than trusting the injected summary.103104`SYMPTOMS.md` is the store most likely to be missing from a repo — debugging knowledge is105otherwise homeless and scatters into commits, comments, and transcripts, recoverable only by106luck. Templates for both ledgers: `references/templates.md`.107108### The three habits1091101. **Resolve → Record, atomically.** The moment a bug is solved or a decision made, write the111 artifact *before* moving to the next task. Journal at state transitions, not continuously —112 that's how you get journaling without transcription. Treat an unrecorded fix as an113 unfinished fix.1141152. **`Symptom:` trailer in every fix commit.** One line describing the *observable*, in the116 words an operator would use to describe it:117 ```118 Fix first-paint race in the renderer119120 Symptom: blank region on the display after startup121 ```122 This makes git itself a self-maintaining symptom index — `git log --grep` on the symptom123 then always works. Near-zero cost.1241253. **Productize-or-it-regresses.** When a debugging session ends, ask: "could a script have126 detected this symptom?" If yes, write the **verifier** before closing the session —127 especially for failure classes whose only prior detector was a human (rendered output,128 audio, hardware behavior). Design requirements — discriminator-based detection, tri-state129 exit codes (observation failure must never masquerade as a pass), failure output that130 points at the `SYMPTOMS.md` entry, invocation wired into state-transition checklists, and131 proof in both directions (healthy → pass, fix stripped → fail) — are in132 `references/verifier-pattern.md`, along with the closed-loop table showing which record133 failure mode each artifact eliminates.134135### The guarantee mechanism: the cold-start test136137Rules are aspirational; this is verifiable. Periodically (or after major debugging sessions),138run a **context-free audit**: a fresh agent with only the repo, asked the key questions —139"why does this odd construct exist?", "what causes symptom X and how do I discriminate the140causes?", "what has already been ruled out?" If it can't answer, the record is lossy — and you141found out cheaply instead of at hour three of a re-investigation. This is a falsifiable test142of losslessness. Full procedure and question-generation guidance: `agents/cold-start-auditor.md`.143144---145146## Deployment modes147148- **As a standing skill**: apply Part 1 automatically whenever debugging begins; apply Part 2149 automatically whenever debugging ends or a decision is made.150- **As a subagent** (Claude Code): install `agents/regression-triage.md` as a project agent151 (`.claude/agents/`). Dispatch it when a symptom appears; it runs the triage protocol and152 reports whether the symptom is known, before any main-line theorizing happens.153- **As an audit**: run the cold-start test from `agents/cold-start-auditor.md` on demand or on154 a schedule.155156## Bootstrap checklist (new or existing repo)1571581. Create `DECISIONS.md` and `SYMPTOMS.md` from `references/templates.md`; seed `SYMPTOMS.md`159 with every currently-known symptom.1602. Audit existing docs: move any derivable state out of append-only files; move any history161 out of mutable dashboards.1623. For each known past fix, check whether an executable guard exists; write the missing ones —163 with special attention to output the tests can't see but a human can (rendered screens,164 audio, hardware behavior). If the only detector for a failure class is a human, build a165 verifier for it per `references/verifier-pattern.md`, and prove it in both directions.1664. Adopt the `Symptom:` commit trailer going forward.1675. Run one cold-start test to baseline the record's losslessness.