80%

§08 platform domain artifact fabric

Goal

The platform’s artifact fabric — skills, rules, commands, hooks, schemas and their @-include/dispatch/wiring/exit-reason contracts — becomes typed nodes and edges with its own presets; the near-novel schema gets an explicit two-pass revision budget.

Implementation Sketch

  • claude_artifact_adapter mirrors spec_adapter.py (single-arg returns list of dicts; registered in route_extraction); .claude/ enumerated under the ori-platform scope with .md extension routing to the adapter.
  • Node vocabulary: :Skill/:Rule/:Command/:Hook/:Schema (+ :RuleSection for §N citation targets); NOT :Symbol-shaped — closer to the Plan/Bug pipeline precedent; cross-schema linking via existing MENTIONS_CODE-style bridge where fabric references code.
  • Edge sources: @-include lines (100%-precision syntactic resolution), python -m + Skill: dispatch refs, settings.json hook matchers, exit_reasons.py EXIT_REASON_ROUTING + orchestration-rules.json caller_exit_reason_handlers, next_action.schema.json consumers.
  • glm F3 accepted: this is a new extraction paradigm — two-pass schema review budgeted; glm F6: constants sidecar lands here before §10 detectors mirror anything.

Spec References

  • intel_repo/neo4j/spec_adapter.py + ori_adapter.py (bespoke adapter shape); scripts/plan_corpus/exit_reasons.py (EXIT_REASON_ROUTING, 184 members); .claude/rules/orchestration-rules.json; .claude/settings.json hooks; scripts/skill_audit/ (the 24 scanners this subsumes/feeds); .claude/rules/impl-hygiene.md STRUCT-37/38/40/41 (exit-reason parity), STRUCT-22 (operational-rule-leak), STRUCT-77 (api-surface-leak)

Work Items

  • Cross-repo constants contract: JSON sidecar readable from both wrapper and intel_repo (cures the mirrored-constant class); schema-revision round explicitly budgeted (two-pass schema review for the novel fabric vocabulary)
  • Bespoke claude_artifact_adapter (spec_adapter.py shape) extracting :Skill/:Rule/:Command/:Hook/:Schema/:RuleSection nodes with frontmatter props (role, paths, autopilot_default) from .claude/ artifacts, including per-section §N RuleSection nodes parsed from rule-file headers so the CITES edge (w-97270e9c) has a resolvable target
  • Fabric edges: INCLUDES (@-include), DISPATCHES (python -m refs + Skill: dispatches), WIRED_BY (settings.json hook matchers), CITES (rule-to-rule §N refs), CONSUMES_SCHEMA (runtime→next_action.schema.json), EMITS/HANDLES_EXIT_REASON (exit_reasons.py EXIT_REASON_ROUTING + caller_exit_reason_handlers)
  • Platform-fabric presets + probes: skills-missing-required-include, exit-reason handler parity (emit set vs handler set), dangling @-include, hook-wiring orphans; KNOWN_SUBCOMMANDS + blurbs + tests

Fresh intel (regenerated)

This is a GREENFIELD extraction paradigm, not an extension of an existing tier. The graph today has ZERO .claude/ nodes (MATCH (s:Symbol {repo:'ori-platform'}) WHERE s.file STARTS WITH '.claude' returns 0) — the entire node vocabulary :Skill/:Rule/:Command/:Hook/:Schema/:RuleSection and every fabric edge (INCLUDES, DISPATCHES, WIRED_BY, CITES, CONSUMES_SCHEMA, EMITS/HANDLES_EXIT_REASON) is genuinely new to schema.cypher (only MENTIONS_CODE of the named edges exists). The predecessor §07 brought the wrapper’s scripts/ Python into the graph as repo ori-platform (30,257 symbols, 38,211 CALLS) via tree-sitter; §08 is a DIFFERENT paradigm — a bespoke line-scanning adapter over Markdown+JSON artifacts, NOT tree-sitter code, so it follows the Plan/Bug non-:Symbol ingest precedent, not the §07 code path.

The decisive [JOIN]: the section’s own body prescribes the exact shape — a spec_adapter.py-style single-arg adapter (the file the body names is NOT in the graph; it lives in gitignored intel_repo/neo4j/spec_adapter.py, read on disk in §2) fused with the import_plan_bug_graph.py graph-contract envelope (dynamic labels:[node_kind] validated by _validate_envelope_grammar_parity against graph_contract_data.build_contracts). Those two proven in-house patterns ARE the design; §08 recombines them, it does not invent.

Decisions this package forces before any code is written:

  1. Register the new vocabulary through graph_contract_data.build_contracts (repo_node/global_node/transient_node factories) FIRST — the Plan/Bug importer hard-fails on any label/relationship absent from the contract (_validate_envelope_grammar_parity). New labels that skip the contract are unrepresentable, not just unreviewed.
  2. The cross-repo constants sidecar (work item w-26d787fe) must land BEFORE the adapter reads EXIT_REASON_ROUTING — the adapter runs inside gitignored intel_repo/, the constant lives in the wrapper’s scripts/plan_corpus/exit_reasons.py; a hard copy is the LEAK:algorithmic-duplication mirrored-constant class the body flags. There is an in-house precedent to mirror: scripts/plan_corpus/extension_registry.py + its test_extension_registry_parity.py.
  3. The platform-fabric probes register with the committed fitness corpus (intel_repo/neo4j/fitness.pyprobe-corpus.json schema-validated, stable-ID-ordered) — the north-star gate scripts/intel-query.sh fitness --json. Adding probes = adding validated corpus rows, never a bespoke check.
  4. The semantic (similar) tier is DARK for ori-platform (embeddings never generated — status shows platform embedding: null; a live similar on a platform symbol errors “no embedding”). Do NOT design any fabric linkage that assumes vector neighbors on platform nodes.
["EXIT_REASON_ROUTING"]

EXIT_REASON_ROUTING (scripts/plan_corpus/exit_reasons.py) is the pre-existing wrapper-repo SSOT the fabric READS as the EMITS/HANDLES_EXIT_REASON edge source across a repo boundary; the fabric adapter must consume it through the budgeted constants sidecar and MUST NOT re-home, mutate, or hard-copy it into intel_repo/ — that copy IS the mirrored-constant defect the section exists to prevent. The section’s OWN new symbols (claude_artifact_adapter, the fabric node labels, the presets/probes) are the work-SUBJECT and are deliberately excluded.

DIG DEEPER

scripts/intel-query.sh cypher "MATCH (s:Symbol {repo:'ori-platform'}) WHERE s.file STARTS WITH '.claude' RETURN count(s)" --human
scripts/intel-query.sh dag-ascii intel-graph-deepening

(full dossier: platform-domain-artifact-fabric—s-3a837610.intel.md)