Agent Harness Configuration & State Management Tool
简体中文 | English
CoPal is a passive Agent Harness tool—providing standardized configuration and state management interfaces for AI Coding Agents (like Claude Code, Codex CLI, Gemini CLI).
CoPal is NOT an Agent and does NOT actively control any workflow.
The real actors are Coding Agents like Claude Code. They read CoPal-generated config files (AGENTS.md,SKILL.md) and callcopalCLI commands to manage task state.
┌───────────────────────────────────────────────────────────────┐
│ User → Claude Code (Actor) → Calls copal CLI → Updates State │
└───────────────────────────────────────────────────────────────┘
- Init-time: CoPal generates configuration files (
AGENTS.md,SKILL.md, workflows) once - Run-time: Agents like Claude Code read these configs and call
copalcommands during execution - CoPal is always passive: It only responds to Agent command calls, never initiates
Inspired by Anthropic's research on long-running agents—when Agents work across multiple context windows, they need mechanisms to:
- Save session summaries (Session Memory)
- Manage task state (todo.json)
- Validate environment state (Pre-task validation)
CoPal implements these mechanisms as a CLI for Agents to call.
| Feature | What CoPal Provides | How Agents Use It |
|---|---|---|
| Session Memory | Interface to store/retrieve session summaries | Agent calls copal done to save, copal next to read history |
| Task State | todo.json and state management commands |
Agent calls copal next / copal done to update state |
| Environment Validation | Pre-task check command | Agent calls copal validate --pre-task to verify environment |
| Worktree Management | Git worktree wrapper | Agent calls copal next --worktree for isolation |
| Config Export | Generate tool-specific configs | User runs copal export claude to generate .claude/ config |
# Using uv (recommended)
uv tool install copal-cli
# Or pip
pip install copal-clicopal initThis generates:
AGENTS.md- Entry guide for Agents.copal/packs/engineering_loop/skill/SKILL.md- Claude Code Skill definition.copal/manifest.yaml- Project configuration
# Export for Claude Code
copal export claude
# Generates .claude/skills/copal-engineering_loop/SKILL.mdNow when you start Claude Code:
- Claude Code reads
AGENTS.mdto understand project rules - Claude Code loads
SKILL.mdto learn how to use CoPal - User gives task: "Implement user login feature"
- Claude Code executes:
# Claude Code calls these commands copal status # Check status copal next # Claim task, view historical context copal validate --pre-task # Verify environment # ... implement code ... copal done 1 # Complete task, save session summary
These commands are designed for Coding Agents to call during execution:
# Check project status
copal status
# Claim next task (shows recent session history)
copal next
# Claim task and create isolated worktree
copal next --worktree
# Complete task (auto-saves session summary to Memory)
copal done <task_id># Pre-task validation: Check Git status + run tests
copal validate --pre-task
# Validate configuration
copal validate
# Validate Agent-generated artifacts
copal validate --artifacts# Search historical memories
copal memory search --query "authentication"
# Add memory
copal memory add --type decision --content "Use JWT for auth"
# List all memories
copal memory list# Create new worktree
copal worktree new feature-login
# List worktrees
copal worktree list
# Remove worktree
copal worktree remove feature-loginThese commands are primarily for users (not Agents):
# Initialize project
copal init
# Export to Agent tool
copal export claude|codex|geminiProject/
├── AGENTS.md # Entry guide for Agents
├── .copal/
│ ├── manifest.yaml # CoPal configuration
│ ├── artifacts/
│ │ └── todo.json # Task list (updated via Agent commands)
│ ├── memory/ # Memory storage (read/written via Agent commands)
│ └── packs/
│ └── engineering_loop/
│ └── skill/SKILL.md # Claude Code Skill (read by Agent)
- CoPal is Passive - Only responds to Agent command calls, never controls flow
- Agent is the Actor - Claude Code etc. makes decisions and executes
- Filesystem as Communication - State and config passed through
.copal/directory - Incremental Progress - Each session completes small tasks, saves summary for next session
MIT License