.agents/memory/MEMORY.md

71 lines
2.7 KiB
Markdown

<!-- generated 2026-02-20 04:14 -->
Current Context
Implementing Phase B: Shadow Extraction for the Signet memory pipeline. The focus is building the extraction and decision intelligence layer in shadow mode to validate quality/reliability without destructive consequences.
Active Projects
Phase B: Shadow Extraction Implementation
- Location: `packages/daemon/src/`
- Status: Planning complete, awaiting implementation
- Dependencies: Phase A infrastructure (schema migrations, DB accessor, feature flags) now in `c1e43b6`
- Next Steps:
1. Create `src/extract/` module with `extractFactsAndEntities(input): ExtractionResult`
2. Build `src/decision/` module for shadow candidate retrieval
3. Implement `src/worker.ts` with job queue processing (reads from `memory_jobs`, writes to `memory_history`)
4. Add contract validation and warning persistence
- Key Constraints:
- Extract from daemon.ts recall logic and hooks.ts extraction
- Keep semantics non-mutating
- All logs go to `memory_history` table only
- New files needed (daemon.ts is 4511 LOC)
Recent Work
Phase A: Infrastructure Hardening (completed in `c1e43b6`)
- Schema migrations 001+002 for job queue/history tables
- Singleton DB accessor with WAL mode and read pool
- Transaction boundaries keeping provider calls outside write locks
- Content-hash dedup implementation
- Feature flags with kill switches (`PipelineV2Config`)
- Entity graph schema with proper entity types
- 102 tests passing
Team Structure Established
- Parallel agent delegation used successfully
- Schema-agent, db-accessor-agent, config-test-agent working in sequence
- Integration pass handling remaining wiring
Technical Notes
Database Schema:
- `memory_jobs` table: stores job queue entries
- `memory_history` table: stores shadow extraction logs/proposals
- Feature flags: `PIPELINE_FLAGS` in `memory-config.ts`
Key Interfaces:
- `ExtractionResult`: structured facts + entities output
- `DecisionEngine`: retrieve top-K candidates, confidence scoring
- `SignetLifecycle` connectors pattern maintained
Tooling:
- Database access via singleton accessor
- Transaction wrappers for write operations
- Content hashing for deduplication
- Vector search integration for candidate retrieval
Code Standards:
- Self-explanatory code with "why" comments
- Max 700 LOC per file, max 3 indentation levels
- Test in browser (not lazy)
Rules & Warnings
- Never delegate UI work to subagents (handle personally as Opus)
- Prefer Sonnet/Haiku delegation when operating as Opus
- Keep journal entries in memory database regularly
- Signet agent profile at `~/.agents/`
- Phase B work must be in new files (daemon.ts too large at 4511 LOC)
- Test in browser, don't be lazy
- Non-mutating semantics for shadow extraction phase