This file provides guidance to AI assistants (Claude, ChatGPT, Gemini, Cursor, etc.) when working with the Multi-AI Collaboration Protocol (MACP) template project.
This is the MACP Template & Tooling project - a framework for enabling multiple AI assistants to collaborate efficiently on software projects while minimizing token costs and maintaining full traceability.
Purpose: Provide copy-paste ready templates and enforcement tools for projects that want AI collaboration with proper accounting and handoffs.
Not a library: This is a template repository. Users copy files to their projects.
All commits to this project MUST follow MACP format (we practice what we preach):
subject: brief description (max 50 chars)
Detailed description in plain English explaining what changed and why.
AI-Agent: Claude-Code
AI-Session-ID: YYYY-MM-DD-HHMMSS-AI-NAME
AI-Task-Type: design|implement|debug|refactor|test|build|docs
AI-Context-Tokens: ~XXXXX
AI-Handoff-From: previous-session-id or "none"
AI-Handoff-To: next-session-id or "none"
AI-Thought-Trace: path/to/trace.md or "none"
Generated-by: Claude AI | ChatGPT | Gemini | etc.
Signed-off-by: Human Name <email@example.com>
Enforcement: The commit-msg hook validates all 9 required fields.
agents/
├── README.md # User-facing documentation
├── CLAUDE.md # This file (AI guidance)
├── GEMENI.md -> CLAUDE.md # Symlink for Gemini
├── CURSOR.md -> CLAUDE.md # Symlink for Cursor
├── AGENTS.md -> CLAUDE.md # Symlink for generic AI tools
├── GETTING-STARTED.md # 5-minute quick start guide
├── bin/
│ ├── commit-msg-hook # Git hook enforcing MACP format
│ └── ai-session # Session management tool
├── templates/
│ ├── project-template/ # Copy to new projects
│ │ └── .ai-traces/ # AI collaboration tracking
│ └── thought-trace-template.md # Decision documentation format
└── examples/
└── foobar-example.md # Real-world cost savings example
CRITICAL: Changes to templates/project-template/ affect all future adopters.
- Test First: Apply changes to a test project
- Validate Hook: Ensure commit-msg-hook still works
- Document Changes: Update README.md if user-facing
- Example Impact: Update examples/ if template format changes
New examples should:
- Show real projects (not synthetic examples)
- Include actual token counts (approximate is fine)
- Demonstrate cost savings with multi-AI routing
- Explain which AI did which tasks and why
- Backward Compatibility: Don't break existing users
- Error Messages: Clear, actionable (tell user what to fix)
- POSIX Shell: Use
/bin/bash, avoid bashisms where possible - Test: Run on clean project before committing
Even this project should use multi-AI collaboration:
Claude Code: Architecture decisions, protocol design, complex validation logic ChatGPT Codex: Script implementation, template creation, boilerplate Gemini CLI: Testing, documentation, simple script updates
- README.md: Primary user documentation, keep concise
- GETTING-STARTED.md: Quick setup only, link to README for details
- CLAUDE.md: AI-specific guidance (this file)
- bin/commit-msg-hook: Validation logic, must be POSIX-compliant bash
- templates/: Reference implementation, users copy these
Before committing changes to enforcement tools:
# Test commit-msg-hook on sample commit
cd /tmp
git init test-macp
cd test-macp
cp ~/devel/agents/bin/commit-msg-hook .git/hooks/commit-msg
chmod +x .git/hooks/commit-msg
# Try valid commit (should pass)
git commit --allow-empty -m "$(cat <<'EOF'
test: valid MACP commit
AI-Agent: Claude-Code
AI-Session-ID: 2025-10-28-120000-Claude-Code
AI-Task-Type: test
AI-Context-Tokens: ~1000
AI-Handoff-From: none
AI-Handoff-To: none
AI-Thought-Trace: none
Generated-by: Claude AI
Signed-off-by: Test User <test@example.com>
EOF
)"
# Try invalid commit (should fail)
git commit --allow-empty -m "test: invalid commit without metadata"For Users (README.md, GETTING-STARTED.md):
- Practical examples that work immediately
- Clear benefits (token savings, traceability)
- Minimal theory, maximum practice
For AIs (CLAUDE.md - this file):
- Internal structure and design rationale
- Testing procedures before commits
- Task routing recommendations
For Future Maintainers (commit messages with thought traces):
- Why decisions were made
- What alternatives were considered
- Real-world usage data
- Add to AI capability matrix in README.md
- Update commit-msg-hook validation (if new AI-Agent value needed)
- Add example showing that AI's strengths
- Create symlink:
ln -s CLAUDE.md NEWTOOL.md
- Change templates/project-template/.ai-traces/session-map.json
- Update bin/ai-session script
- Document in README.md
- Add migration notes for existing users
- Edit bin/commit-msg-hook
- Test with both valid and invalid commits
- Update tests in this file's "Testing Changes" section
- Commit with AI-Task-Type: debug
- Will this break existing users? If yes, provide migration path
- Is the benefit worth the complexity? Keep it simple
- Can this be tested? Add test procedure to this file
- Is it documented? Update README.md if user-facing
- Does it follow the protocol? Use MACP commit format
This template was created on 2025-10-28 after observing that projects document AI collaboration protocols but never actually enforce them. The goal: make it impossible to forget by using git hooks and structured tooling.
Inspired by: The Rush build system's CLAUDE.md which documented MACP extensively but didn't use it until enforcement was added.
Lesson: Documentation without enforcement is aspirational. Enforcement without documentation is mysterious. You need both.
Protocol Version: 1.0 Last Updated: 2025-10-28 Maintainer: Multi-AI collaboration (practice what we preach)