Skip to content
Merged
42 changes: 42 additions & 0 deletions .claude/board/INTEGRATION_PLANS.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,3 +345,45 @@ These existing plans absorb cleanly into the new architecture and remain in scop
### Sprint-2 governance

This sprint was orchestrated as 12 worker agents + 1 meta agent on branch `claude/unified-ogit-architecture-synthesis`. CCA2A pattern: per-agent append-only logs in `.claude/board/sprint-log-2/agents/agent-W*.md`; meta review in `.claude/board/sprint-log-2/meta-1-review.md`; sprint summary in `.claude/board/sprint-log-2/sprint-summary.md`.

## 2026-05-12 — Sprint-3: Tier-1 Implementation Specs (PR #360 + #361 + substrate-recognition sweep)

11 PR-X-1 implementation specs landed via PR #360 + 2 architectural corrections via PR #361 + 3 spec re-scopes via post-#360 substrate-sweep PR. After this sprint sequence, an engineer picks any PR-X-Y spec and starts coding without re-design.

### New specs (`.claude/specs/`)

| Spec | Pattern | Status | Effort (post-substrate-sweep) |
|---|---|---|---|
| `sprint-3-execution-plan.md` | (master) | Active | n/a |
| `sprint-3-pr-graph.md` | (sequencing; compressed timeline) | Active | n/a |
| `pr-a-1-spo-g-u32-slot.md` | A | Active (re-scoped) | ~150 LOC / 1 day |
| `pr-b-1-context-bundle.md` | B | Active | ~200 LOC / 1 day |
| `pr-c-1-generic-bridge.md` | C | Active (re-scoped) | ~80 LOC / ½ day |
| `pr-d-1-fma-owl-hydrator.md` | D (PARTIALLY SHIPPED) | Active (re-scoped) | ~250 LOC / 1-2 days |
| `pr-e-1-manifest-modules.md` | E | Active (post-#361 cycle fix) | ~330 LOC / 2 days |
| `pr-f-1-ractor-supervisor.md` | F | Active (post-#361 inert-bundle skip) | ~400 LOC / 3 days |
| `pr-j-1-int4-32d-atoms.md` | J | Active | ~120 LOC / 1 day |
| `consumer-crate-template.md` | (Pattern C dry-run; re-targeted to woa-rs + medcare-rs precedents) | Active | n/a |
| `ogit-g-smoke-test.md` | (validation; PR-A-1+B-1+C-1+E-1+F-1) | Active | ~200 LOC / 1 day |
| `trivia-prs-bundle.md` | (3 quick wins: TD-CAM-DIST + TD-ADJ-THINK + TD-DEEPNSM-NSM) | Active | ~60 LOC total / <1 day |

### New knowledge docs (`.claude/knowledge/`)

- `pattern-recognition-cross-source.md` — 4-taxonomy matrix (A-O ↔ Pillars 0-4 ↔ `.grok/` ↔ shipped substrate)
- `cca2a-sprint-prompt-template.md` — substrate-grep checklist + wrong-repo guardrail + pattern-letter discipline

### Pre-existing plans absorbed by sprint-3

- `lance-graph-ontology-v5.md` — Pillar 0 (already shipped via PR #355)
- `palantir-parity-cascade-v2.md` — Pillars 0-4 architecture (parallel taxonomy; cross-referenced via new matrix)
- `ogit-cascade-supabase-callcenter-v1.md` — Pillars 0-4 cascade execution (parallel taxonomy)
- `unified-ogit-architecture-v1.md` (W1 master) — sprint-2 north star
- `ogit-g-context-bundle-v1.md` (sprint-2 Tier-1 sub-plan)
- `compile-time-consumer-binding-v1.md` (sprint-2 Tier-2 sub-plan)
- `anatomy-realtime-v1.md` (sprint-2 proof-of-vision)

### Cross-references

- `.claude/board/LATEST_STATE.md` — sprint-3 entry (paired with this index update)
- `.claude/board/TECH_DEBT.md` — TD-OGIT-G-SLOT-1 through TD-DEEPNSM-NSM-COLLAPSE-11 (the 11 entries spec'd by sprint-3)
- `.claude/board/sprint-log-3/` — coordination directory (12 agent logs + meta-1 + sprint-summary)
38 changes: 38 additions & 0 deletions .claude/board/LATEST_STATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,3 +317,41 @@ The master plan-doc `.claude/plans/unified-ogit-architecture-v1.md` provides the
- **Risk:** the "~80% already shipped" claim is W1/W2's recognition assertion, not independently re-verified by W9. This section reports it as the synthesis output; the canonical evidence lives in `tier-0-pattern-recognition.md` (W2) and the entropy ledger reframe rows (W6).
- **Governance:** append-only preserved. No deletions. No edits to the prior `## 2026-05-07 — Append: lance-graph-ontology shipped` section. Section heading matches the spec exactly.
- **What this section does NOT do:** it does not edit the top-of-file "Last updated" line (would violate append-only); it does not edit the "Recently Shipped PRs" table (Sprint-2 shipped no PRs); it does not edit "Active Branches" (Sprint-2 is documentation tier on a branch that has not yet merged).

## 2026-05-12 — Sprint-3: Tier-1 Implementation Specs (PR #360 + #361 + post-#360 substrate sweep)

**PR #360** (sprint-3 main): 11 PR-X-1 specs covering 7 design-phase patterns A/B/C/D/E/F/J + 3 trivia closures + supporting docs. ~140 KB across `.claude/specs/`. Engineer can now execute Tier-1 in ~6 working days parallelized (per W10 sequencing).

**PR #361** (post-#360 corrections): PR-F-1 supervisor must skip inert bundles (DOLCE/FMA have consumer_pointer=None by design); PR-E-1 build script must emit data-only (no consumer crate refs) to avoid Cargo dependency cycle. Both fixed via append-only correction sections; inventory-crate self-registration recommended for actor binding.

**Post-#360 substrate-recognition sweep** (this PR): 3 of 11 specs reclassified PARTIALLY SHIPPED:
- Pattern A: SchemaPtr.ontology_context_id + NamespaceRegistry::seed_defaults already ship; PR-A-1 reduces to ~150 LOC / 1 day
- Pattern C: BridgeFromRegistry + 3 impls + woa-rs#2 + medcare-rs#110 consumer scaffolds already ship; PR-C-1 reduces to ~80 LOC / ½ day
- Pattern D: parse_ttl_directory_with_provenance + attach_provenance already ship; PR-D-1 reduces to ~250 LOC / 1-2 days (OWL/RDF-XML adapter only)

Compressed sprint-3 critical path: ~6 days → ~3-4 days parallelized. The genuinely-new ~5-pattern set is B (context bundle), E (manifest-modules), F (ractor port), G (inheritance protocol), J (INT4-32D atoms).

### New knowledge docs (sprint-3 substrate-sweep)

- `.claude/knowledge/pattern-recognition-cross-source.md` — A-O ↔ Pillars 0-4 ↔ `.grok/` ↔ shipped substrate matrix (4 parallel taxonomies cross-referenced)
- `.claude/knowledge/cca2a-sprint-prompt-template.md` — substrate-grep checklist + wrong-repo guardrail + pattern-letter discipline (mandatory pre-spawn template for future sprints)

### Anti-Pattern recurrence captured

The "Designing What's Already Built" anti-pattern (introduced PR #358) recurred in sprint-3's own design (PR-A-1/PR-C-1/PR-D-1 over-scoped because they didn't sweep post-#355 substrate). The correction PR formalizes the substrate-grep checklist as mandatory before any new spec.

### Recurring failure mode: wrong-repo error

Sprint-2 W7 → ndarray; sprint-3 W9 → ada-consciousness. Both corrected via main-thread pygithub recovery. Wrong-repo guardrail snippet now mandatory in every worker prompt (per `.claude/knowledge/cca2a-sprint-prompt-template.md`).

### Cross-references

- `.claude/specs/sprint-3-execution-plan.md` (W1 master)
- `.claude/specs/sprint-3-pr-graph.md` (W10 sequencing — to be updated for compressed timeline)
- `.claude/specs/pr-{a,b,c,d,e,f,j}-1-*.md` (11 PR-ready specs; A/C/D have appended CORRECTION sections)
- `.claude/specs/consumer-crate-template.md` (W8; re-target from hubspo-rs hypothetical to woa-rs/medcare-rs precedent)
- `.claude/specs/ogit-g-smoke-test.md` (W11 validation)
- `.claude/specs/trivia-prs-bundle.md` (W12 — 3 quick wins parallel-shippable)
- `.claude/board/sprint-log-3/{SPRINT_LOG.md,agents/agent-W1..W12.md,meta-1-review.md,sprint-summary.md}`

PR sequence: #360 → #361 → post-#360 substrate-sweep (this PR).
112 changes: 112 additions & 0 deletions .claude/knowledge/cca2a-sprint-prompt-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# CCA2A Sprint Prompt Template

> **READ BEFORE WRITING agent prompts** for any sprint that scopes new architectural work.
>
> This template captures the lessons learned from sprint-2 (PR #358/#359) and sprint-3 (PR #360/#361/sprint-3-rescope) about how to prevent the recurring failure modes.

## Failure modes captured to date

1. **"Designing What's Already Built" anti-pattern** (sprint-2 itself; recurred in sprint-3 PR-A-1/PR-C-1/PR-D-1 specs) — agents propose new types/files for substrate that already ships
2. **Wrong-repo error** (W7 sprint-2 → ndarray; W9 sprint-3 → ada-consciousness) — agents defer to `GITHUB_REPO` env var instead of explicit prompt
3. **Race-with-merge** (PR #358/#359, PR #360/#361, this PR) — main thread corrections land after PR merge; need follow-up PR
4. **Pattern letter divergence** (sprint-2 W2 invented A-G that conflicted with W1) — fixed by embedding canonical pattern letters in every prompt

## Substrate-grep checklist (mandatory before any new spec)

Before writing PR-X-Y spec for any pattern X, run:

```python
import os
from github import Github, Auth
tok = os.environ["GITHUB_TOKEN"].strip().strip('"').strip("'")
g = Github(auth=Auth.Token(tok))
repo = g.get_repo("AdaWorldAPI/lance-graph") # CANONICAL — do not defer to GITHUB_REPO env

# 1. Read tier-0 doc — current pattern X status
tier0 = repo.get_contents(".claude/knowledge/tier-0-pattern-recognition.md", ref="main").decoded_content.decode()
# Find Pattern X section; note SHIPPED / PARTIALLY SHIPPED / DESIGN PHASE status

# 2. Read cross-source matrix — find Pattern X row
cross = repo.get_contents(".claude/knowledge/pattern-recognition-cross-source.md", ref="main").decoded_content.decode()
# Note: shipped substrate file:symbol citations

# 3. Substrate grep — confirm cited substrate exists
for path in cited_substrate_files:
f = repo.get_contents(path, ref="main")
# Verify symbols mentioned in tier-0 actually exist in the file

# 4. TD-X check — read corresponding TD row in TECH_DEBT.md
td = repo.get_contents(".claude/board/TECH_DEBT.md", ref="main").decoded_content.decode()
# Find TD-X row; status must align with tier-0

# 5. Recent PR check — has this pattern been touched in the last 30 days?
recent = list(repo.get_commits(since=datetime.now() - timedelta(days=30)))
# Scan for commits mentioning Pattern X or its TD-X
```

If any check reveals shipped substrate, the spec MUST cite it and re-scope to "extension of shipped" rather than "construction from scratch".

## Wrong-repo guardrail (mandatory in every agent prompt)

Every worker agent prompt should include this snippet:

```python
# WRONG-REPO GUARDRAIL: do not defer to GITHUB_REPO env var
import os
from github import Github, Auth
tok = os.environ["GITHUB_TOKEN"].strip().strip('"').strip("'")
g = Github(auth=Auth.Token(tok))
repo = g.get_repo("AdaWorldAPI/lance-graph") # CANONICAL — explicit, not env-driven
assert repo.full_name == "AdaWorldAPI/lance-graph", \
f"WRONG REPO: got {repo.full_name}, expected AdaWorldAPI/lance-graph"
```

This 8-line block has prevented zero wrong-repo errors so far (because it didn't exist). Going forward, every spawned agent should have it pre-pended to their write protocol.

## Pattern letter discipline

The canonical pattern letter assignment lives in:
1. `.claude/plans/unified-ogit-architecture-v1.md` (W1 master, sprint-2)
2. `.claude/patterns.md` Pattern Recognition Framework (W3 sprint-2)
3. `.claude/knowledge/tier-0-pattern-recognition.md` (post-PR #359 corrected)

Every worker agent prompt MUST embed the canonical 15-letter table inline. Do not invent new letters; do not re-letter substrate inventory items.

If a worker discovers a genuinely new pattern, they MUST surface it as a meta-1-review escalation, not invent letter P / Q / etc. unilaterally.

## Race-with-merge mitigation

When the main thread (or meta agent) catches a defect AFTER the PR opens but BEFORE merge:
1. Push the fix to the same sprint branch (PR will pick it up on next push)
2. Comment on the PR with the fix summary so reviewer sees it before merge
3. If the merge happens before the fix lands: open a follow-up PR off main (this is what PR #359/#361/this PR does)

## Sprint scaffolding pattern

Every sprint should pre-create:
1. Branch (`claude/<sprint-N>-<scope>`) off main via pygithub
2. SPRINT_LOG-N.md scaffolding at `.claude/board/sprint-log-N/SPRINT_LOG.md` (worker roster, deliverables table, coordination notes, **canonical pattern letters embedded**)
3. Worker prompt template (this template)

Then spawn 12+meta agents in parallel; each agent's prompt includes:
- Sprint context (compact)
- Their specific deliverable (file path, target size, acceptance criteria)
- Wrong-repo guardrail snippet
- Substrate-grep checklist
- Canonical pattern letter table (inline, not by reference)
- pygithub-first protocol with quote-stripped GITHUB_TOKEN

## Cross-references

- `.claude/knowledge/tier-0-pattern-recognition.md` — canonical pattern letters + status
- `.claude/knowledge/pattern-recognition-cross-source.md` — A-O ↔ Pillars ↔ .grok/ ↔ shipped substrate matrix
- `.claude/board/sprint-log-2/sprint-summary.md` — sprint-2 lessons (W2 invented pattern letters, W7 wrong-repo)
- `.claude/board/sprint-log-3/sprint-summary.md` — sprint-3 lessons (W9 wrong-repo, recurring; specs over-scoped)
- `.claude/patterns.md` Pattern Recognition Framework + Anti-Pattern subsection

## Provenance

Captured post-#360 review pass. Reviewer flagged:
> "Suggested guardrail for the next sprint: bake into every worker prompt a first-action verify step — `git remote -v` (if local) or `mcp__github__get_me` + repo env confirmation before any write. Cost: ~10 LoC per prompt. Saves 1 wrong-repo-rev per sprint."

This template formalizes that guardrail + extends to substrate-grep + pattern-letter discipline.
71 changes: 71 additions & 0 deletions .claude/knowledge/pattern-recognition-cross-source.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Cross-source pattern recognition matrix

> **READ FIRST** alongside `.claude/knowledge/tier-0-pattern-recognition.md`.
>
> This workspace has 4 parallel architectural taxonomies that don't currently cross-reference each other. Future sessions reading one and missing the parallels is the recurring failure mode behind the "Designing What's Already Built" anti-pattern. This doc is the canonical mapping.

## The 4 taxonomies

1. **A-O Patterns** (sprint-2 PR #358 + PR #359 + sprint-3 PR #360) — `.claude/plans/unified-ogit-architecture-v1.md`, `.claude/patterns.md`, `.claude/knowledge/tier-0-pattern-recognition.md`
2. **Pillars 0-4** (palantir-parity-cascade) — `.claude/plans/palantir-parity-cascade-v2.md`, `.claude/plans/ogit-cascade-supabase-callcenter-v1.md`
3. **`.grok/` epiphanies + open threads** — `.grok/01_overview/` through `.grok/05_query_languages/`, `FANOUT_MAPPING_PLAN.md`, `GLUE_LAYER_OGIT_TO_OWL_SPEC.md`, etc.
4. **Shipped substrate** (~28 crates) — what actually exists in `crates/`, anchored to TD-X rows in `.claude/board/TECH_DEBT.md`

## Master mapping table

| A-O | Pillar | .grok/ doc | Shipped substrate (file:symbol) | TD ref |
|---|---|---|---|---|
| **A** SPO-G u32 slot | Pillar 0 (OGIT u32 namespace) | `04_mathematical_foundation/` | `lance-graph-ontology/src/namespace.rs::SchemaPtr.ontology_context_id` (PARTIAL) | TD-OGIT-G-SLOT-1 |
| **B** Context Bundle | Pillar 0 (OWL overlay) | `GLUE_LAYER_OGIT_TO_OWL_SPEC.md` | (typed surface missing) | TD-CONTEXT-BUNDLE-2 |
| **C** Generic Bridge | Pillar 0 (BridgeFromRegistry) | `FANOUT_MAPPING_PLAN.md` § bridge dispatch | `lance-graph-ontology/src/bridges/mod.rs::BridgeFromRegistry` + 3 impls (PARTIAL) | TD-GENERIC-BRIDGE-3 |
| **D** Meta-Structure Hydration | Pillar 0 (TTL → bundle) | `04_mathematical_foundation/` § hydration | `lance-graph-ontology/src/ttl_parse.rs::parse_ttl_directory_with_provenance` (PARTIAL) | (anatomy demo PR-ANATOMY-1) |
| **E** Compile-Time Consumer Binding | Pillar 1 (manifest format) | `MCP/` | (manifest format missing) | TD-MANIFEST-MODULES-4 |
| **F** ractor Supervisor | Pillar 1 (supervised mesh) | `INVESTIGATION_AGENT_CODE_SKETCH.rs` | `cognitive-shader-driver/src/grpc.rs` (shape proven, supervisor missing) | TD-RACTOR-SUPERVISOR-5 |
| **G** Best-Practice Thinking Inheritance | Pillar 2 (per-G styles) | `03_cognitive_layers/` | `p64-bridge::STYLES` (12-base codebook) | (no TD; Pattern G deferred) |
| **H** Switchable Cognitive Vessel | Pillar 2 (cognitive-shader-driver) | `01_overview/` | `p64-bridge/src/lib.rs::cognitive_shader::CognitiveShader` ✅ SHIPPED | (no TD) |
| **I** Implicit Cognition | Pillar 2 (CycleAccumulator) | (parallel to FANOUT) | `lance-graph-contract/src/cycle_accumulator.rs` ✅ SHIPPED | (no TD) |
| **J** INT4-32D Atoms | Pillar 3 (proximity reranker) | `03_cognitive_layers/` § proximity | `thinking-engine/src/reranker_lens.rs` (lens shape only) | TD-INT4-32D-ATOMS-6 |
| **K** Circular Compilation | Pillar 3 (JIT actor) | `02_core_primitives/` § JITson | `lance-graph/src/cam_pq/jitson_kernel.rs` (kernel scope) | TD-CIRCULAR-COMPILATION-7 |
| **L** SPO-Chain Narrative | Pillar 4 (NARS chains) | `05_query_languages/` | `lance-graph-planner::nars::truth::TruthValue` + AriGraph (PARTIAL) | (no TD; deferred) |
| **M** Wave-Particle Bimodal | Pillar 2 (qualia + SPO) | `03_cognitive_layers/` § wave-particle | bgz17 + qualia (wave) + AriGraph + SPO (particle) ◐ PRIMITIVES SHIPPED | (no TD) |
| **N** Fingerprint-as-Codebook | Pillar 0 (substrate operation) | `02_core_primitives/` § codebook | `thinking-engine::prime_fingerprint`, `qualia::FAMILY_CENTROIDS`, `p64-bridge::STYLES` ✅ SHIPPED | (no TD) |
| **O** Phenomenological Memory | Pillar 2 (Qualia17D) | `03_cognitive_layers/` § qualia | `thinking-engine/src/qualia.rs` (39 KB) ✅ SHIPPED | (no TD) |

## Shipped consumer scaffolds (Pattern C precedents)

The Pattern C "consumer template" worked example doesn't need to be hypothetical (hubspo-rs). Two real precedents already validate the LOC reduction claim:

| Consumer | Repo / PR | Scaffold size | Status |
|---|---|---|---|
| **woa-rs** | `AdaWorldAPI/woa-rs` PR #2 | ~150 LOC | merged |
| **medcare-rs medcare-bridge** | `AdaWorldAPI/medcare-rs` PR #110 | ~250 LOC | merged |
| **smb-office-rs SmbMembraneGate** | `AdaWorldAPI/smb-office-rs` PR #29 | ~30 LOC newtype | merged |
| **medcare-rs MedCareMembraneGate** | `AdaWorldAPI/medcare-rs` PR #98 | ~30 LOC newtype | merged |
| (hypothetical) **hubspo-rs** | (W8 spec proposed scaffolding from scratch) | <150 LOC target | PROPOSED, NOT NECESSARY |

The architectural validation gate originally scoped to "build hubspo-rs in <150 LOC" should re-target to "verify woa-rs (~150 LOC) + medcare-bridge (~250 LOC) hit the LOC budget claim" — those are merged precedents.

## Maintenance protocol

When a new architectural insight surfaces in any one of the 4 taxonomies:
1. **Locate it in this matrix** — find the closest existing row
2. **Update all 4 columns** — A-O letter, Pillar number, .grok/ section, shipped-substrate file
3. **Cite the substrate file** with `file:symbol` precision (so future sessions can `grep` to verify before designing)
4. **If the insight has no existing row** — add a new row only after confirming it's not a re-discovery (use the substrate-grep checklist in `.claude/knowledge/cca2a-sprint-prompt-template.md`)

## Cross-references

- `.claude/knowledge/tier-0-pattern-recognition.md` — canonical A-O letter assignments + status
- `.claude/plans/palantir-parity-cascade-v2.md` — Pillars 0-4 architecture
- `.claude/plans/ogit-cascade-supabase-callcenter-v1.md` — Pillars 0-4 cascade execution
- `.grok/01_overview/` through `.grok/05_query_languages/` — parallel-session epiphanies
- `.claude/board/TECH_DEBT.md` — TD-X execution backlog
- `.claude/board/ARCHITECTURE_ENTROPY_LEDGER.md` — per-component scoring + clusters
- `.claude/knowledge/cca2a-sprint-prompt-template.md` — substrate-grep checklist (next deliverable)

## Provenance

This doc was created post-#360 (sprint-3 specs PR) review pass. Reviewer flagged:
> "Four parallel architectural taxonomies now exist in this workspace... None of them cross-reference the other three. Future sessions read one and miss the parallels."

This matrix is that cross-reference.
Loading