Skip to content

jaytoone/claude-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

claude-hooks

License: MIT Platform Claude Code

Persistent memory for Claude Code — across sessions, across projects.


The Problem

Claude Code starts fresh every session. No memory of what you built yesterday, what decisions you made, or what your codebase looks like. You re-explain everything. Every time.

The Fix: 3 Hooks

hooks/memory/
├── git-memory.py      # G1 — time memory
├── g2-augment.py      # G2 — space memory
└── chat-memory.py     # CM — conversation memory

G1 — Time Memory (git-memory.py)

Runs on every prompt. Reads the last 7 days of git history and injects a structured summary — commits, changed files, project state — so Claude always knows what you've been working on.

G2 — Space Memory (g2-augment.py)

Runs after Grep/Glob tool calls. Queries a SQLite codebase graph to find related entities (files, functions, classes) and surfaces them automatically. Requires a pre-built graph index.

CM — Conversation Memory (chat-memory.py)

Runs on every prompt. Searches past Claude Code conversations using BM25 (FTS5) + vector hybrid retrieval. Recalls relevant decisions, context, and notes from previous sessions instantly.


Setup

Copy the hooks to your Claude Code hooks directory:

cp hooks/memory/*.py ~/.claude/hooks/

Register them in ~/.claude/settings.json:

{
  "hooks": {
    "UserPromptSubmit": [
      {
        "hooks": [
          { "type": "command", "command": "python3 ~/.claude/hooks/git-memory.py" },
          { "type": "command", "command": "python3 ~/.claude/hooks/chat-memory.py" }
        ]
      }
    ],
    "PostToolUse": [
      {
        "matcher": "Grep|Glob|Read",
        "hooks": [
          { "type": "command", "command": "python3 ~/.claude/hooks/g2-augment.py" }
        ]
      }
    ]
  }
}

Dependencies

pip install rank-bm25 sqlite-utils

G2 requires a pre-built SQLite codebase graph. See g2-augment.py for indexing instructions.


License

MIT — free to use, modify, and distribute. See LICENSE for details.

About

A lightweight hook system that makes Claude Code follow your rules automatically — every session, without repeating yourself.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages