Knowledge Graph | 知識圖
Language: English | 繁體中文
Answer structural questions across specs, decisions, and code — "what is the full impact chain of XSPEC-205?" — using the Knowledge Graph Memory relationship schema. Works with or without a graph engine.
回答橫跨規格、決策與程式碼的結構性問題——「XSPEC-205 的完整影響鏈是什麼?」——依據知識圖記憶標準的關係 schema。有無圖引擎皆可運作。
Implements: XSPEC-237 Phase 5 — knowledge-graph skill (EngramGraph opt-in)
Mode Selection | 模式選擇
Detect which mode to use before answering:
| Condition |
Mode |
ENGRAM_URL set, or a local graph engine responds on /health |
Service mode (engine) |
| Otherwise |
Degraded mode (Markdown) |
Workflow | 工作流程
- Resolve the target — normalise the argument to a canonical id (
XSPEC-205, DEC-062, a function name).
- Choose mode — probe for a graph engine (service) else fall back (degraded).
- Service mode (AC-5b) — issue a single multi-hop query and present the returned chain, including cross-domain links (code → spec → decision):
curl -s -X POST "$ENGRAM_URL/graph/impact-analysis" \
-H 'content-type: application/json' \
-d '{"nodeId":"XSPEC-205","maxHops":3}'
- Degraded mode (AC-5a) — with no engine, read the target document, follow its
impacts/impacted_by/supersedes/related front-matter and inline [[ref]] links by reading the linked files, and assemble the chain manually (bounded by reading depth).
- Present the chain — list the connected Specs and Decisions, the edge type for each hop, and (if present) each node's
confidence, highest first.
- State the mode used — always say whether the answer came from the engine or Markdown fallback, so completeness is clear.
Relationship Schema | 關係 schema
See knowledge-graph-memory. Front-matter fields: related, impacts, impacted_by, supersedes, implements. Edge derivation: Decision impacts Spec → IMPACTS; Decision supersedes Decision → SUPERSEDES.
關係欄位與邊推導見知識圖記憶標準。
Next Steps Guidance | 下一步引導
- If degraded mode hit a reading-depth limit, tell the user a graph engine (e.g. EngramGraph) would give a complete chain, and how to set
ENGRAM_URL.
- If a referenced id was not found, surface it as a dangling reference to fix.
- Offer to add missing
impacts/impacted_by front-matter to the documents you traversed.
Reference | 參考
1---2name: knowledge-graph3scope: partial4description: |5 [UDS] Trace impact chains across specs, decisions, and code via a knowledge graph, with a Markdown fallback when no engine is present.6 Use when: asking what a spec or decision affects, finding which code implements an artifact, tracing dependencies between specs, ADRs, and modules.7 Not for: plain text search with no spec or decision anchor — use Grep; authoring the spec itself — use /sdd.8 Keywords: knowledge graph, impact chain, traceability, spec impact, decision graph, 知識圖, 影響鏈, 規格追蹤.9allowed-tools: Read, Glob, Grep, Bash(curl:*)10argument-hint: "[artifact id, e.g. XSPEC-205 | 產物 id]"11---1213# Knowledge Graph | 知識圖1415> **Language**: English | [繁體中文](../../locales/zh-TW/skills/knowledge-graph/SKILL.md)1617Answer structural questions across specs, decisions, and code — *"what is the full impact chain of XSPEC-205?"* — using the [Knowledge Graph Memory](../../core/knowledge-graph-memory.md) relationship schema. Works with or without a graph engine.1819回答橫跨規格、決策與程式碼的結構性問題——*「XSPEC-205 的完整影響鏈是什麼?」*——依據[知識圖記憶標準](../../core/knowledge-graph-memory.md)的關係 schema。有無圖引擎皆可運作。2021> **Implements**: XSPEC-237 Phase 5 — knowledge-graph skill (EngramGraph opt-in)2223## Mode Selection | 模式選擇2425Detect which mode to use **before** answering:2627| Condition | Mode |28|-----------|------|29| `ENGRAM_URL` set, or a local graph engine responds on `/health` | Service mode (engine) |30| Otherwise | Degraded mode (Markdown) |3132## Workflow | 工作流程33341. **Resolve the target** — normalise the argument to a canonical id (`XSPEC-205`, `DEC-062`, a function name).352. **Choose mode** — probe for a graph engine (service) else fall back (degraded).363. **Service mode (AC-5b)** — issue a single multi-hop query and present the returned chain, including cross-domain links (code → spec → decision):37 ```bash38 curl -s -X POST "$ENGRAM_URL/graph/impact-analysis" \39 -H 'content-type: application/json' \40 -d '{"nodeId":"XSPEC-205","maxHops":3}'41 ```424. **Degraded mode (AC-5a)** — with no engine, read the target document, follow its `impacts`/`impacted_by`/`supersedes`/`related` front-matter and inline `[[ref]]` links by reading the linked files, and assemble the chain manually (bounded by reading depth).435. **Present the chain** — list the connected Specs and Decisions, the edge type for each hop, and (if present) each node's `confidence`, highest first.446. **State the mode used** — always say whether the answer came from the engine or Markdown fallback, so completeness is clear.4546## Relationship Schema | 關係 schema4748See [knowledge-graph-memory](../../core/knowledge-graph-memory.md). Front-matter fields: `related`, `impacts`, `impacted_by`, `supersedes`, `implements`. Edge derivation: Decision `impacts` Spec → IMPACTS; Decision `supersedes` Decision → SUPERSEDES.4950關係欄位與邊推導見[知識圖記憶標準](../../core/knowledge-graph-memory.md)。5152## Next Steps Guidance | 下一步引導5354- If degraded mode hit a reading-depth limit, tell the user a graph engine (e.g. EngramGraph) would give a complete chain, and how to set `ENGRAM_URL`.55- If a referenced id was not found, surface it as a dangling reference to fix.56- Offer to add missing `impacts`/`impacted_by` front-matter to the documents you traversed.5758## Reference | 參考5960- Standard: [core/knowledge-graph-memory.md](../../core/knowledge-graph-memory.md)61- Engine (opt-in): [EngramGraph](https://github.com/AsiaOstrich/EngramGraph) — `engramgraph`62- Detailed guide: [guide.md](guide.md)