CLAUDE.md
classic/original_autogpt/CLAUDE.mdCLAUDE.md
Quality
90/100
Scores the file, not the repository.Length
1,129 words
29 headings · 13 code blocksRepository
186k
— · pushed 0 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.45## Quick Reference67All commands run from the `classic/` directory (parent of this directory):89```bash10# Run interactive CLI11poetry run autogpt run1213# Run Agent Protocol server (port 8000)14poetry run serve --debug1516# Run tests17poetry run pytest original_autogpt/tests/18poetry run pytest original_autogpt/tests/unit/ -v19poetry run pytest -k test_name20```2122## Entry Points2324| Command | Entry | Description |25|---------|-------|-------------|26| `autogpt run` | `app/cli.py:run()` | Interactive agent mode |27| `autogpt serve` | `app/cli.py:serve()` | Agent Protocol server (FastAPI) |2829Both ultimately call functions in `app/main.py`:30- `run_auto_gpt()` → `run_interaction_loop(agent)`31- `run_auto_gpt_server()` → Hypercorn + FastAPI3233## Directory Structure3435```36autogpt/37├── __main__.py # Entry: runs cli()38├── app/ # Application layer39│ ├── cli.py # Click CLI (@cli.command decorators)40│ ├── main.py # run_auto_gpt(), run_interaction_loop()41│ ├── config.py # AppConfig (Pydantic) + ConfigBuilder42│ ├── agent_protocol_server.py # FastAPI server for Agent Protocol43│ ├── setup.py # Interactive AI profile setup44│ └── configurator.py # Config overrides, model validation45├── agents/ # Core agent46│ ├── agent.py # Agent class (extends BaseAgent)47│ ├── agent_manager.py # State persistence (load/save)48│ └── prompt_strategies/49│ └── one_shot.py # Prompt building + response parsing50└── agent_factory/ # Agent creation51 ├── configurators.py # create_agent(), configure_agent_with_state()52 └── profile_generator.py # AI profile generation53```5455## Core Architecture5657### Agent Class (`agents/agent.py`)5859Extends `forge.agent.base.BaseAgent[OneShotAgentActionProposal]`.6061**Constructor**:62```python63Agent(64 settings: AgentSettings, # State: profile, directives, history65 llm_provider: MultiProvider, # LLM access66 file_storage: FileStorage, # File access67 app_config: AppConfig,68)69```7071**Built-in Components** (initialized in `__init__`):72- `self.system` - System information73- `self.history` - ActionHistoryComponent (episodic memory)74- `self.file_manager` - FileManagerComponent (workspace files)75- `self.code_executor` - CodeExecutorComponent (Docker-based)76- `self.git_ops` - GitOperationsComponent77- `self.image_gen` - ImageGeneratorComponent78- `self.web_search` - WebSearchComponent79- `self.web_browser` - WebPlaywrightComponent80- `self.context` - ContextComponent81- `self.watchdog` - WatchdogComponent82- `self.user_interaction` - UserInteractionComponent8384**Key Methods**:85- `propose_action()` → Builds prompt, calls LLM, returns `OneShotAgentActionProposal`86- `execute(proposal)` → Runs the proposed tool, returns `ActionResult`87- `do_not_execute(proposal, feedback)` → Registers user feedback instead8889### Main Loop (`app/main.py:run_interaction_loop`)9091```92While cycles_remaining > 0:93 1. agent.propose_action() → ActionProposal (thoughts + tool call)94 2. Display thoughts + proposed command to user95 3. Get user feedback (or auto-execute in continuous mode)96 4. agent.execute(proposal) or agent.do_not_execute(proposal, feedback)97 5. Decrement cycles, handle Ctrl+C gracefully98```99100**Cycle Budget**:101- Normal mode: `cycles = 1` (prompt user each step)102- Continuous mode: `cycles = continuous_limit or ∞`103- User can extend: "y -5" gives 5 more cycles104105### Prompt Strategy (`agents/prompt_strategies/one_shot.py`)106107**`OneShotAgentActionProposal`**:108```python109thoughts: AssistantThoughts # observations, reasoning, plan, self_criticism110use_tool: AssistantFunctionCall # {name, arguments}111```112113**`AssistantThoughts`**:114```python115observations: str # From last action result116text: str # Main thoughts117reasoning: str # Why this thought118self_criticism: str # Constructive critique119plan: list[str] # Multi-step plan120speak: str # What to say to user121```122123**Prompt Structure**:1241. System prompt (intro + profile + directives + commands)1252. Task as user message1263. Message history from components1274. "Determine next action" instruction128129### Configuration (`app/config.py`)130131**`AppConfig`** (Pydantic BaseModel):132```python133smart_llm: ModelName = "gpt-4-turbo" # Complex reasoning134fast_llm: ModelName = "gpt-3.5-turbo" # Fast operations135temperature: float = 0.0136continuous_mode: bool = False137continuous_limit: int = 0138restrict_to_workspace: bool = True # Sandbox file access139disabled_commands: list[str] = []140```141142**`ConfigBuilder.build_config_from_env()`** loads from:1431. Hardcoded defaults1442. Environment variables1453. `.env` file1464. CLI arguments (highest priority)147148### State Persistence149150**Workspace Structure**:151```152data/agents/{agent_id}/153├── state.json # AgentSettings (profile, directives, history)154└── workspace/ # Agent's working directory155```156157**`AgentSettings`** contains:158- `agent_id`, `task`159- `ai_profile` (name, role, goals)160- `ai_directives` (constraints, resources, best practices)161- `history` (EpisodicActionHistory)162163**`AgentManager`**:164- `list_agents()` - All agent IDs165- `load_agent_state(agent_id)` - Load from state.json166- `save_state()` - Persist current state167168## Memory System169170**Short-term** (within execution):171- `agent.event_history` (EpisodicActionHistory)172- Each action creates an `Episode` with action + result173- Token-limited: oldest episodes dropped when limit exceeded174175**Long-term** (across sessions):176- Serialized to `state.json` via Pydantic177- Resume with `AgentManager.load_agent_state()`178179## Component System180181Components implement protocols from forge:182- `CommandProvider.get_commands()` - Provide available commands183- `DirectiveProvider.get_*()` - Provide constraints/resources/best practices184- `MessageProvider.get_messages()` - Provide context messages185186**Execution**: `agent.run_pipeline(Protocol.method)` runs all component implementations.187188**Ordering**: `component.run_after(other)` controls execution order.189190## Forge Dependency191192Heavy reliance on `forge` package (sibling directory):193- `forge.agent.base.BaseAgent` - Base class194- `forge.llm.providers.MultiProvider` - LLM abstraction195- `forge.file_storage` - File storage backends196- `forge.components.*` - All component implementations197- `forge.models.config` - Configuration models198199## Key Gotchas2002011. **Component ordering matters** - Use `run_after()` for dependencies2022. **Token limits are critical** - History auto-drops old episodes; large results get truncated2033. **Continuous mode is dangerous** - No user approval between steps2044. **State files grow large** - Full history in state.json2055. **SIGINT handling** - First Ctrl+C stops continuous mode; second exits2066. **Anthropic limitations** - Doesn't support functions API + prefilling207208## CLI Options209210```bash211autogpt run [OPTIONS]212 -c, --continuous # No user approval between steps213 -l, --continuous-limit N # Max steps in continuous mode214 --ai-name NAME # Override AI name215 --ai-role ROLE # Override AI role216 --constraint TEXT # Add constraint (repeatable)217 --resource TEXT # Add resource (repeatable)218 --best-practice TEXT # Add best practice (repeatable)219 --component-config-file PATH # JSON config for components220 --debug # Enable debug logging221 --log-level LEVEL # Set log level222```223224## Testing225226**Fixtures** (`tests/conftest.py`):227- `app_data_dir` - Temp directory228- `config` - AppConfig with noninteractive_mode=True229- `storage` - LocalFileStorage230- `llm_provider` - MultiProvider231- `agent` - Fully initialized Agent232233**Running** (from `classic/` directory):234```bash235poetry run pytest original_autogpt/tests/ # All tests236poetry run pytest original_autogpt/tests/unit/ -v # Unit tests237poetry run pytest original_autogpt/tests/integration/ # Integration tests238poetry run pytest -k test_config # By name239OPENAI_API_KEY=sk-dummy poetry run pytest original_autogpt/ # With dummy key240```241242## Common Tasks243244### Add a New Component2451. Create class extending `forge.components.AgentComponent`2462. Implement protocols (e.g., `CommandProvider.get_commands()`)2473. Add to `Agent.__init__()` after `super().__init__()`2484. Use `run_after()` to set execution order249250### Disable a Command251```python252config.disabled_commands.append("execute_python")253```254255### Custom LLM256```bash257SMART_LLM=gpt-4258FAST_LLM=gpt-3.5-turbo259TEMPERATURE=0.7260```261262## Tracing Execution2632641. `__main__.py` → `cli()`2652. `cli.py:run()` → `run_auto_gpt()`2663. `main.py:run_auto_gpt()`:267 - Build config from env268 - Set up file storage269 - Load or create agent270 - Call `run_interaction_loop(agent)`2714. `main.py:run_interaction_loop()`:272 - `agent.propose_action()` → LLM call273 - Display to user274 - Get feedback or auto-execute275 - `agent.execute()` or `agent.do_not_execute()`276 - Loop277278## Benchmarking279280Run performance benchmarks from the `classic/` directory:281282```bash283# Run a single test284poetry run direct-benchmark run --tests ReadFile285286# Run with specific strategies and models287poetry run direct-benchmark run \288 --strategies one_shot,rewoo \289 --models claude \290 --parallel 4291292# Run regression tests only293poetry run direct-benchmark run --maintain294295# List available challenges296poetry run direct-benchmark list-challenges297```298299See `direct_benchmark/CLAUDE.md` for full documentation on strategies, model presets, and CLI options.300
Also in Significant-Gravitas/AutoGPT
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Significant-Gravitas/AutoGPTautogpt_platform/frontend/src/tests/AGENTS.md · 186k | AGENTS.md | teststylearchtypes+2 | 81/100 | 3 days ago | |
| Significant-Gravitas/AutoGPT.github/copilot-instructions.md · 186k | Copilot instructions | setupbuildtestlint-format+10 | 88/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTAGENTS.md · 186k | AGENTS.md | teststylearchgit+1 | 87/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/AGENTS.md · 186k | AGENTS.md | setuptestarchtesting-strategy+3 | 77/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/backend/AGENTS.md · 186k | AGENTS.md | setuptestlint-formatstyle+9 | 81/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/backend/backend/copilot/graphiti/AGENTS.md · 186k | AGENTS.md | styleperformance | 66/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTautogpt_platform/frontend/AGENTS.md · 186k | AGENTS.md | setupbuildtestlint-format+7 | 96/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTclassic/CLAUDE.md · 186k | CLAUDE.md | setuptestlint-formatstyle+7 | 89/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTclassic/direct_benchmark/CLAUDE.md · 186k | CLAUDE.md | setuptestlint-formatarch+4 | 78/100 | 3 days ago | |
| Significant-Gravitas/AutoGPTclassic/forge/CLAUDE.md · 186k | CLAUDE.md | teststylearchtypes+3 | 73/100 | 3 days ago | |
| Significant-Gravitas/AutoGPT.claude/skills/vercel-react-best-practices/AGENTS.md · 186k | AGENTS.md | buildlint-formatstyledependencies+4 | 61/100 | 3 days ago |
Diff against autogpt_platform/frontend/src/tests/AGENTS.md Diff against .github/copilot-instructions.md Diff against AGENTS.md Diff against autogpt_platform/AGENTS.md Diff against autogpt_platform/backend/AGENTS.md Diff against autogpt_platform/backend/backend/copilot/graphiti/AGENTS.md Diff against autogpt_platform/frontend/AGENTS.md Diff against classic/CLAUDE.md Diff against classic/direct_benchmark/CLAUDE.md Diff against classic/forge/CLAUDE.md Diff against .claude/skills/vercel-react-best-practices/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| dotCMS/corecore-web/CLAUDE.md · 949 | CLAUDE.md | teststylearchtesting-strategy+3 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 949 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | today | |
| carrot-foundation/middle-earthCLAUDE.md · 0 | CLAUDE.md | setupbuildtestlint-format+6 | 97/100 | 3 days ago |
