Orchestrata Ultimate › Plans › evidence › w8-context-layer-inventory

W8.1 Ground-Truth Inventory — Context Semantic Layer (2026-07-06)

Source: plans/evidence/w8-context-layer-inventory.md at 8a2cb42ad · last changed 2026-07-27 · first committed 2026-07-06 · 101 lines.

Prose pending.

Plan text

W8.1 Ground-Truth Inventory — Context Semantic Layer (2026-07-06)

Evidence pack for the W8.2 design. Produced read-only while W4.4 (injector merge) was IN FLIGHT — context_injector.py findings marked pre-merge must be re-verified after W4.4 lands.

1. KG schema-as-built — SIX independent, uncoordinated writers

Writer File Labels Merge key(s) Rels
AST->KG bridge knowledge_graph/sync.py:32-889 (Neo4jSyncer, via scripts/sync_ast_to_neo4j.py) Project, Package, Module, Class, Function, Method, Parameter, Requirement, Test id (all; hardcoded constraint list sync.py:69-81) DEFINES (sync.py:538), INHERITS_FROM, IMPORTS, CALLS, TESTED_BY (sync.py:808), HAS_METHOD
Spike writer knowledge_graph/synchronizer.py:280,369 (FileSynchronizer) File (path key), Class/Function path/id DEFINES (File->sym), HAS_METHOD, CALLS, INHERITS, IMPORTS
Pipeline runtime kernel/pipeline_kg.py:140,208,240,312,318 Volk, Artifact, Intent, PipelineRun, Decision, Requirement Volk=alias; Requirement=req_id (DIVERGES from sync.py id) GENERATED_BY, EXECUTED_BY, TRIGGERED, MADE, JUSTIFIED_BY, APPLIES_TO
Session KG sync session/kg_sync/_stage_code.py:281-378 + _stage_specs_traces.py:114-297 Class/Function (methods collapsed into :Function w/ class_id), Spec, Requirement, RequirementItem Class/Fn id = {relpath}::{Name} (DIVERGES from sync.py qualified-name ids) HAS_CLASS/HAS_FUNCTION (3rd rel for what sync.py calls DEFINES), TRACES_TO (->RequirementItem!), IMPLEMENTS
kg_design spike knowledge_graph/kg_design.py:142,493,506,561 CodeClass (distinct from Class!) {name, project} composite TRACES_TO (CodeClass->Requirement direct)
Misc audit/session kernel/audit/writers.py:295, gateway/audit.py:40, memory/cold_store.py:92, orchestrator/fact_neo4j.py:70, orchestrator/neo4j_audit.py:346, session/kg_sync/_stage_session.py:44,86, harness/history.py:165 Session, Project, Volk Session: session_id x4 vs id vs seq (3 keys!); Project: id vs slug; Volk: alias vs volk_id vs name (3 keys!) —

Constraint split-brain: 3 non-overlapping "schemas": sync.py:69-81 hardcoded (13 labels, some never written); schema.py:113-139 LABEL_* (21 labels; get_all_ddl() at :175 has ZERO callers); types_enums.py:24-58 NodeType/RelationshipType StrEnums (12 types, missing Task/Method/Volk/Intent/Decision/PipelineRun). No single command creates a consistent schema.

2. Injection surfaces

3. Reusable assets

4. Gaps the design must fill (ranked)

  1. NO CANONICAL CODE-GRAPH WRITER — labels/ids/rels diverge across 5-6 writers; a selector query gets 0/1/3 disjoint nodes depending on which writer last ran. Canonicalize (one writer/id scheme) BEFORE building the selector, or every query needs coalesce-style multi-key matching (context_injector.py:679,698 already does this defensively).
  2. Requirement/Spec pipeline split + partially dead (AST-bridge no-op vs session/kg_sync live path) — ONE extraction path needed.
  3. inject_for_task unwired (0 call sites) — W8.5.
  4. No real token/size budget enforcement (constants dead; no k-hop bound).
  5. No semantic ranking signal (embedding stub) — use graph-structural ranking.
  6. No editable-pack format exists — VolkContext.to_dict()/to_markdown() is the closest precedent but is a fixed render.
  7. openspec island decision.

5. Risks

Not covered

kg_design.py full read; _stage_folders/_stage_docs bodies; Neo4j runtime verification (all static Cypher analysis); domaingen/constraints.py + stardog.py bodies; orchestrator audit writers beyond merge-key grep; false-confidence-test pass on tests/knowledge_graph/* (recommend separate audit before W8.3/W8.4).