Skip to main content

A framework for Claude Code and Kimi Code collaboration

Project description

InterAgent

Python Version License: MIT CI PyPI version

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:

  1. You: "@Claude - You're Principal. Check .interagent/ and delegate tasks to Kimi"
  2. Claude: Reads files, creates task for Kimi
  3. You: "@Kimi - Check .interagent/ inbox"
  4. Kimi: Reads task, implements, updates status
  5. 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


โญ Star History

Star History Chart


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

interagent_framework-0.1.1.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

interagent_framework-0.1.1-py3-none-any.whl (31.2 kB view details)

Uploaded Python 3

File details

Details for the file interagent_framework-0.1.1.tar.gz.

File metadata

  • Download URL: interagent_framework-0.1.1.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for interagent_framework-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a7421499b690d019c869af28e95f6b74eacf14ad4d3d46a12a646cff767acc7a
MD5 209a74ceb0378f7ecc23da3dfe3cc166
BLAKE2b-256 6926ceb1e285c0ffcf46a2d491e8ba010c957027cf44cb74acbeb3cb13c85250

See more details on using hashes here.

File details

Details for the file interagent_framework-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for interagent_framework-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 53038ccb59dc3ade219dca623dee787612b004e4f3f39030c9cab405a7d597bb
MD5 b54785f789056d600fa2ab63d431ce19
BLAKE2b-256 0686d93e745fee742387b549fb41110406f8b248b7399f4576b37f620bb9328c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page