Skip to content

Commit 00a5f8e

Browse files
authored
Merge pull request #257 from AdaWorldAPI/claude/smb-contract-traits
feat: Foundry-equivalent ontology + RBAC crate + encode endpoint + A2A docs
2 parents 177aee9 + 0ea205e commit 00a5f8e

26 files changed

Lines changed: 2583 additions & 16 deletions

File tree

.claude/board/AGENT_LOG.md

Lines changed: 253 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,267 @@
1-
# AGENT_LOG
1+
# Agent Log — Append-Only Activity Record
22

3-
Append-only log of agent sessions. Prepend new entries at the top.
3+
> **APPEND-ONLY.** Every agent run gets one entry. Newest first.
4+
> Never edit past entries. This is the durable record of what each
5+
> agent did — future sessions read this instead of replaying
6+
> conversations.
7+
>
8+
> **Format:** `## YYYY-MM-DDTHH:MM — <description> (<model>, <branch>)`
9+
> followed by D-ids, commit, test counts, verdict/outcome, and any
10+
> findings worth preserving.
11+
>
12+
> **Chunking purpose:** An agent's entry here REPLACES its full
13+
> transcript in the knowledge graph. If you need to know what an
14+
> agent did, read this file — don't search for task transcripts.
15+
>
16+
> **Who writes:** The main thread appends after each agent completes.
17+
> Agents themselves should also append if they run long enough to
18+
> risk context compaction (write progress incrementally, not just
19+
> at the end).
20+
>
21+
> **Cross-agent blackboard.** This file IS the Layer 2 A2A blackboard.
22+
> Agents MUST read this file before starting work — it tells them
23+
> what other agents already shipped, found, or are working on.
24+
> This replaces explicit message passing between agents: no backend
25+
> coordination needed, just file reads. The pattern mirrors the
26+
> runtime `Blackboard` (Layer 1, `a2a_blackboard.rs`) — each entry
27+
> is a `BlackboardEntry` with expert_id (agent name), capability
28+
> (D-ids), result (commit), confidence (test count). Later agents
29+
> read prior entries and build on them, same as Layer 1 experts do.
430
531
---
632

33+
## Canonical Append Pattern
34+
35+
Agents append to this file via `cat >>` heredoc — no Read required,
36+
no overwrite risk, permission pre-allowed in `.claude/settings.json`:
37+
38+
```bash
39+
cat >> .claude/board/AGENT_LOG.md <<'EOF'
40+
41+
## YYYY-MM-DDTHH:MM — description (model, branch)
42+
43+
**D-ids:** ...
44+
**Commit:** `abc1234`
45+
**Tests:** N pass (M new)
46+
**Outcome:** One-line summary.
47+
EOF
48+
```
49+
50+
This is the ONLY sanctioned write pattern for this file. Do not use
51+
`Edit` or `Write` tools — they risk overwriting prior entries.
52+
`cat >>` is append-only by construction.
53+
54+
---
55+
56+
## Three Coordination Layers
57+
58+
All three layers use the **same entry format** and the **same
59+
append-only semantics**. Only the transport differs.
60+
61+
### Layer A — Teleportation (in-context role switch)
62+
63+
**Transport:** None (same context window).
64+
**Latency:** Instant. **Context loss:** Zero.
65+
66+
The model loads an agent card (`.claude/agents/*.md`), adopts its
67+
role and knowledge, does the work, and switches back. No process
68+
boundary, no serialization. The 19 specialist + 5 meta-agent cards
69+
in this workspace are **teleportation roles**, not delegation
70+
targets. The agent IS the main thread wearing a different hat.
71+
72+
```
73+
[main thread] → load @family-codec-smith card → do codec work
74+
→ load @truth-architect card → review with full context
75+
→ back to main thread (nothing lost)
76+
```
77+
78+
### Layer B — File Blackboard (in-session, between agents)
79+
80+
**Transport:** `AGENT_LOG.md` commit + git stage.
81+
**Latency:** Seconds. **Context loss:** Commit-level summary.
82+
83+
Agents spawned via `Agent()` are isolated processes. They read this
84+
file before starting to see what others shipped. They append their
85+
own entry after committing. The main thread appends for agents that
86+
don't write the log themselves.
87+
88+
```
89+
Agent A commits → appends to AGENT_LOG.md
90+
Agent B reads AGENT_LOG.md → sees A's findings → builds on them
91+
```
92+
93+
### Layer C — Cross-Session Branch Pub/Sub (between sessions)
94+
95+
**Transport:** `git push` + `subscribe_pr_activity` webhook.
96+
**Latency:** Minutes. **Context loss:** Entry-level summary.
97+
98+
Two concurrent Claude Code sessions coordinate through a shared
99+
branch. One pushes an `AGENT_LOG.md` append, the other gets a
100+
GitHub webhook notification via `subscribe_pr_activity`. No polling,
101+
no MCP server, no infrastructure — just git + GitHub webhooks.
102+
103+
**Setup:**
104+
105+
```
106+
# Session A (first):
107+
git checkout -b claude/blackboard
108+
# create or update AGENT_LOG.md
109+
git push -u origin claude/blackboard
110+
gh pr create --title "coordination blackboard" --body "A2A bus"
111+
# → PR #NNN created
112+
subscribe_pr_activity(pr=NNN)
113+
114+
# Session B (joins):
115+
subscribe_pr_activity(pr=NNN)
116+
git fetch origin claude/blackboard
117+
git checkout claude/blackboard
118+
# read AGENT_LOG.md — see what A did
119+
```
120+
121+
**Coordination loop:**
122+
123+
```
124+
Session A: Session B:
125+
[does work]
126+
appends to AGENT_LOG.md
127+
git commit && git push
128+
← webhook: push event on PR #NNN
129+
git pull origin claude/blackboard
130+
reads A's AGENT_LOG.md entries
131+
[does work building on A's findings]
132+
appends to AGENT_LOG.md
133+
git commit && git push
134+
← webhook: push event on PR #NNN
135+
git pull
136+
reads B's entries
137+
[continues with full picture]
138+
```
139+
140+
**Why this works:**
141+
142+
- `subscribe_pr_activity` is already in the MCP toolkit — zero setup.
143+
- GitHub doesn't care what's in the push — an `AGENT_LOG.md` append
144+
is just a commit. The webhook fires. The subscriber reads.
145+
- Git handles append-only merge cleanly — prepend-to-top means the
146+
merge base is always the old top, never a collision.
147+
- The PR is the pub/sub channel. The entry format is the message.
148+
The transport is `git push`. The notification is a webhook.
149+
All existing primitives, composed sideways.
150+
151+
### Summary
152+
153+
| Layer | Scope | Transport | Latency | Loss |
154+
|---|---|---|---|---|
155+
| **A: Teleport** | In-context | None | Instant | Zero |
156+
| **B: File** | In-session | `AGENT_LOG.md` | Seconds | Commit |
157+
| **C: Branch** | Cross-session | `git push` + webhook | Minutes | Entry |
158+
159+
All three share one invariant: **append-only, structured entries,
160+
newest-first.** A `BlackboardEntry` by any other transport.
161+
162+
---
163+
164+
## Entries (reverse chronological)
165+
166+
167+
## 2026-04-24T15:20 — RBAC crate scaffold (sonnet, claude/smb-contract-traits)
168+
169+
**D-ids:** lance-graph-rbac (permission, role, policy, access)
170+
**Commit:** `0df8780`
171+
**Tests:** 14 pass (14 new: 1 access + 3 permission + 4 role + 6 policy)
172+
**Outcome:** New workspace crate `lance-graph-rbac`. PermissionSpec ties RBAC to ontology via PrefetchDepth gates + action whitelists. Example roles: accountant (Detail on Customer, Full+write on Invoice), auditor (Full read-only everywhere), admin (Full+write+act everywhere). `smb_policy()` composes all three. `Policy.evaluate()` returns `AccessDecision { Allow, Deny, Escalate }`.
173+
174+
175+
## 2026-04-24T15:05 — Foundry ontology layer (main thread, claude/smb-contract-traits)
176+
177+
**D-ids:** LinkSpec, PrefetchDepth, ActionSpec (property.rs) + ModelBinding, ModelHealth, SimulationSpec, Ontology builder (ontology.rs)
178+
**Commit:** `574a93d`
179+
**Tests:** 209 pass (19 new: 10 property + 9 ontology)
180+
**Outcome:** Fills all 5 Palantir Foundry gaps. LinkSpec = typed edges (Cardinality). PrefetchDepth = L0-L3 progressive property loading (Identity → Detail → Similar → Full). ActionSpec = Manual/Auto/Suggested triggers. ModelBinding = external model I/O → ontology property. ModelHealth = NARS-based prediction quality tracking. SimulationSpec = World::fork() what-if parameters. Ontology builder composes schemas + links + actions.
181+
182+
183+
## 2026-04-24T14:55 — Schema builder + board hygiene (main thread, claude/smb-contract-traits)
184+
185+
**D-ids:** Schema, SchemaBuilder
186+
**Commit:** `cb8fb37`
187+
**Tests:** 190 pass (6 new Schema builder tests)
188+
**Outcome:** Declarative API: `Schema::builder("Customer").required("tax_id").searchable("industry").free("note").build()`. `.validate()` returns missing Required predicates. `.searchable()` = Optional + CamPq shorthand. Board-hygiene: LATEST_STATE + EPIPHANIES updated for full SMB surface.
189+
190+
191+
## 2026-04-24T14:45 — PropertySpec + CAM-PQ routing (sonnet, claude/smb-contract-traits)
192+
193+
**D-ids:** PropertyKind, PropertySpec, PropertySchema, CUSTOMER_SCHEMA, INVOICE_SCHEMA
194+
**Commit:** `b1ff05e`
195+
**Tests:** 184 pass (10 new property tests)
196+
**Outcome:** bardioc Required/Optional/Free maps to I1 Codec Regime Split: Required = Passthrough (Index), Optional = configurable, Free = CamPq (Argmax). PropertySpec carries predicate + kind + codec_route + nars_floor. CUSTOMER_SCHEMA (10 props) + INVOICE_SCHEMA (10 props).
197+
198+
199+
## 2026-04-24T14:30 — SMB contract traits (sonnet, claude/smb-contract-traits)
200+
201+
**D-ids:** repository.rs, mail.rs, ocr.rs, tax.rs, reasoning.rs
202+
**Commit:** `3ab8a52`
203+
**Tests:** 174 pass (0 new — trait-shape only, no executable logic)
204+
**Outcome:** 5 new zero-dep trait files per smb-office-rs proposal. EntityStore + EntityWriter + Batch (repository). MailParser + ThreadLinker (mail). OcrProvider + PageImage + Bbox + LayoutBlock (ocr). TaxEngine + TaxPeriod + Jurisdiction + RuleBundle (tax). Reasoner + ReasoningKind + Budget (reasoning). Additive-only: 5 `pub mod` appends to lib.rs.
205+
206+
207+
## 2026-04-24T14:15 — FingerprintColumns.cycle f32 migration (sonnet, claude/teleport-session-setup-wMZfb)
208+
209+
**D-ids:** PR B (SoAReview expansion item #1, bindspace substrate)
210+
**Commit:** `121acc1`
211+
**Tests:** 42 pass in cognitive-shader-driver (40 unit + 2 e2e), 174 contract — 0 regressions
212+
**Outcome:** `FingerprintColumns.cycle` migrated from `Box<[u64]>` (256 × u64, Binary16K) to `Box<[f32]>` (16,384 × f32, Vsa16kF32 carrier). New constant `FLOATS_PER_VSA = 16_384`. `set_cycle(&[f32])` for direct VSA write, `set_cycle_from_bits(&[u64; 256])` adapter with `binary16k_to_vsa16k_bipolar` projection. `write_cycle_fingerprint()` API unchanged (takes u64, converts internally). `byte_footprint()` for 1 row = 71,774 bytes. Module doc updated.
213+
214+
215+
## 2026-04-24T13:45 — Vsa16kF32 switchboard carrier (main thread, claude/vsa16k-f32-carrier-type → PR #253 merged)
216+
217+
**D-ids:** PR #253, expansion-list item #1 from SoAReview sweep
218+
**Commit:** `dc56586` (merged to main as `ddb3017`)
219+
**Tests:** 174 contract, 11 callcenter — 0 regressions. 7 new fingerprint tests.
220+
**Outcome:** `CrystalFingerprint::Vsa16kF32(Box<[f32; 16_384]>)` shipped as first-class variant. 6 algebra primitives: vsa16k_zero, binary16k_to_vsa16k_bipolar, vsa16k_to_binary16k_threshold, vsa16k_bind, vsa16k_bundle, vsa16k_cosine. Inside-BBB only. to_vsa10k_f32() downcast wired.
221+
222+
223+
## 2026-04-24T13:00 — SoAReview multi-angle sweep (opus, two parallel agents)
224+
225+
**D-ids:** Supabase-shape subscriber (verdict: GHOST), Archetype transcode (verdict: LOCKED-MAPPING-INCOMPLETE)
226+
**Commits:** none (review-only agents)
227+
**Tests:** n/a
228+
**Outcome — Supabase:** `subscribe()` = disconnected mpsc stub (lance_membrane.rs:186-189). DM-4 LanceVersionWatcher + DM-6 DrainTask modules commented out (lib.rs:71-79). CognitiveEventRow BBB-clean (11 LIVE, 2 ghost fields). 7-item expansion path identified.
229+
**Outcome — Archetype:** `lance-graph-archetype/` crate does not exist. Contract-layer mappings (PersonaCard/Blackboard/CollapseGate) LIVE. 0 archetype-specific types exist. ADR-0001 Decision 1 deblocks scaffold (Rust interface defined BY new crate, not mirrored from Python). 8-item scaffold path identified.
230+
231+
232+
## 2026-04-24T12:30 — Supabase subscriber wire-up (opus, claude/supabase-subscriber-wire-up) [STILL RUNNING]
233+
234+
**D-ids:** DM-4a/b/c, DM-5a, DM-6a/b, DM-7
235+
**Plan:** `.claude/plans/supabase-subscriber-v1.md`
236+
**Status:** In flight. tokio::sync::watch swap, version_watcher.rs, drain.rs scaffold, test flip.
237+
**Target verdict:** GHOST → PARTIAL
238+
239+
240+
## 2026-04-24T12:30 — Archetype crate scaffold (opus, claude/archetype-crate-scaffold) [STILL RUNNING]
241+
242+
**D-ids:** DU-2.1 through DU-2.6
243+
**Plan:** `.claude/plans/archetype-scaffold-v1.md`
244+
**Status:** In flight. New crate + Component/Processor traits + World/CommandBroker stubs.
245+
**Target verdict:** LOCKED-MAPPING-INCOMPLETE → LOCKED-AND-SCAFFOLDED
246+
247+
## 2026-04-24T15:45 — Three-layer coordination + RBAC + AGENT_LOG governance (main thread, claude/smb-contract-traits)
248+
249+
**D-ids:** AGENT_LOG.md, CLAUDE.md governance, lance-graph-rbac, ontology.rs, settings.json permissions
250+
**Commits:** `5e00049` (AGENT_LOG created) → `c0eda21` (blackboard protocol) → `13c1f19` (three-layer docs) → current
251+
**Tests:** 209 contract + 14 RBAC = 223 pass
252+
**Outcome:** Documented three coordination layers (Teleport / File Blackboard / Branch Pub-Sub). Added `cat >>` heredoc as canonical append pattern. Permissions opened for `cat >> AGENT_LOG.md`, `git push/fetch/pull`, `cargo test/check`. RBAC crate shipped (permission × role × policy × access). Ontology layer shipped (LinkSpec, PrefetchDepth, ActionSpec, ModelBinding, ModelHealth, SimulationSpec).
253+
254+
7255
## 2026-04-24T16:30 — Supabase subscriber v2 (sonnet, claude/supabase-subscriber-wire-up)
8256

9257
**D-ids:** DM-4a/b/c, DM-6a/b
10258
**Commit:** `ec3b5c7`
11-
**Tests:** 17 pass with realtime feature (13 without); 5 new tests total (4 in version_watcher.rs, 1 subscribe_receives_on_project in lance_membrane.rs)
12-
**Outcome:** Wired LanceMembrane::subscribe() from Phase-A disconnected mpsc stub to live tokio::sync::watch::Receiver<CognitiveEventRow> under [realtime] feature. project() now calls watcher.bump(row.clone()) on every projected cycle. DrainTask scaffold (Poll::Pending) ships unconditionally. Tokio was already a dep — no Cargo.toml changes needed. PR 255: https://github.com/AdaWorldAPI/lance-graph/pull/255
259+
**Tests:** 17 pass with realtime feature (13 without); 5 new tests total
260+
**Outcome:** Wired LanceMembrane::subscribe() from Phase-A disconnected mpsc stub to live tokio::sync::watch::Receiver<CognitiveEventRow> under [realtime] feature. PR #255 merged.
13261

14262
## 2026-04-24T16:30 — Archetype scaffold v2 (sonnet, claude/archetype-crate-scaffold)
15263

16264
**D-ids:** DU-2.1..2.6
17265
**Commit:** `816a7c0`
18266
**Tests:** 12 pass
19-
**Outcome:** Shipped `lance-graph-archetype` crate scaffold: Component + Processor traits (Arrow-backed), World meta-state with tick/fork/at_tick stubs, CommandBroker FIFO queue, ArchetypeError (thiserror). Added to root workspace members. No compile errors; 12 unit tests green.
267+
**Outcome:** Shipped `lance-graph-archetype` crate scaffold: Component + Processor traits, World meta-state with tick/fork/at_tick stubs, CommandBroker FIFO queue, ArchetypeError. PR #254 merged.

0 commit comments

Comments
 (0)