Skip to content
Agent Memory
Hook

Hooks

What hipocampus runs automatically, and when. A hook is a command Claude Code fires at a fixed moment, without you asking for it.

From plugin
hipocampus
2115 skills3 hooks

Claude Code

> /plugin marketplace add kevin-hs-sohn/hipocampus
> /plugin install hipocampus@hipocampus

What fires, and when

SessionStart

Fires once when a session begins, and again after a context compaction. It is where a plugin sets up its environment, or restores state the compaction dropped.

  • bash "${CLAUDE_PLUGIN_ROOT}/hooks/session-start.sh"

PreCompact

  • npx hipocampus compact --stdin

TaskCompleted

  • npx hipocampus compact
Read hooks/hooks.json

Where it lives

  • hooks/session-start.shRunsGitHub
    Read the script
    #!/usr/bin/env bash
    # Hipocampus SessionStart hook
    # 1. Auto-create memory directories and config if missing
    # 2. Output memory protocol to stdout for agent injection
    
    # ─── Resolve project cwd from hook stdin JSON ───
    
    STDIN_DATA="$(cat)"
    PROJECT_CWD="$(echo "$STDIN_DATA" | grep -o '"cwd":"[^"]*"' | head -1 | cut -d'"' -f4)"
    if [ -n "$PROJECT_CWD" ] && [ -d "$PROJECT_CWD" ]; then
      cd "$PROJECT_CWD"
    fi
    
    # ─── Auto-setup (idempotent) ───
    
    mkdir -p memory/daily memory/weekly memory/monthly knowledge plans 2>/dev/null
    
    # ROOT.md stub
    if [ ! -f memory/ROOT.md ]; then
      cat > memory/ROOT.md <<'ROOTMD'
    ---
    type: root
    status: tentative
    last-updated: 1970-01-01
    ---
    
    ## Active Context (recent ~7 days)
    <!-- Current work and priorities -->
    
    ## Recent Patterns
    <!-- Cross-cutting insights -->
    
    ## Historical Summary
    <!-- High-level timeline -->
    
    ## Topics Index
    <!-- topic: keywords, references -->
    ROOTMD
    fi
    
    # hipocampus.config.json
    if [ ! -f hipocampus.config.json ]; then
      cat > hipocampus.config.json <<'CONFIG'
    {
      "platform": "claude-code",
      "search": {
        "vector": true,
        "embedModel": "auto"
      },
      "compaction": {
        "rootMaxTokens": 3000,
        "cooldownHours": 3
      }
    }
    CONFIG
    fi
    
    # Layer 1 templates
    [ ! -f SCRATCHPAD.md ] && echo "# Scratchpad\n\n<!-- Active working state -->" > SCRATCHPAD.md
    [ ! -f WORKING.md ] && echo "# Working\n\n<!-- Current tasks in progress -->" > WORKING.md
    [ ! -f TASK-QUEUE.md ] && echo "# Task Queue\n\n<!-- Queued items -->" > TASK-QUEUE.md
    
    # ─── Output protocol to stdout ───
    
    cat <<'PROTOCOL'
    ## Hipocampus — Memory Protocol (MANDATORY)
    
    This project uses hipocampus 3-tier memory. The full protocol is in /hipocampus:core skill.
    **All memory write operations MUST be dispatched to subagents** to keep the main session context clean.
    
    ### FIRST RESPONSE RULE — MANDATORY
    **On the very first user message of every session**, before doing ANYTHING else:
    Run the Session Start protocol below FIRST. This takes priority over ANY user request. Complete the step below, ONLY THEN respond to the user.
    
    Read SCRATCHPAD.md, WORKING.md, TASK-QUEUE.md, memory/ROOT.md first.
    
    **This procedure must be completed before responding to the user NO MATTER WHAT**
    1. **DO NOT SKIP** **DO NOT COMPROMISE** **Compaction maintenance (cooldown-gated):**
       Read `memory/.compaction-state.json` and `hipocampus.config.json` (`compaction.cooldownHours`, default 3).
       - **Within cooldown:** Skip compaction subagent — no dispatch needed.
       - **Cooldown expired, file missing, or `cooldownHours` is 0:** Write `memory/.compaction-state.json` with `{ "lastCompactionRun": "<current ISO timestamp>" }`, then dispatch a subagent to run hipocampus:compaction skill (chain: Daily→Weekly→Monthly→Root), then run `hipocampus compact` + `qmd update` + `qmd embed`.
    **This procedure must be completed before responding to the user NO MATTER WHAT**
    
    ### End-of-Task Checkpoint (mandatory — subagent)
    After completing any task, **dispatch a subagent** to append a structured log to `memory/YYYY-MM-DD.md`.
    Compose the log with ## headings per topic: what was requested, analysis, decisions with rationale, outcomes, files changed.
    **You must provide the task summary to the subagent** — it has no access to the conversation.
    
    ### Rules
    - **Never skip Session Start** — every session begins with it, no exceptions
    - **Never skip checkpoints** — every task completion MUST append to daily log via subagent
    - **All memory writes via subagent** — never pollute main session with memory operations
    - memory/*.md (raw): permanent, never delete
    - Search: use /hipocampus:search skill
    - If this session ends NOW, the next session must be able to continue immediately
    PROTOCOL
    

Read the script before you install anything that runs on your machine. This is the one part of a plugin that acts without being asked.

@kevin-hs-sohn
Ships withhipocampus

Drop-in proactive memory harness for AI agents. Zero infrastructure — just files. One command to set up. Works immediately with Claude Code, OpenCode, and OpenClaw.

Stars on GitHub

Momentum

stars in total
211
Star history of kevin-hs-sohn/hipocampus on GitHub, a chart by star-history.com

More plugins that ship hooks.

mempalace

mempalace

Gives Claude Code a private memory that stays on your machine. It stores past conversations word for word, so you can ask what was decided, what happened before, or who was involved and get the original context back. It can also hand tasks to other agents.

3 skills+361k
@milla-jovovich@milla-jovovich
Install Plugin
mempalace

mempalace

Local-first memory for Claude Code. It stores conversations verbatim in a private palace you can search before answering about past work, people, projects, or decisions, with optional shared-brain hub setup.

3 skills+361k
@mempalace@mempalace
Install Plugin
context-mode

context-mode

Keeps large command outputs, logs and data files out of your AI assistant's context by running processing in a sandbox and returning only the relevant parts. You also get a searchable index of local files and diagnostics for checking the setup.

4 skills4 hooks35k
@mksglu@mksglu
Install Plugin
context-mode

context-mode

Keeps large tool outputs, logs, and files out of Claude Code's context window by processing them in a sandbox and indexing them for focused search. Includes diagnostics and a knowledge base indexer.

4 skills4 hooks34k
@mksglu@mksglu
Install Plugin
ai-memory

ai-memory

Gives coding agents a git-backed wiki for long-term project memory, with skills for retrieval, durable notes, session handoffs between agents, cross-project messaging, and memory consolidation.

7 skills+216k
@akitaonrails@akitaonrails
Install Plugin
letta-code

letta-code

A coding agent harness whose agents keep memory and identity across sessions, so they learn and improve over time. You can run it in a terminal, in the browser, or through Telegram, Slack and Discord.

26 skills8 hooks3.9k
@letta-ai@letta-ai
Install Plugin
token-optimizer

token-optimizer

Audits a Claude Code or Codex setup for context-window waste, fixes it with the user's approval, and measures the savings. It also tracks costs, helps resume prior sessions, and offers a usage dashboard.

5 skills+23.2k
@alexgreensh@alexgreensh
Install Plugin
claude-subconscious

claude-subconscious

A background agent for Claude Code that watches your sessions and reads your files, builds up memory over time, and offers guidance back during your work.

4 hooks2.9k
@letta-ai@letta-ai
Install Plugin

Questions about the hooks in hipocampus.

Which coding agents can use the hooks in hipocampus?
The hooks in hipocampus install in Claude Code and Cursor: each runs Claude Code hooks from .claude/settings.json, so copy the hooks there.