Phase 1 delivers the complete durability and storage layer:
- WAL with crash recovery: Append-only journal with BLAKE3 checksums,
fsync guarantees, and proper seek-to-EOF on reopen
- Storage engine: sled-backed KVStore with scan_prefix for range queries
- Content-addressed storage: H:{hash}, V:{hash}, E:{hash} key patterns
- Ingestor: Background worker tailing WAL, writing to KV with 8-byte
aligned record headers for rkyv zero-copy deserialization
- Comprehensive tests: 31 tests covering crash recovery, round-trips,
and multi-cycle durability
New crates: stemedb-wal, stemedb-storage, stemedb-ingest
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
161 lines
4.5 KiB
Plaintext
161 lines
4.5 KiB
Plaintext
sequenceDiagram
|
|
%% The Catastrophe: When Proposals Look Like Decisions
|
|
|
|
participant RA as Research Agent
|
|
participant E as Episteme
|
|
participant LO as Lead Orchestrator
|
|
participant IA as Implementation Agent
|
|
participant DA as Deploy Agent
|
|
participant P as Production
|
|
|
|
RA->>E: Store RFC finding
|
|
Note right of E: RFC proposes ES256. Stored as PROPOSED.
|
|
|
|
LO->>E: What's the JWT algorithm?
|
|
Note right of E: ⚠️ No lifecycle filter. This is the bug.
|
|
|
|
E-->>LO: ES256 (conf: 0.87)
|
|
Note right of LO: ⚠️ Returns the proposal. Most recent wins.
|
|
|
|
LO->>IA: Use ES256 for JWT
|
|
Note right of IA: ⚠️ Orchestrator passes 'truth' downstream.
|
|
|
|
IA->>DA: Config ready
|
|
Note right of DA: ⚠️ Code written against ES256.
|
|
|
|
DA->>P: Deploy JWT config
|
|
Note right of P: ⚠️ Deployed with confidence. Tests passed.
|
|
|
|
P->>P: 401 Unauthorized
|
|
Note over P: ⚠️ Auth service expects RS256. Every token fails.
|
|
|
|
|
|
---
|
|
|
|
sequenceDiagram
|
|
%% The Correct Path: With Lifecycle Filtering
|
|
|
|
participant RA as Research Agent
|
|
participant E as Episteme
|
|
participant LO as Lead Orchestrator
|
|
participant IA as Implementation Agent
|
|
participant DA as Deploy Agent
|
|
participant P as Production
|
|
|
|
RA->>E: Store RFC finding
|
|
Note right of E: Same RFC. Still stored as PROPOSED.
|
|
|
|
LO->>E: What's the APPROVED JWT algorithm?
|
|
Note right of E: ✓ Lifecycle filter: approved only.
|
|
|
|
E-->>LO: RS256 (conf: 0.92)
|
|
Note right of LO: ✓ Returns the approved decision. Proposal excluded.
|
|
|
|
LO->>IA: Use RS256 for JWT
|
|
Note right of IA: ✓ Correct algorithm propagates.
|
|
|
|
IA->>E: Pre-flight constraint check
|
|
Note right of E: ✓ Check for forbidden patterns before coding.
|
|
|
|
E-->>IA: No violations
|
|
Note right of IA: ✓ No negative constraints for RS256.
|
|
|
|
IA->>DA: Config ready
|
|
Note right of DA: ✓ Code written against RS256.
|
|
|
|
DA->>P: Deploy JWT config
|
|
Note right of P: ✓ Deployed. Matches production expectation.
|
|
|
|
P->>P: 200 OK
|
|
Note over P: ✓ Auth works. No pager. Sleep continues.
|
|
|
|
|
|
---
|
|
|
|
sequenceDiagram
|
|
%% The Correction Loop: Tracing, Fixing, Learning
|
|
|
|
participant H as Human Supervisor
|
|
participant E as Episteme
|
|
participant G as Gardener
|
|
|
|
H->>E: Trace deploy agent queries
|
|
Note right of E: SRE investigates: what did the agent believe?
|
|
|
|
E-->>H: Query audit trail
|
|
Note right of H: ⚠️ Found it: no lifecycle filter. Proposal returned.
|
|
|
|
H->>E: Mark assertion incorrect
|
|
Note right of E: Supersede the problematic assertion.
|
|
|
|
E->>G: Correction event
|
|
Note right of G: Gardener wakes up.
|
|
|
|
G->>E: TrustRank back-propagation
|
|
Note right of E: Lead Orchestrator's reputation on auth topics drops.
|
|
|
|
G->>E: Store negative constraint
|
|
Note right of E: ✓ Future queries will see this constraint.
|
|
|
|
|
|
---
|
|
|
|
sequenceDiagram
|
|
%% Persistent Learning: Fixing the Optimization Conflict
|
|
|
|
participant H as Human Supervisor
|
|
participant E as Episteme
|
|
participant G as Gardener
|
|
participant IA as Implementation Agent
|
|
|
|
H->>E: Correct the agent
|
|
Note right of E: Human stores correction with forbidden alternative.
|
|
|
|
E->>G: Negative constraint stored
|
|
Note right of G: Gardener sees the correction event.
|
|
|
|
G->>E: TrustRank penalty
|
|
Note right of E: Implementation Agent's confidence on HTTP libs drops.
|
|
|
|
IA->>IA: New session begins
|
|
Note over IA: 30 days later. Fresh context. No memory of correction.
|
|
|
|
IA->>E: Pre-flight constraint check
|
|
Note right of E: ✓ Before writing code, check constraints.
|
|
|
|
E-->>IA: Constraint found
|
|
Note right of IA: ✓ The correction from Day 1 is still there.
|
|
|
|
IA->>IA: Write code with axios
|
|
Note over IA: ✓ Agent uses axios. Constraint honored.
|
|
|
|
E->>E: Resurrection
|
|
Note over E: ✓ Constraint used successfully. Stays fresh forever.
|
|
|
|
|
|
---
|
|
|
|
sequenceDiagram
|
|
%% Time Travel Debugging: What Did We Believe Then?
|
|
|
|
participant H as Human Supervisor
|
|
participant E as Episteme
|
|
|
|
H->>E: What's the current JWT algorithm?
|
|
Note right of E: Current state shows RS256 (post-fix).
|
|
|
|
E-->>H: RS256 (current)
|
|
Note right of H: This is useless for debugging. We need history.
|
|
|
|
H->>E: What did we believe at 9pm?
|
|
Note right of E: Time-travel query.
|
|
|
|
E-->>H: ES256 (at 9pm)
|
|
Note right of H: ⚠️ At 9pm, the system believed ES256 was correct.
|
|
|
|
H->>E: What changed in last 24h?
|
|
Note right of E: Diff view for change analysis.
|
|
|
|
E-->>H: Diff result
|
|
Note right of H: ✓ Clear view: RFC added at 2:30pm caused the issue.
|