Trace intent

From melodic-software/claude-code-plugins · View interactive version

Trace intent is an AI agent skill from the GitHub repository melodic-software/claude-code-plugins. Reconstruct WHY something was built the way it was from evidence outside the code, and report what could not be found. Use when: 'why was this built this way', 'why did we pick X over Y', 'what were they thinking', 'design rationale', 'what problem was this solving', 'why does this still exist', 'ar

How to use this skill

Skill file

Arguments. <target>. e.g., /discovery:trace-intent the retry backoff in api/client.ts, /discovery:trace-intent why we chose the local-markdown adapter

Purpose

Reconstruct intent from the records outside the code (review threads, tickets, design documents,

incident timelines), which are partial, contradictory, and sometimes gone, and say plainly which

parts could not be recovered. /discovery:explore answers what IS, /discovery:research

what SHOULD BE, and this skill what WAS, and why. Never build a confident story from thin

evidence: a plausible narrative about a decision is worse than an admission of ignorance, because

it is acted upon.

Routing. Dispatch by default

From the main conversation, this skill dispatches the discovery:intent-tracer subagent. Intent

archaeology reads a lot of other people's writing: review threads, ticket histories, design

documents. Keeping that out of the orchestrator's context window is the point. The agent

investigates each resolvable category, writes the artifact set, and returns a file pointer plus a

verification request, not the transcript. The parent resolves the pre-dispatch envelope first: six fields (target on the Topic: line, reason, memory-slice path, memory root, budget, capability

flags), written into the dispatch prompt as the labeled template in the

parent contract, and owns the **post-dispatch

boundary** after: re-surfacing open_questions, dispatching the sibling verifier for tier

assignment, and writing that verdict back into the index. Before that verifier, run

bash "${CLAUDE_PLUGIN_ROOT}/lib/read-verification.sh" --plugin discovery --skill trace-intent --file docs/conventions/discovery.yaml and

report its line: light and off skip it and write verification: skipped (<level>), per the

parent contract's "The sibling verifier, stated once". The spawn's model follows the parent

contract's "The worker's model is the parent's call": pass one only when a multi-agent config

layer moves the intent-tracer's role off its pin.

Run inline instead for tight turn-by-turn iteration, for cost, or when the invoking context is

already a subagent, and inline runs the identical discipline; the escape hatch relaxes nothing

below. An un-runnable gate is not one of the three reasons: probe --help on the artifact

checker before dispatching, and a denied or errored probe halts rather than routing you inline.

All three reasons in full, and the halt rule: CODE0.

Discipline-liveness token. A dispatched agent receives this body through its skills: preload,

and nothing else in its run shows whether that preload resolved. The record for that harness behavior is

CODE0,

"Harness facts the dispatch design rests on".

The disk fallback Reads this same file, so a matching preload_token is file-identity, not proof that preload fired. A missing or mismatched token is a hard failure: the parent discards the run. Provenance is preload: fired | fallback; fallback is the accepted recovery.

discovery-trace-intent-preload-7b3e2d

Pre-dispatch: create the memory slice and touch <that slice>/.trace-intent-dispatch as the

acceptance gate's freshness baseline. Without it a slice already holding an earlier run's index

passes every on-disk check even when this dispatch wrote nothing. **Both shell forms of that command

are in the parent contract**. Copy the one matching this session's shell, because the POSIX form's

touch is not a command in PowerShell and its directory flag is a parameter error there.

Post-dispatch, the payload is graded off disk before it is believed. status: complete is the

agent's claim about its own run, and a claim is not evidence. The gate's four steps, the reason this

family ships no coverage ledger, the by-value rung, and the boundary the parent still owns after the

gate passes are in CODE0. Two things worth knowing before you

get there: any non-zero exit halts the workflow, and a gate that could not run is a FAIL rather

than a skip; and a claims_by_tier census sitting entirely in Speculative and Unknown is a

successful run over an undocumented decision, never grounds for a re-dispatch.

Scope

Investigate the following target: $ARGUMENTS

Under dispatch the target arrives in the dispatch prompt instead. Do not rely on seeing an unfilled

slot: a target that did not arrive in this prompt is a missing target, not an empty one, and it is a

parent-envelope failure the agent reports rather than repairs. Contract:

CODE0. Running

inline with no target, infer it from the conversation, the file, symbol, decision, or convention

under discussion.

The intent-evidence tier

Every claim carries exactly one tier. The tier measures **how far the claim sits from someone

explicitly stating the intent**, not how confident the run feels, and not how authoritative the

source is. Those are different axes, and merging them is the defect this scale exists to avoid.

| Tier | What it means | How to phrase it | Where it goes |

|---|---|---|---|

| Direct | Someone wrote down why. A review comment, a ticket, a design doc, a code comment stating a reason | Confident, present tense: "this exists because X" | What we found |

| Supported | No single source says it, but several indirect pieces converge on it | Confident but visibly derived: "the evidence points strongly to X" | What we found |

| Inferred | A reasonable reading of context, with nothing explicit behind it | Hedged: "appears to", "likely", "suggests", and show the chain | What we can reasonably infer |

| Speculative | Plausible, but rival explanations fit the same evidence | Explicitly a guess: "one possibility is X, but no direct evidence" | Competing hypotheses |

| Unknown | Looked, did not find | Name what was searched, not just the absence | What we do not know |

Unknown is a finding. A question that was investigated and came back empty tells the reader

something real about how the decision was made. Usually that it was never written down.

Source reliability rides alongside, and never routes

Every citation also carries a short reliability note: who wrote it, how close they were to the

decision, and how old it is (a review comment by the change's author and a wiki page four years

stale are both Direct). This is a note, not a second ladder. Only the tier decides which section

a claim lands in.

`Direct` needs a person's own words

Each source records author_kind: owner-quote | agent-relay: who wrote the words, not whose login

posted them. When you cannot tell, it is agent-relay, and a claim whose sources are all

agent-relay is not Direct. Rule and check: CODE2.

Code shape is not intent evidence

"It handles the null case because it checks for null" is mechanics, not motivation. Code-shape

inference does not get a low tier. It leaves the scale entirely and is recorded as a gap: code is

always there to consult, so a low rung for it would fill exactly when the real record is thin,

which is when a reader most needs to be told so.

Version-control behavior is not code shape. Change coupling, churn and hotspot data are evidence

the code alone cannot give you, and they are admissible, but they locate rather than explain: they

show that two files always change together, never why anyone decided that. Behavioral signal reaches

Inferred at most, never Supported, never Direct.

Evidence categories

Three categories are investigated wherever they resolve, and none is assumed present.

| Category | What it holds | What kind of why it uniquely surfaces |

|---|---|---|

| Source control | Commit history, review discussion, merge threads, code comments | Implementation-time rationale captured during review, the problem statement, the alternatives argued, the constraint someone encoded in a comment |

| Long-form documents | Design docs, RFCs, ADRs, specs, postmortems | Rationale written out before it became code. Explicit "alternatives considered", the decision record, the postmortem action item |

| Issue tracker | Tickets, their labels, their parent initiatives | The product or business forcing function, the customer request, the compliance deadline, the incident follow-up |

Each is presence-gated. Source control is not guaranteed either: a run may execute where no

repository resolves, which is the normal condition for a dispatched worker rather than an edge case.

An unavailable category is reported as a gap, never skipped in silence.

Repo-local git archaeology is delegated by invoking /discovery:explore git via the Skill tool

when that skill is enabled, rather than reimplemented here; without it, read the history directly

and say so. Tracker access routes through /work-items:track (if enabled), invoked via the Skill tool, which owns the

provider-neutral seam; without it, use whatever tracker interface the session actually has, and when

none resolves, report the tracker category as unavailable.

Categories beyond these three (team chat, observability, error tracking, product analytics) carry

real intent evidence but are not shipped as investigators, because nothing in this marketplace

reaches them, so four permanently-empty investigators would report the same gap forever. Extension seam: CODE0.

Skipping a category

Exactly two reasons permit skipping, and both are written into the output:

  1. The category does not resolve in this environment. Report it as a gap, not a choice.
  2. The category is provably irrelevant, not merely unlikely. "This is a build-time script with

no runtime path, so error tracking cannot hold anything" qualifies.

"Probably not in the tracker" and "docs likely don't cover this" do not qualify. Deciding in

advance that a source is empty is how a blind spot becomes a finding. Run the search and let the null

result speak: an empty category costs one search, a missed design document costs a wrong answer.

Output

Lead with the question restated and the code anchor, then the sections below in order. Sections with

nothing in them are omitted, except Sources consulted, which is never omitted.

note.

against each. Do not force a winner the record does not support.

- <category>: <what was searched>. <what was found | no relevant results | skipped, reason>.

When the question precedes an actual change, close with a Preserve / Change / Avoid / Risk

constraint set the planning stage can consume.

Persist it as INTENT.md plus INTENT-<section>.md sidecars in the memory slice, so a fresh

session can resume from the artifact alone. Destination and slug resolve per the lifecycle artifact protocol

(CODE0).

The index is the entry point at every size, and **Sources

consulted** lives in it rather than in a sidecar, a reader who takes the answer and stops must still

meet the shape of the record behind it. Header schema, and why neither sibling family's header fits:

CODE0.

Outcome gate

The tier assignments are not this run's to grade. The parent dispatches a fresh context as this

run's reviewer, and this run returns verification pending.

Check these against the written output, not against recollection:

document, or a comment with its location.

Spoke paths

The context/ files write the plugin's root directory as <plugin-root>, which is

${CLAUDE_PLUGIN_ROOT}. Put that path in place of the placeholder before running a command: we

never rely on a ${…} token in a file read from disk being expanded later.

plugin manifest reference: where each variable resolves

live.

Next

Related

Gotchas

See CODE0.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.