Graph Engineering
Overview
Model a project as evidence-backed knowledge, not a pile of files. Build only the graph needed for the current decision, keep facts separate from inference, and persist only durable knowledge.
Core Contract
- Define the question and the smallest useful scope.
- Inspect existing documentation before source code, tests, configuration, and history.
- Attach a repository path, symbol, sanitized command result, or commit to every important claim.
- Classify each claim as
observed, inferred, proposed, or unknown.
- Represent relevant entities and connections with the vocabulary in knowledge-schema.md.
- Apply update-policy.md before changing durable documentation.
- Report impact, risk, unresolved questions, and the evidence that supports each conclusion.
Do not require a graph database, MCP server, external API, or special runtime. A compact Markdown table or diagram is enough when it preserves the required semantics.
Output Contract
Return these sections in order:
- Scope — question, boundaries, and audited revision when available.
- Evidence — strongest sources and any contradictions.
- Knowledge map — relevant nodes and directed relations.
- Impact — affected components, interfaces, constraints, and decisions.
- Risks and unknowns — consequences, missing evidence, and validation needed.
- Persistence decision — no change, update an existing document, or propose a new durable location.
Example map:
| Source |
Relation |
Target |
Status |
Evidence |
AccountDeletionRoute |
implemented_by |
DeleteAccountService |
observed |
api/routes/account.ts#deleteAccount |
DeleteAccountService |
depends_on |
DeletionJob |
proposed |
approved ADR-0042 |
DeletionJob |
constrained_by |
Idempotent cleanup |
inferred |
retry configuration + integration test |
Durable Knowledge Guardrail
Default to read-only analysis. Edit project knowledge only when the user explicitly requests documentation changes or the authorized task clearly includes them.
Never persist:
- chain-of-thought, hidden reasoning, scratch notes, or loop transcripts;
- raw command output or logs; persist a sanitized conclusion and command reference instead;
- unverified guesses presented as facts;
- secrets, credentials, personal data, or environment-specific identifiers;
- temporary status that will be obsolete when the current task ends.
Common Mistakes
| Mistake |
Correction |
| Mapping every file |
Keep only entities that affect the current decision. |
| Treating a diagram as evidence |
Attach evidence to each important node or relation. |
| Replacing conflicting history |
Mark the conflict and supersede only with stronger evidence. |
| Creating a new context folder immediately |
Prefer the closest existing durable document. |
| Writing assumptions as architecture |
Label them inferred, proposed, or unknown. |
1---2name: graph-engineering3description: Use when work spans multiple components, an unfamiliar codebase needs dependency mapping, impact analysis depends on architecture or constraints, or durable evidence-backed project context must be created or refreshed.4---56# Graph Engineering78## Overview910Model a project as evidence-backed knowledge, not a pile of files. Build only the graph needed for the current decision, keep facts separate from inference, and persist only durable knowledge.1112## Core Contract13141. Define the question and the smallest useful scope.152. Inspect existing documentation before source code, tests, configuration, and history.163. Attach a repository path, symbol, sanitized command result, or commit to every important claim.174. Classify each claim as `observed`, `inferred`, `proposed`, or `unknown`.185. Represent relevant entities and connections with the vocabulary in [knowledge-schema.md](references/knowledge-schema.md).196. Apply [update-policy.md](references/update-policy.md) before changing durable documentation.207. Report impact, risk, unresolved questions, and the evidence that supports each conclusion.2122Do not require a graph database, MCP server, external API, or special runtime. A compact Markdown table or diagram is enough when it preserves the required semantics.2324## Output Contract2526Return these sections in order:27281. **Scope** — question, boundaries, and audited revision when available.292. **Evidence** — strongest sources and any contradictions.303. **Knowledge map** — relevant nodes and directed relations.314. **Impact** — affected components, interfaces, constraints, and decisions.325. **Risks and unknowns** — consequences, missing evidence, and validation needed.336. **Persistence decision** — no change, update an existing document, or propose a new durable location.3435Example map:3637| Source | Relation | Target | Status | Evidence |38| --- | --- | --- | --- | --- |39| `AccountDeletionRoute` | `implemented_by` | `DeleteAccountService` | observed | `api/routes/account.ts#deleteAccount` |40| `DeleteAccountService` | `depends_on` | `DeletionJob` | proposed | approved ADR-0042 |41| `DeletionJob` | `constrained_by` | `Idempotent cleanup` | inferred | retry configuration + integration test |4243## Durable Knowledge Guardrail4445Default to read-only analysis. Edit project knowledge only when the user explicitly requests documentation changes or the authorized task clearly includes them.4647Never persist:4849- chain-of-thought, hidden reasoning, scratch notes, or loop transcripts;50- raw command output or logs; persist a sanitized conclusion and command reference instead;51- unverified guesses presented as facts;52- secrets, credentials, personal data, or environment-specific identifiers;53- temporary status that will be obsolete when the current task ends.5455## Common Mistakes5657| Mistake | Correction |58| --- | --- |59| Mapping every file | Keep only entities that affect the current decision. |60| Treating a diagram as evidence | Attach evidence to each important node or relation. |61| Replacing conflicting history | Mark the conflict and supersede only with stronger evidence. |62| Creating a new context folder immediately | Prefer the closest existing durable document. |63| Writing assumptions as architecture | Label them `inferred`, `proposed`, or `unknown`. |