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

claude-code-octopus

AGENTS.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…

  • Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.

    Of the AGENTS.md files we read, the 11,736 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.

  • In this repositoryOne other file it gives its agents.

The file

Show its rules and text

We split this AGENTS.md into the rules it gives an agent

20 rules. About 0 are common, 13 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈13

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

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

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

    line 183
  3. Distinctive:

    All agents and commands are Context7-aware.

    line 192
  4. Very specific:

    Add YAML frontmatter with name, description, and tools array

    line 231
  5. Distinctive:

    Write detailed system prompt with role and responsibilities

    line 232
  6. Very specific:

    Test with /agents command in Claude Code

    line 233
  7. Very specific:

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

    line 234
  8. Very specific:

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

    line 247
  9. Distinctive:

    Validate: - Test in each CLI before committing

    line 267
  10. Distinctive:

    Always research before implementation:

    line 314
  11. Distinctive:

    Document Context7 sources in plans

    line 320
  12. Distinctive:

    Follow principle of least privilege for MCP server access

    line 399
  13. Distinctive:

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

    line 403
  14. Distinctive:

    Test in sandboxed environment before production use

    line 405
  15. Distinctive:

    When you improve an agent or command:

    line 439
  16. Distinctive:

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

    line 441
  17. Very specific:

    Update the canonical source in .factory/

    line 442
  18. Distinctive:

    Update both AGENTS.md and CLAUDE.md as needed

    line 444
  19. Distinctive:

    Document CLI-specific quirks in this file

    line 445
  20. Distinctive:

    Create PR with validation notes from multiple CLIs

    line 446

≈ “Common” is an estimate: at least 1 in 5 of the 16,597 AGENTS.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
AGENTS.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/)
  • 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)
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)
├── 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)
├── .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 CodeCodex/Factory CLICopilot CLI
Agent FormatYAML frontmatter + MarkdownN/A (uses AGENTS.md).github/prompts/*.md
Command FormatYAML frontmatter + MarkdownPlain MarkdownPlain Markdown
Tool Permissionsallowed-tools in frontmatterCLI flags --allow-toolCLI flags --allow-tool
MCP SupportNative MCP integrationMCP via Agents SDKMCP servers

Maintaining Consistency

When updating templates:

  1. Update .factory/ first (canonical source)
  2. Sync to .claude/ for Claude Code agents/commands
  3. Sync to .codex/ for Codex CLI commands (if format compatible)
  4. Update AGENTS.md for general conventions shared across CLIs
  5. 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 Copilot CLI

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

Contributing Back to Factory

When you improve an agent or command:

  1. Test in your target CLI (Claude Code, Codex, etc.)
  2. Update the canonical source in .factory/
  3. Sync to other CLI directories 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.