Skip to main content

Module distill

Module distill 

Source
Expand description

Distillation pipeline shared between Stop / PreCompact hooks and the upcoming MCP memory_distill_pending tool (R4).

§Module layout

  • redact — secrets pattern matching + replacement (runs before any payload is shown to the user, written to ledger, or sent to sampling/createMessage)
  • transcript — Claude Code session transcript JSONL parser (~/.claude/projects/<sanitized-cwd>/<session-id>.jsonl)
  • heuristic — Tier 1 heuristics (R3b):
    • self_tag — explicit self-tags (“记一下”, “decide”, “from now on”) → accepted records
    • extraction — repeated patterns / corrected mistakes → candidate records

Tier 2 (R4) lives outside this module: it goes through the MCP sampling reverse-call, not local code.

Modules§

heuristic
Tier 1 heuristics — local pattern matchers that produce candidate / accepted memory signals from transcript text.
pipeline
Distill pipeline service — the shared core that turns a session transcript + a queue of post-tool-use signals into ledger writes.
redact
Heuristic secrets redaction.
transcript
Claude Code session transcript parser.