Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/coleam00/claude-memory-compiler/llms.txt

Use this file to discover all available pages before exploring further.

The Claude Memory Compiler is intentionally low-configuration: most defaults work well without any changes. The values below are the ones you are most likely to want to adjust, along with where each one lives in the source. All changes require editing the source file directly — there is no central config file.

Runtime constants

COMPILE_AFTER_HOUR

File: scripts/flush.py, line 142
COMPILE_AFTER_HOUR = 18  # 6 PM local time
Controls end-of-day auto-compilation. After each memory flush, flush.py checks whether the local hour is greater than or equal to this value. If it is, and today’s daily log has changed since its last compilation hash was recorded in scripts/state.json, compile.py is spawned as a detached background process. The default of 18 means compilation triggers automatically on the first session that ends after 6 PM. Change this to any integer in the range 0–23 to shift the compile window earlier or later.
COMPILE_AFTER_HOUR uses local time via datetime.now(timezone.utc).astimezone(). If you work across time zones, be aware that the trigger follows the system clock of the machine running Claude Code.

MAX_CONTEXT_CHARS

File: hooks/session-start.py, line 30
MAX_CONTEXT_CHARS = 20_000
The maximum number of characters injected into Claude’s context window by the SessionStart hook. The hook assembles the current date, knowledge/index.md, and the tail of the most recent daily log, then hard-truncates the result at this limit with a ...(truncated) suffix. Increase this value if your index has grown large and you want more of it to be visible at session start. Decrease it if you want to reduce the overhead on every session’s initial context. Note that a larger MAX_CONTEXT_CHARS slightly increases the token cost of the first message in every session.

MAX_LOG_LINES

File: hooks/session-start.py, line 31
MAX_LOG_LINES = 30
The maximum number of lines read from the most recent daily log and included in the SessionStart context injection. The hook reads daily/YYYY-MM-DD.md and slices the last MAX_LOG_LINES lines before appending them to the injected context. Increase this value if you want Claude to see more recent session history at startup. Decrease it to keep the injected context smaller.

Deduplication window

File: scripts/flush.py, line 210
if (
    state.get("session_id") == session_id
    and time.time() - state.get("timestamp", 0) < 60
):
flush.py skips a flush if the same session_id was processed within the last 60 seconds. This prevents double-flushing when pre-compact.py and session-end.py both fire in quick succession at the end of a session. To widen the dedup window (for example, to 120 seconds), change the 60 in that condition.

Hook timeouts

Hook timeouts are set in .claude/settings.json:
{
  "hooks": {
    "SessionStart": [{ "matcher": "", "hooks": [{ "type": "command", "command": "uv run python hooks/session-start.py", "timeout": 15 }] }],
    "PreCompact": [{ "matcher": "", "hooks": [{ "type": "command", "command": "uv run python hooks/pre-compact.py", "timeout": 10 }] }],
    "SessionEnd": [{ "matcher": "", "hooks": [{ "type": "command", "command": "uv run python hooks/session-end.py", "timeout": 10 }] }]
  }
}
HookDefault timeoutNotes
SessionStart15 sPure file I/O; typically finishes in under 1 s. The extra margin covers slow disks or large index files.
PreCompact10 sJSONL parsing and a subprocess spawn; completes in 1–3 s in practice.
SessionEnd10 sSame architecture as PreCompact; identical timing profile.
None of the hooks make API calls. If a hook exceeds its timeout, Claude Code kills the process and the session continues without memory extraction for that event.
Lowering hook timeouts below 5 seconds risks premature termination on slower machines or when the knowledge/index.md is large. The defaults are conservative by design.

Custom article types

The knowledge base ships with three article types (concepts/, connections/, qa/). You can add your own directories — for example knowledge/people/, knowledge/projects/, or knowledge/tools/. To add a custom article type:
1

Create the directory

Add the new subdirectory under knowledge/:
mkdir knowledge/people
2

Define the article schema in AGENTS.md

Add a new section to AGENTS.md describing the frontmatter fields and required sections for the new type, following the same pattern as the existing Concept Articles and Connection Articles sections. The LLM reads AGENTS.md at compile time to understand what to write.
3

Register the directory in utils.py

scripts/utils.py contains a list_wiki_articles() function that enumerates all knowledge articles. Add your new directory to the list of paths it searches so that lint checks, query loading, and index updates include articles in the new directory:
# In scripts/utils.py — add to list_wiki_articles()
for article in (KNOWLEDGE_DIR / "people").glob("*.md"):
    articles.append(article)
After adding a new article type, run uv run python scripts/lint.py --structural-only to confirm that the new articles are being picked up correctly and that no broken-link or orphan warnings appear.

Build docs developers (and LLMs) love