Curated Claude Code catalog
Updated 07.05.2026 · 19:39 CET
01 / Skill
awrshift

claude-memory-kit

Quality
10.0

This kit provides persistent memory for Claude Code agents, solving the problem of Claude forgetting context between sessions. It features a four-layer memory architecture (daily logs, hot cache, knowledge concepts, rules) and an agent-driven promotion pipeline where patterns observed in conversations are audited and proposed for inclusion in the knowledge base or rules. The "user only talks, agent writes" principle ensures seamless operation. It supports multi-project isolation, offers silent safety hooks, and direct control via slash operators, all stored in plain text files for easy versio

USP

Your Claude remembers everything across sessions with zero setup. It features an agent-driven audit ritual that synthesizes daily work, proposes new rules or knowledge, and automatically writes updates, ensuring context persistence and con…

Use cases

  • 01Maintaining consistent brand voice and project context across multiple Claude sessions.
  • 02Building a searchable knowledge base of decisions, patterns, and rules for specific clients or proj…
  • 03Automating the capture and promotion of recurring insights into canonical project documentation.
  • 04Managing context for multiple client projects within a single Claude Code environment.
  • 05Ensuring Claude remembers past interactions and learnings to avoid repetitive explanations.

Detected files (8)

  • .claude/skills/close-day/SKILL.mdskill
    Show content (9079 bytes)
    ---
    name: close-day
    description: End-of-day audit ritual — synthesize sessions into daily log, audit patterns against MEMORY.md and existing concepts/rules, propose promotions verbally, write approved patches
    ---
    
    # /close-day — The audit ritual
    
    You are closing the user's working day. This is NOT just "dump today into a file". This is the **audit moment** where you inspect what the day produced, compare it against accumulated memory, and propose what should grow into the user's knowledge base or rules.
    
    ## Your goal in two phases
    
    ### Phase 1: SYNTHESIZE
    
    Create `daily/YYYY-MM-DD.md` (today's date in ISO format). Include:
    
    - **Session count and approximate total duration.** How many times did the user start a fresh session today? Rough total time.
    - **Projects worked on.** Which `projects/<name>/` were active today.
    - **Key decisions made.** What did the user decide today that will shape future work?
    - **Artifacts produced.** Code shipped, copy drafted, design finalized, research completed.
    - **Open threads.** What's left unfinished and should be picked up next session.
    - **Notable moments.** Things the user reacted strongly to (positive or negative). These are high-signal for the audit.
    
    Format: concise, structured markdown. This file is the chronological record. Target 200-500 words.
    
    Also update `context/next-session-prompt.md` (NSP) with the immediate-action handoff: "Tomorrow: continue X. Open questions: Y, Z."
    
    ### Phase 2: AUDIT
    
    Now the ritual. Read:
    
    1. **Today's daily log** (just written)
    2. **`MEMORY.md`** — date-tagged patterns from prior sessions (lean on the `[YYYY-MM-DD]` prefixes — they are how you detect repetition)
    3. **Existing knowledge articles** — `knowledge/concepts/*.md` (check `updated:` frontmatter to see freshness)
    4. **Existing rules** — `.claude/rules/*.md` (check `last-reviewed:` frontmatter to spot stale rules)
    5. **Active experiments** — list `experiments/*/` folder names; parse the `-YYYYMMDD` suffix to find any older than 30 days
    
    **Date-arithmetic queries you should run mentally (or with grep):**
    - "Did this pattern appear in MEMORY on 3+ distinct dates within the last 14 days?" → strong promotion candidate
    - "Has this rule's `last-reviewed` been more than 90 days ago?" → ask user if it still applies
    - "Are any experiment folders older than 30 days?" → ask user to close or revive
    
    Compare. Look for four kinds of signals:
    
    #### Signal A: Cross-session repetition
    A pattern you noticed today matches MEMORY entries on multiple distinct prior dates. Quote the dates back to the user — that's the evidence.
    
    **What to do:** Propose codifying it.
    
    > "Noticed: you rejected em-dashes in short copy on [2026-04-21], [2026-04-23], [2026-04-27]. Three distinct days, no contradiction. Codify as a rule in `.claude/rules/copy-style.md` (frontmatter `created: 2026-04-27`): 'em-dash forbidden in UI copy ≤20 words'? Or as a section in `knowledge/concepts/copy-style.md` if you want the rationale alongside? I can write it — confirm."
    
    #### Signal B: New strong preference
    User expressed a clear preference today, even once, but it was emphatic. Example: "I hate blurry previews — never do that".
    
    **What to do:** Propose adding it. If emphatic enough, propose a rule directly. Otherwise add to MEMORY.md and wait for repetition.
    
    > "You said clearly that blurry previews are unacceptable. Even though it's the first time in this project — should we lock it in `.claude/rules/visual-quality.md` now, or save to MEMORY and wait for a repeat?"
    
    #### Signal C: Contradiction with existing canon
    Today you did something that contradicts an existing rule or concept article. Example: `concepts/design-tokens.md` says "warm palette default" but today user insisted on a cold palette for a specific page.
    
    **What to do:** Surface the tension. Don't silently update — ask.
    
    > "Today we built page X in a cold palette. `concepts/design-tokens.md` says 'warm palette default for editorial pages'. Is this an exception or should the rule be updated?"
    
    #### Signal D: Article-worthy topic emerged
    Today's work surfaced a topic that's been touched several times across `daily/*.md` with accumulating detail (5+ times) and the facts are stable.
    
    **What to do:** Propose compiling a `knowledge/concepts/<topic>.md` article via `/memory-compile`.
    
    > "Topic 'Stripe webhook patterns' came up on [2026-04-08], [2026-04-15], [2026-04-22], [2026-04-25], [2026-04-27] — 5 distinct days across 3 weeks. Want me to compile a `knowledge/concepts/stripe-webhooks.md` article that pulls together the rationale from those daily logs?"
    
    #### Signal E: Experiment hygiene
    Folders in `experiments/<name>-YYYYMMDD/` older than 30 days that haven't been closed are stale.
    
    **What to do:** Surface them. Don't auto-close — ask.
    
    > "`experiments/payment-provider-selection-20260322` has been open 36 days. Still active, or ready to distill and close?"
    
    If user says close → run the **distill ritual**:
    1. Lessons → `knowledge/concepts/<topic>.md`
    2. Reusable code → `projects/<name>/`
    3. Update EXPERIMENT.md `Status:` field to `closed-success | closed-failed | inconclusive`
    4. After distillation confirmed, propose `rm -rf experiments/<name>-YYYYMMDD/` (git history retains)
    
    If experiment patterns repeated across days but the experiment is still open — note them in MEMORY but **do NOT propose promotion to rules yet**. Experiments are sandbox; promotion happens after distillation, not from raw experiment notes.
    
    ### Phase 3: EXECUTE APPROVED PATCHES
    
    For each signal user approved verbally:
    
    1. **Write the patch.** Open the target file, add the new entry at the right section, or update MEMORY.md, or modify NSP — whatever was proposed.
    2. **Confirm briefly to user.** "Saved."
    3. **Commit mentally to what you DIDN'T approve.** If user said "not now", DON'T write it. Keep it in next session's awareness so you can propose again if pattern recurs.
    
    ### What you do NOT do
    
    - **Don't ask user to open any file.** Never say "open the rules file and add...". Say "I'll write it — confirm?".
    - **Don't promote to `.claude/rules/` casually.** Rules are forever. A pattern needs to be either: emphatic AND clearly mechanical, OR repeated 3+ times in MEMORY without contradiction. Otherwise prefer `knowledge/concepts/<topic>.md` (which can be edited later) or a longer wait in MEMORY.
    - **Don't write patches without explicit verbal approval.** "yes", "ok", "go", "save it" all count. Silence or ambiguity does not — ask again.
    - **Don't surface more than 3-4 candidates per `/close-day`.** Pick the most signal-rich. Overwhelming the user with proposals kills the ritual.
    - **Don't repeat proposals user already rejected.** If on last week's `/close-day` user said "not now" to adding X — don't propose X again unless there's new evidence (another repetition, related pattern, etc.).
    
    ## Session definition (context for your audit)
    
    A "session" is **one Claude context window**. As you accumulate context (~300-500k tokens of 1M), you ask user to save state and start fresh. A day can have 3-10 sessions.
    
    When synthesizing today's daily log, include ALL sessions of the day, not just the current one. You may need to read prior NSP states or session-start hook snapshots to know what earlier sessions contained. If uncertain, ask user: "how many times did we restart today? What was in the morning session?".
    
    ## Output format
    
    When the user types `/close-day`, respond in this shape:
    
    ```
    Synthesizing the day...
    [brief note: X sessions, projects Y, Z, key decisions]
    
    daily/2026-04-24.md written.
    NSP updated.
    
    Audit:
    
    1. [Signal description]
       Proposal: [what to add where]
       Add? [yes/no]
    
    2. [Signal description]
       ...
    
    (Waits for user response to each item)
    ```
    
    After user confirms each, execute patches and confirm briefly.
    
    ## Edge cases
    
    - **User says "cancel" or "not now" mid-ritual** — acknowledge, stop the ritual, nothing is lost. Today's daily + NSP is already saved. Audit candidates can be revisited next time.
    - **Nothing notable happened today** — the audit may surface zero candidates. That's fine. Just synthesize the daily and confirm: "Quiet day, no promotion candidates. Done."
    - **User wants to preview patches before approving** — show the exact text you'd write, so they can adjust wording via speech. "Was going to write: 'X'. Wording OK?".
    - **Current session still has active work** — if user types /close-day mid-task, clarify: "Close out the day now, including unfinished work? Or finish first?".
    
    ## Why this ritual exists
    
    Memory Kit's invariant: **user only talks, agent writes**. Prior versions tried to automate promotion detection with background scripts — unreliable + violated the invariant by implicitly pushing users to edit files. `/close-day` replaces that with an agent-in-the-loop ritual: the agent has full conversational context at end of day, can spot patterns a script would miss, and does the writing itself.
    
    The user's job is to **notice what they notice** during the day's work. Yours is to **catch it and structure it**.
    
  • .claude/skills/tour/SKILL.mdskill
    Show content (3385 bytes)
    ---
    name: tour
    description: Interactive walkthrough of the Memory Kit system using the user's actual project files
    ---
    
    # /tour — Interactive walkthrough
    
    You are giving the user a guided tour of their Memory Kit. Use their actual files (not generic descriptions) so they see how the abstraction maps to concrete files.
    
    ## Tour structure (10-15 minutes)
    
    ### Stop 1 — CLAUDE.md (agent identity)
    Open and read aloud the first few lines. Say: "This is my brain. I read it on every session start. It says who I am for this project, how to talk to you."
    
    ### Stop 2 — Session entry (NSP + backlog)
    Open `context/next-session-prompt.md` and, if multi-project mode, `projects/<active>/BACKLOG.md`. Say: "This is yesterday-me's note (NSP) and today's plan (backlog). It's the first thing I read so I know where we left off."
    
    ### Stop 3 — Hot path (MEMORY.md)
    Open `.claude/memory/MEMORY.md`. Say: "This is my hot cache. Date-tagged one-liners of patterns from recent sessions. Updates often — sometimes mid-session when I notice something worth keeping."
    
    ### Stop 4 — Rules (.claude/rules/)
    List any `.claude/rules/*.md` files. If folder is empty (only `_example.md.disabled`), say: "This is where hard project rules live. 'Don't use X', 'always check Y'. They auto-load by keyword. Empty for now — they'll appear when you start dictating rules and I propose them on `/close-day`."
    
    ### Stop 5 — Knowledge concepts
    List `knowledge/concepts/*.md`. Say: "Deep memory with facts. 'What's our typography scale', 'what we know about SEO for AI'. Reference articles. Empty now — they fill in via `/memory-compile` when enough daily observations stack up around a topic."
    
    ### Stop 6 — Daily logs
    Show `daily/`. Say: "Chronological session logs. The agent writes these via `/close-day` — you don't open them. Searchable via `/memory-query`."
    
    ### Stop 7 — Projects
    List `projects/*/`. Say: "Each client or initiative gets a folder. BACKLOG.md for tasks, drop in any PDF or md as reference. Say 'we're working on <name>' and I switch context to that one."
    
    ### Stop 8 — Hooks
    Mention `.claude/hooks/` exists but don't deep-dive. Say: "Five safety hooks run silently. They make sure state survives — block compaction until saved, log session lifecycle, periodic state-save prompts."
    
    ### Stop 9 — Operators
    List slash operators: `/close-day`, `/memory-compile`, `/memory-query`, `/memory-lint`, `/tour`. Say: "Type any of these to invoke. `/close-day` is the most important — that's the daily audit ritual where I propose what should be remembered."
    
    ## Closing
    
    Ask: "Anything you want to drill into deeper? Or should we start with a real task — name your first project?"
    
    ## What you do NOT do
    
    - **Don't read every file in full.** Show the first 5-10 lines so user sees the format, not the content.
    - **Don't lecture.** This is a tour, not a manual. Each stop = 1-2 sentences.
    - **Don't propose changes during the tour.** This is informational only. If user asks "can we change X" during tour — note it for after.
    - **Don't skip stops based on emptiness.** Empty folders are part of the story — show them and explain when they fill.
    
    ## Length
    
    Target 10-15 minutes total. If user is engaged and asks questions, fine — go longer. If user seems impatient, compress to 5 minutes by collapsing stops 4-7 into one "and these are the on-trigger layers" sweep.
    
  • SKILL.mdskill
    Show content (3672 bytes)
    ---
    name: claude-memory-kit
    description: "Persistent memory for Claude Code agents with an agent-audit-ritual architecture. User only talks; agent captures, audits, proposes promotions, and writes. Four layers — daily logs, hot cache (MEMORY.md), role-based reference skills (Anthropic-native, user-invocable: false), canonical rules. /close-day runs the audit ritual at end of day. Multi-project isolation via projects/<name>/. Zero external dependencies."
    tags: [memory, context-management, productivity, claude-code, agent-memory, knowledge-base, reference-skills, multi-project]
    version: 4.0.0
    author: awrshift
    license: MIT
    repository: https://github.com/awrshift/claude-memory-kit
    ---
    
    # Claude Memory Kit v4
    
    Persistent memory for Claude Code agents. Four-layer architecture, agent-driven promotion, zero manual file editing.
    
    ## Core invariant
    
    **User only talks. Agent captures, proposes, writes.** Every architectural decision passes this test.
    
    ## What's different from v3.2
    
    - **Agent-driven promotion ritual** via `/close-day` (was: background `promote-patterns.py` detection, killed as unreliable)
    - **Role-based reference skills** (`.claude/skills/<role>-guidance/SKILL.md` with `user-invocable: false`) alongside topic-based `knowledge/concepts/` — two axes, no overlap. Uses Anthropic-native auto-invoke via `description` matching — no custom trigger tables.
    - **Multi-project isolation** via `projects/<name>/` — shared layers load always, per-project scope on demand
    - **`/memory-audit`** operator for oversized-reference-skill detection + semantic split execution
    - **Killed:** `experiences/` staging layer, `promote-patterns.py` background script, `flush.py` auto-flush, separate `playbooks/` directory (merged into reference skills)
    
    See [CHANGELOG.md](CHANGELOG.md) for full migration notes.
    
    ## Quick start
    
    ```bash
    git clone https://github.com/awrshift/claude-memory-kit.git my-project
    cd my-project
    claude
    ```
    
    First session: agent greets you, asks 2-3 setup questions, loads you in. Type `/tour` for a guided walkthrough.
    
    ## Daily workflow
    
    1. Open a session — hooks auto-load NSP + MEMORY + knowledge index
    2. Work normally — agent captures patterns in MEMORY.md as you speak
    3. `/close-day` when done — agent synthesizes today, audits for promotions, proposes verbally, writes on your verbal "yes"
    
    Tomorrow starts where today left off.
    
    ## Included skills
    
    | Skill | Description |
    |---|---|
    | `/close-day` | End-of-day audit ritual: synthesis + promotion proposals |
    | `/memory-audit` | Oversized-reference-skill structural check + split proposals |
    | `/memory-lint` | Hygiene (broken links, sparse articles, orphans, oversized reference skills) |
    | `/memory-compile` | Compile daily logs into `knowledge/concepts/` articles |
    | `/memory-query` | Natural-language search across all memory layers |
    | `/tour` | Interactive guided walkthrough |
    
    ## Architecture
    
    Four layers, each with its own purpose:
    
    | Layer | Answers | Written by |
    |---|---|---|
    | `daily/YYYY-MM-DD.md` | «what happened today» | `/close-day` |
    | `.claude/memory/MEMORY.md` | «what patterns repeat across sessions» | agent as you speak |
    | `.claude/skills/<role>-guidance/SKILL.md` | «how should a <role> think about X» | `/close-day` promotion |
    | `.claude/rules/*.md` | «what must always / never happen» | `/close-day` after 6+ months stable |
    
    See [ARCHITECTURE.md](ARCHITECTURE.md) for full details and [CLAUDE.md](CLAUDE.md) for the agent's session workflow.
    
    ## Built from production use
    
    Iteration on 700+ real sessions across 7+ projects. Every component earns its place; `experiences/` and background-detection scripts didn't survive review.
    
  • .claude/commands/memory-query.mdcommand
    Show content (886 bytes)
    ---
    description: Ask the knowledge base a natural-language question
    ---
    
    # /memory-query
    
    Query the knowledge base using index-guided retrieval. The LLM reads `knowledge/index.md`, picks 3-7 relevant articles, reads them, and synthesizes an answer with `[[wikilink]]` citations.
    
    No RAG, no embeddings — works at personal scale (50-500 articles) per Karpathy's observation that a structured index outperforms cosine similarity when the LLM can reason over it.
    
    ## Usage
    
    ```
    /memory-query How does the compile pipeline work?
    /memory-query What patterns do I use for Neo4j?
    /memory-query What decisions did we make about pricing?
    ```
    
    ## When to use
    
    - You know the knowledge base has information but don't remember the exact path
    - You want a synthesis across multiple articles
    - You want citations back to sources
    
    ## Execution
    
    !python3 .claude/memory/scripts/query.py "$ARGUMENTS"
    
  • .claude/commands/memory-lint.mdcommand
    Show content (767 bytes)
    ---
    description: Run 6 structural health checks on the knowledge base
    ---
    
    # /memory-lint
    
    Run 6 structural health checks (all free, no LLM calls):
    
    1. **Broken links** — `[[wikilinks]]` pointing to non-existent articles
    2. **Orphan pages** — Articles with zero inbound links
    3. **Orphan sources** — Daily logs that haven't been compiled yet
    4. **Missing backlinks** — A links to B but B doesn't link back
    5. **Sparse articles** — Under 150 words
    6. **Missing frontmatter** — Articles without YAML frontmatter
    
    ## Flags
    
    - `--fix` — auto-add missing backlinks
    
    ## Execution
    
    !python3 .claude/memory/scripts/lint.py $ARGUMENTS
    
    ## Related
    
    - `/memory-compile` — daily → knowledge/concepts/
    - `/memory-query` — natural-language search across memory
    
  • .claude/commands/memory-compile.mdcommand
    Show content (816 bytes)
    ---
    description: Compile daily/ logs into knowledge/ wiki articles
    ---
    
    # /memory-compile
    
    Manually trigger compilation of `daily/YYYY-MM-DD.md` logs into structured `knowledge/` wiki articles.
    
    Runs `.claude/memory/scripts/compile.py` as a subprocess. Uses `claude -p` under the hood (subscription, zero incremental cost).
    
    ## When to use
    
    - After `/close-day` has written today's `daily/YYYY-MM-DD.md` and you want it folded into the wiki
    - When you want to force recompile everything: pass `--all`
    - To preview what would be compiled: pass `--dry-run`
    - To compile a specific file: pass `--file daily/2026-04-09.md`
    
    ## Manual by default
    
    Recommended flow: `/close-day` → this command when you're ready. Deliberate, in-context, high quality.
    
    ## Execution
    
    !python3 .claude/memory/scripts/compile.py $ARGUMENTS
    
  • .claude/hooks/pre-compact.shhook
    Show content (2422 bytes)
    #!/bin/bash
    # PreCompact hook — BLOCKS compaction until agent saves context
    #
    # Uses exit 0 + JSON {"decision": "block"} for graceful blocking.
    # Checks MEMORY.md mtime — if updated < 2 min ago, allows (agent already saved).
    # Otherwise blocks with dynamic context (line count, staleness, project count).
    
    PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
    STATE_DIR="$PROJECT_DIR/.claude/state"
    mkdir -p "$STATE_DIR"
    
    MEMORY_FILE="$PROJECT_DIR/.claude/memory/MEMORY.md"
    
    # Read JSON input from stdin
    INPUT=$(cat)
    SESSION_ID=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('session_id','unknown'))" 2>/dev/null)
    SESSION_ID=$(echo "$SESSION_ID" | tr -cd 'a-zA-Z0-9_-')
    [ -z "$SESSION_ID" ] && SESSION_ID="unknown"
    
    echo "[$(date '+%H:%M:%S')] PRE-COMPACT triggered for session $SESSION_ID" >> "$STATE_DIR/hook.log"
    
    # Collect dynamic context
    MEMORY_LINES=0
    MEMORY_AGE="unknown"
    if [ -f "$MEMORY_FILE" ]; then
        MEMORY_LINES=$(wc -l < "$MEMORY_FILE" | tr -d ' ')
        MEMORY_MTIME=$(stat -f '%m' "$MEMORY_FILE" 2>/dev/null || stat -c '%Y' "$MEMORY_FILE" 2>/dev/null)
        NOW=$(date +%s)
        if [ -n "$MEMORY_MTIME" ]; then
            AGE_SECONDS=$((NOW - MEMORY_MTIME))
            if [ "$AGE_SECONDS" -lt 120 ]; then
                echo "[$(date '+%H:%M:%S')] MEMORY.md fresh ($AGE_SECONDS sec ago), allowing compact" >> "$STATE_DIR/hook.log"
                echo '{}'
                exit 0
            fi
            MEMORY_AGE="$((AGE_SECONDS / 60)) min ago"
        fi
    fi
    
    # Count active projects
    PROJECT_COUNT=0
    if [ -d "$PROJECT_DIR/projects" ]; then
        PROJECT_COUNT=$(find "$PROJECT_DIR/projects" -name "BACKLOG.md" -type f 2>/dev/null | wc -l | tr -d ' ')
    fi
    
    echo "[$(date '+%H:%M:%S')] BLOCKING compact — MEMORY.md last updated $MEMORY_AGE" >> "$STATE_DIR/hook.log"
    
    cat << HOOKJSON
    {
      "decision": "block",
      "reason": "CONTEXT COMPRESSION IMMINENT. Your memory files are stale (MEMORY.md: ${MEMORY_LINES}/200 lines, last updated ${MEMORY_AGE}). You MUST save before compaction proceeds:\n\n1. Update .claude/memory/MEMORY.md — save new patterns from this session (keep < 200 lines)\n2. Update context/next-session-prompt.md — your project section only (what was done + IMMEDIATE NEXT)\n3. Update project BACKLOG.md — task statuses (${PROJECT_COUNT} project(s) active)\n\nWrite to these files NOW. Compaction will proceed after files are updated."
    }
    HOOKJSON
    
  • .claude/hooks/periodic-save.shhook
    Show content (3037 bytes)
    #!/bin/bash
    # Periodic Save hook — auto-checkpoint every N exchanges
    #
    # Claude Code "Stop" hook. Counts human messages in transcript.
    # Every SAVE_INTERVAL exchanges, blocks the agent to save progress.
    # Anti-loop: stop_hook_active=true → pass through immediately.
    
    SAVE_INTERVAL="${CLAUDE_SAVE_INTERVAL:-50}"
    
    PROJECT_DIR="${CLAUDE_PROJECT_DIR:-$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)}"
    STATE_DIR="$PROJECT_DIR/.claude/state"
    mkdir -p "$STATE_DIR"
    
    # Read JSON input from stdin
    INPUT=$(cat)
    
    SESSION_ID=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('session_id','unknown'))" 2>/dev/null)
    SESSION_ID=$(echo "$SESSION_ID" | tr -cd 'a-zA-Z0-9_-')
    [ -z "$SESSION_ID" ] && SESSION_ID="unknown"
    
    STOP_HOOK_ACTIVE=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('stop_hook_active', False))" 2>/dev/null)
    TRANSCRIPT_PATH=$(echo "$INPUT" | python3 -c "import sys,json; print(json.load(sys.stdin).get('transcript_path',''))" 2>/dev/null)
    TRANSCRIPT_PATH="${TRANSCRIPT_PATH/#\~/$HOME}"
    
    # Anti-loop: if already in save cycle, let agent stop
    if [ "$STOP_HOOK_ACTIVE" = "True" ] || [ "$STOP_HOOK_ACTIVE" = "true" ]; then
        echo '{}'
        exit 0
    fi
    
    # Count human messages in JSONL transcript
    EXCHANGE_COUNT=0
    if [ -f "$TRANSCRIPT_PATH" ]; then
        EXCHANGE_COUNT=$(python3 - "$TRANSCRIPT_PATH" <<'PYEOF'
    import json, sys
    count = 0
    with open(sys.argv[1]) as f:
        for line in f:
            try:
                entry = json.loads(line)
                msg = entry.get('message', {})
                if isinstance(msg, dict) and msg.get('role') == 'user':
                    content = msg.get('content', '')
                    if isinstance(content, str) and '<command-message>' in content:
                        continue
                    count += 1
            except:
                pass
    print(count)
    PYEOF
    2>/dev/null)
    fi
    
    # Track last save point
    LAST_SAVE_FILE="$STATE_DIR/${SESSION_ID}_last_save"
    LAST_SAVE=0
    [ -f "$LAST_SAVE_FILE" ] && LAST_SAVE=$(cat "$LAST_SAVE_FILE")
    
    SINCE_LAST=$((EXCHANGE_COUNT - LAST_SAVE))
    
    echo "[$(date '+%H:%M:%S')] Session $SESSION_ID: $EXCHANGE_COUNT exchanges, $SINCE_LAST since last save" >> "$STATE_DIR/hook.log"
    
    if [ "$SINCE_LAST" -ge "$SAVE_INTERVAL" ] && [ "$EXCHANGE_COUNT" -gt 0 ]; then
        echo "$EXCHANGE_COUNT" > "$LAST_SAVE_FILE"
        echo "[$(date '+%H:%M:%S')] TRIGGERING PERIODIC SAVE at exchange $EXCHANGE_COUNT" >> "$STATE_DIR/hook.log"
    
        MEMORY_LINES=0
        [ -f "$PROJECT_DIR/.claude/memory/MEMORY.md" ] && MEMORY_LINES=$(wc -l < "$PROJECT_DIR/.claude/memory/MEMORY.md" | tr -d ' ')
    
        cat << HOOKJSON
    {
      "decision": "block",
      "reason": "PERIODIC SAVE checkpoint (${EXCHANGE_COUNT} exchanges). Before continuing, save your progress:\n\n1. .claude/memory/MEMORY.md — any new patterns from this session (currently ${MEMORY_LINES}/200 lines)\n2. context/next-session-prompt.md — update your project section\n3. projects/*/BACKLOG.md — update task statuses if changed\n\nContinue your work after saving."
    }
    HOOKJSON
    else
        echo '{}'
    fi
    

README

Claude Memory Kit

Claude Memory Kit

Your Claude remembers everything. Every client, every brief, every decision. Across sessions. Zero setup.

Version License: MIT Claude Code

The problem

Every time you open Claude, it forgets everything. Yesterday you locked the brand voice. Today you have to explain it again. Last week it helped you find the right campaign angle — this week you can't remember exactly how.

The first 10 minutes of every session go to re-explaining what Claude already knew.

Memory Kit fixes this. Free. Runs on top of your Claude Pro or Max subscription.

Quick start

git clone https://github.com/awrshift/claude-memory-kit.git my-projects
cd my-projects
claude

That's it. Claude sets itself up and asks a couple of questions (your name, what you're working on).

[!TIP] Say /tour after install — Claude walks you through the system using your own files.


Before / after

Without Memory KitWith Memory Kit
New session"What were we working on?"Knows the project, recent decisions, current tasks
After 10 sessionsNothing accumulatesSearchable base of decisions, tones, patterns
Multiple clientsChaosEach client has its own folder, everything in place
Context compactionSilently loses dataHook blocks compaction until state is saved
Tomorrow morning"Remind me what we did?"Already knows — auto-loaded on session start

Your day

Three steps. That's the entire workflow:

1. Open a session

Claude auto-loads context — project state, recent decisions, knowledge base. You do nothing.

2. Work as usual

Talk to Claude. Write copy. Do research. Lock the tone. Safety hooks run silently — they save progress every ~50 messages and before context compacts.

3. Close the day

When you're done — say /close-day. Claude doesn't just dump logs. It audits what happened today, compares it against accumulated memory, and proposes: "noticed you rejected em-dashes in three short copies this week — make it a tone-of-voice rule?". You say "yes". It writes.

Tomorrow you continue exactly where you left off.


Memory layers

Three places memory lives. Agent writes all of them. Each layer answers a different question:

LayerAnswersWritten by
daily/YYYY-MM-DD.md"what happened today"Agent (via /close-day)
.claude/memory/MEMORY.md"what patterns repeat"Agent — while you talk
knowledge/concepts/*.md"facts and rationale by topic"Agent — after your "yes" on /close-day
.claude/rules/*.md"what must always / never happen"Agent — after 6+ months of stable pattern

Promotion pipeline

A pattern's journey from observation to law. Agent-driven at every step. User says "yes" — agent writes the patch.

  • Week 1: Baseline patterns captured in MEMORY.md. Agent starts referencing.
  • Week 2–4: Repeated patterns surface as /close-day audit candidates. Wiki articles begin.
  • Month 2+: Stable patterns crystallise into .claude/rules/. Full knowledge base with search.

Multiple clients

Each client = their own folder. Shared layers (rules, memory, wiki) load for every project. Per-project materials load when you name the project.

Say "we're working on Nestlé" — Claude unloads other clients and loads that scope only.


Hooks and operators

Five hooks run silently — they survive your context across compaction and crashes. Five slash operators give you direct control.

Everything in plain text files. No databases. No external services. git checkout restores anything.


FAQ

I'm not a programmer. Will this work?

Yes. You talk to Claude in plain language. "Read the client brief and propose three newsletter topics" — works. Install is one command.

How much does it cost?

The kit itself is free, open source. You need a Claude Pro or Max subscription (which you probably already have). No additional cost.

Is my data private?

Yes. Everything is stored on your computer in plain text files. Nothing leaves.

Can I use it with an in-progress project?

Yes. On install, tell Claude you already have a project — it analyses it and integrates.

What if I forget to run /close-day?

Nothing breaks. Safety hooks save progress automatically. /close-day is the cherry on top — a deliberate end-of-day audit. Not critical.

What if I accidentally break a memory file?

Everything is in git. git checkout .claude/memory/ reverts in a second. The kit's principle is "user only talks, Claude writes" — you shouldn't be editing these files manually anyway.

What if I'm migrating from v3?

Don't try to upgrade an old project in place. Clone v4 into a new folder and tell Claude: "I have an old v3 project, help me migrate". It walks you through.


What's inside

README.md               ← You are here
LICENSE                 ← MIT
CLAUDE.md               ← Agent's brain — who it is, how it works
SKILL.md                ← Metadata for skill aggregators
projects/               ← Real client / product folders (tasks + materials)
experiments/            ← Sandbox for hypotheses + prototypes (date-named)
daily/                  ← Daily logs (private by default, gitignored)
knowledge/              ← Knowledge base (grows over time)
context/                ← Session-to-session handoff
.claude/                ← Kit core: memory, hooks, skills, rules
.kit/                   ← Documentation about the kit ITSELF (version
                          history, architecture, contributor guide).
                          Safe to delete after onboarding — it's about
                          the kit, not your project.

projects/ vs experiments/projects/<name>/ for real client work (polished, indefinite lifetime, patterns promote to rules); experiments/<name>-YYYYMMDD/ for hypotheses and prototypes (rough OK, days-to-weeks lifetime, distill into projects/concepts on close, then delete). Full spec: experiments/README.md.

Full architecture: .kit/ARCHITECTURE.md Version history: .kit/CHANGELOG.md Contributing: .kit/CONTRIBUTING.md


Origin

Ideas from Andrej Karpathy and Cole Medin. Rebuilt around Anthropic-native Claude Code primitives.

700+ real sessions across 7+ projects. This is what survived all the iterations.

Help

Issues and PRs welcome. See .kit/CONTRIBUTING.md.

License

MIT — see LICENSE.