Skip to content

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

@suryaiyer95

Description

@suryaiyer95

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions