in progress · 2026
Weave
Project Memory for AI Coding Agents
A tool that gives AI coding agents a memory. After each Claude Code or pi session, it reads the transcript and updates the project's documents (decisions, backlog, status) without making anything up: code extracts the facts, the LLM only arranges them.
- automated tests
- 291
- packages published on npm
- 5
- production dependencies in the engine
- 0
↓ Problem, architecture and technical decisions ↑ Collapse
The problem
Coding agents like Claude Code move fast, but forget everything between sessions. Their decisions stay buried in a transcript nobody rereads, compaction of long sessions wipes out the intermediate reasoning, and asking the agent to document its work makes it reread the whole history, at full price.
What I built
A tool that reads the transcript of a finished session and updates the project documents you choose: decision log, backlog, status page, changelog. The next session, human or agent, starts from what actually happened.
- Nothing made up: code extracts the facts, the LLM only arranges them; if a session has nothing for a document, it is left untouched
- Declarative: each document is described in a few lines of YAML (expected content, structure, write mode)
- Safe to rerun: running again on the same session never duplicates an entry
- Frugal: the model gets a compact extract prepared by code, not the full history; everything that can fail is checked locally before the LLM call
- Reliable: 291 automated tests, about 1.6 lines of test per line of code
- Integrated: CLI,
/weavecommand in pi, Claude Code hook; 5 packages published on npm
Under the hood
Three steps, and a strict boundary between what depends on the agent and what does not:
transcript (.jsonl)
└─ Extract → bundle structured facts: actions, errors, files (adapter)
└─ Scribe → fragment one LLM call per target document (engine)
└─ Write → document append / prepend / replace, guarded writes (engine)
Only two contracts connect the engine to the agents: extract(transcript) → bundle and complete(prompt) → text. The engine knows neither transcript formats nor SDKs: supporting a new agent means writing an adapter, without touching the core.
- Extraction: parsers for pi and Claude Code transcripts (successful actions, tool errors, files changed, compactions, subagent delegations with their result and cost)
- Scribe prompt: an explicit data contract; transcript content is treated as material, never as instructions, which guards against prompt injection
- Idempotency: each appended fragment carries a session marker (
<!-- weaved:session=<id> -->), so a rerun never writes twice - Safe writes: paths confined to the session directory, collisions rejected between targets,
.bakbackups, the transcript and the config (symbolic and hard links included), write access checked before the LLM call - Typed errors:
CONTRACT/DATA/RUNTIMEcodes compared by value rather thaninstanceof, which breaks as soon as a package is duplicated innode_modules - Publishing: GitLab CI publishes to npm on every version merged into
main, and compatibility jobs run against the real Claude Code and pi SDKs
Deliberate choices
| Rejected option | Why |
|---|---|
| Asking the agent to document at the end of the session | Resends the whole history to the model and relies on its memory, which compaction has already truncated |
| Feeding the raw transcript to the LLM | More expensive, and it makes things up: code extracts the facts, the model arranges them |
| One tool per agent | A shared engine and one adapter per agent: adding one leaves the core untouched |
| A YAML library | A flat subset parsed in-house is enough for targets.yaml and keeps the engine dependency-free |