← The Machine Room · Case File 007 — Afterwit Localhost only · v0.1.0 · --:--:-- GST · Sheet 1 of 7
CASE FILE · AFTERWIT · AGENT MEMORY / DEVTOOLS DWG NO. AH-CS-007

Afterwit turns coding-agent hindsight into a few cited memory cards, served only when they will help.

A local, single-user memory desk for Claude Code and Codex work. It mines session exhaust into reviewed cards, then injects at most three tiny citations into the next run — or returns nothing when the match is weak.

INGEST → DISTILL → REVIEW → CARDS → INDEX_DB
CLAUDE CODE + CODEX JSONL · MEMORY DOCS · PROJECT DOCS
VERIFIED-ONLY PUSH · SILENCE IS A VALID ANSWER

CONTEXT AS A SCALPEL
LOCALHOST ONLY · ONE MACHINE · NO CLOUD MEMORY
injection ceiling
≤600
TOKENS MAX · ≤3 CARDS · CONFIG DEFAULT + BUDGET LOOP
THE REST STAYS IN PULL RETRIEVAL  VERIFIED
Drawn byAbu Huraira Mukhtar
RoleArchitect & Sole Author
Packagehh · v0.1.0
Scale≤3 Cards · ≤600 Tokens
LicenseNo License File
StatusPre-Release · P4 Complete
Source4,236 LOC · 110 Tests
Sheet1 of 7
SHEET 2 OF 7 · ABSTRACTGENERAL NOTES APPLY

01 · Memory that knows when to stay quiet

Ask Afterwit what earlier sessions learned and it refuses to dump a transcript. It returns a few cited cards, or nothing.

The source pile is real: Claude Code JSONL, Codex JSONL, memory markdown, and project docs. The product is the restraint layer between that pile and the next agent. Ingest normalizes events, distill promotes only resolved outcomes, review gates trust, and injection stays capped at ≤3 cards / ≤600 tokens VERIFIED.

The name is literal. Afterwit means wisdom that arrives too late; this system catches that late session-wisdom before the next context window pays to rediscover it.

GENERAL NOTES
1 · SINGLE MACHINE · LOCALHOST ONLY VERIFIED
2 · 4 INGESTION ADAPTERS · REDACT BEFORE PERSISTENCE VERIFIED
3 · 8 MCP TOOLS · 10 CARD TYPES · 12 CLI SUBCOMMANDS VERIFIED
4 · 110 TESTS PASSED IN 8.88S VERIFIED
SHEET 3 OF 7 · FIELD NOTESTHE BEFORE-STATE

02 · Agent amnesia is expensive

A coding-agent session finally finds the fix, defends the decision, names the environment trap, and then the context window closes.

The next agent starts clean and pays the same tax again. The transcript technically remembers everything, but at human scale it remembers too much: false starts, dead ends, raw logs, and hundreds of megabytes nobody will reread before asking for help.

FIG. 1 shows the failure before the mechanism. Paid-for intelligence falls off the end of the session; the next run begins with no useful memory in hand.

OBSERVED
PAID-FOR INTELLIGENCE EVAPORATES VERIFIED
48 CODEX SESSION FILES · MAX 69MB VERIFIED
196 CODEX PROMPTS · 441 PROJECT DOCS VERIFIED
THE OLD RETRIEVAL METHOD — REREAD THE PILE
SESSION EXHAUST FIX THAT WORKED DECISION DEFENDED ENV TRAP NAMED LATE SESSION-WISDOM CONTEXT ENDS RAW TRANSCRIPT KEEPS EVERYTHING USEFUL OR NOT STARTS OVER NEXT AGENT PAID-FOR INTELLIGENCE FALLS OFF THE NEXT RUN RE-DERIVES IT
FIG. 1 — AGENT AMNESIA, AS OBSERVEDSCALE — ONE USEFUL SESSION : ZERO CARRY-FORWARD MEMORY
SHEET 4 OF 7 · SECTION A-ACUT THROUGH THE RUNNING PIPELINE

03 · The hindsight loop filters before it remembers

INGEST · 4 ADAPTERS EVENT(SOURCE, LINES, ROLE, KIND) REDACT BEFORE PERSISTENCE NORMALIZED EVENTS DISTILL EMPTY ARRAY IS GOOD REVIEW QUEUE DEDUPE · MERGE SUPERSEDE · CONFIDENCE WIKI MARKDOWN IS TRUTH MANDATORY SOURCES · 10 CARD TYPES SQLITE FTS5 IS REBUILDABLE CACHE RANK + INJECT ≤3 CARDS · ≤600 TOKENS VERIFIED-ONLY SILENCE OK MCP PULL · 8 TOOLS RECALL · WHY · FOR_FILE USAGE FEEDS RANKING 30-DAY HIT-RATE <20% DISABLES INJECTION ONE BACKBONE END TO END · PUSH WHEN SAFE · PULL WHEN THE AGENT ASKS
FIG. 2 — SECTION A-A · THE HINDSIGHT LOOP, V0.1.0COUNTS VERIFIED · FEEDBACK ARC DESIGNED FOR
BEAT 1 · INGEST · REDACT BEFORE PERSISTENCE

1Ingest

Claude Code JSONL, Codex JSONL, memory docs, and project docs enter through four adapters. Each one normalizes into the same Event shape with source lines, project, timestamp, role, kind, text, and metadata — and calls redaction before returning anything.

BEAT 2 · DISTILL · RESOLVED OUTCOMES ONLY

2Distill

The prompt is deliberately conservative: empty output is common and good. Candidates need visible resolution evidence and source lines. False starts remain in the transcript; only decisions, error-fix pairs, gotchas, preferences, facts, and snippets that actually resolved can move forward.

BEAT 3 · POSTPROCESS + REVIEW · NO SILENT TRUST

3Review

Afterwit dedupes, merges, supersedes, and confidence-gates. Agent-written cards and low-confidence candidates go to a queue. The reviewed batch report shows the posture in practice: 190 queued cards reviewed, 187 approved, 3 left queued, and no automatic promotion to trusted memory. VERIFIED REPORT

BEAT 4 · WIKI TRUTH · SQLITE CACHE

4Index

Trusted knowledge becomes one markdown file per card with mandatory sources. SQLite is deliberately disposable: rebuild deletes derived rows and reindexes from wiki markdown. That means audit, rollback, sync, and provenance stay ordinary file operations instead of becoming opaque database lore.

BEAT 5 · RANK + INJECT · ≤600 TOKENS

5Inject

The proactive path is small on purpose: threshold-gated ranking, verified-only by default, maximum three cards and six hundred tokens. Weak matches fall below the floor. Returning nothing is not a miss; it is the feature that keeps context trustworthy.

BEAT 6 · MCP PULL · FEEDBACK RANKS FUTURE PUSH

6Pull

The full retrieval surface stays available through eight MCP tools: recall, lookup, why, file context, project brief, related cards, save insight, and feedback. VERIFIED The dashed ember arc is the product's discipline loop: usage feeds future ranking, and injection disables if the 30-day hit-rate falls below 20% over at least 20 servings. DESIGNED FOR

DETAIL B · SEE FIG. 2, PRIVACY BOUNDARY

Pointer over copy

The obvious design was semantic code search: index the bodies, embed the snippets, and let agents paste old code into new contexts.

Chose distilled knowledge cards that point to live files, never copied code bodies, because stale code and private context are exactly what a memory tool must not leak forward. Cost: less magical code search. Benefit: every reuse starts by reading current source, with lower privacy risk. ADR-002 · ADR-014
DETAIL C · SEE FIG. 2, NO-ANSWER GATE

The hook is allowed to say nothing

Memory systems are usually rewarded for surfacing something. For coding agents, wrong-but-related context is worse than silence.

Chose threshold ranking, no-answer traps, query-token coverage, and hard no-answer precision gates, because the proactive hook must earn trust every time it appears. Cost: some useful cards may not surface. Benefit: silence is expected, not suspicious. ADR-006 · ADR-012
SHEET 5 OF 7 · REVISION HISTORYALL ENTRIES TRACEABLE

04 · What failed before it became memory

The hard decisions all rhyme: do less proactively, keep more provenance, and make trust revocable.

These are the six forks that shaped the product. Each row starts with the tempting failure mode and ends with the constraint that made Afterwit useful instead of noisy.

REV
TRACE
WHAT BROKE
THE FIX
STATUS
A
ADR-002 / 014
COPYIndexing code bodies would make reuse feel magical and then serve stale, private, or wrong code back into future sessions.
POINTNever index code bodies. Store distilled knowledge and capability cards that cite live files; force the agent to read current source.
VERIFIED
B
ADR-004 / 011 / 017
POISONAutomatic memory can poison the next agent if every plausible note becomes trusted context.
REVIEWDistill only resolved outcomes, queue agent-written or low-confidence cards, and push only human-verified cards by default.
VERIFIED
C
ADR-001 / 008
OPAQUE TRUTHA database is fast, but memory that cannot be audited by humans or agents turns into folklore.
WIKI FIRSTOne markdown card per fact is truth. SQLite is FTS/cache and can be rebuilt losslessly from the wiki.
VERIFIED
D
ADR-006 / 012
NOISEA proactive hook that always returns something teaches agents to ignore it.
SILENCEThreshold-gate ranking, test no-answer traps, and treat empty output as a product feature.
VERIFIED
E
ADR-003
HARNESS DRIFTClaude hooks and Codex prompt semantics are not the same contract.
BACKBONEMCP is shared retrieval. Claude gets bounded push as a bonus; Codex gets session-start and pull retrieval.
VERIFIED
F
ADR-016
COLD STARTEmbeddings improve pull retrieval, but ONNX cold-start can blow the injection hot path.
OFF PATHPrecompute vectors for recall and MCP pull. Keep hh inject lexical, verified-only, boring, and fast.
VERIFIED

One number a skeptic should push on, answered before the interview: p95 <200ms is a budget, not a measured distribution. The verified latency evidence here is one Wave 3 report of 50ms. VERIFIED SINGLE The page does not dress one sample as a benchmark.

VERIFICATION
110 TESTS PASSED IN 8.88S VERIFIED
355 INDEXED / 329 ACTIVE VECTORIZED REPORT
RECALL@3 75% · NO-ANSWER PRECISION 100% REPORT
P95 <200MS · HOT-PATH BUDGET DESIGNED FOR
SHEET 6 OF 7 · APPROVAL PLATEPROVENANCE ON EVERY NUMBER

05 · Tiny context, full recall

≤600Token ceiling for proactive injection — context stays a scalpel, not a transcript dumpVERIFIED
110Tests passing in the verified run — the cleanest engineering-health numberVERIFIED
50 msSingle measured inject run; p95 <200ms remains a budget, not a distributionVERIFIED · SINGLE
8MCP tools expose pull retrieval for both Claude Code and CodexVERIFIED
4Ingestion adapter sources: Claude, Codex, memory markdown, and project docsVERIFIED
10Card types in the reviewed knowledge format, each requiring sourcesVERIFIED
SPECIMEN — THE HINDSIGHT FLASH · REAL MECHANICS, SYNTHETIC CARD TEXT · COMMAND, CAPS, FILTERS, NO-OUTPUT PATH, AND TIMER ARE GROUNDED
$ hh inject --mode prompt "Fix this failing hook test." ↳ local sqlite · no network · verified-only ↳ ranking floor cleared · 2 cards selected [gotcha] Hook must fail open when memory is unavailable. If the local index cannot answer, return empty context and let the command continue. source: synthetic/hook-runbook.md:12-18 [decision] Push surfaces serve verified cards only. Queue agent-written insights for review; do not promote them into proactive context automatically. source: synthetic/verified-push.md:4-11 token meter: 312 / 600 · cap: 3 cards timer: 50ms measured · p95 budget <200ms $ hh inject --mode prompt "rename this button" ↳ candidates below relevance floor ↳ no verified card injected result: empty output — silence is the feature
THE FLARE
CARD TITLES, BODIES, AND SOURCE NAMES ARE SYNTHETIC BY RULE
312 / 600 METER — REPLAY-DESIGNED · 600 CAP VERIFIED DESIGNED
REAL MECHANICS — COMMAND, CAPS, VERIFIED FILTER, FLOOR, NO-OUTPUT PATH
50MS IS A SINGLE REPORTED RUN · P95 <200MS IS DESIGNED FOR VERIFIED SINGLE

What that buys an agent: not a second brain, not a transcript dump, and not a chatbot memory fantasy. Just the smallest verified reminder that changes the next move — with a citation attached.

Ask what your agents keep relearning →
SHEET 7 OF 7 · CLOSE-OUTPLAIN VOICE

06 · One machine, honest limits

A dossier about trusted memory should say exactly where trust ends.

Afterwit currently has one user: me. It is v0.1.0, P4 is complete, and the cleanest idea in this ledger lives on one machine. There is no README, no LICENSE file, and no git remote configured in the verified repo-local state.

The public-release story is future work, not something this page should imply. The db_schema adapter is P5 and unbuilt. The injection hot path has one verified 50ms report; p95 <200ms is still a budget, not a measured distribution. The reviewed corpus exists, but real card bodies and paths are private and stay off this page.

That candor is the trust gate. Afterwit means wisdom too late; this project earns the name only if it captures hindsight without pretending it has already become a platform.

UNRESOLVED
USERS — 1 · THE AUTHOR VERIFIED
LICENSE FILE — MISSING VERIFIED · FLAG
README — MISSING · REMOTE — NONE VERIFIED
DB_SCHEMA ADAPTER — P5, UNBUILT VERIFIED GAP
P95 <200MS — BUDGET, NOT DISTRIBUTION DESIGNED FOR
DRAWN & BUILT BY
ABU HURAIRA MUKHTAR · SOLO · V0.1.0 · P4 COMPLETE
A. H. M.
SHEET 7 OF 7
END OF CASE FILE 007
THE DRAWING OFFICE · AFTER HOURS

Future agents should inherit the lesson, not the transcript.

Bring the failure your tools keep rediscovering. The page is inert, but the offer is simple: turn hindsight into cited, review-gated memory that knows when to stay silent.

Start a conversation → ← Back to the machine room
NEXT DRAWING The Machine Room → SHEET 1 OF —