AltimateAI / AltimateAI/altimate-code

feat: inject and refresh memory using altimate-code Post hooks

Abierto
#672 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
TypeScript
Estrellas
811
Forks
134
Merge medio
3 d 2 h
PR fusionados (30 d)
50

Descripción

## 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:

1. **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
2. **Missed save opportunities** — the LLM may forget to persist important feedback or project context learned mid-conversation
3. **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.md` index to catch cross-session updates

### 2. `PostToolCall` hook — Context-aware memory triggers
- After specific tool calls (e.g., `git commit`, `Write` to memory files), trigger validation or indexing
- Example: after a `Write` to a memory file, auto-verify `MEMORY.md` index 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 `jq` to 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 `PostResponse` memory refresh hook
- [ ] Implement `PostToolCall` memory 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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.