claude-code-octopus
CLAUDE.md0 starsChanged 13 months agoMITView on GitHub
Code Agent Octopus is a multi-CLI toolkit that provides reusable agents, commands, and workflows for AI coding assistants. This repository serves as a centralized template library supporting: Key principle: .factory/ contains canonical templates that are synced to CLI-specific directories. This project maintains two primary instruction files: Both files coexist to support all tools. See AGENTS.md for build commands and coding conventions shared across all CLIs. This section describes Claude Code-specific features. For general conventions, see AGENTS.md. Factory Pattern: Templates in…
- Deletes or force-pushes
- Commits and pushes
In this repositoryOne other file it gives its agents.
- AGENTS.mdAGENTS.md
The file
Show its rules and text
We split this CLAUDE.md into the rules it gives an agent
25 rules. About 0 are common, 15 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 174
/create-commit: - Create git commits with staged changes - Very specific: line 190
Important: All agents save to working-docs/analysis/[ISSUE-KEY]/ with consistent naming:
- Distinctive: line 199
All agents and commands are Context7-aware.
- Very specific: line 238
Add YAML frontmatter with name, description, and tools array
- Distinctive: line 239
Write detailed system prompt with role and responsibilities
- Very specific: line 240
Test with /agents command in Claude Code
- Very specific: line 241
If proven useful, copy to .factory/droids/ as canonical template
- Very specific: line 254
Use dynamic features: $ARGUMENTS, !command
, @file/path - Distinctive: line 274
Validate: - Test in each CLI before committing
- Distinctive: line 323
Always research before implementation:
- Distinctive: line 329
Document Context7 sources in plans
- Distinctive: line 408
Follow principle of least privilege for MCP server access
- Distinctive: line 412
When syncing to multiple CLIs, audit tool permissions for each target
- Distinctive: line 414
Test in sandboxed environment before production use
- Very specific: line 482
Create/modify agents in .claude/agents/
- Distinctive: line 483
Test in Claude Code
- Distinctive: line 485
Test in OpenCode CLI
- Very specific: line 529
All other agents use conservative bash."*": ask for safety.
- Distinctive: line 570
When you improve an agent or command:
- Distinctive: line 572
Test in your target CLI (Claude Code, OpenCode, Codex, etc.)
- Very specific: line 573
Update the canonical source in .factory/
- Very specific: line 576
Run python3 .opencode/migrate_from_claude.py for OpenCode
- Distinctive: line 578
Update both AGENTS.md and CLAUDE.md as needed
- Distinctive: line 579
Document CLI-specific quirks in this file
- Distinctive: line 580
Create PR with validation notes from multiple CLIs
≈ “Common” is an estimate: at least 1 in 5 of the 29,248 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repository Purpose
Code Agent Octopus is a multi-CLI toolkit that provides reusable agents, commands, and workflows for AI coding assistants. This repository serves as a centralized template library supporting:
- Claude Code - Anthropic's CLI with sub-agents and slash commands (
.claude/) - OpenCode - OpenCode.ai CLI with agents and commands (
.opencode/) - Codex CLI - OpenAI's CLI with AGENTS.md configuration (
.codex/) - Factory CLI - Factory.ai's CLI with specialized Droids (
.factory/) - GitHub Copilot CLI - GitHub's CLI that reads multiple instruction formats (
.github/)
Key principle: .factory/ contains canonical templates that are synced to CLI-specific directories.
Multi-CLI Architecture
Configuration Files Strategy
This project maintains two primary instruction files:
- CLAUDE.md (this file) - Claude Code-specific guidance with detailed architecture
- AGENTS.md - Vendor-neutral standard (July 2025) used by Codex CLI, Factory CLI, and Copilot CLI
Both files coexist to support all tools. See AGENTS.md for build commands and coding conventions shared across all CLIs.
How Each CLI Reads Instructions
| CLI Tool | Reads | Format | Location |
| Claude Code | CLAUDE.md | Markdown with detailed sections | Root directory (auto-loaded) |
| OpenCode | AGENTS.md, .opencode/agent/, .opencode/command/ | YAML frontmatter + Markdown | .opencode/ directory |
| Codex CLI | AGENTS.md | Plain Markdown with semantic headings | Root directory (auto-loaded) |
| Factory CLI | AGENTS.md | Plain Markdown (same as Codex) | Root directory (auto-loaded) |
| Copilot CLI | AGENTS.md, CLAUDE.md, .github/copilot-instructions.md | Markdown with natural language | Multiple locations |
Directory Structure
code-agent-octopus/
├── AGENTS.md # Vendor-neutral config (Codex, Factory, Copilot, OpenCode)
├── CLAUDE.md # This file - Claude Code specific
├── .claude/
│ ├── agents/ # Claude Code sub-agents (YAML + Markdown)
│ │ ├── planning-agents/ # Architecture, implementation planners
│ │ └── code-review-agents/ # Quality, security, performance reviewers
│ ├── commands/ # Slash commands with YAML frontmatter
│ │ ├── planning/ # /planning:agentic-jira-task-analyze
│ │ ├── code-review/ # /code-review:pr-review
│ │ ├── testing/ # /testing:test-app-playwright
│ │ ├── research/ # /research:use-context7
│ │ └── context-memory/ # /context-memory:add-memory
│ └── settings.local.json # Local config (gitignored)
├── .opencode/
│ ├── agent/ # OpenCode agents (flat structure, 19 total)
│ ├── command/ # OpenCode commands (flat structure, 19 total)
│ ├── migrate_from_claude.py # Auto-migration script
│ └── README.md # OpenCode-specific documentation
├── .codex/
│ └── commands/ # Codex CLI command mirrors (same as .claude/commands)
├── .factory/
│ ├── droids/ # Canonical agent templates (source of truth)
│ │ ├── planning-agents/ # 10 specialized planning agents
│ │ └── code-review-agents/ # 5 code review agents
│ └── commands/ # Canonical command templates
│ ├── planning/
│ ├── code-review/
│ ├── testing/
│ ├── research/
│ └── context-memory/
├── .github/
│ └── prompts/ # GitHub Actions/Copilot prompts
└── docs/
└── claude-code/ # Guides for commands, agents, hooks
├── custom-slash-commands.md
├── sub-agents-guide.md
└── hooks-guide.mdClaude Code Specific Architecture
This section describes Claude Code-specific features. For general conventions, see AGENTS.md.
Agent System (Claude Code Only)
Factory Pattern: Templates in .factory/droids/ are canonical sources. Sync to .claude/agents/ for active use in Claude Code.
Agent File Format:
---
name: agent-identifier
description: When to use this agent (enables auto-delegation)
tools: [Read, Grep, Glob, mcp__context7__*]
---
# Agent System Prompt
Your role and responsibilities here...Agent Categories:
- Planning Agents (
.claude/agents/planning-agents/)planning-implementation- Architecture design, implementation roadmaps with Context7planning-quality-advisor- Architecture patterns, code quality analysisplanning-security-architect- Security design, authentication flowsplanning-testing-strategist- Test strategy and coverage planningplanning-ci-cd- CI/CD pipeline analysis (Jenkins, GitHub Actions, GitLab)planning-performance-architect- Performance optimization strategiesplanning-bug-prevention- Edge case identification before implementationplanning-documentation- Documentation planning for changesplanning-best-practices- Post-implementation best practices reviewcodebase-analyzer- Deep codebase structure analysis usingmcp__filesystem__*
- Code Review Agents (
.claude/agents/code-review-agents/)code-quality-reviewer- Best practices, maintainability, SOLID principlesbug-detector- Bug detection, edge cases, logic errorsperformance-reviewer- Performance bottlenecks, optimization opportunitiessecurity-reviewer- Security vulnerabilities, secure coding practicestesting-reviewer- Test coverage, test quality assessment
- Utility Agents
confluence-searcher- Atlassian Confluence search via MCPpdf-analyzer- PDF document analysis with memory persistencememory-manager- MCP memory operations and compilationlint-type-checker- Background linting and type checking
Command System (Claude Code Slash Commands)
Namespace Pattern: Commands in subdirectories are invoked as /namespace:command-name.
Command File Format:
---
description: Brief command description
argument-hint: "parameter description"
allowed-tools: Task, Read, Write, mcp__atlassian__*
model: claude-sonnet-4-5-20250929 # Optional
---
# Command Title
Instructions with dynamic features:
- $ARGUMENTS for user input
- !`bash command` for execution
- @path/to/file for file inclusionAvailable Commands:
/planning:*- JIRA analysis, implementation planning/planning:agentic-jira-task-analyze [JIRA-KEY]- Multi-agent JIRA analysis with codebase deep dive/planning:agentic-plan-implementation [requirements]- Comprehensive planning with Context7 research/planning:jira-task-analyze [JIRA-KEY]- Single-agent JIRA analysis
/code-review:*- Code quality, PR reviews/code-review:pr-review [PR_NUMBER] [branch]- Multi-agent PR review (GitHub/Bitbucket)/code-review:agentic-code-review- Parallel specialized reviews for staged changes/code-review:quality-code-review- Best practices focused review/code-review:commit-review-by-hash-id [hash]- Review specific commits/code-review:non-agentic-precommit-review- Direct review without sub-agents
/testing:*- Browser automation, testing/testing:test-app-playwright [url]- MCP Playwright integration for testing/testing:use-playwright-mcp [query]- Playwright best practices research/testing:use-chrome-devtools-mcp [query]- Chrome DevTools MCP research
/research:*- Documentation lookup/research:use-context7 [tech]- Context7 integration for best practices/research:find-solution [problem]- Multi-source documentation research
/context-memory:*- Knowledge persistence/context-memory:add-memory- Store observations in MCP memory/context-memory:read-memory- Retrieve stored knowledge
/analyze-docs- PDF and Confluence document analysis with memory/create-commit- Create git commits with staged changes/quality-check-python- Python code quality checks
Key Workflows (Claude Code)
Multi-Agent Orchestration Pattern
Commands like /planning:agentic-jira-task-analyze demonstrate parallel agent execution:
- Phase 0: Fetch JIRA task, save to
working-docs/analysis/[ISSUE-KEY]/jira-task.md - Phase 1: Launch core agents in parallel using Task tool
codebase-analyzer- Deep filesystem analysis withmcp__filesystem__*planning-implementation- Architecture with Context7 research
- Phase 2: Launch optional agents based on complexity (security, testing)
- Phase 3: Synthesize all outputs into
working-docs/analysis/[ISSUE-KEY]/final-plan.md
Important: All agents save to working-docs/analysis/[ISSUE-KEY]/ with consistent naming:
jira-task.md- Original requirementscodebase-analysis.md- Structure and integration pointsimplementation-plan.md- Detailed roadmapsecurity-analysis.md- Security considerations (optional)testing-strategy.md- Test planning (optional)
Context7 Integration Workflow
All agents and commands are Context7-aware. Standard pattern:
1. Identify technology stack from code/requirements
2. Call mcp__context7__resolve-library-id for each framework
3. Call mcp__context7__get-library-docs with 15000+ tokens for detailed docs
4. Research multiple implementation patterns
5. Check for breaking changes and deprecations
6. Incorporate current best practices into plansMCP Tool Usage in Claude Code
- Atlassian MCP (
mcp__atlassian__*): JIRA issue management, Confluence search, task transitions - Filesystem MCP (
mcp__filesystem__*): Deep codebase analysis, directory trees, file search - Memory MCP (
mcp__memory__*): Knowledge persistence across sessions, entity graphs - Playwright MCP (
mcp__playwright__*): Browser automation, testing, screenshots - IDE MCP (
mcp__ide__*): Language diagnostics, code execution in Jupyter
Working with Claude Code Templates
Syncing from Factory to Claude Code
# Sync agent template
cp .factory/droids/planning-agents/planning-implementation.md .claude/agents/planning-agents/
# Sync command template
cp .factory/commands/research/use-context7.md .claude/commands/research/
# Verify in Claude Code
claude
/agents # List and verify agent is registered
/commands # List available slash commandsCreating New Claude Code Agents
- Create file:
.claude/agents/[category]/[agent-name].md - Add YAML frontmatter with
name,description, andtoolsarray - Write detailed system prompt with role and responsibilities
- Test with
/agentscommand in Claude Code - If proven useful, copy to
.factory/droids/as canonical template
Creating New Slash Commands
- Create file:
.claude/commands/[namespace]/[command-name].md - Add YAML frontmatter:
--- description: Brief command description argument-hint: "parameter description" allowed-tools: Task, Read, Write, mcp__atlassian__* --- - Use dynamic features:
$ARGUMENTS,!command``,@file/path - Test invocation:
/namespace:command-name [args] - Mirror to
.codex/commands/if applicable
Cross-CLI Synchronization Patterns
Factory → Active Directories
.factory/ serves as the single source of truth. Workflow:
- Edit in Factory - Make changes to
.factory/droids/or.factory/commands/ - Sync to Active CLIs:
# Sync to Claude Code cp -r .factory/droids/* .claude/agents/ cp -r .factory/commands/* .claude/commands/ # Sync to Codex CLI cp -r .factory/commands/* .codex/commands/ - Validate - Test in each CLI before committing
CLI-Specific Adaptations
Different CLIs have different formats:
| Feature | Claude Code | OpenCode | Codex/Factory CLI | Copilot CLI |
| Agent Format | YAML frontmatter + Markdown | YAML frontmatter + Markdown | N/A (uses AGENTS.md) | .github/prompts/*.md |
| Command Format | YAML frontmatter + Markdown | YAML frontmatter + Markdown | Plain Markdown | Plain Markdown |
| Tool Permissions | allowed-tools in frontmatter | permission map (tri-state) | CLI flags --allow-tool | CLI flags --allow-tool |
| MCP Support | Native MCP integration | Native MCP + wildcards | MCP via Agents SDK | MCP servers |
| Orchestration | Parallel via Task tool | Sequential via @ mentions | Manual | Manual |
Maintaining Consistency
When updating templates:
- Update
.factory/first (canonical source) - Sync to
.claude/for Claude Code agents/commands - Sync to
.opencode/using migration script:python3 .opencode/migrate_from_claude.py - Sync to
.codex/for Codex CLI commands (if format compatible) - Update
AGENTS.mdfor general conventions shared across CLIs - Update this file (
CLAUDE.md) for Claude Code-specific guidance
Development Patterns
Agent Communication (Claude Code)
Agents use filesystem for inter-agent communication. Pattern:
1. Orchestrator command creates: working-docs/analysis/[ISSUE-KEY]/
2. Each agent writes to: working-docs/analysis/[ISSUE-KEY]/[agent-name].md
3. Orchestrator compiles all outputs into final deliverableParallel Agent Execution (Claude Code)
Launch independent agents in parallel using Task tool:
Use single message with multiple Task tool calls when no dependencies exist.
Example: codebase-analyzer and planning-implementation can run simultaneously.Context7 Best Practices
Always research before implementation:
- Identify all technologies in the stack
- Resolve library IDs for each technology
- Fetch 15000+ tokens of documentation
- Apply current patterns, avoid deprecated approaches
- Document Context7 sources in plans
Common Operations
Claude Code Inspection
claude
/agents # List registered sub-agents
/commands # List custom slash commands
/hooks # Review hook configuration
/mcp # Check MCP server statusJIRA Task Workflow (Claude Code)
/planning:agentic-jira-task-analyze PROJ-123
# Creates: working-docs/analysis/PROJ-123/
# Outputs: jira-task.md, codebase-analysis.md, implementation-plan.md, etc.Code Review Workflow (Claude Code)
/code-review:pr-review 456
# Multi-agent review: quality, security, performance, testing, bugsCross-CLI Command Testing
# Test in Claude Code
claude
/research:use-context7 FastAPI
# Test equivalent in Codex CLI (if ported)
codex
/commands reload
/research:use-context7 FastAPI
# Test in Factory CLI
factory droid exec "Research FastAPI best practices using Context7"Syncing Factory to Codex
# After updating .claude/commands/
rsync -av .claude/commands/ .codex/commands/
# Verify in Codex
codex
/commands reloadDocumentation References
Claude Code Specific
- Custom Slash Commands:
docs/claude-code/custom-slash-commands.md - Sub-Agents Guide:
docs/claude-code/sub-agents-guide.md - Hooks Guide:
docs/claude-code/hooks-guide.md - Official Claude Code Docs: https://docs.anthropic.com/en/docs/claude-code
- MCP Documentation: https://docs.anthropic.com/en/docs/claude-code/mcp
- Context7 Docs: https://context7.com
Multi-CLI Resources
- AGENTS.md (this repo) - Shared conventions for Codex, Factory, Copilot
- OpenAI Codex Docs: https://developers.openai.com/codex/cli
- Factory CLI Docs: https://docs.factory.ai/factory-cli
- GitHub Copilot CLI: https://docs.github.com/en/copilot/concepts/agents/about-copilot-cli
Security Considerations
Claude Code Specific
- Agents execute with CLI session permissions
- Review YAML frontmatter and
toolsarrays before enabling agents - Store credentials in
.claude/settings.local.json(gitignored) - Validate tool scopes in
allowed-toolsfrontmatter - Follow principle of least privilege for MCP server access
Cross-CLI Security
- Factory templates in
.factory/should use minimal permissions - When syncing to multiple CLIs, audit tool permissions for each target
- Different CLIs may interpret permissions differently
- Test in sandboxed environment before production use
Quick Start for Different CLIs
Using Claude Code (Primary)
claude
/agents # See available sub-agents
/planning:agentic-jira-task-analyze PROJ-123Using Codex CLI
codex
# AGENTS.md is auto-loaded
# Run commands from .codex/commands/Using Factory CLI
factory droid code
# AGENTS.md guides the Code Droid
# Use factory templates from .factory/droids/Using OpenCode CLI
opencode
# Agents and commands auto-loaded from .opencode/
# Agent invocation: @agent-name
/agentic-jira-task-analyze PROJ-123Using Copilot CLI
gh copilot
# Reads AGENTS.md, CLAUDE.md, .github/copilot-instructions.md
# Use for GitHub-integrated workflowsOpenCode Integration
Overview
OpenCode support was added to provide compatibility with the OpenCode.ai CLI. All Claude Code agents and commands have been migrated to OpenCode format in the .opencode/ directory.
Key Differences: Claude Code vs OpenCode
| Feature | Claude Code | OpenCode |
| Directory Structure | Nested (.claude/agents/planning-agents/) | Flat (.opencode/agent/) |
| Command Naming | Namespace-based (/planning:cmd) | Hyphenated (/cmd) |
| Agent Invocation | Task(subagent_type="X") | @X mention syntax |
| Execution Model | Parallel agents supported | Sequential only (~40-50% slower) |
| Tool Format | Array (tools: [Read, Write]) | Boolean map (tools: {read: true}) |
| Permissions | Simple (allowed-tools) | Tri-state (allow/ask/deny + bash granularity) |
| Mode System | Implicit | Explicit (primary/subagent/all) |
| Wildcard Tools | Not supported | Supported (mcp__context7__*: true) |
Migration Strategy
The .opencode/ directory is auto-generated from .claude/ using the migration script:
python3 .opencode/migrate_from_claude.pyWorkflow:
- Create/modify agents in
.claude/agents/ - Test in Claude Code
- Run migration script
- Test in OpenCode CLI
- Commit both versions
OpenCode-Specific Features
1. Permission Granularity
permission:
bash:
"git add *": allow
"git commit *": allow
"git push *": ask # Require confirmation
"rm -rf *": deny # Block dangerous commands2. Mode System
mode: primary # For main interactive agents
mode: subagent # For specialized reviewers
mode: all # Available in both contexts (default)3. Temperature Control
temperature: 0.1 # For deterministic analysis
temperature: 0.8 # For creative explorationOpenCode Agent Permissions
Agents with Write Permission (9 agents):
- planning-implementation
- codebase-analyzer
- planning-quality-advisor
- planning-security-architect
- planning-testing-strategist
- planning-ci-cd
- planning-performance-architect
- planning-bug-prevention
- planning-documentation
These agents create analysis artifacts and have bash."*": allow.
Review Agents (10 agents):
All other agents use conservative bash."*": ask for safety.
OpenCode Command Adaptations
Commands are adapted for sequential execution:
Claude Code (parallel):
Launch agents in parallel:
- Task(subagent_type="codebase-analyzer")
- Task(subagent_type="planning-implementation")OpenCode (sequential):
Step 1: @codebase-analyzer Analyze codebase...
Step 2: @planning-implementation Create plan using findings...Testing OpenCode Integration
# Verify agent availability
opencode
@planning-implementation Create plan for user auth
# Test command
/agentic-jira-task-analyze PROJ-123
# Test Context7 integration
@planning-implementation Research FastAPI patterns using Context7Documentation
- OpenCode README: .opencode/README.md
- Migration Script: .opencode/migrate_from_claude.py
- Official Docs: https://opencode.ai/docs/
Contributing Back to Factory
When you improve an agent or command:
- Test in your target CLI (Claude Code, OpenCode, Codex, etc.)
- Update the canonical source in
.factory/ - Sync to other CLI directories:
.claude/for Claude Code- Run
python3 .opencode/migrate_from_claude.pyfor OpenCode .codex/for Codex CLI (if applicable)
- Update both
AGENTS.mdandCLAUDE.mdas needed - Document CLI-specific quirks in this file
- Create PR with validation notes from multiple CLIs
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

