Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

3. **Snapshot** (pre-compact): The PreCompact hook (Claude Code, Kimi) saves a lightweight snapshot of the conversation before context compression.

4. **Extract** (session end): The Stop hook launches a background ingestion process that parses the transcript, runs the encoding gate on each fact, and stores high-quality memories.
4. **Extract** (session end): The SessionEnd hook launches a background ingestion process that parses the transcript, runs the encoding gate on each fact, and stores high-quality memories. (On Claude Code, the `SessionEnd` event fires only when the session actually terminates — `Stop` fires per-turn and is therefore the wrong trigger for transcript-end extraction.)

## Package Structure

Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# 4. Runs `truememory-mcp --setup` (code from PyPI) to auto-configure
# Claude Code and/or Claude Desktop. Set TRUEMEMORY_SKIP_SETUP=1 to skip.
# 5. Runs `truememory-ingest install` to wire up lifecycle hooks
# (SessionStart, Stop, UserPromptSubmit, PreCompact) and merge
# (SessionStart, SessionEnd, UserPromptSubmit, PreCompact) and merge
# CLAUDE.md instructions so Claude uses TrueMemory proactively.
#
# Environment overrides:
Expand Down
2 changes: 1 addition & 1 deletion truememory/ingest/CLAUDE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ MEMORY.md may contain personal facts that were cached from earlier sessions. **D

## Background Processing
- Memories are also extracted automatically from conversations via background processing.
- The Stop hook captures the full transcript and runs deep extraction after sessions end.
- The SessionEnd hook captures the full transcript and runs deep extraction when the session terminates.
- You do NOT need to store everything manually — focus on in-conversation corrections and explicit preferences.
- The background extractor handles: personal facts, preferences, decisions, temporal facts, and technical context.

Expand Down
6 changes: 3 additions & 3 deletions truememory/ingest/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ def _run_install(args):
Hooks installed:
- SessionStart: injects relevant memories as additionalContext
- UserPromptSubmit: buffers user messages (kept for future use)
- Stop: triggers background fact extraction after each session
- SessionEnd: triggers background fact extraction when the session terminates
- PreCompact: saves context snapshot before Claude compresses conversation

Note: the event is named ``PreCompact`` in Claude Code's settings.json
Expand All @@ -809,7 +809,7 @@ def _run_install(args):
hook_files = {
"SessionStart": hooks_dir / "session_start.py",
"UserPromptSubmit": hooks_dir / "user_prompt_submit.py",
"Stop": hooks_dir / "stop.py",
"SessionEnd": hooks_dir / "stop.py",
"PreCompact": hooks_dir / "compact.py",
}
missing = [name for name, path in hook_files.items() if not path.exists()]
Expand Down Expand Up @@ -1083,7 +1083,7 @@ def _run_status(args):
try:
settings = json.loads(settings_path.read_text(encoding="utf-8"))
hooks = settings.get("hooks", {})
expected = ["SessionStart", "UserPromptSubmit", "Stop", "PreCompact"]
expected = ["SessionStart", "UserPromptSubmit", "SessionEnd", "PreCompact"]
installed = []
missing = []
for event in expected:
Expand Down