feat: Add Altimate Memory — persistent cross-session agent context for data engineering
Summary
Add Altimate Memory, a persistent, self-editable memory system that allows the AI agent to retain and recall context across sessions. This is critical for data engineering workflows where the agent needs to remember warehouse configurations, naming conventions, team preferences, and past analysis decisions.
Currently, altimate-code has a schema cache for warehouse metadata, but no mechanism for the agent to persist learned context (e.g., "this team uses stg_ prefix for staging models", "Snowflake warehouse is ANALYTICS_WH", "prefer star schema over OBT"). Every new session starts from zero.
Motivation
Why data engineering agents need memory
Data engineering agents benefit enormously from persistent memory because:
- Warehouse context is stable — connection details, naming conventions, and team standards rarely change but are tedious to re-explain every session.
- Past analyses inform future work — if the agent previously optimized a query or traced lineage for a table, recalling that context avoids redundant work.
- User preferences accumulate — SQL style preferences, preferred dialects, dbt patterns, etc.
- Project knowledge compounds — understanding of the data model, business logic encoded in SQL, known data quality issues.
Research context
- 62% of AI agent memories are wrong — best recall is only 43%, update accuracy below 26%. Altimate Memory mitigates this with human-readable Markdown files that users can inspect, edit, and delete directly.
- Memory poisoning is a real threat — poisoned memories persist across sessions. Altimate Memory uses per-user/per-project isolation, size limits, and plaintext files (auditable by humans and CI) rather than opaque vector stores.
- Context bloat degrades agent performance. Altimate Memory caps injection via a token budget and sorts by recency, so stale memories don't crowd out working context.
Design
Architecture
Two scopes:
- Global memory (
~/.local/share/altimate-code/memory/) — user preferences, general conventions - Project memory (
.opencode/memory/) — project-specific knowledge
Each block is a Markdown file with YAML frontmatter — human-readable, version-controllable.
Three altimate-branded tools
altimate_memory_read— Read/filter memory blocksaltimate_memory_write— Create or update blocksaltimate_memory_delete— Remove outdated blocks
System prompt injection
At session start, blocks are loaded and injected into system prompt (capped at configurable token budget).
Potential side effects
Context window impact
- One-time injection at session start (default budget: 8,000 chars, fits 15-40 typical blocks)
- Does NOT grow during session
Stale/wrong memories
- Blocks persist indefinitely (no auto-expiry)
- Mitigation: plain Markdown files, visible create/update output, manual edit/delete
Security
- Plaintext storage (not encrypted) — no secrets/PII
- Per-user/per-project isolation
- Add
.opencode/memory/to.gitignoreif sensitive
Acceptance Criteria
- [ ] Markdown files with YAML frontmatter
- [ ] Three tools:
altimate_memory_read,altimate_memory_write,altimate_memory_delete - [ ] Global and project scoping
- [ ] System prompt injection with token budget
- [ ] Size limits (2KB/block, 50 blocks/scope)
- [ ] Atomic writes
- [ ] Comprehensive tests
- [ ] Documentation
- [ ] Graceful degradation