agentleFS
justinseger015-ctrljustinseger015-ctrl/claude-code-octopus/CLAUDE.md

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.

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
  1. Very specific:

    /create-commit: - Create git commits with staged changes

    line 174
  2. Very specific:

    Important: All agents save to working-docs/analysis/[ISSUE-KEY]/ with consistent naming:

    line 190
  3. Distinctive:

    All agents and commands are Context7-aware.

    line 199
  4. Very specific:

    Add YAML frontmatter with name, description, and tools array

    line 238
  5. Distinctive:

    Write detailed system prompt with role and responsibilities

    line 239
  6. Very specific:

    Test with /agents command in Claude Code

    line 240
  7. Very specific:

    If proven useful, copy to .factory/droids/ as canonical template

    line 241
  8. Very specific:

    Use dynamic features: $ARGUMENTS, !command, @file/path

    line 254
  9. Distinctive:

    Validate: - Test in each CLI before committing

    line 274
  10. Distinctive:

    Always research before implementation:

    line 323
  11. Distinctive:

    Document Context7 sources in plans

    line 329
  12. Distinctive:

    Follow principle of least privilege for MCP server access

    line 408
  13. Distinctive:

    When syncing to multiple CLIs, audit tool permissions for each target

    line 412
  14. Distinctive:

    Test in sandboxed environment before production use

    line 414
  15. Very specific:

    Create/modify agents in .claude/agents/

    line 482
  16. Distinctive:

    Test in Claude Code

    line 483
  17. Distinctive:

    Test in OpenCode CLI

    line 485
  18. Very specific:

    All other agents use conservative bash."*": ask for safety.

    line 529
  19. Distinctive:

    When you improve an agent or command:

    line 570
  20. Distinctive:

    Test in your target CLI (Claude Code, OpenCode, Codex, etc.)

    line 572
  21. Very specific:

    Update the canonical source in .factory/

    line 573
  22. Very specific:

    Run python3 .opencode/migrate_from_claude.py for OpenCode

    line 576
  23. Distinctive:

    Update both AGENTS.md and CLAUDE.md as needed

    line 578
  24. Distinctive:

    Document CLI-specific quirks in this file

    line 579
  25. Distinctive:

    Create PR with validation notes from multiple CLIs

    line 580

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

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:

  1. CLAUDE.md (this file) - Claude Code-specific guidance with detailed architecture
  2. 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 ToolReadsFormatLocation
Claude CodeCLAUDE.mdMarkdown with detailed sectionsRoot directory (auto-loaded)
OpenCodeAGENTS.md, .opencode/agent/, .opencode/command/YAML frontmatter + Markdown.opencode/ directory
Codex CLIAGENTS.mdPlain Markdown with semantic headingsRoot directory (auto-loaded)
Factory CLIAGENTS.mdPlain Markdown (same as Codex)Root directory (auto-loaded)
Copilot CLIAGENTS.md, CLAUDE.md, .github/copilot-instructions.mdMarkdown with natural languageMultiple 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.md

Claude 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:

  1. Planning Agents (.claude/agents/planning-agents/)
    • planning-implementation - Architecture design, implementation roadmaps with Context7
    • planning-quality-advisor - Architecture patterns, code quality analysis
    • planning-security-architect - Security design, authentication flows
    • planning-testing-strategist - Test strategy and coverage planning
    • planning-ci-cd - CI/CD pipeline analysis (Jenkins, GitHub Actions, GitLab)
    • planning-performance-architect - Performance optimization strategies
    • planning-bug-prevention - Edge case identification before implementation
    • planning-documentation - Documentation planning for changes
    • planning-best-practices - Post-implementation best practices review
    • codebase-analyzer - Deep codebase structure analysis using mcp__filesystem__*
  2. Code Review Agents (.claude/agents/code-review-agents/)
    • code-quality-reviewer - Best practices, maintainability, SOLID principles
    • bug-detector - Bug detection, edge cases, logic errors
    • performance-reviewer - Performance bottlenecks, optimization opportunities
    • security-reviewer - Security vulnerabilities, secure coding practices
    • testing-reviewer - Test coverage, test quality assessment
  3. Utility Agents
    • confluence-searcher - Atlassian Confluence search via MCP
    • pdf-analyzer - PDF document analysis with memory persistence
    • memory-manager - MCP memory operations and compilation
    • lint-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 inclusion

Available 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:

  1. Phase 0: Fetch JIRA task, save to working-docs/analysis/[ISSUE-KEY]/jira-task.md
  2. Phase 1: Launch core agents in parallel using Task tool
    • codebase-analyzer - Deep filesystem analysis with mcp__filesystem__*
    • planning-implementation - Architecture with Context7 research
  3. Phase 2: Launch optional agents based on complexity (security, testing)
  4. 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 requirements
  • codebase-analysis.md - Structure and integration points
  • implementation-plan.md - Detailed roadmap
  • security-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 plans

MCP 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 commands

Creating New Claude Code Agents

  1. Create file: .claude/agents/[category]/[agent-name].md
  2. Add YAML frontmatter with name, description, and tools array
  3. Write detailed system prompt with role and responsibilities
  4. Test with /agents command in Claude Code
  5. If proven useful, copy to .factory/droids/ as canonical template

Creating New Slash Commands

  1. Create file: .claude/commands/[namespace]/[command-name].md
  2. Add YAML frontmatter:
    ---
    description: Brief command description
    argument-hint: "parameter description"
    allowed-tools: Task, Read, Write, mcp__atlassian__*
    ---
  3. Use dynamic features: $ARGUMENTS, !command``, @file/path
  4. Test invocation: /namespace:command-name [args]
  5. Mirror to .codex/commands/ if applicable

Cross-CLI Synchronization Patterns

Factory → Active Directories

.factory/ serves as the single source of truth. Workflow:

  1. Edit in Factory - Make changes to .factory/droids/ or .factory/commands/
  2. 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/
  3. Validate - Test in each CLI before committing

CLI-Specific Adaptations

Different CLIs have different formats:

FeatureClaude CodeOpenCodeCodex/Factory CLICopilot CLI
Agent FormatYAML frontmatter + MarkdownYAML frontmatter + MarkdownN/A (uses AGENTS.md).github/prompts/*.md
Command FormatYAML frontmatter + MarkdownYAML frontmatter + MarkdownPlain MarkdownPlain Markdown
Tool Permissionsallowed-tools in frontmatterpermission map (tri-state)CLI flags --allow-toolCLI flags --allow-tool
MCP SupportNative MCP integrationNative MCP + wildcardsMCP via Agents SDKMCP servers
OrchestrationParallel via Task toolSequential via @ mentionsManualManual

Maintaining Consistency

When updating templates:

  1. Update .factory/ first (canonical source)
  2. Sync to .claude/ for Claude Code agents/commands
  3. Sync to .opencode/ using migration script: python3 .opencode/migrate_from_claude.py
  4. Sync to .codex/ for Codex CLI commands (if format compatible)
  5. Update AGENTS.md for general conventions shared across CLIs
  6. 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 deliverable

Parallel 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:

  1. Identify all technologies in the stack
  2. Resolve library IDs for each technology
  3. Fetch 15000+ tokens of documentation
  4. Apply current patterns, avoid deprecated approaches
  5. 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 status

JIRA 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, bugs

Cross-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 reload

Documentation References

Claude Code Specific

Multi-CLI Resources

Security Considerations

Claude Code Specific

  • Agents execute with CLI session permissions
  • Review YAML frontmatter and tools arrays before enabling agents
  • Store credentials in .claude/settings.local.json (gitignored)
  • Validate tool scopes in allowed-tools frontmatter
  • 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-123

Using 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-123

Using Copilot CLI

gh copilot
# Reads AGENTS.md, CLAUDE.md, .github/copilot-instructions.md
# Use for GitHub-integrated workflows

OpenCode 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

FeatureClaude CodeOpenCode
Directory StructureNested (.claude/agents/planning-agents/)Flat (.opencode/agent/)
Command NamingNamespace-based (/planning:cmd)Hyphenated (/cmd)
Agent InvocationTask(subagent_type="X")@X mention syntax
Execution ModelParallel agents supportedSequential only (~40-50% slower)
Tool FormatArray (tools: [Read, Write])Boolean map (tools: {read: true})
PermissionsSimple (allowed-tools)Tri-state (allow/ask/deny + bash granularity)
Mode SystemImplicitExplicit (primary/subagent/all)
Wildcard ToolsNot supportedSupported (mcp__context7__*: true)

Migration Strategy

The .opencode/ directory is auto-generated from .claude/ using the migration script:

python3 .opencode/migrate_from_claude.py

Workflow:

  1. Create/modify agents in .claude/agents/
  2. Test in Claude Code
  3. Run migration script
  4. Test in OpenCode CLI
  5. 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 commands

2. 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 exploration

OpenCode 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 Context7

Documentation

  • 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:

  1. Test in your target CLI (Claude Code, OpenCode, Codex, etc.)
  2. Update the canonical source in .factory/
  3. Sync to other CLI directories:
    • .claude/ for Claude Code
    • Run python3 .opencode/migrate_from_claude.py for OpenCode
    • .codex/ for Codex CLI (if applicable)
  4. Update both AGENTS.md and CLAUDE.md as needed
  5. Document CLI-specific quirks in this file
  6. Create PR with validation notes from multiple CLIs

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.