Task-Scoped Context
codedecay context retrieves a bounded, inspectable packet of engineering context for one task. Use it when a user-owned coding agent needs the relevant routes, files, tests, requirements, memory, docs, owners, and proof references without receiving a whole-repository dump.
npx codedecay context \
--task "Allow finance admins to retry failed payouts" \
--format markdownThe command refreshes local analysis artifacts, reads repo-local context, ranks nodes with deterministic lexical and graph-neighbor matching, writes .codedecay/local/task-context.json, and prints Markdown or JSON.
What It Reads
Context retrieval uses existing CodeDecay evidence as source-of-truth input:
- requirements from
--taskand optional--requirements - changed files, impacted areas, route/API impacts, symbol impacts, and test proof from the current analysis report
- normalized impact graph artifacts from
.codedecay/local/impact-graph.json - local
.codedecay/memory.json .codedecay/config.ymldesign contracts, product endpoints, commands, and probes- repository docs and ADR/RFC-style markdown
- CODEOWNERS entries
- package manifests
- latest local product/runtime verification evidence when analysis includes it
It does not execute configured checks, call models, generate embeddings, use network access, or send telemetry.
Output Shape
JSON output includes:
query: task text, deterministic tokens, source revision, and node limitgraph.nodes: selected context nodes with stable IDs, kind, trust class, confidence, provenance, limitations, and source revisiongraph.edges: selected evidence links such asserves,tests,depends-on,owns, andobserved-byselected: ranked relevance explanations and evidence referencesrejected: near-miss decoys that scored below the selected boundsafety: proof that no model, command, network, telemetry, or hosted service path was used
Trust classes distinguish current facts from context:
current-revision-fact: current code, config, analysis, or runtime/tool evidencememory: repo-local memory that is useful but not proofhistorical-context: docs, ADRs, and similar context that may inform reviewstale-context: deprecated, superseded, outdated, or conflicting contextai-suggestion: untrusted agent text when present in upstream evidence
Memory and docs can guide investigation, but they cannot prove current behavior or merge safety without corroborating current-revision evidence.
Examples
Retrieve context before editing:
npx codedecay context \
--task "Add a dashboard filter for reviewed uploads" \
--max-nodes 16 \
--format markdownRetrieve context for an active PR diff:
npx codedecay context \
--task "Change payout retry formatting" \
--base main \
--head HEAD \
--format jsonUse structured acceptance criteria:
npx codedecay context \
--task "Add billing export" \
--requirements .codedecay/requirements.yml \
--format markdownMCP
The MCP server exposes the same retrieval boundary as task_context.
Example input:
{
"task": "Allow finance admins to retry failed payouts",
"requirements": {
"acceptanceCriteria": [
{
"id": "AC-1",
"text": "A retry request enqueues exactly one worker job.",
"requiredProof": ["API integration test", "worker idempotency test"]
}
]
},
"format": "json",
"maxNodes": 16
}The tool is report-only. It writes the same local artifact and uses the same trust, provenance, and limitation fields as the CLI.
