Feature Implementation
Systematic approach to implementing new features in the Rust memory system.
Quick Reference
- Process - Implementation phases (planning, design, implementation, testing)
- Structure - Module structure and file organization
- Patterns - Code patterns and conventions
- Quality - Quality standards and checklists
When to Use
- Adding new functionality to the codebase
- Following project conventions for feature development
- Maintaining code quality and test coverage
Core Process
- Planning - Understand requirements and constraints
- Design - Architecture and module structure
- Implementation - Write code following patterns
- Testing - Add tests with >90% coverage
- Documentation - Update docs and examples
See process.md for detailed phases and patterns.md for Rust code patterns.
Project Standards
- File size: ≤ 500 LOC per file
- Async/Tokio patterns for I/O
- Error handling:
anyhow::Result - Storage: Turso (durable) + redb (cache)
- Serialization: postcard
StorageBackend Surface Guardrails
- A new defaulted
StorageBackendmethod must be classified in
scripts/storage-backend-capabilities.toml in the same PR, or the fail-closed
checker in fast-gate blocks every PR (regenerate
docs/generated/storage-backend-capabilities.json with --write).
- Use
fail-closedwhen the default returnsError::CapabilityUnavailablebut
there is no predicate to name; capability-gated requires a real
supports_*/can_* predicate in the trait source (LESSON-043: list_embedding_ids
fit neither class, so the checker gained fail-closed rather than the gate
blocking a correct default or the inventory staying noisy).
- A new capability predicate belongs on
StorageBackendCapabilities(default
false), and every cache/durability caller gates on it before treating a write
as durable (ADR-081 style).
- Every
StorageBackendtest double needs theStorageBackendCapabilitiesimpl
(impl StorageBackendCapabilities for T {} is enough when it advertises
nothing).