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>
5.3 KiB
| description | argument-hint |
|---|---|
| Implement a task with vision alignment, design thinking, quality gates, and simulation coverage | <task-description> |
Implement Task: $ARGUMENTS
You are implementing a task for Episteme (StemeDB). Follow this rigorous process.
Phase 1: Vision Alignment
Read and internalize the vision:
- Read
vision.mdto understand the core philosophy - Read
architecture.mdto understand the system design - Read
roadmap.mdto understand where we're headed
Answer before proceeding:
- How does this task align with "Git for Truth" and the probabilistic knowledge lattice?
- Does this task respect append-only semantics?
- Which architectural tier does this touch (Spine, Lattice, or Cortex)?
If the task conflicts with the vision, STOP and explain the conflict to the user.
Phase 2: Code Understanding
Explore the existing codebase:
- Use the Explore agent to find all files relevant to this task
- Read the existing code thoroughly - understand patterns, not just syntax
- Check
ai-lookup/for documented facts about related components - Check
.claude/guides/for relevant procedures
Document your understanding:
- What existing code does this task interact with?
- What patterns are already established that we must follow?
- Are there any technical debts or constraints to be aware of?
Phase 3: Design Thinking
Apply best practices and principles from "Philosophy of Software Design" by John Ousterhout:
- Complexity is the enemy. Design for simplicity, not cleverness.
- Deep modules over shallow modules. Hide complexity behind simple interfaces.
- Define errors out of existence. Design APIs so invalid states are unrepresentable.
- Strategic vs tactical programming. We're building for the long term, not quick wins.
- Comments should describe what isn't obvious. Code tells how, comments tell why.
Design the implementation:
- What is the minimal interface that solves this problem?
- What complexity can we hide inside the module?
- How will this decision look in 2 years? 5 years?
- What are the failure modes and how do we handle them defensively?
Write down your design before coding:
- The public interface (traits, structs, functions)
- The internal implementation strategy
- Error handling approach
- Test strategy
Phase 4: Agent Selection & Implementation
Select the appropriate specialized agent based on the task domain:
| Domain | Agent | Use When |
|---|---|---|
| Storage, WAL, LSM | storage-engine-architect |
Write path, durability, crash recovery |
| Graph structures, concurrency | rust-graph-engine-architect |
Lock-free structures, cache optimization |
| Lens system, queries | stemedb-lens-architect |
Query resolution, ranking algorithms |
| Defensive patterns | defensive-systems-architect |
Rate limiting, hostile input, circuit breakers |
| General Rust features | primary-developer |
Feature implementation, refactoring |
Delegate to the agent: Use the Task tool to spawn the selected agent with:
- The task description
- Your design from Phase 3
- Specific files to modify
- Constraints and patterns to follow
Phase 5: Quality Gates
Run all quality checks:
make quality
This runs:
cargo fmt --check- Formattingcargo clippy -- -D warnings- Linting (zero warnings policy)jscpd- Code duplication detectioncargo test- All tests pass
Code review checklist:
- No
unwrap()orexpect()in production code - All public APIs have doc comments
- Error types are descriptive and actionable
- New code follows existing patterns
- No hardcoded values that should be configurable
If any quality gate fails, fix the issues before proceeding.
Phase 6: Simulation Coverage (steme-sim)
Every feature must be representable in the simulation.
The simulation (stemedb-sim / The Arena) validates StemeDB under adversarial conditions. Check simulation-vision.md for context.
Update the simulation to cover this feature:
-
Which agent persona exercises this feature?
- Scientist (truth-seeking)
- Troll (adversarial)
- Believer (consensus-following)
- Skeptic (variance-detecting)
- Historian (context-preserving)
-
What scenario tests this feature?
- Create or extend a scenario in the simulation config
- Define success criteria (what should happen vs. what shouldn't)
-
What metrics should we track?
- Add any new observability to the simulation metrics
If the simulation doesn't exist yet:
- Document how this feature WOULD be tested in the simulation
- Add a TODO in
simulation-vision.mdunder Implementation Plan
Phase 7: Documentation
Update documentation:
- If new types/concepts: add to
ai-lookup/ - If new procedures: add to
.claude/guides/ - Update
CLAUDE.mdrouting if this is a major feature - Ensure code comments explain WHY, not just HOW
Output
When complete, provide:
- Summary: What was implemented and why
- Files Changed: List of modified files
- Design Decisions: Key decisions and their rationale (referencing Philosophy of Software Design)
- Quality Status: Output of
make quality - Simulation Coverage: How this feature is validated in the simulation
- Follow-up: Any remaining work or known limitations