/trace:distilfrom trace
Evaluates recent git changes and proposes updates to permanent project context (AGENTS.md or docs) when durable knowledge is discovered.
Ships in trace. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Use Claude Code’s Read, Glob, Write, and Edit tools for file operations. Use AskUserQuestion for closed choices and normal chat for open questions. Invoke referenced skills with the Skill tool. Resolve script paths from this installed skill; respect the session’s permissions.
You are running the distillation step of TRACE: evaluate recent changes and propose capturing anything durable into the project's permanent context.
Before doing anything, read distillation-criteria.md (the bar for Phase 2) and docs-folder-resolution.md (folder lookup for Phase 3). Read authoring-rules.md and example-distillation.md later, in Phase 5, and only if you end up writing something.
Get the changed-file list before reading diff content — don't pull the whole diff blind.
git status --short and git diff HEAD --stat. If present, those files are the scope.git log -5 --oneline and git diff HEAD~1 HEAD --stat (further back if the developer gave a range).git not installed, or the folder isn't a repository), don't stop on the error: ask the developer to describe what changed and evaluate from their answer.Then read the diff only for files worth evaluating, one or a few at a time: git diff HEAD -- <path>. Prioritise config, security-sensitive paths, new files, and structural changes (added/removed exports, schema changes). Skip lockfiles, generated output, and formatting-only churn.
Apply distillation-criteria.md to what you read. Judge criteria 1–4 (new convention, security boundary, durable design choice, non-obvious gotcha) from the diff alone. Hold each qualifying observation as a separate candidate — they may route to different files. Criterion 5 (a correction to existing context) is confirmed in Phase 3, when you read the affected scope's AGENTS.md.
If the diff yields no candidates and nothing in it plausibly invalidates existing context, say so, clear the sentinel (Phase 6), and stop — skip the rest. Most runs distil nothing; don't invent reasons to write.
A project may be a single repo or a super-repo of sub-repos that each carry their own AGENTS.md and durable-context folder. Route each candidate to the most-local scope whose contents it describes — otherwise sub-repo knowledge lands at the super-repo level, where someone working inside the sub-repo never sees it.
For each candidate, find its nearest-ancestor scope — the closest ancestor directory (from the changed file upward) containing an AGENTS.md; the repo root counts, intermediate directories with their own AGENTS.md count first. (An existing CLAUDE.md without a sibling AGENTS.md does not count — per TRACE's convention only AGENTS.md is canonical.) Resolve that scope's durable-context folder per docs-folder-resolution.md; if it isn't TRACE-marked yet, you'll mark it on first write (Phase 5). Also note any further-ancestor scopes between that one and the project root — distil reads these too, so a sub-scope candidate doesn't duplicate something a domain-wide AGENTS.md or docs folder already records.
Read existing context proportionally — enough to avoid duplicates and contradictions, not the whole library:
AGENTS.md, and each ancestor scope's root AGENTS.md up to the project root (all small; together they are your dedup and your correction check for criterion 5 — a change can invalidate something the parent scope claims, not just the local one).AGENTS.md marker and the filenames in <docs-folder>/system/, <docs-folder>/architecture/ (if present), and at the <docs-folder>/ root (legacy location for descriptive files). Open in full only the file(s) whose area overlaps a candidate — skip unrelated ones.<docs-folder>/adr/ at the affected scope or any ancestor, touching a candidate's area, so you don't restate its rationale.<docs-folder>/adr/ is never a distillation target. Historical folders (reference/, working-notes/) are also never targets — distil writes living knowledge, not rationale or research. <docs-folder>/architecture/ is a valid target for prescriptive candidates (operational rules), but only when the project has the folder set up; descriptive candidates always route to system/.
For each candidate observation, pick a destination using two questions in this order:
1. Which scope owns this knowledge? Default to the nearest-ancestor scope of the changed paths. Then check three promotion signals against the ancestor scopes you read in Phase 3:
AGENTS.md or a file in its docs folder already discusses what this candidate adds to. Propose updating that file instead of writing a local duplicate.shared/, contracts/, proto/, or similar). Propose the nearest scope that owns the shared path.When any signal fires, lead with the upward target in Phase 5; the developer can still flip via Change location. When none fire but the candidate still feels domain-wide (a general rule rather than scope-specific behaviour), use the question control before drafting: Keep at <local> / Hoist to <parent> / Skip. Don't guess silently. When none fire and the candidate is plainly local, propose local and move on.
2. Inside that scope, which file?
First decide what kind of knowledge the candidate is:
src/auth.ts"). Routes to system/.architecture/<area>.md. Use only if the candidate is unambiguously a MUST/operational rule and <docs-folder>/architecture/ exists in the project. If unclear, default to descriptive and let the developer redirect.Then pick the file:
AGENTS.md if the candidate corrects an outdated entry there (Stack/Commands), or is a scope-wide gotcha — one that would catch out work anywhere in the scope. A gotcha confined to one area routes to that area's system/<topic>.md instead.<docs-folder>/system/<topic>.md, <docs-folder>/architecture/<topic>.md, or <docs-folder>/<topic>.md (legacy). Do not migrate the file's location as part of the update.<docs-folder>/system/<topic>.md if no existing file fits and the candidate is substantial enough to warrant its own file.<docs-folder>/architecture/<topic>.md only if the candidate is clearly a MUST/operational rule, <docs-folder>/architecture/ already exists, and no existing architecture file covers the area. Use RFC 2119 voice (MUST / MUST NOT / SHOULD) and cite the source (an ADR, a contract, an incident) for each rule.Naming guidance for new context files: scope each to a meaningful concept — security.md, data-model.md, kafka-events.md, api-conventions.md. Not so narrow they fragment (that-blue-button.md is wrong). Not so broad they become a dump (misc.md is wrong). Use the project's own vocabulary, not the example list. Pair filenames across system/ and architecture/ for the same area (e.g. system/api.md describing the client + architecture/api.md constraining it).
Don't duplicate an ADR's rationale. Distilled context records the resulting convention ("rate limits go through RateLimiter"); an ADR records the decision and why ("we chose token-bucket over fixed-window because…"). If a candidate is really a design decision and an ADR covers it, distil only the convention and point at the ADR rather than restating the reasoning. If the decision is significant but no ADR exists, suggest /trace:adr instead of capturing the rationale here.
Work through the candidates one at a time — present, get one approval, write, then move on. Ask for every candidate, even when the routing is obvious. For each:
Show the developer, together:
services/api/docs/api-conventions.md).Ask once using the question control: Confirm & write / Change location / Edit content / Skip. Nothing is written until the developer confirms.
On confirm: if the target durable-context folder isn't TRACE-marked yet (missing, or no AGENTS.md with TRACE heading), write the marker first: <scope>/<docs-folder>/AGENTS.md from context-folder-template.md (start at # Durable project context; Write creates parent dirs), plus a sibling <scope>/<docs-folder>/CLAUDE.md containing the one-line forwarder See @AGENTS.md for more information.. If the folder already holds hand-written docs, tell the developer the marker pair lands alongside them. Then write the candidate's addition.
If this run wrote files, run the structure validator and repair anything the writes introduced (a broken relative link, a misplaced file) before finishing:
node "${CLAUDE_SKILL_DIR}/../../scripts/doctor.js" check
Pre-existing findings unrelated to this run are not yours to fix here — mention /trace:doctor and move on.
Once this run reaches a clean conclusion — candidates written, or a no-op from Phase 2 — clear the sentinel:
node "${CLAUDE_SKILL_DIR}/../../scripts/clear-sentinel.js"
Skip only if the developer aborted mid-flow; then the pending state still applies.
AGENTS.md at the root, say so and recommend running /trace:agents-md-setup first. (An existing CLAUDE.md without an AGENTS.md does not count — only AGENTS.md is canonical.) In a super-repo with sub-repos that have their own AGENTS.md files, a missing super-repo AGENTS.md is fine — the recommendation only applies when there's no AGENTS.md anywhere in the changed scopes.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub axakon/trace --plugin trace11 skills in this plugin
/adrRecord an architecture decision as a lightweight, immutable ADR in the scope's docs folder. Owns the ADR template, numbering, and write. Invokable directly for a direct-path decision, or by /trace:spec at handoff./agents-md-setupSet up or review the project's AGENTS.md through an interactive interview with the developer/commit-messageDraft a single commit's message — imperative-mood title plus a short why body, optional decision bullets, plain text (no markdown). Use when the developer explicitly asks for a commit message, asks to fix a message before amending, or asks the agent to perform the commit on their behalf./context-graphMeasure context weight per directory: AGENTS.md chains, @ imports, gotchas, on-demand docs./doctorValidate a TRACE-adopted scope against TRACE's own conventions — doc structure, marker pairs, AGENTS.md spec, ADR numbering and immutability, working-note banners, relative links — then guide the fixes. Owns the resolution flow for ADR number collisions left by merged branches. Useful after merges, before releases, or whenever the structure feels off./epicTurn a multi-phase feature into a local epic — an architecture-focused interview producing core user stories, diagrams, and spec-sized tickets under ~/.claude/epics — then manage the board as work lands