Skip to content

Commit b2ab1ec

Browse files
committed
add documentation
1 parent 016eead commit b2ab1ec

23 files changed

Lines changed: 3291 additions & 38 deletions

CLAUDE.md

Lines changed: 126 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ python autonomous_agent_demo.py --project-dir my-app --yolo
5454

5555
# Parallel mode: run multiple agents concurrently (1-5 agents)
5656
python autonomous_agent_demo.py --project-dir my-app --parallel --max-concurrency 3
57+
58+
# Batch mode: implement multiple features per agent session (1-3)
59+
python autonomous_agent_demo.py --project-dir my-app --batch-size 3
60+
61+
# Batch specific features by ID
62+
python autonomous_agent_demo.py --project-dir my-app --batch-features 1,2,3
5763
```
5864

5965
### YOLO Mode (Rapid Prototyping)
@@ -68,7 +74,7 @@ python autonomous_agent_demo.py --project-dir my-app --yolo
6874
```
6975

7076
**What's different in YOLO mode:**
71-
- No regression testing (skips `feature_get_for_regression`)
77+
- No regression testing
7278
- No Playwright MCP server (browser automation disabled)
7379
- Features marked passing after lint/type-check succeeds
7480
- Faster iteration for prototyping
@@ -97,22 +103,31 @@ npm run lint # Run ESLint
97103
### Python
98104

99105
```bash
100-
ruff check . # Lint
101-
mypy . # Type check
102-
python test_security.py # Security unit tests (163 tests)
103-
python test_security_integration.py # Integration tests (9 tests)
106+
ruff check . # Lint
107+
mypy . # Type check
108+
python test_security.py # Security unit tests (12 tests)
109+
python test_security_integration.py # Integration tests (9 tests)
110+
python -m pytest test_client.py # Client tests (20 tests)
111+
python -m pytest test_dependency_resolver.py # Dependency resolver tests (12 tests)
112+
python -m pytest test_rate_limit_utils.py # Rate limit tests (22 tests)
104113
```
105114

106115
### React UI
107116

108117
```bash
109118
cd ui
110119
npm run lint # ESLint
111-
npm run build # Type check + build
120+
npm run build # Type check + build (Vite 7)
112121
npm run test:e2e # Playwright end-to-end tests
113122
npm run test:e2e:ui # Playwright tests with UI
114123
```
115124

125+
### CI/CD
126+
127+
GitHub Actions (`.github/workflows/ci.yml`) runs on push/PR to master:
128+
- **Python job**: ruff lint + security tests
129+
- **UI job**: ESLint + TypeScript build
130+
116131
### Code Quality
117132

118133
Configuration in `pyproject.toml`:
@@ -124,16 +139,21 @@ Configuration in `pyproject.toml`:
124139
### Core Python Modules
125140

126141
- `start.py` - CLI launcher with project creation/selection menu
127-
- `autonomous_agent_demo.py` - Entry point for running the agent
142+
- `autonomous_agent_demo.py` - Entry point for running the agent (supports `--yolo`, `--parallel`, `--batch-size`, `--batch-features`)
128143
- `autocoder_paths.py` - Central path resolution with dual-path backward compatibility and migration
129144
- `agent.py` - Agent session loop using Claude Agent SDK
130-
- `client.py` - ClaudeSDKClient configuration with security hooks and MCP servers
145+
- `client.py` - ClaudeSDKClient configuration with security hooks, MCP servers, and Vertex AI support
131146
- `security.py` - Bash command allowlist validation (ALLOWED_COMMANDS whitelist)
132-
- `prompts.py` - Prompt template loading with project-specific fallback
147+
- `prompts.py` - Prompt template loading with project-specific fallback and batch feature prompts
133148
- `progress.py` - Progress tracking, database queries, webhook notifications
134-
- `registry.py` - Project registry for mapping names to paths (cross-platform)
149+
- `registry.py` - Project registry for mapping names to paths (cross-platform), global settings model
135150
- `parallel_orchestrator.py` - Concurrent agent execution with dependency-aware scheduling
151+
- `auth.py` - Authentication error detection for Claude CLI
152+
- `env_constants.py` - Shared environment variable constants (API_ENV_VARS) used by client.py and chat sessions
153+
- `rate_limit_utils.py` - Rate limit detection, retry parsing, exponential backoff with jitter
154+
- `api/database.py` - SQLAlchemy models (Feature, Schedule, ScheduleOverride)
136155
- `api/dependency_resolver.py` - Cycle detection (Kahn's algorithm + DFS) and dependency validation
156+
- `api/migration.py` - JSON-to-SQLite migration utility
137157

138158
### Project Registry
139159

@@ -147,13 +167,36 @@ The registry uses:
147167

148168
### Server API (server/)
149169

150-
The FastAPI server provides REST endpoints for the UI:
151-
152-
- `server/routers/projects.py` - Project CRUD with registry integration
153-
- `server/routers/features.py` - Feature management
154-
- `server/routers/agent.py` - Agent control (start/stop/pause/resume)
155-
- `server/routers/filesystem.py` - Filesystem browser API with security controls
156-
- `server/routers/spec_creation.py` - WebSocket for interactive spec creation
170+
The FastAPI server provides REST and WebSocket endpoints for the UI:
171+
172+
**Routers** (`server/routers/`):
173+
- `projects.py` - Project CRUD with registry integration
174+
- `features.py` - Feature management
175+
- `agent.py` - Agent control (start/stop/pause/resume)
176+
- `filesystem.py` - Filesystem browser API with security controls
177+
- `spec_creation.py` - WebSocket for interactive spec creation
178+
- `expand_project.py` - Interactive project expansion via natural language
179+
- `assistant_chat.py` - Read-only project assistant chat (WebSocket/REST)
180+
- `terminal.py` - Interactive terminal I/O with PTY support (WebSocket bidirectional)
181+
- `devserver.py` - Dev server control (start/stop) and config
182+
- `schedules.py` - CRUD for time-based agent scheduling
183+
- `settings.py` - Global settings management (model selection, YOLO, batch size, headless browser)
184+
185+
**Services** (`server/services/`):
186+
- `process_manager.py` - Agent process lifecycle management
187+
- `project_config.py` - Project type detection and dev command management
188+
- `terminal_manager.py` - Terminal session management with PTY (`pywinpty` on Windows)
189+
- `scheduler_service.py` - APScheduler-based automated agent scheduling
190+
- `dev_server_manager.py` - Dev server lifecycle management
191+
- `assistant_chat_session.py` / `assistant_database.py` - Assistant chat sessions with SQLite persistence
192+
- `spec_chat_session.py` - Spec creation chat sessions
193+
- `expand_chat_session.py` - Expand project chat sessions
194+
- `chat_constants.py` - Shared constants for chat services
195+
196+
**Utilities** (`server/utils/`):
197+
- `process_utils.py` - Process management utilities
198+
- `project_helpers.py` - Project path resolution helpers
199+
- `validation.py` - Project name validation
157200

158201
### Feature Management
159202

@@ -164,18 +207,26 @@ Features are stored in SQLite (`features.db`) via SQLAlchemy. The agent interact
164207

165208
MCP tools available to the agent:
166209
- `feature_get_stats` - Progress statistics
167-
- `feature_get_next` - Get highest-priority pending feature (respects dependencies)
168-
- `feature_claim_next` - Atomically claim next available feature (for parallel mode)
169-
- `feature_get_for_regression` - Random passing features for regression testing
210+
- `feature_get_by_id` - Get a single feature by ID
211+
- `feature_get_summary` - Get summary of all features
212+
- `feature_get_ready` - Get features ready to work on (dependencies met)
213+
- `feature_get_blocked` - Get features blocked by unmet dependencies
214+
- `feature_get_graph` - Get full dependency graph
215+
- `feature_claim_and_get` - Atomically claim next available feature (for parallel mode)
216+
- `feature_mark_in_progress` - Mark feature as in progress
170217
- `feature_mark_passing` - Mark feature complete
218+
- `feature_mark_failing` - Mark feature as failing
171219
- `feature_skip` - Move feature to end of queue
220+
- `feature_clear_in_progress` - Clear in-progress status
172221
- `feature_create_bulk` - Initialize all features (used by initializer)
222+
- `feature_create` - Create a single feature
173223
- `feature_add_dependency` - Add dependency between features (with cycle detection)
174224
- `feature_remove_dependency` - Remove a dependency
225+
- `feature_set_dependencies` - Set all dependencies for a feature at once
175226

176227
### React UI (ui/)
177228

178-
- Tech stack: React 19, TypeScript, TanStack Query, Tailwind CSS v4, Radix UI, dagre (graph layout)
229+
- Tech stack: React 19, TypeScript, Vite 7, TanStack Query, Tailwind CSS v4, Radix UI, dagre (graph layout), xterm.js (terminal)
179230
- `src/App.tsx` - Main app with project selection, kanban board, agent controls
180231
- `src/hooks/useWebSocket.ts` - Real-time updates via WebSocket (progress, agent status, logs, agent updates)
181232
- `src/hooks/useProjects.ts` - React Query hooks for API calls
@@ -187,6 +238,12 @@ Key components:
187238
- `DependencyGraph.tsx` - Interactive node graph visualization with dagre layout
188239
- `CelebrationOverlay.tsx` - Confetti animation on feature completion
189240
- `FolderBrowser.tsx` - Server-side filesystem browser for project folder selection
241+
- `Terminal.tsx` / `TerminalTabs.tsx` - xterm.js-based multi-tab terminal
242+
- `AssistantPanel.tsx` / `AssistantChat.tsx` - AI assistant for project Q&A
243+
- `ExpandProjectModal.tsx` / `ExpandProjectChat.tsx` - Add features via natural language
244+
- `DevServerControl.tsx` - Dev server start/stop control
245+
- `ScheduleModal.tsx` - Schedule management UI
246+
- `SettingsModal.tsx` - Global settings panel
190247

191248
Keyboard shortcuts (press `?` for help):
192249
- `D` - Toggle debug panel
@@ -248,15 +305,6 @@ The following directories (relative to home) are always blocked:
248305
- `.docker`, `.config/gcloud` - Container/cloud configs
249306
- `.npmrc`, `.pypirc`, `.netrc` - Package manager credentials
250307

251-
**Example Output:**
252-
253-
```
254-
Created security settings at /path/to/project/.claude_settings.json
255-
- Sandbox enabled (OS-level bash isolation)
256-
- Filesystem restricted to: /path/to/project
257-
- Extra read paths (validated): /Users/me/docs, /opt/shared-libs
258-
```
259-
260308
#### Per-Project Allowed Commands
261309

262310
The agent's bash command access is controlled through a hierarchical configuration system:
@@ -318,13 +366,29 @@ blocked_commands:
318366

319367
**Files:**
320368
- `security.py` - Command validation logic and hardcoded blocklist
321-
- `test_security.py` - Unit tests for security system (136 tests)
322-
- `test_security_integration.py` - Integration tests with real hooks (9 tests)
323-
- `TEST_SECURITY.md` - Quick testing reference guide
369+
- `test_security.py` - Unit tests for security system
370+
- `test_security_integration.py` - Integration tests with real hooks
324371
- `examples/project_allowed_commands.yaml` - Project config example (all commented by default)
325372
- `examples/org_config.yaml` - Org config example (all commented by default)
326373
- `examples/README.md` - Comprehensive guide with use cases, testing, and troubleshooting
327374

375+
### Vertex AI Configuration (Optional)
376+
377+
Run coding agents via Google Cloud Vertex AI:
378+
379+
1. Install and authenticate gcloud CLI: `gcloud auth application-default login`
380+
2. Configure `.env`:
381+
```
382+
CLAUDE_CODE_USE_VERTEX=1
383+
CLOUD_ML_REGION=us-east5
384+
ANTHROPIC_VERTEX_PROJECT_ID=your-gcp-project-id
385+
ANTHROPIC_DEFAULT_OPUS_MODEL=claude-opus-4-5@20251101
386+
ANTHROPIC_DEFAULT_SONNET_MODEL=claude-sonnet-4-5@20250929
387+
ANTHROPIC_DEFAULT_HAIKU_MODEL=claude-3-5-haiku@20241022
388+
```
389+
390+
**Note:** Use `@` instead of `-` in model names for Vertex AI.
391+
328392
### Ollama Local Models (Optional)
329393

330394
Run coding agents using local models via Ollama v0.14.0+:
@@ -360,8 +424,24 @@ Run coding agents using local models via Ollama v0.14.0+:
360424

361425
## Claude Code Integration
362426

363-
- `.claude/commands/create-spec.md` - `/create-spec` slash command for interactive spec creation
364-
- `.claude/skills/frontend-design/SKILL.md` - Skill for distinctive UI design
427+
**Slash commands** (`.claude/commands/`):
428+
- `/create-spec` - Interactive spec creation for new projects
429+
- `/expand-project` - Expand existing project with new features
430+
- `/gsd-to-autocoder-spec` - Convert GSD codebase mapping to app_spec.txt
431+
- `/check-code` - Run lint and type-check for code quality
432+
- `/checkpoint` - Create comprehensive checkpoint commit
433+
- `/review-pr` - Review pull requests
434+
435+
**Custom agents** (`.claude/agents/`):
436+
- `coder.md` - Elite software architect agent for code implementation (Opus)
437+
- `code-review.md` - Code review agent for quality/security/performance analysis (Opus)
438+
- `deep-dive.md` - Technical investigator for deep analysis and debugging (Opus)
439+
440+
**Skills** (`.claude/skills/`):
441+
- `frontend-design` - Distinctive, production-grade UI design
442+
- `gsd-to-autocoder-spec` - Convert GSD codebase mapping to Autocoder app_spec format
443+
444+
**Other:**
365445
- `.claude/templates/` - Prompt templates copied to new projects
366446
- `examples/` - Configuration examples and documentation for security settings
367447

@@ -392,7 +472,7 @@ The UI receives updates via WebSocket (`/ws/projects/{project_name}`):
392472

393473
When running with `--parallel`, the orchestrator:
394474
1. Spawns multiple Claude agents as subprocesses (up to `--max-concurrency`)
395-
2. Each agent claims features atomically via `feature_claim_next`
475+
2. Each agent claims features atomically via `feature_claim_and_get`
396476
3. Features blocked by unmet dependencies are skipped
397477
4. Browser contexts are isolated per agent using `--isolated` flag
398478
5. AgentTracker parses output and emits `agent_update` messages for UI
@@ -405,6 +485,16 @@ The orchestrator enforces strict bounds on concurrent processes:
405485
- Testing agents are capped at `max_concurrency` (same as coding agents)
406486
- Total process count never exceeds 11 Python processes (1 orchestrator + 5 coding + 5 testing)
407487

488+
### Multi-Feature Batching
489+
490+
Agents can implement multiple features per session using `--batch-size` (1-3, default: 3):
491+
- `--batch-size N` - Max features per coding agent batch
492+
- `--testing-batch-size N` - Features per testing batch (1-5, default: 3)
493+
- `--batch-features 1,2,3` - Specific feature IDs for batch implementation
494+
- `--testing-batch-features 1,2,3` - Specific feature IDs for batch regression testing
495+
- `prompts.py` provides `get_batch_feature_prompt()` for multi-feature prompt generation
496+
- Configurable in UI via settings panel
497+
408498
### Design System
409499

410500
The UI uses a **neobrutalism** design with Tailwind CSS v4:

ui/src/App.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { ThemeSelector } from './components/ThemeSelector'
2828
import { ResetProjectModal } from './components/ResetProjectModal'
2929
import { ProjectSetupRequired } from './components/ProjectSetupRequired'
3030
import { getDependencyGraph, startAgent } from './lib/api'
31-
import { Loader2, Settings, Moon, Sun, RotateCcw } from 'lucide-react'
31+
import { Loader2, Settings, Moon, Sun, RotateCcw, BookOpen } from 'lucide-react'
3232
import type { Feature } from './lib/types'
3333
import { Button } from '@/components/ui/button'
3434
import { Card, CardContent } from '@/components/ui/card'
@@ -335,6 +335,17 @@ function App() {
335335
</>
336336
)}
337337

338+
{/* Docs link */}
339+
<Button
340+
onClick={() => { window.location.hash = '#/docs' }}
341+
variant="outline"
342+
size="sm"
343+
title="Documentation"
344+
aria-label="Open Documentation"
345+
>
346+
<BookOpen size={18} />
347+
</Button>
348+
338349
{/* Theme selector */}
339350
<ThemeSelector
340351
themes={themes}

0 commit comments

Comments
 (0)