https://github.com/jaytoone/claude-hooks
A lightweight hook system that makes Claude Code follow your rules automatically — every session, without repeating yourself.
https://github.com/jaytoone/claude-hooks
ai-workflow claude claude-code hooks
Last synced: about 2 months ago
JSON representation
A lightweight hook system that makes Claude Code follow your rules automatically — every session, without repeating yourself.
- Host: GitHub
- URL: https://github.com/jaytoone/claude-hooks
- Owner: jaytoone
- License: mit
- Created: 2026-03-06T03:23:36.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2026-04-17T01:34:12.000Z (2 months ago)
- Last Synced: 2026-04-17T03:36:02.095Z (2 months ago)
- Topics: ai-workflow, claude, claude-code, hooks
- Language: Python
- Homepage:
- Size: 37.1 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# claude-hooks
[](LICENSE)
[](https://github.com/anthropics/claude-code)
[](https://claude.ai/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:
```bash
cp hooks/memory/*.py ~/.claude/hooks/
```
Register them in `~/.claude/settings.json`:
```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
```bash
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](LICENSE) for details.