{
  "schema_version": "0.1",
  "brainstorm_id": "BR-2026-07-16-graph-lang-id-traceability",
  "title": "GRAPH_LANG x PRD IDs: clickable trace, per-feature code graphs, earned completion",
  "created_at": "2026-07-16",
  "author_agent": "AGENT-CLAUDE",
  "source_session": "SES-CLAUDE-TRACE",
  "status": "open",
  "context": "User-directed brainstorm immediately after 0.16.16 shipped code anchors (prd_graph indexes canonical-ID stamps in source; --anchors lists file:line sites). Seeds: (1) click an ID in the implementation plan and land in its code; (2) attach code graphs to features via GRAPH_LANG; (3) possibly require every feature to have a graph as well as an ID. GRAPH_LANG catalogue (from its wiki @ 3b14b2b and utcp.json, 8 read tools): GraphKernel is the sole legality authority with typed state machines and an append-only GraphEvent log carrying kernel-origin causal lineage (caused_by, depth-2 chains); trust is two orthogonal axes (KIND/provenance: RawEvidence->DerivedSummary->Interpretation->RuntimeCmtEvidence->ApprovedKnowledge; RANK: state-driven, only NodeState::Approved elevates); the defining discipline is earned-not-declared (the .gnce compiler REFUSES state=Approved and plain transitions onto gated edges; gates pass only via evidence-derived evaluation); node taxonomy Cognition/Development with the graph-first rule (Development nodes capped Unapproved until linked); the .gnce language projects one write surface onto CLI+MCP+UTCP with full kernel write coverage; tool tiers T1 read (throwaway kernel per call: compile/ask/trust_view/active_policies/condemnations/impact/eu_ai_act_policy_pack), T2 kernel-guarded (apply/sync on the live kernel), T3 review-guarded authority acts; runtime is a pinned SpacetimeDB fork.",
  "goals": [
    "BR-REQ-001: Clickable trace surfaces - every canonical ID rendered in the offline HTML viewer (plan/PRD/graph pages) is a link: ID -> its code anchor sites -> open the file at the line via editor URI (vscode://file/<abs>:<line>), powered entirely by the existing prd_graph anchors data.",
    "BR-REQ-002: Anchors index pages - a generated per-record trace page (record summary, chain neighbors, anchored file:line links) so IDs are also clickable in plain markdown/GitHub contexts, not only the viewer.",
    "BR-REQ-003: Deterministic .gnce projection - prd_graph gains an exporter that emits a feature's chain (REQ/PRD-REQ/IMP-TASK/code anchors/EV) as a .gnce program: nodes with KIND mapped from artifact type (EV=RawEvidence, wiki=DerivedSummary/ApprovedKnowledge, brainstorm=Interpretation, code=Development-class), connectors from graph edges, evidence statements citing EV command outcomes.",
    "BR-REQ-004: Earned completion - model the completion gate as a GNCE gate: a feature node reaches Approved rank ONLY by promote-through-passed-gate whose evidence is the feature's EV records; declared done is a compile-time refusal. Validate per release with T1 throwaway-kernel tools (graph-lang_compile + trust_view) so CI needs no daemon.",
    "BR-REQ-005: Graph-first parity - map GNCE's graph-first rule (Development node capped Unapproved until linked) onto tool/skill/test parity: a feature node with no tool, no test, and no evidence connectors cannot rank, making the 0.16.15 tool-parity rule structural instead of audit-only.",
    "BR-REQ-006: Feature-graph requirement (the strong form) - every feature in the coverage map must have a compiling .gnce graph whose trust_view is part of release gating; decide whether this is mandatory or config-gated per repo.",
    "BR-REQ-007: Cross-repo trace questions via graph-lang_ask - once projected, questions like impact-of, trust-of, and condemnation checks run against feature graphs through GRAPH_LANG's existing 11 ask verbs instead of bespoke prd_graph queries."
  ],
  "non_goals": [
    "Replacing prd_graph or canonical .prd_plugin state - GNCE would be a projection target and discipline layer, never the record owner (same authority seam as the Substrate adapter, DEC-005/DEC-008).",
    "Depending on the live GNCE daemon or T2/T3 tools for gating - release validation uses T1 throwaway kernels only.",
    "Duplicating AI-Collab-owned embedding/retrieval or GRAPH_LANG-owned review/condemnation authority.",
    "A flag-day requirement on historical features - graphs accrete like code anchors do, on next touch."
  ],
  "open_questions": [
    "BR-Q-001: Status mapping - which PRD statuses project to which GNCE node states without laundering rank (accepted != Approved; only evidence-gated verification should promote)?",
    "BR-Q-002: Where does the projected .gnce live - generated-only (like utcp.json regeneration) or committed per feature under docs/graphs/?",
    "BR-Q-003: Editor URI scheme portability - vscode:// works on this machine; what is the fallback for other editors/OS (plain file path copy button)?",
    "BR-Q-004: Does the strong form (BR-REQ-006) apply to all 25 mapped features or only agent-facing ones (mirroring the tool_exemption pattern)?",
    "BR-Q-005: GRAPH_LANG availability coupling - the workspace has it, downstream repos may not; the projection must degrade to no-op when graph-lang tools are absent (capability discovery, not assumption)."
  ],
  "candidate_architecture": {
    "trace_viewer": "Extend the offline wiki/all-wikis viewer family with a trace page rendering prd_graph JSON; IDs are anchors-aware links; code sites open via editor URI with copy-path fallback.",
    "gnce_exporter": "prd_graph.py --gnce <ID> walks the record's provenance+impact subgraph and emits a deterministic .gnce program using only base statements (node/connector/gate/evidence/promote), validated by graph-lang_compile in tests when the tool is discoverable.",
    "completion_gate_bridge": "engineering.verify / hub.release workflow step compiles the touched features' graphs and asserts trust_view rank for features claiming implemented status; absence of GRAPH_LANG degrades to the existing audits.",
    "authority_seam": "PRD state remains canonical; GNCE kernels are throwaway per validation run; any future live-kernel integration (T2 apply) is a separate, config-gated decision."
  },
  "linked_ids": ["TRK-125", "REQ-115", "DEC-005", "DEC-008"]
}
