A framework for Claude Code and Kimi Code collaboration
Project description
InterAgent
A collaboration framework for Claude Code and Kimi Code
InterAgent enables Claude Code and Kimi Code to collaborate effectively on software development projects through structured protocols, task delegation, and shared state management.
๐ฏ Why InterAgent?
Claude and Kimi are both powerful coding assistants, but they have different strengths:
- Claude excels at architecture, system design, and documentation
- Kimi shines at implementation, tool usage, and optimization
InterAgent lets you leverage both by providing:
- ๐ญ Role-based collaboration (Principal, Delegate, Reviewer)
- ๐ Structured task delegation with capability-based routing
- ๐ Code review workflows between agents
- ๐ฌ Discussion protocols for complex decisions
- ๐ Shared state via Git-trackable files
๐ Quick Start
Installation
pip install interagent
Initialize a Session
interagent init --project "My API" --principal claude
This creates an .interagent/ directory with:
- Session configuration
- Task management
- Message queue
- Shared context
Quick Start - Single Command
interagent quick --to kimi "Design database schema"
This single command:
- Creates a task
- Assigns it to Kimi
- Generates a message
- Prints what to tell Kimi
Check Status
interagent status # Detailed status
interagent summary # Quick overview
๐ก How It Works
InterAgent uses a file-based protocol where both agents read and write to a shared .interagent/ directory:
Your Project/
โโโ .interagent/
โ โโโ session.json # Current session
โ โโโ tasks/
โ โ โโโ active/ # Active tasks
โ โ โโโ completed/ # Completed tasks
โ โโโ messages/
โ โ โโโ pending/ # Unread messages
โ โ โโโ archive/ # Message history
โ โโโ shared/
โ โโโ context.md # Project context
โโโ [your code...]
The user acts as the orchestrator, prompting each agent to check the shared state:
- You: "@Claude - You're Principal. Check
.interagent/and delegate tasks to Kimi" - Claude: Reads files, creates task for Kimi
- You: "@Kimi - Check
.interagent/inbox" - Kimi: Reads task, implements, updates status
- You: "@Claude - Kimi completed the task. Please review"
๐ Commands
Quick Commands (Reduced Friction)
interagent quick --to kimi "Implement user auth" # Single-command delegation
interagent relay --to kimi # Generate prompt to copy
interagent summary # Quick overview for decisions
Session Management
interagent init --project "Name" --principal claude # Initialize session
interagent status # Show status
interagent summary # Quick summary for relay
Task Management
interagent task create --title "Task" --assignee kimi # Create task
interagent task list # List all tasks
interagent task show task-xxx # Show task details
interagent task update task-xxx --status completed # Update status
Messaging
interagent inbox --agent kimi # Check inbox
interagent msg send --to kimi --message "Hello" # Send message
interagent msg read msg-xxx # Mark as read
Quick Delegation
interagent delegate --to kimi --task "Implement auth" # Quick delegation
Template Maintenance
Keep your project kickoff template current with new AI capabilities:
| Command | Description |
|---|---|
interagent update-template --agent claude |
Generate research prompt for Claude |
interagent update-template --agent kimi |
Generate research prompt for Kimi |
interagent update-template --agent claude --focus "sub-agents" |
Focus on a specific area |
interagent update-template --agent kimi --template-path ~/projects/template.txt |
Specify template path |
The generated prompt instructs the agent to search for new best practices,
review the current template, apply improvements, and write a TEMPLATE_UPDATE.md
summary of what changed.
๐ญ Roles
Principal Engineer
- Makes architectural decisions
- Delegates tasks to the Delegate
- Reviews completed work
Delegate
- Executes assigned tasks
- Reports progress to Principal
- Requests help when needed
Reviewer
- Reviews code from another agent
- Provides structured feedback
- Approves or requests revisions
๐ก๏ธ Safety Features
Schema Validation
All JSON files are validated before saving:
- โ Task status must be valid
- โ Agent names must be "claude" or "kimi"
- โ Required fields present
- โ Type checking
File Locking
Prevents race conditions when both agents work simultaneously:
- ๐ Tasks are locked during updates
- ๐ Messages are locked during sending
- ๐ Automatic lock timeout (5 minutes)
- ๐ Stale lock detection
Input Sanitization
- String length limits
- Type coercion
- Invalid character filtering
๐ Example Workflow
1. Initialize Session
interagent init --project "E-commerce API" --principal claude
2. Claude (as Principal) Plans Architecture
You: "@Claude - You're Principal Engineer. Check .interagent/ and plan the API architecture."
Claude: Reviews project, delegates with quick command:
# Single command creates task and message
interagent quick --to kimi "Design database schema"
# Check what to tell Kimi
interagent relay --to kimi
Output:
RELAY PROMPT FOR KIMI
--------------------
@kimi - You have work in the InterAgent collaboration system.
Your role: delegate
๐ You have 1 new task(s):
- Design database schema (task-xxx)
Please:
1. Check .interagent/tasks/active/ for details
2. Run: interagent task update task-xxx --status in_progress
3. Do the work
4. Run: interagent task update task-xxx --status completed
5. Send a message when done
Copy-paste the relay prompt to Kimi.
3. Kimi (as Delegate) Implements
Kimi: Receives the prompt, runs the commands:
interagent task update task-xxx --status in_progress
# Implements schema
interagent task update task-xxx --status completed
interagent msg send --to claude --subject "Schema ready" --message "Done!"
4. You Check Summary
interagent summary
Output:
INTERAGENT SUMMARY
==================
[TASKS]
โ
1 task(s) approved
๐ 1 task(s) ready for review
[MESSAGES]
๐ฌ Claude: 1 unread message(s)
- From kimi: Schema ready
[ACTION ITEMS]
โ Tell claude to review 1 completed task(s)
[QUICK COMMANDS]
interagent relay --to claude
5. Claude Reviews
You: Copy-paste the relay prompt to Claude:
interagent relay --to claude
Claude: Reviews and approves:
interagent inbox --agent claude
interagent task show task-xxx
# Reviews work
interagent task update task-xxx --status approved
interagent msg send --to kimi --message "Approved! Great work."
๐งฉ Capabilities
InterAgent automatically routes tasks based on agent capabilities:
| Capability | Best Agent |
|---|---|
| Architecture Design | Claude |
| System Design | Claude |
| Implementation | Kimi |
| Code Refactoring | Kimi |
| Performance Optimization | Kimi |
| Testing | Kimi |
| Code Review | Claude |
| Documentation | Claude |
| Security Analysis | Claude |
| Tool Use | Kimi |
๐ Python API
InterAgent can also be used as a Python library:
from interagent import Session, Task, Message
# Initialize session
session = Session.create("My Project", principal="claude")
session.save()
# Create task
task = Task.create(
title="Implement API",
assignee="kimi",
priority="high",
)
task.save()
# Send message
msg = Message.create(
sender="claude",
recipient="kimi",
content="Task assigned!",
)
msg.save()
See examples/ for more complete examples.
๐ Project Structure
.interagent/
โโโ session.json # Session configuration
โโโ README.md # Session documentation
โโโ agents/
โ โโโ claude.json # Claude's status & inbox
โ โโโ kimi.json # Kimi's status & inbox
โโโ tasks/
โ โโโ active/ # Active tasks (*.json)
โ โโโ completed/ # Completed tasks (*.json)
โโโ messages/
โ โโโ pending/ # Unread messages (*.json)
โ โโโ archive/ # Read messages (*.json)
โโโ shared/
โโโ context.md # Project context
โโโ architecture.md # Architecture decisions
โโโ decisions.md # Decision log
๐ Best Practices
DO โ
- Check inbox first before starting work
- Update task status as you progress (in_progress โ completed)
- Include context when delegating tasks
- Use descriptive subjects for messages
- Document decisions in
shared/decisions.md - Commit
.interagent/to Git for history
DON'T โ
- Work without checking inbox first
- Leave tasks in "in_progress" when blocked
- Send vague messages without context
- Forget to mark messages as read
- Work on tasks you haven't accepted
๐ค Integration with Claude and Kimi
For Claude Code
Claude can use the CLI directly:
interagent inbox --agent claude
interagent task list
interagent task update task-xxx --status in_progress
For Kimi Code
Kimi can use the CLI or create a skill for slash commands:
# .kimi/skills/interagent/skill.yaml
name: interagent
description: InterAgent collaboration
commands:
- name: inbox
description: Check inbox
- name: task_create
description: Create task
Then use:
/interagent inbox
/interagent task_create --title "Task" --assignee claude
๐ Comparison
| Feature | InterAgent | Manual Coordination |
|---|---|---|
| Task tracking | โ Structured | โ Ad-hoc |
| Message history | โ Persistent | โ Lost |
| Role clarity | โ Defined | โ Ambiguous |
| Code reviews | โ Structured | โ Informal |
| Git integration | โ Tracked | โ Manual notes |
| Audit trail | โ Complete | โ Fragmented |
๐ฆ Installation Options
From PyPI (Recommended)
pip install interagent
From Source
git clone https://github.com/yourusername/interagent.git
cd interagent
pip install -e .
Development Install
git clone https://github.com/yourusername/interagent.git
cd interagent
pip install -e ".[dev]"
๐ Watchdog (Optional)
Monitor for new messages and tasks automatically:
# Start watching for changes
python -m interagent.watchdog
# Or with custom poll interval
python -m interagent.watchdog --interval 10
This prints notifications when:
- ๐ฌ New messages arrive
- ๐ New tasks are assigned
- โ Tasks are completed
Useful for running in a separate terminal while you work.
๐ฎ Roadmap
- Quick mode (single-command delegation)
- Relay prompt generation
- Summary command
- Schema validation
- File locking
- Watchdog script
- Web dashboard for visualizing collaboration
- Desktop notifications for new messages
- Integration with GitHub/GitLab PRs
- Slack/Discord notifications
- More agent profiles (GPT-4, Copilot, etc.)
๐ค FAQ
Q: Do Claude and Kimi talk directly?
A: No, they communicate through shared files in .interagent/. The user prompts each agent to check the files.
Q: Can I use this with other AI assistants?
A: Yes! Just add their profiles to the agent configuration.
Q: Is the .interagent/ directory required?
A: Yes, it's where all collaboration state is stored.
Q: Should I commit .interagent/ to Git?
A: Yes, it provides a complete audit trail of your collaboration.
Q: Can agents work in parallel?
A: Yes! Each can work on their assigned tasks independently.
Q: What if agents disagree?
A: The Principal Engineer makes the final decision.
๐ License
MIT License - see LICENSE file.
๐ Contributing
Contributions welcome! See CONTRIBUTING.md for guidelines.
๐ฌ Support
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: Full Documentation
โญ Star History
Happy collaborating! ๐
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file interagent_framework-0.1.0.tar.gz.
File metadata
- Download URL: interagent_framework-0.1.0.tar.gz
- Upload date:
- Size: 34.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c29501e7f35e80315b6c0b2107f34488724f27cbea1b560bc920ab090b3a601d
|
|
| MD5 |
70994d6f2e882b37592cf77ee8b6447b
|
|
| BLAKE2b-256 |
373607511500198e391cb5b8cde371f3bf89c5cfd337c20c1ad98da165873869
|
File details
Details for the file interagent_framework-0.1.0-py3-none-any.whl.
File metadata
- Download URL: interagent_framework-0.1.0-py3-none-any.whl
- Upload date:
- Size: 29.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d834e0858ec4cc29bee31f351a7388c7431c42c453ec8eb260dafb195d700975
|
|
| MD5 |
b08b4e1e0b02d46c75fd8a06f5d0c9eb
|
|
| BLAKE2b-256 |
5005c855cd7c359e06654ec72508b57f78d75445e1af68ce6b43ba01bf9fbbb9
|