gitify-prompt
v0.1.1
Published
Automatically capture Claude Code conversations and link them to git commits
Maintainers
Readme
Gitify Prompt
Automatic conversation capture for Claude Code - Track your AI-assisted coding sessions with zero manual effort.
What It Does
Automatically captures your Claude Code conversations and links them to git commits, giving you a complete history of how your code evolved with AI assistance.
Features
- 🤖 Zero-Effort Capture - Conversations automatically saved as you code
- 💬 Full Conversations - Captures your prompts AND Claude's responses
- 📋 Pasted Content - Preserves screenshots, code snippets, error messages you paste
- 🔗 Git Integration - Links conversations to commits automatically
- 👤 Git Author Tracking - Records who had the conversation
- 🚀 Real-Time Sync - Sessions saved immediately, not on exit
- 🔄 Multi-Session Support - Run multiple Claude instances, capture all of them
- 🛠️ Any Commit Tool - Works with GitHub Desktop, VS Code, Terminal, or even Claude itself
- 📊 CLI Dashboard - List, search, and filter prompts from terminal
- 🌐 Web Dashboard - Beautiful static HTML dashboard with search and filters
- 🌿 Branch Tracking - See which branch each conversation happened on
Quick Start
1. Installation
npm install -g gitify-prompt2. Set Up Wrapper Alias
# Add to ~/.zshrc or ~/.bashrc:
echo 'alias claude="/path/to/gitify-prompt/dist/bin/claude-wrapper.sh"' >> ~/.zshrc
source ~/.zshrcOr run without alias:
/path/to/claude-wrapper.sh "your prompt"3. Initialize Your Project
cd your-project
gitify-prompt initThis creates:
.prompts/directory- Git hooks (automatically detects Husky!)
4. Use Claude Normally
claude "add error handling to src/api.ts"
# Conversation captured automatically ✓5. Commit Your Changes
git add .
git commit -m "Add error handling"
# ✓ Conversation linked to commit automatically!How It Works
Architecture
┌────────────────────────────────────────┐
│ Your Shell: claude "add feature" │
└────────────────┬───────────────────────┘
↓
┌────────────────────────────────────────┐
│ claude-wrapper.sh │
│ Sets: NODE_OPTIONS=--import hook.js │
└────────────────┬───────────────────────┘
↓
┌────────────────────────────────────────┐
│ Claude Code (with hook loaded) │
│ - Intercepts file writes │
│ - Reads ~/.claude/projects/*.jsonl │
│ - Saves to .prompts/.meta/session-*.json │
└────────────────┬───────────────────────┘
↓
┌────────────────────────────────────────┐
│ git commit │
│ Pre-commit: Add prompts to commit │
│ Post-commit: Link to commit SHA │
└────────────────────────────────────────┘Conversation Capture
The hook reads from ~/.claude/projects/ where Claude Code stores conversations:
~/.claude/projects/
└── -Users-you-dev-project/
├── abc123-xyz.jsonl ← Your conversations
├── def456-uvw.jsonl
└── ...Each JSONL file contains:
- User messages (your prompts)
- Assistant messages (Claude's responses)
- Tool uses (code executions)
- Timestamps
- Pasted content (inline)
Session Matching
Sessions are matched to conversations using:
- Timestamp - Only messages after session start
- Project path - Only conversations from this repo
- Best fit - Picks conversation with most matching messages
What Gets Saved
{
"id": "session-abc123",
"tool": "claude-code",
"startTime": "2025-01-15T10:30:00Z",
"author": {
"name": "Your Name",
"email": "[email protected]"
},
"messages": [
{
"role": "user",
"content": "add error handling to src/api.ts",
"timestamp": "2025-01-15T10:30:00Z"
},
{
"role": "assistant",
"content": "I'll add comprehensive error handling...",
"timestamp": "2025-01-15T10:30:05Z"
}
],
"filesModified": [
{
"file": "/path/to/project/src/api.ts",
"timestamp": "2025-01-15T10:30:10Z"
}
],
"metadata": {
"commitSha": "abc123def",
"branch": "feature-auth",
"parentBranch": "main",
"fileCount": 1,
"messageCount": 2
}
}Features in Detail
✅ Real-Time Session Saving
Sessions are saved immediately when files are modified, not when Claude exits. This means:
- ✅ Works even if Claude is still running when you commit
- ✅ Captures sessions even if Claude crashes
- ✅ No dependency on process lifecycle
✅ Pasted Content Included
When you paste error messages, screenshots, or code into Claude:
You: [Pasted text #1 +150 lines] fix this errorThe full 150 lines are captured, not just the summary.
✅ Multi-Session Support
Run Claude in 3 terminal tabs:
# Tab 1: claude "fix bug A"
# Tab 2: claude "add feature B"
# Tab 3: claude "refactor C"Commit once → All 3 conversations captured!
✅ Works with Any Commit Tool
- ✅ Terminal:
git commit - ✅ GitHub Desktop
- ✅ VS Code Source Control
- ✅ Claude itself:
claude "commit these changes"
All trigger the same hooks → consistent behavior.
✅ Husky Integration
Automatically detects if your project uses Husky:
Standard Git:
.git/hooks/
├── pre-commit ← Created by gitify-prompt
└── post-commit ← Created by gitify-promptHusky Project:
.husky/
├── pre-commit ← Appended (preserves lint-staged!)
└── post-commit ← Created by gitify-promptRepository Structure
your-project/
├── .prompts/
│ ├── config.json
│ ├── prompts/
│ │ ├── 1705315800000-abc123.json ← Captured session
│ │ ├── 1705402200000-def456.json
│ │ └── ...
│ └── .meta/
│ └── (temporary session files)
└── .git/
└── hooks/
├── pre-commit
└── post-commitCommands
gitify-prompt init
Initialize .prompts/ directory and install git hooks.
cd your-project
gitify-prompt initOptions:
- Detects Husky automatically
- Preserves existing hooks
- Safe to run multiple times
gitify-prompt list
List all captured prompts with metadata.
gitify-prompt list
gitify-prompt list --branch feature-auth
gitify-prompt list --author "Your Name"
gitify-prompt list --since "2 days ago"
gitify-prompt list --limit 10Output:
┌──────────┬────────────────┬───────────────┬──────────┬────────┬──────────────────┐
│ SHA │ Branch │ Author │ Messages │ Files │ Date │
├──────────┼────────────────┼───────────────┼──────────┼────────┼──────────────────┤
│ abc123d │ feature-auth │ @Your Name │ 3 │ 5 │ 2 hours ago │
│ def456g │ main │ @Your Name │ 7 │ 2 │ 5 hours ago │
└──────────┴────────────────┴───────────────┴──────────┴────────┴──────────────────┘gitify-prompt show <sha>
View full conversation and changes for a specific commit.
gitify-prompt show abc123
gitify-prompt show abc123 --json
gitify-prompt show abc123 --filesOutput:
Commit: abc123def456
Branch: feature-auth ← main
Author: Your Name <[email protected]>
Date: Jan 15, 2025, 10:30:00 AM (2 hours ago)
Messages: 3 • Files: 5
💬 Conversation
[10:30:00] 👤 You:
add error handling to src/api.ts
[10:30:05] 🤖 Claude:
I'll add comprehensive error handling...
📝 Files Modified (5)
✏️ src/api.ts
✏️ src/types.ts
...gitify-prompt web
Generate a static HTML dashboard to visualize your prompts.
gitify-prompt web
gitify-prompt web --open # Open in browser after generationFeatures:
- 🔍 Search prompts
- 🔄 Filter by branch/author
- 💬 View full conversations
- 📱 Responsive design
- 🌐 Works offline (no backend needed)
- 📦 Commit to git for GitHub Pages
Output:
.prompts/web/
├── index.html # Prompt list dashboard
├── prompts/ # Individual prompt pages
├── assets/ # CSS and JavaScript
└── data.json # All prompts as JSONConfiguration
Edit .prompts/config.yaml:
autoCapture:
enabled: true
tools:
claudeCode: true
# cursor: false (future)
# chatgpt: false (future)
privacy:
maskSensitiveData: true
excludePatterns:
- "*.env"
- "*secret*"
- "*password*"
- "*api*key*"Troubleshooting
Prompts Not Captured?
1. Check hook is loaded:
claude --version
# Look for: [gitify-prompt] Capturing session ...2. Check wrapper alias:
which claude
# Should show: ...claude-wrapper.sh3. Check git hooks installed:
cat .git/hooks/pre-commit | grep gitify-prompt
# or for Husky:
cat .husky/pre-commit | grep gitify-prompt4. Check session files exist:
ls -la .prompts/.meta/
# Should show session-*.json when Claude is running5. Re-initialize:
gitify-prompt initNo Conversation in Captured Prompts?
Check if Claude Code is storing conversations:
ls -la ~/.claude/projects/
# Should see directory for your projectIf not, Claude Code might not be saving conversations. This is a Claude Code issue, not gitify-prompt.
Privacy & Security
- Local Only - All data stays on your machine
- No Network - No remote connections
- No Telemetry - No tracking or analytics
- Git Control - You decide what gets committed
- Sensitive Data Masking - Auto-filters passwords, API keys (config)
Requirements
- Node.js 18.19+ (for
--importflag) - Git
- Claude Code
- macOS or Linux (Windows untested)
Known Limitations
- Claude Code only (Cursor, ChatGPT not supported yet)
- Requires wrapper setup (alias configuration)
- No retroactive capture (only active sessions)
- Windows untested (path encoding might differ)
Development
# Clone and install
git clone https://github.com/gauravkrp/git-for-prompts.git
cd git-prompts
npm install
# Build
npm run build
# Link globally
npm link
# Test
cd /path/to/test/project
gitify-prompt init
claude "test prompt"How This Differs from Manual Annotation
Before (Manual):
claude "add feature"
# ... work ...
gitify-prompt annotate -m "I asked Claude to add feature X"
git commit -m "Add feature"Now (Automatic):
claude "add feature" # ← Conversation captured automatically
git commit -m "Add feature" # ← Linked automaticallyZero extra steps!
Development
Publishing New Versions
This package uses automated publishing via GitHub Actions. When you push a version change to main, it automatically publishes to npm.
Quick version bump:
npm version patch # 0.1.0 → 0.1.1
npm version minor # 0.1.0 → 0.2.0
npm version major # 0.1.0 → 1.0.0
git push && git push --tagsThis triggers the GitHub Actions workflow which:
- Detects version change
- Runs build and tests
- Publishes to npm
- Creates GitHub release
See AUTO-PUBLISH.md for setup instructions.
Local Development
# Clone the repo
git clone https://github.com/gauravkrp/git-for-prompts.git
cd git-for-prompts
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Test locally
./dist/cli/index.js --helpContributing
Contributions welcome! Please see CONTRIBUTING.md (coming soon).
Areas needing help:
- Windows support
- Cursor IDE integration
- ChatGPT integration
- Automated tests
- Performance optimization
Related Projects
- Claude Code - The AI coding assistant
- Cursor - AI-first code editor
- Aider - AI pair programming
License
MIT
Start capturing your Claude conversations today!
npm install -g gitify-prompt
cd your-project
gitify-prompt init
# Add wrapper alias (see Quick Start)
claude "your first prompt"
git add . && git commit -m "First captured session!"