Excellent! Now I have a comprehensive understanding of the codebase. Let me compile a detailed analysis report.

## Autocoder Codebase Exploration Report

Based on my thorough analysis of the Autocoder codebase, here is a comprehensive breakdown of the three key areas you requested:

---

### **1. MAIN AGENT ARCHITECTURE**

**File:** `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\agent.py`

**Core Flow:**
The autonomous agent uses a **two-agent pattern** implemented in `run_autonomous_agent()`:

```python
# Lines 35-107: run_agent_session() - Single session execution
# Sends prompt to Claude SDK and streams response, handling:
#  - AssistantMessage (text + tool use blocks)
#  - UserMessage (tool results)
#  - Security-blocked commands

# Lines 109-231: run_autonomous_agent() - Main loop
# 1. Check if first run: has_features(project_dir) determines if initializer needed
# 2. Load appropriate prompt (initializer_prompt vs coding_prompt)
# 3. Create fresh client for each session
# 4. Run session with async context manager
# 5. Auto-continue every 3 seconds if agent returns "continue" status
```

**Agent Types:**
- **Initializer Agent** (first session): Reads app spec, generates 200+ test cases, creates features in SQLite
- **Coding Agent** (subsequent sessions): Implements features one by one, marks as passing
- **YOLO Mode**: Uses `coding_prompt_yolo` instead - skips regression testing

**Key Configuration:**
```python
# autonomous_agent_demo.py lines 38-39
DEFAULT_MODEL = "claude-opus-4-5-20251101"
```

**Agent-to-Agent Coordination:**
- **Initializer** stores features in database via `feature_create_bulk()`
- **Coding agent** retrieves next feature via `feature_get_next()`
- Progress tracked in SQLite: `features.db` in project directory
- No direct inter-agent messaging - all coordination through shared database

---

### **2. CLAUDE SDK CLIENT SETUP**

**File:** `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\client.py`

**Sandbox Configuration (Lines 125-133):**
```python
security_settings = {
    "sandbox": {"enabled": True, "autoAllowBashIfSandboxed": True},
    "permissions": {
        "defaultMode": "acceptEdits",
        "allow": permissions_list,
    },
}
```

**Three-Layer Security Model (Lines 88-92):**
1. **OS-level sandbox**: Prevents filesystem escape from bash commands
2. **Filesystem permissions**: Restricted to `project_dir` only via relative paths `"./**"`
3. **Security hooks**: Bash commands validated against `ALLOWED_COMMANDS` allowlist

**Allowed Tools (Lines 63-122):**
- Built-in: `Read`, `Write`, `Edit`, `Glob`, `Grep`, `Bash`, `WebFetch`, `WebSearch`
- MCP: `feature_*` tools (8 tools), `playwright_*` tools (14 tools in standard mode)
- YOLO mode: Excludes Playwright MCP for speed

**Security Hook Setup (Lines 191-194):**
```python
hooks={
    "PreToolUse": [
        HookMatcher(matcher="Bash", hooks=[bash_security_hook]),
    ],
}
```

**MCP Servers Configured (Lines 162-180):**
- **features**: Custom Python MCP server (feature_mcp.py) - always included
- **playwright**: Browser automation (npx @playwright/mcp@latest) - only in standard mode
- Both run in isolated processes with inherited environment

**To Remove Sandbox (Current Constraints):**

Location: `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\client.py` lines 127-133

Current:
```python
"sandbox": {"enabled": True, "autoAllowBashIfSandboxed": True},
```

To disable:
```python
"sandbox": {"enabled": False},  # Removes OS-level isolation
```

**Key Security Paths:**
- Settings file: `{project_dir}/.claude_settings.json` (lines 139-141)
- Bash validation: `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\security.py`

---

### **3. ORCHESTRATION FLOW**

**Entry Points:**
1. **CLI Launcher:** `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\start.py` (lines 348-374)
2. **Direct Demo:** `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\autonomous_agent_demo.py` (lines 130-138)

**Initializer → Coding Agent Coordination (agent.py):**

```python
# Line 145: Determines which agent to run
is_first_run = not has_features(project_dir)

# Line 157: Copy spec for initializer
if is_first_run:
    copy_spec_to_project(project_dir)

# Lines 182-190: Select prompt based on session type
if is_first_run:
    prompt = get_initializer_prompt(project_dir)
    is_first_run = False  # Only use initializer once
else:
    if yolo_mode:
        prompt = get_coding_prompt_yolo(project_dir)
    else:
        prompt = get_coding_prompt(project_dir)

# Lines 192-194: Execute selected agent
async with client:
    status, response = await run_agent_session(client, prompt, project_dir)
```

**Prompt Loading Fallback Chain (prompts.py lines 24-64):**

```python
# 1. Project-specific: {project_dir}/prompts/{name}.md
# 2. Base template: .claude/templates/{name}.template.md
```

**Template Files Location:**
- `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\.claude\templates\`
  - `initializer_prompt.template.md` - Generates 200+ feature test cases
  - `coding_prompt.template.md` - Implements features, runs tests, marks passing
  - `coding_prompt_yolo.template.md` - Fast iteration without testing
  - `app_spec.template.txt` - Application specification template

**Feature Database Flow (progress.py):**

```python
# Line 20-55: has_features() - Check if initializer should run
# Looks for features in: {project_dir}/features.db
# Falls back to legacy: {project_dir}/feature_list.json

# Lines 58-89: count_passing_tests() - Progress tracking
# Queries SQLite for passing/in_progress/total features

# Lines 122-199: send_progress_webhook() - Optional n8n notifications
# WEBHOOK_URL environment variable triggers notifications
```

**MCP Server Interaction (feature_mcp.py):**

Tools available to agent via MCP:
- `feature_get_stats()` - Get progress (passing, in_progress, total, %)
- `feature_get_next()` - Get highest-priority pending feature
- `feature_get_for_regression()` - Random passing features for testing
- `feature_mark_passing()` - Mark feature complete
- `feature_mark_in_progress()` - Mark feature being worked on
- `feature_skip()` - Move feature to end of queue
- `feature_create_bulk()` - Initialize all features (initializer only)
- `feature_clear_in_progress()` - Reset in-progress flag

**Project Registry (registry.py):**

```python
# Stores project name → path mappings
# Location: ~/.autocoder/registry.db (SQLite)
# Functions:
# - register_project(name, path) - Add project
# - get_project_path(name) - Lookup project by name
# - list_registered_projects() - All projects
# - validate_project_path(path) - Permission check
```

---

### **4. RECOMMENDATIONS FOR YOUR REQUIREMENTS**

**A. Remove Sandbox Constraints:**
- **File:** `client.py` line 128
- Change: `"sandbox": {"enabled": True}` → `"sandbox": {"enabled": False}`
- **Warning:** Removes OS-level bash isolation; ensure security hooks remain active

**B. Add New Agent Types (e.g., Git Agent):**
1. Create agent in `agent.py`: Add function like `async def run_git_agent()`
2. Update orchestration in `run_autonomous_agent()` to support agent type selection
3. Create prompt: `C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\.claude\templates\git_agent_prompt.template.md`
4. Add MCP server if needed (Git commands via bash or custom MCP)

**C. Enable Parallel Agent Execution:**
- **Current:** Sequential - each agent runs one per session (lines 165-210 in agent.py)
- **To parallelize:**
  1. Modify `run_agent_session()` to be non-blocking
  2. Wrap multiple agents in `asyncio.gather()` instead of sequential `async with client`
  3. Ensure database transactions prevent feature conflicts (SQLite has built-in locking)
  4. Consider using `agent.lock` file to prevent concurrent runs (see `start.py`)

---

### **Key Files Summary Table**

| File | Purpose | Lines |
|------|---------|-------|
| `agent.py` | Main orchestration loop | 35-231 |
| `client.py` | SDK config & security | 76-200 |
| `security.py` | Bash command allowlist | 14-374 |
| `autonomous_agent_demo.py` | Entry point | 101-148 |
| `mcp_server/feature_mcp.py` | Feature MCP tools | 118-250+ |
| `progress.py` | Progress tracking | 20-224 |
| `prompts.py` | Prompt loading | 24-229 |
| `registry.py` | Project registry | 135-283 |
| `api/database.py` | SQLite models | 19-94 |

---

### **Absolute Paths Reference**

```
C:\Users\MikeSwanson\claude-projects\Autocode-remix\Autocode-fork\autocoder-master\
├── agent.py                           # Orchestration logic
├── client.py                          # SDK setup & security
├── security.py                        # Bash validation
├── autonomous_agent_demo.py           # Entry point
├── prompts.py                         # Prompt loading
├── progress.py                        # Progress tracking
├── registry.py                        # Project registry
├── api/
│   └── database.py                    # SQLAlchemy models
├── mcp_server/
│   └── feature_mcp.py                 # Feature MCP server
└── .claude/
    ├── templates/
    │   ├── initializer_prompt.template.md
    │   ├── coding_prompt.template.md
    │   ├── coding_prompt_yolo.template.md
    │   └── app_spec.template.txt
    ├── commands/
    │   ├── create-spec.md
    │   └── import-spec.md
    └── skills/
        └── frontend-design/
```

This architecture supports extensibility for new agent types while maintaining security through multiple validation layers. The async pattern enables future parallel execution with proper database transaction handling.