Claude Code Setup
This guide shows you how to set up Claude Code to automatically log thoughts to AGIT.
Prerequisites
- AGIT installed
- Claude Code CLI installed
- A Git repository with
agit initrun
Automatic Setup
When you run agit init, a CLAUDE.md file is created automatically. Claude Code reads this file and follows its instructions.
Restart Required
After running agit init or agit init --update, restart your Claude Code session to load the updated AGIT configuration. The CLI will remind you:
Restart your AI assistant to activate AGIT memory.
How It Works
- Claude Code reads
CLAUDE.mdwhen starting a session - While working, Claude sees instructions to log thoughts
- Claude calls
agit_log_stepvia MCP - Thoughts are stored in
.agit/index
The CLAUDE.md File
The generated file contains instructions like:
# AGIT Integration
This project uses AGIT to capture reasoning context.
## Instructions
When working on tasks in this project:
1. Log the user's intent when they describe what they want:
- Call `agit_log_step` with role="user", category="intent"
2. Log your reasoning when you decide on an approach:
- Call `agit_log_step` with role="ai", category="reasoning"
3. For significant decisions, log them as well.
This creates a trace that gets linked to git commits.
Verifying It Works
- Start Claude Code in your project directory
- Ask Claude to help with a task
- Check AGIT status:
agit status
Expected output:
Staging area:
2 entries pending
Recent entries:
[14:22:31] user/intent: Refactor authentication module
[14:22:35] ai/reasoning: Will extract auth logic into separate service
Customizing Instructions
You can edit CLAUDE.md to customize logging behavior:
Add Custom Categories
## Logging Categories
- `intent`: User's goal
- `reasoning`: Your approach
- `decision`: Technical decisions
- `alternative`: Considered but rejected options
Control Logging Frequency
## When to Log
- Always log the initial user request
- Log when choosing between approaches
- Log significant technical decisions
- Don't log minor implementation details
Best Practices
Clear Task Descriptions
Give Claude clear context:
"I want to add rate limiting to the API endpoints.
The goal is to prevent abuse while not affecting legitimate users.
We're using Express.js."
Encourage Explanation
Ask Claude to explain before acting:
"Before implementing, explain your approach and any trade-offs."
Regular Commits
Commit frequently to keep reasoning traces focused:
# After completing a logical unit of work
git add .
agit commit -m "Add rate limiting middleware"
Troubleshooting
Nothing Being Logged
- Verify
CLAUDE.mdexists in project root - Check AGIT is initialized:
ls .agit - Restart Claude Code session - this is required after init or update
- If you updated AGIT, run
agit init --updatethen restart again
MCP Not Connecting
- Ensure
agitis in your PATH - Try running
agit servermanually - Check for error messages in Claude Code
Logs Missing Context
Edit CLAUDE.md to add more specific instructions about what to log.