altimate-code
altimate-code copied to clipboard
feat: inject and refresh memory using altimate-code Post hooks
Summary
We should leverage altimate-code's Post hooks (e.g., PostToolCall, PostResponse) to automatically inject and refresh the auto-memory system, rather than relying solely on the LLM to decide when to read/write memory during conversation.
Motivation
Currently, memory read/write is entirely LLM-driven — the model decides when to check MEMORY.md, when to save new memories, and when to update stale ones. This has several failure modes:
- Stale context at conversation start — memory is only loaded when the LLM "thinks" to check it, which may be too late or not at all
- Missed save opportunities — the LLM may forget to persist important feedback or project context learned mid-conversation
- No refresh on external changes — if another session updates memory files, the current session won't pick up changes
Proposal
Use altimate-code's hook system to automate memory lifecycle:
1. PostResponse hook — Memory refresh/injection
- After each assistant response, a lightweight script scans for memory-worthy signals (user corrections, project facts, explicit "remember this" requests)
- Optionally re-reads
MEMORY.mdindex to catch cross-session updates
2. PostToolCall hook — Context-aware memory triggers
- After specific tool calls (e.g.,
git commit,Writeto memory files), trigger validation or indexing - Example: after a
Writeto a memory file, auto-verifyMEMORY.mdindex is updated
3. Session start hook — Warm memory load
- On
UserPromptSubmit(first message), pre-load relevant memories based on working directory, recent git activity, or explicit tags
Implementation Ideas
- Hook scripts in
.altimate-code/hooks/as shell or Node scripts - Could use
jqto parse hook event JSON and decide whether to act - Memory refresh script: read
MEMORY.md, check file mtimes, surface stale entries - Memory save script: parse assistant output for patterns like "I'll remember that" and verify the file was actually written
Acceptance Criteria
- [ ] Design hook-based memory injection architecture
- [ ] Implement
PostResponsememory refresh hook - [ ] Implement
PostToolCallmemory validation hook - [ ] Implement session-start warm load via
UserPromptSubmit - [ ] Test across multi-session scenarios (cross-session memory updates)
- [ ] Document hook configuration in altimate-code settings
Labels
Enhancement, Developer Experience