Agent Collaboration
Dojo is built from the ground up for AI agent collaboration. Agents are first-class participants with their own workspaces, structured commits, and full API access.
The workspace model
Section titled “The workspace model”Agents work through remote workspaces — isolated sandboxes on the server. No local checkout needed. Each workspace:
- Is based on a specific commit (usually the
maintip) - Maintains an overlay of changed files
- Supports multiple commits within a session
- Can be submitted as a stack for review
# Create a workspacedojo workspace create --name "feature-auth" --agent "claude"
# Write filesdojo workspace write <ws-id> src/auth.ts
# Commitdojo workspace commit <ws-id> -m "Implement OAuth flow"
# Submit for reviewdojo workspace submit <ws-id> -t "Add authentication"Why workspaces, not branches?
Section titled “Why workspaces, not branches?”Workspaces solve problems that branches can’t:
- No filesystem races — multiple agents can work simultaneously without local file conflicts
- Instant creation — no git clone, no checkout. Workspace is ready in milliseconds
- Built-in isolation — each workspace has its own overlay; changes are invisible to other workspaces
- Path locking — prevent two agents from editing the same files
- Conflict detection — check for overlapping changes before submitting
Multi-agent patterns
Section titled “Multi-agent patterns”Parallel agents on separate features
Section titled “Parallel agents on separate features”The simplest pattern: each agent gets its own workspace for a different feature.
Agent A → workspace "auth-system" → src/auth/*Agent B → workspace "dashboard-ui" → src/components/*Agent C → workspace "api-endpoints" → src/routes/*No coordination needed — workspaces are naturally isolated.
Relay pattern (sequential handoff)
Section titled “Relay pattern (sequential handoff)”One agent starts work, another picks it up:
- Agent A creates a workspace, writes code, commits
- Agent B creates a new workspace based on Agent A’s commit
- Agent B continues where Agent A left off
# Agent A worksdojo workspace create --name "auth-v1" --agent "claude"dojo workspace commit ws_a -m "Add OAuth skeleton"
# Agent B continues from Agent A's commitdojo workspace create --name "auth-v2" --agent "gemini" --base-commit <agent-a-commit>Review agent pattern
Section titled “Review agent pattern”One agent writes code, another reviews it:
- Author agent creates workspace, writes code, submits stack
- Review agent reads the stack diff and leaves comments
- Author agent addresses feedback
Dojo’s review API supports this natively.
Searching code
Section titled “Searching code”Agents can search repository contents via the API or the pi-dojo tool:
# Search via APIGET /api/repos/owner/name/search?q=handleAuth&ref=main
# Search within a workspace (includes uncommitted overlay files)GET /api/repos/owner/name/workspaces/ws_id/search?q=handleAuthSearch is powered by FTS5 with ranked results, snippet extraction, and path filtering. See the Search API for full details.
Browsing code
Section titled “Browsing code”Agents can browse the file tree without downloading the entire repo:
# List root directoryGET /api/repos/owner/name/tree?ref=main
# List subdirectoryGET /api/repos/owner/name/tree?ref=main&path=src/components
# Recursive listingGET /api/repos/owner/name/tree?ref=main&path=src&recursive=true
# Read a specific fileGET /api/repos/owner/name/file/src/auth.ts?ref=mainSee the Tree Browsing API for details.
Intent metadata
Section titled “Intent metadata”Dojo commits support structured metadata for agent traceability:
{ "message": "Add user model", "intent": { "goal": "Create database schema for users", "plan": "Define TypeScript types, create Drizzle schema, add migration", "confidence": "high", "agent": "claude-code" }}This metadata is:
- Stored on the commit in
commit_metadata - Visible in the web UI commit view
- Queryable via API (
/api/repos/.../commits?meta.intent.agent=claude) - Preserved through rebases and rewrites
Scoped API keys
Section titled “Scoped API keys”Create restricted API keys for agents to limit what they can do:
POST /api/keys{ "name": "agent-claude", "scopes": ["repo:read", "workspace:write", "stack:write"]}This gives the agent read access to the repo and the ability to create workspaces and submit stacks, but not modify refs directly or change settings. See the API Overview for all available scopes.
Activity heatmap
Section titled “Activity heatmap”The Dojo web UI shows a dual-color activity heatmap on repository pages:
- 🟢 Green — human contributions
- 🟣 Purple — agent contributions
This gives an at-a-glance view of who’s contributing what, and how active the repo is.
pi-dojo integration
Section titled “pi-dojo integration”If you’re using pi as your agent harness, the pi-dojo extension provides native tools:
| Tool | Description |
|---|---|
dojo_status | Repository status overview |
dojo_commit | Create commits with intent metadata |
dojo_workspace | Full workspace management (create, write, read, commit, submit, search, tree) |
dojo_stacks | List, show, and submit stacks |
dojo_review | Code review (approve, reject, comment) |
dojo_history | Log, show, evolution, ops |
dojo_sync | Push and pull |
dojo_rewrite | Describe, split, reorder, undo |
Install pi-dojo in your .pi/settings.json:
{ "extensions": ["../packages/pi-dojo"]}Best practices
Section titled “Best practices”- Use workspaces — avoid filesystem races with other agents and humans
- Small, focused commits — easier to review and revert
- Include intent metadata — explain your reasoning for reviewers
- Check for conflicts before submitting stacks
- Use scoped API keys — principle of least privilege
- Search before writing — use the search API to understand existing code
- Browse the tree — understand the project structure before making changes