Skip to main content

Cokodo Agent

A CLI tool and MCP server for the AI Agent Collaboration Protocol (.agent). Generate, lint, sync, and serve standardized project context to any MCP-compatible IDE.

Similar to create-react-app, this tool helps you quickly set up an .agent directory with best practices for AI-assisted development.

v1.9.0+ adds spec-driven change units under .agent/project/changes/ (co change new | list | status), aligned with the planning workflow popularized by OpenSpec (proposal / specs / design / tasks). We are grateful to the OpenSpec project for the inspiration; our implementation stays Python-native and integrated with MCP and session state (status.md). See the main repo README and .agent/project/research/openspec-analysis.md for the full rationale.

v1.11.0+ (protocol 3.3.0) adds Agent Git/PR collaboration templates: project/AGENT-GIT-PR-WORKFLOW.md and project/sop/agent-git-pr-collaboration.md (PR tracks, journal.d workflow, merge gates). Run co scaffold -y on existing projects and co adapt all to refresh IDE rules. See docs/usage-guide.md § Agent Git and PR collaboration.


Installation

# Default install (CLI + MCP server support)
pip install cokodo-agent

# With network fetch (GitHub release). Omit for offline-only use.
pip install cokodo-agent[network]

# Or use pipx (recommended)
pipx install cokodo-agent
pipx install "cokodo-agent[network]"   # if you need co init to fetch from GitHub

Dependencies: Default install includes MCP support for co serve. It does not include httpx; use co init --offline or install with [network] to fetch the latest protocol from GitHub.


Quick Start

# Navigate to your project
cd my-project

# Run the generator (any of these commands work)
co init           # Short alias
cokodo init       # Full name
cokodo-agent init # Package name

# Or specify a path
co init ./new-project

Usage

Interactive Mode (Default)

$ co init

  Cokodo Agent v1.9.14
  ====================

  Fetching protocol...
    OK Protocol v3.0.0

? Project name: my-awesome-app
? Brief description: A task management web application

? Primary tech stack:
  > Python
    Rust
    Qt/C++
    Mixed
    Other

? AI tools to configure (at least one required):
  [x] Cokodo (Protocol Only)    # Default - only .agent/
  [ ] Cursor
  [ ] GitHub Copilot
  [ ] Claude Projects
  [ ] Gemini Code Assist

  Generating .agent/
  OK Created .agent/

  Success! Created .agent in /path/to/my-awesome-app

  Next steps:
    1. Review .agent/project/context.md
    2. Start coding with AI assistance!

Quick Mode

# Use defaults, skip prompts (Cokodo mode - protocol only)
co init --yes

# Specify options directly
co init --name "my-app" --stack python -y

Commands

Command Description
co init [path] Create .agent in target directory
co adapt <cursor|claude|copilot|cline|gemini|codex|all> [path] Generate IDE entry files and .agents/skills/ from existing .agent
co skills <list|export> [path] List or export protocol skills to .agents/skills/
co hooks <generate|show> [path] Write Cursor hooks.json and a Claude settings merge snippet
co mcp snippet cline [path] Show Cline MCP snippet path (--show prints JSON)
co mcp install cline [path] Merge cokodo-agent into Cline MCP settings (--dry-run, --target, -y)
co detect [path] Detect IDE instruction files (read-only)
co import [path] Import rules from IDE files into .agent/project/
co lint [path] Check protocol compliance
co diff [path] Compare local .agent with latest protocol
co sync [path] Sync local .agent with latest protocol
co upgrade [path] Run sync -> scaffold -> adapt(existing) in one step
co context [path] Get context files based on stack and task
co status [path] View or update project status
co ref <action> Manage cross-project references (list/add/remove/check/fetch/cache)
co collab <action> Manage collaborations (list/add/remove/status/diff/pull)
co global <action> Manage global project registry (list/info/status/search/gc/unregister)
co serve [path] Start MCP server (add --workspace for multi-project, --global for registry)
co shared <action> Manage the machine-wide shared MCP daemon and version store
co journal [path] Record a session entry to session-journal.md
co journal-flush [path] Flush fragment files into status.md (trim to cap, archive overflow)
co branch start [branch] Fetch trunk and create a task branch (--topic, --prefix, --dry-run)
co branch cleanup [branch] Mandatory post-merge cleanup — delete local + remote head
co git hygiene List merged remote branches not deleted; --apply --no-dry-run to clean up
co policy <action> Manage policy-as-code: check / install-hook / doctor
co release <action> Release helpers: plan (derive next version) / draft-note (generate release note skeleton)
co release-docs check [path] Gate: verify release-doc placeholders are filled for a version-governance track. Exit 0 = pass, 1 = fail, 2 = fatal.
co release-docs refresh [path] Print the canonical agent prompt to refresh release documentation (audit or apply mode).
co prepare-release [path] --track Move a track into release preparation (supports --auto to derive version + note)
co cut-release [path] --track Mark a track as released after the release flow
co start-next-version [path] --track --version Open the next working version
co open-next-version [path] --track --version Post-release: open the next iteration draft
co update-checksums [path] Update bundled manifest.json checksums (maintainer)
co version Show version information

Options for co init

Option Description
--yes, -y Skip prompts, use defaults
--name Project name
--stack Tech stack (python/rust/qt/typescript/mixed/other)
--force Overwrite existing .agent directory
--online Fetch latest protocol from GitHub Release (default: use bundled)

Options for co lint

Option Description
--rule, -r Check specific rule only
--format, -f Output format (text/json/github)

Options for co context

Option Description
--stack, -s Tech stack (python/rust/qt/typescript/mixed)
--task, -t Task type (coding/testing/review/documentation/bug_fix)
--output, -o Output format (list/paths/content)

Options for co journal

Option Description
--title, -t Session title (e.g., "Feature X implementation")
--completed, -c Completed items (comma-separated)
--debt, -d Technical debt items (comma-separated)
--decisions Key decisions made (comma-separated)
--interactive, -i Interactive mode with prompts

Options for co journal-flush

Option Description
--cap Max items to keep in status.md (default: 5)
--for-release Archive all items under a version header (e.g. v1.9.15)
--dry-run Preview changes without writing files

MCP Server

cokodo-agent includes a built-in MCP (Model Context Protocol) server that exposes .agent/ project context to any compatible IDE. MCP support is included in the default install (pip install cokodo-agent); no extra step required.

IDE Configuration

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "cokodo-agent": {
      "command": "co",
      "args": ["serve", "--shared-launcher"]
    }
  }
}

Claude Code (.mcp.json):

{
  "mcpServers": {
    "cokodo-agent": {
      "command": "co",
      "args": ["serve", "--shared-launcher"],
      "type": "stdio"
    }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "cokodo-agent": {
      "command": "co",
      "args": ["serve", "--shared-launcher"],
      "type": "stdio"
    }
  }
}

Generated IDE configs now use co serve --shared-launcher by default so multiple IDE sessions can share one machine-wide daemon while still talking stdio locally.

Shared Runtime Management

co shared start
co shared status
co shared install-version 1.9.14
co shared use-version 1.9.14
co shared import-runtime C:/Python311/python.exe

Available Tools

Tool Description
get_project_context Get context files based on stack and task type
update_status Update project status with tasks, blockers, context
lint_protocol Run protocol compliance check
list_files List all .agent/ files with loading layers
list_relations List cross-project references and collaborations
get_related_context Read content from references (local or remote)
get_collaboration_context Get shared content from collaboration partners
get_collaboration_status Check collaboration sync status
fetch_remote_references Fetch/refresh remote git references
check_relation_health Verify all relationships are accessible
list_global_projects List all cokodo projects registered on this machine
get_global_project_context Get context files from any registered project by name or ID
get_global_project_status Get status.md from any registered project
global_search Search across all registered projects by keyword (name/stack/status)

Workspace Mode

Serve multiple projects from a parent directory:

co serve --workspace /path/to/workspace

Adds workspace-level tools: list_workspace_projects, workspace_get_context, workspace_get_status, workspace_read_file, workspace_list_relations, workspace_health_check.

Global Registry Mode

Serve all cokodo projects registered on this machine, without needing to be inside a specific project directory:

co serve --global

Projects are registered automatically each time any co command is run inside a directory that has .agent/. No manual registration needed.


Global Project Registry

cokodo-agent maintains a local registry of all cokodo projects at ~/.cokodo/cokodo.db (SQLite). Registration is automatic — run any co command in a project to register it.

Registry Commands

co global list                  # List all registered projects
co global info <name>           # Show full details for a project
co global status <name>         # Show status.md for a project
co global search <keyword>      # Search by name, stack, or status
co global gc                    # Remove stale entries (deleted projects)
co global unregister <name>     # Remove a project from registry

Cross-project Context via MCP

When the MCP server is running (any mode), the AI can query all registered projects:

list_global_projects            → discover all projects on this machine
get_global_project_context      → load .agent/ context from any project
get_global_project_status       → read status.md from any project
global_search "keyword"         → find projects by name, stack, or status

Protocol Sources

The tool fetches the latest protocol from multiple sources with fallback:

Priority Source Description
1 GitHub Release Latest version from repository
2 Built-in Bundled version in package

Generated Structure

Cokodo Mode (Default)

Only generates .agent/ directory:

my-project/
+-- .agent/                     # Protocol directory
    +-- start-here.md           # * Entry point
    +-- quick-reference.md      # Cheat sheet
    +-- core/                   # Governance rules
    +-- project/                # Project-specific (customized)
    +-- skills/                 # Skill modules
    +-- adapters/               # Tool adapter templates
    +-- scripts/                # Helper scripts

With AI Tool Adapters

Run co adapt <tool> (or co adapt all) in a project that already has .agent/. Generated files follow each IDE’s official spec:

For the most common post-upgrade flow, use co upgrade -y to sync .agent/, scaffold any newly required project/ files, and refresh the IDE adapters already present in the repo.

Tool Generated File
Cursor .cursor/rules/agent-protocol.mdc (YAML frontmatter)
Claude Code CLAUDE.md (project root)
GitHub Copilot AGENTS.md (project root)
Gemini Code Assist GEMINI.md (project root, supports @file imports)

Configuration

Environment Variables

Variable Description
COKODO_OFFLINE Force offline mode (1 or true)
COKODO_CACHE_DIR Custom cache directory
COKODO_HOME_DIR Custom home directory (default: ~/.cokodo/)

Cache Location

Downloaded protocols and the project registry are stored at:

  • All platforms: ~/.cokodo/ (cache at ~/.cokodo/cache/)
  • Existing ~/.cache/cokodo/ is migrated automatically on first run

Development

# Clone repository
git clone https://github.com/dinwind/agent_protocol.git
cd agent_protocol/cokodo-agent

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

License

MIT License - see LICENSE for details.


Documentation

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cokodo_agent-1.12.7.tar.gz (335.8 kB view details)

Uploaded Source

Built Distribution

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

cokodo_agent-1.12.7-py3-none-any.whl (416.9 kB view details)

Uploaded Python 3

File details

Details for the file cokodo_agent-1.12.7.tar.gz.

File metadata

  • Download URL: cokodo_agent-1.12.7.tar.gz
  • Upload date:
  • Size: 335.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cokodo_agent-1.12.7.tar.gz
Algorithm Hash digest
SHA256 ffdb0909def60787701b790f45230f67bc3a58453bd05463e9e721162ed56be1
MD5 c30e696f2f95ba77f843d12211fa77a5
BLAKE2b-256 d0ba8d41563430772cae6e3019008c13d1ad2ada06c47a29c36b2de6a5cc50df

See more details on using hashes here.

Provenance

The following attestation bundles were made for cokodo_agent-1.12.7.tar.gz:

Publisher: release.yml on dinwind/agent_protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cokodo_agent-1.12.7-py3-none-any.whl.

File metadata

  • Download URL: cokodo_agent-1.12.7-py3-none-any.whl
  • Upload date:
  • Size: 416.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for cokodo_agent-1.12.7-py3-none-any.whl
Algorithm Hash digest
SHA256 292620f9718a7b5363e94c1dd9e678f39e4b3c9611bed77f1a363957414a1303
MD5 185d362c3860f1ddd1f33dfd26000622
BLAKE2b-256 b213e38b0df014a1c9680c9f8f247d7d0abe88f337aedf4cd866ac3e837df18a

See more details on using hashes here.

Provenance

The following attestation bundles were made for cokodo_agent-1.12.7-py3-none-any.whl:

Publisher: release.yml on dinwind/agent_protocol

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.12.7 This release

2 files

1.12.6

2 files

1.12.5

2 files

1.12.4

2 files

1.12.3

2 files

1.12.2

2 files

1.12.1

2 files

1.12.0

2 files

1.11.0

2 files

1.10.1

2 files

1.10.0

2 files

1.9.15

2 files

1.9.14

2 files

1.9.13

2 files

1.9.12

2 files

1.9.11

2 files

1.9.10

2 files

1.9.9

2 files

1.9.8

2 files

1.9.7

2 files

1.9.6

2 files

1.9.4

2 files

1.9.3

2 files

1.9.2

2 files

1.9.0

2 files

1.8.8

2 files

1.8.7

2 files

1.8.6

2 files

1.8.5

2 files

1.8.3

2 files

1.8.2

2 files

1.8.1

2 files

1.8.0

2 files

1.7.0

2 files

1.6.0

2 files

1.5.2

2 files

1.5.1

2 files

1.5.0

2 files

1.3.1

2 files

1.3.0

2 files

1.2.0

2 files

1.1.0

2 files

1.0.0

2 files

Supported by

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