CLAUDE
SERVICE CONTRACT · VIEW: GOV
Axiom
CLAUDE is the governed agent context surface. Compilation is graph traversal. The galaxy is the input graph. BFS from any starting node discovers contextual INTEL and optimized LEARNING by graph distance. The agent that builds the system is governed by the same system it builds.
Constraints
MUST: Compile CLAUDE.md via galaxy graph BFS (graph-native, not hardcoded paths) MUST: Carry _generated marker on compiled output MUST: Evolve via build, not hand-edit (fix the compiler or contract, not the output) MUST: Budget-control by graph distance (d=0 all, d=1 summary, d=2 meta-patterns, d=3 axioms) MUST: Discover cross-scope LEARNING via BFS (any node with learning_count > 0) MUST: Discover cross-axiomatic INTEL via INHERITS edges (cross-repo traversal) MUST: Contextualize INTEL by graph distance (closer scopes contribute more) MUST: Promote durable ad hoc feedback into governed LEARNING MUST: Compose all three primitives (INTEL + CHAT + COIN) MUST NOT: Hardcode scope paths (discover via galaxy graph, not filesystem) MUST NOT: Include secrets, credentials, or passwords in compiled output MUST NOT: Allow ad hoc memory to diverge from governed LEARNING indefinitely MUST NOT: Compile all 139K patterns (budget-controlled extraction only)
Capabilities
COMPILE_CONTEXT, CONTEXTUAL_INTEL, CROSS_AXIOMATIC_DISCOVERY, CROSS_SCOPE_LEARNING, GALAXY_BFS, GRAPH_DISTANCE_BUDGET, MEMORY_PROMOTE, SESSION_HANDOFF
COVERAGE: 255/255
SPEC
Purpose
CLAUDE governs the agent context surface for Claude Code sessions. The compiled output at /CANONIC/CLAUDE.md is the file Claude Code reads at the start of every conversation. Compilation is graph traversal: BFS from the CLAUDE node in the galaxy discovers contextual INTEL and cross-scope LEARNING by graph distance.
Architecture
Galaxy (phase 07-scopes-galaxy):
GOV tree → discover_all() → galaxy.json (394 nodes, 564 edges)
Compiler (phase 09-compile-claude):
galaxy.json → GovGraph → BFS from CLAUDE
d=0 CLAUDE scope (CANON, INTEL, LEARNING, VOCAB)
d=1 SERVICES parent + siblings (TALK, TRANSCRIPT, EMAIL...)
d=2 DEXTER + children (TALKS/MAMMOCHAT, TALKS/CARIBCHAT...)
d=3 Cross-axiomatic (canonic-canonic/MAGIC via INHERITS edges)
→ compose → /CANONIC/CLAUDE.md (_generated)
Graph Layers (Source Chain)
| Layer | Distance | Scope | Budget |
|---|---|---|---|
| 0 | d=0 | CLAUDE | all (CANON, INTEL, LEARNING, VOCAB) |
| 1 | d=1 | SERVICES, siblings | INTEL summary, 5 LEARNING patterns |
| 2 | d=2 | DEXTER, TALKS/* | INTEL summary, 3 meta-patterns |
| 3 | d=3 | Cross-axiomatic (MAGIC) | axiom only |
Intake Channel
Claude Code’s native memory system (~/.claude/projects/*/memory/) serves as a staging area for immediate feedback. Durable patterns promote to GOV LEARNING at build time. Two-phase commit: immediate staging (ungoverned), then governed persistence.
Generalization
The GovGraph.bfs(start_id) + compile(start) pattern works for any scope. CLAUDE is the first composed instance. TALK prompts can follow the same graph-native approach. One graph, one traversal algorithm, any starting node.
INTEL
User
Dexter Hadley, MD/PhD (Penn). Stanford Research Associate (Butte Lab). Faculty at UCSF and UCF (Founding Chief of AI). Co-Founder and Gov General of CANONIC. 14 years, 7,062 commits, 6 patent families, 65+ publications, $38M+ funded research. Terse, action-oriented, expects fast iteration. Says “cont” to continue, “ok” to approve.
Compilation Architecture
The CLAUDE compiler is graph-native. It loads the galaxy (394 nodes, 564 edges, built by phase 07-scopes-galaxy) and runs BFS from the CLAUDE node. At each discovered node, it extracts INTEL (contextual by graph distance), LEARNING (budget-controlled by distance), and ROADMAP (active items). Cross-axiomatic discovery follows INHERITS edges across repo boundaries.
- Galaxy input:
~/.canonic/canonic-canonic.github.io/MAGIC/galaxy.json - BFS traversal: PARENT edges bidirectional (tree spine), INHERITS edges forward (cross-axiomatic)
- Budget function: d=0 all, d=1 summary+5 patterns, d=2 summary+3 meta-patterns, d=3 axioms only
- Phase ordering: 07-scopes-galaxy → 09-compile-claude (galaxy guaranteed current)
- Generalization: same algorithm works for any starting node (MAMMOCHAT, CARIBCHAT, etc.)
LEARNING
Patterns
| Date | Signal | Pattern | Source |
|---|---|---|---|
| 2026-03-13 | META_GOV | Claude’s ad hoc feedback memory is ungoverned D7. CANONIC already solves institutional memory at every service scope. Wire Claude’s memory into the governed LEARNING system. The loop closes: TRANSCRIPT → LEARNING → CLAUDE.md → next session. | Meta-governance discovery |
| 2026-03-14 | GALAXY_GRAPH_COMPILE | Compilation is graph traversal. The galaxy (394 nodes, 564 edges) is the input graph. BFS from CLAUDE discovers cross-scope LEARNING and contextual INTEL by graph distance. INHERITS edges enable cross-axiomatic discovery across GOV repos. Each service is self-contained; CLAUDE is the first composed instance. | Graph-native compiler design |
| 2026-03-15 | IDEMPOTENT_BUILD | Compiler must produce identical output on consecutive builds when inputs unchanged. Timestamps only write when content changes via emit_json_stable(). Blog/paper format oscillation traced to freshness cache skipping compiled.add() and stale cleanup. BFS non-determinism traced to unsorted neighbor iteration. | Compiler stabilization session |
| 2026-03-15 | GOV_OVERRIDE | Hand-crafted GOV index.md with sections takes precedence over auto-generated surfaces. The compiler serves the contract, not the other way around. When GOV declares the surface, the compiler copies it verbatim. Auto-generate is fallback only. | Community learning surface refactor |
| 2026-03-15 | INSTANCE_LEARNING | Community learning surfaces source from TALKS/{scope}/LEARNING.md (user session ledgers with SESSION_LEDGERED entries), not from SERVICES/TALK/{scope}/LEARNING.md (governance patterns). Users are contributors, not builders. Low-entropy questions filtered via _is_low_entropy(). | Community learning source fix |
| 2026-03-15 | RUNTIME_GOVERNED | The compiler repo (~/.canonic) must be pushed to GitHub (canonic-canonic/.canonic). Ungoverned runtime means ungoverned toolchain. Every compiler fix, every phase renumber, every build artifact must be versioned. The runtime is always forgotten because it lives outside the project tree. | Runtime governance gap |
| 2026-03-15 | METALEARNING | The agent that builds the system must also update the governed LEARNING and ROADMAP after every session. Session patterns promote to LEARNING. Open items promote to ROADMAP. The loop: session → LEARNING → CLAUDE.md → next session. Without metalearning, each session starts from scratch. | This session |
| 2026-03-15 | COMPILER_METALEARNING | Metalearning closure hardened into the compiler itself. Three mechanisms: (1) intake-promote script reads ~/.claude/projects//memory/.md, classifies by frontmatter type, deduplicates by content hash, and appends pattern rows to CLAUDE/LEARNING.md; (2) hash_sources includes intake files so promotion triggers recompile; (3) discover_intake_files checks promotion state so compiled output only shows truly unpromoted files. Phase 09-learning runs intake-promote before 10-claude. The loop is now build-automated, not session-manual. | Compiler metalearning session |
| *LEARNING | CLAUDE | 2026-03-15* |
ROADMAP
Now
- [x] Graph-native compiler: BFS from CLAUDE node in galaxy graph
- [x] Cross-scope LEARNING discovery via graph distance
- [x] Cross-axiomatic INTEL via INHERITS edges (cross-repo traversal)
- [x] Contextual INTEL budget by graph distance
- [x] Build phase 10-claude (renumbered from 08a)
- [x] Idempotent builds: deterministic BFS, stable timestamps, no format oscillation
- [x] Metalearning: session patterns auto-promote to governed LEARNING
- [x] Claude-directed ROADMAP updates at session end
- [x] Intake pipeline: intake-promote scans ad hoc memory at build time, promotes to GOV LEARNING
- [x] Compiler metalearning closure: hash_sources includes intake, discover_intake_files checks promotion state
- [x] COVERAGE compilation — extract coverage_score + open gates from galaxy, emit Coverage Gates section in CLAUDE.md
- [x] ROADMAP open-items — skip [x] done items in galaxy enrichment, surface first open [ ] item per scope
Next
- [x] Promotion trigger: Stop hook in settings.json runs intake-promote --status at session end (closes PROMOTION_TRIGGER gate)
- [x] CHAT composition: compile-claude-md reads TRANSCRIPT.json, emits CHAT section with sessions, lanes, evidence size (closes CHAT_COMPOSITION gate)
- [ ] Generalize compiler: BFS is generalized (GovGraph.bfs takes any start_id), CLI wrapper hardcodes CLAUDE — parametrize compile-claude-md with --start-node
- [x] Session handoff notes in governed location — TRANSCRIPT CLAUDE lane operational (145 sessions archived, SHA-256 MANIFEST, NAS canonical store)
- [ ] SHOP.json / deck.json residual write-on-every-build (content diff to trace)
- [ ] Runtime repo (~/.canonic) as submodule of CANONIC for single-clone reproducibility
Later
- Full LEARNING pipeline integration: boundary.py discovers Claude session patterns
- TRANSCRIPT lane for Claude sessions feeds LEARNING feeds CLAUDE.md (closed loop)
- Graph centrality scoring: hub nodes get priority in budget allocation
- CLAUDE.md compilation for multiple users/agents
- VOCAB drift automated remediation (312 warnings → 0)
VOCAB
| Term | Definition |
|---|
INHERITANCE CHAIN
SERVICES
SERVICES compose primitives — INTEL + CHAT + COIN. Every service governed. Every scope discovered.
MUST: Maintain TRIAD integrity (CANON.md + VOCAB.md + README.md)
MUST: Treat SPEC as scope identity (`{SCOPE}` directory), not as a file
MUST: Every SERVICE scope include ROADMAP.md, COVERAGE.md, LEARNING.md, and `{SCOPE}.md` as governed content surfaces
MUST: Discover SERVICE scopes from filesystem only (no manual catalog)
MUST: Keep http:// and magic:// on the same namespace (transport differs, scope path matches)
MUST: CANON.md = axiom + universal constraints (no service names, no paths, no implementation)
MUST: README.md = how to run the CANON (nothing else)
MUST: {SCOPE}.md = SPEC — the interface (purpose, routes, projections, ecosystem)
MUST: SHOP.md = public projection file (per scope, filesystem-discoverable)
MUST: VAULT.md = private projection file (per scope, filesystem-discoverable)
MUST: Runtime implementation remains under ~/.canonic; this workspace is governance-first
MUST NOT: Hardcode service names in CANON constraints (law speaks universals)
MUST NOT: Define ungoverned terms outside VOCAB.md
MUST NOT: Treat `{SCOPE}.md` as SPEC identity
MUST NOT: Move architecture/lifecycle into README
MUST NOT: Leak private projections to public surfaces
MUST NOT: Maintain duplicate mapping tables outside generated manifest outputs
MUST NOT: Add runtime jargon to governance contracts
MUST: Ledger-consuming services declare source ledgers, scope filters, and closure gates
MUST: Learning governance remains live — closure claims require fresh DISCOVER → GENERATE → RELINK evidence
hadleylab-canonic
HADLEYLAB ships software. Every app, book, paper, deal, and patent is PROOF that MAGIC works. COIN = WORK. LEARNING = COMPUTE.
MUST: Every app, book, paper, deal, or patent is evidence of MAGIC MUST: All scopes inherit canonic-canonic/CANONIC.md governance MUST: All users governed under USERS/ via SERVICES/USER MUST: Cross-index INTEL across users (INTEL.md) MUST: Shared events propagate to ALL affected user dashboards MUST: Maintain governance workspace purity (.md files only) MUST: Ledger all COIN (validated work) through MAGIC 255 MUST: Compile all INTEL from governed sources MUST: Keep frontend/runtime implementation under ~/.canonic (hidden runtime) MUST: Surface governed TALK, Library, and SERVICES scopes (no orphan content) MUST: Derive nav labels from governed scope names (no hardcoded strings) MUST NOT: Publish without governance (CANON.md required) MUST NOT: Duplicate primitives — compose from INTEL, CHAT, COIN MUST NOT: Silo intelligence inside a single user when multiple are affected MUST NOT: Expose VAULT contents outside NDA scope MUST NOT: Store runtime artifacts in governance workspace
canonic-canonic
SPEC is governance. `canonic-canonic/` is the spec root.
MUST: Keep this repo governance-only (.md/.pdf) MUST: Publish workspace mapping in CANONIC.git (no hardcoded repo lists) MUST: Preserve three primary lanes: FOUNDATION, INDUSTRIES, MAGIC MUST NOT: Commit runtime artifacts here (runtime belongs in ~/.canonic/) MUST: Sell MAGIC tiers — the product, not the proof (proof is hadleylab-canonic) MUST NOT: Embed beta-test app URLs in platform page content