Skip to content

Commit c909f62

Browse files
committed
Update documentation content and add quick-start guide
1 parent 9685ca0 commit c909f62

25 files changed

Lines changed: 556 additions & 617 deletions

AGENTS.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,19 @@ AO now splits project-local config from scoped runtime state.
8989
Project-local config in `<project>/.ao/`:
9090

9191
- `config.json`
92-
- `pm-config.json`
9392
- `workflows.yaml`
9493
- `workflows/*.yaml`
9594

9695
Scoped runtime state in `~/.ao/<repo-scope>/`:
9796

9897
- `core-state.json`
9998
- `resume-config.json`
99+
- `workflow.db`
100+
- `config/`
101+
- `daemon/`
100102
- `docs/`
101-
- `requirements/`
102-
- `tasks/`
103-
- `index/`
104103
- `state/`
105-
- `runs/`
106-
- `artifacts/`
104+
- `worktrees/`
107105

108106
Global config in `protocol::Config::global_config_dir()`:
109107

docs/.vitepress/config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ export default withMermaid(
55
defineConfig({
66
title: 'AO',
77
description: 'Agent Orchestrator — orchestrate AI agent workflows from the command line',
8-
base: '/ao-cli/',
8+
base: '/ao/',
99

1010
head: [
11-
['link', { rel: 'icon', type: 'image/svg+xml', href: '/ao-cli/logo.svg' }],
11+
['link', { rel: 'icon', type: 'image/svg+xml', href: '/ao/logo.svg' }],
1212
],
1313

1414
lastUpdated: true,

docs/architecture/crate-map.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,55 @@
11
# Crate Map
22

3-
The AO workspace contains 17 crates organized into seven groups by responsibility.
3+
The AO workspace contains 17 crates organized by responsibility.
44

55
## Foundation
66

77
| Crate | Description | Key Responsibility |
88
|-------|-------------|-------------------|
9-
| [protocol](../../crates/protocol/README.md) | Wire protocol types shared across all crates | Defines IPC messages, configuration schemas, scoped state paths, model routing defaults, and CLI JSON envelope contracts |
10-
| [orchestrator-logging](../../crates/orchestrator-logging/Cargo.toml) | Shared tracing and logging utilities | Initializes tracing, writes structured JSONL logs, and manages log rotation for runtime processes |
9+
| [protocol](../../crates/protocol/README.md) | Shared wire and config types | IPC messages, config schemas, scoped runtime paths, CLI JSON envelopes |
1110

1211
## Core
1312

1413
| Crate | Description | Key Responsibility |
1514
|-------|-------------|-------------------|
16-
| [orchestrator-core](../../crates/orchestrator-core/README.md) | Domain logic and state management | ServiceHub trait, service API implementations, workflow state machines, task dispatch policy, execution projections |
17-
| [orchestrator-config](../../crates/orchestrator-config/README.md) | Workflow and runtime configuration | YAML workflow parsing, workflow config compilation, variable expansion, phase plan resolution |
18-
| [orchestrator-store](../../crates/orchestrator-store/README.md) | Persistence primitives | Atomic JSON writes (`write_json_atomic`), `read_json_or_default`, scoped project state directories |
15+
| [orchestrator-core](../../crates/orchestrator-core/README.md) | Domain logic and services | `ServiceHub`, service APIs, workflow lifecycle, task and requirement state mutation |
16+
| [orchestrator-config](../../crates/orchestrator-config/README.md) | Workflow and runtime configuration | Workflow YAML parsing, pack loading, scaffolding, phase plan resolution |
17+
| [orchestrator-store](../../crates/orchestrator-store/README.md) | Persistence primitives | Atomic JSON writes, repo-scoped state directory helpers |
18+
| `orchestrator-logging` | Shared logging support | Structured logging helpers and runtime log plumbing |
1919

2020
## Runtime
2121

2222
| Crate | Description | Key Responsibility |
2323
|-------|-------------|-------------------|
24-
| [orchestrator-daemon-runtime](../../crates/orchestrator-daemon-runtime/README.md) | Daemon tick loop and dispatch engine | Project tick execution, dispatch queue management, process manager for workflow-runner-v2 subprocesses, schedule evaluation, completion reconciliation |
25-
| [workflow-runner-v2](../../crates/workflow-runner-v2/Cargo.toml) | Standalone workflow execution binary | Phase execution loop, runtime contract construction, IPC client to agent-runner, phase failover classification, merge recovery |
26-
| [agent-runner](../../crates/agent-runner/README.md) | Standalone daemon managing LLM CLI processes | IPC server (Unix socket / TCP), token-based auth, output parsing (tool calls, artifacts, thinking blocks), environment sanitization, provider abstraction |
24+
| [orchestrator-daemon-runtime](../../crates/orchestrator-daemon-runtime/README.md) | Daemon scheduling runtime | Queue execution, reactive dispatch, subprocess supervision |
25+
| `workflow-runner-v2` | Workflow execution runtime | Phase execution, state-machine transitions, checkpoint persistence |
26+
| [agent-runner](../../crates/agent-runner/README.md) | Agent process runner | IPC server, AI CLI execution, output parsing |
2727

2828
## CLI
2929

3030
| Crate | Description | Key Responsibility |
3131
|-------|-------------|-------------------|
32-
| [orchestrator-cli](../../crates/orchestrator-cli/README.md) | Main `ao` binary (clap-based CLI) | CLI dispatch for 22 top-level commands, JSON envelope output, MCP server (via rmcp), error classification |
32+
| [orchestrator-cli](../../crates/orchestrator-cli/README.md) | Main `ao` binary | Clap command surface, JSON output, MCP server, operational commands |
3333

3434
## Web
3535

3636
| Crate | Description | Key Responsibility |
3737
|-------|-------------|-------------------|
38-
| [orchestrator-web-api](../../crates/orchestrator-web-api/README.md) | Web API business logic | WebApiService bridging HTTP requests to core service APIs |
39-
| [orchestrator-web-contracts](../../crates/orchestrator-web-contracts/README.md) | Shared web types | Request/response types shared between web-api and web-server |
40-
| [orchestrator-web-server](../../crates/orchestrator-web-server/README.md) | Axum web server with embedded static assets | HTTP routing, GraphQL (optional feature), static asset serving, compression |
38+
| [orchestrator-web-api](../../crates/orchestrator-web-api/README.md) | Web API business logic | HTTP-facing orchestration services |
39+
| [orchestrator-web-contracts](../../crates/orchestrator-web-contracts/README.md) | Shared web contracts | Request and response types shared between web layers |
40+
| [orchestrator-web-server](../../crates/orchestrator-web-server/README.md) | Axum web server | HTTP routing, embedded UI delivery, browser entrypoint |
4141

4242
## Integration
4343

4444
| Crate | Description | Key Responsibility |
4545
|-------|-------------|-------------------|
46-
| [orchestrator-providers](../../crates/orchestrator-providers/README.md) | External provider integrations | Git provider abstraction, task/requirements/subject providers; optional Jira, Linear, and GitLab features behind feature flags |
47-
| [orchestrator-notifications](../../crates/orchestrator-notifications/README.md) | Notification delivery | Webhook-based notifications for daemon and workflow events |
48-
| [orchestrator-git-ops](../../crates/orchestrator-git-ops/README.md) | Git workflow operations | Branch management, merge operations, PR creation, merge conflict handling for workflow post-success actions |
46+
| [orchestrator-providers](../../crates/orchestrator-providers/README.md) | Provider integrations | Built-in task, requirement, subject, and git adapters |
47+
| [orchestrator-notifications](../../crates/orchestrator-notifications/README.md) | Notification delivery | Webhook and runtime notification support |
48+
| [orchestrator-git-ops](../../crates/orchestrator-git-ops/README.md) | Git automation | Branching, worktree, merge, and PR helper operations |
4949

50-
## LLM
50+
## Model and Runner Adapters
5151

5252
| Crate | Description | Key Responsibility |
5353
|-------|-------------|-------------------|
54-
| [llm-cli-wrapper](../../crates/llm-cli-wrapper/README.md) | Abstraction over AI CLI tools | Unified interface for spawning and interacting with claude, codex, gemini, opencode CLI processes |
55-
| [oai-runner](../../crates/oai-runner/README.md) | OpenAI-compatible streaming API client | Direct API streaming for OpenAI-compatible endpoints, MCP client integration via rmcp |
54+
| [llm-cli-wrapper](../../crates/llm-cli-wrapper/README.md) | AI CLI abstraction layer | Claude, Codex, Gemini, and related CLI integration |
55+
| [oai-runner](../../crates/oai-runner/README.md) | OpenAI-compatible runner | Streaming API execution for OpenAI-compatible endpoints |

docs/architecture/index.md

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Architecture Overview
22

3-
AO is a Rust-only agent orchestrator CLI built as a 17-crate Cargo workspace. It provides a CLI, daemon, agent runner, LLM wrappers, MCP server, and web UI for orchestrating AI agent workflows.
3+
AO is a Rust-only agent orchestrator CLI built as a 17-crate Cargo workspace. It provides a CLI, daemon runtime, workflow runner, agent runner, MCP server, and web UI for orchestrating AI workflows.
44

55
## Crate Dependency Graph
66

@@ -16,13 +16,13 @@ graph TD
1616
AR[agent-runner]
1717
LLM[llm-cli-wrapper]
1818
OAI[oai-runner]
19-
LOG[orchestrator-logging]
2019
WAPI[orchestrator-web-api]
2120
WCON[orchestrator-web-contracts]
2221
WSRV[orchestrator-web-server]
2322
PROV[orchestrator-providers]
2423
NOTIF[orchestrator-notifications]
2524
GIT[orchestrator-git-ops]
25+
LOG[orchestrator-logging]
2626
2727
CLI --> CORE
2828
CLI --> DAEMON
@@ -34,24 +34,21 @@ graph TD
3434
CLI --> NOTIF
3535
CLI --> LLM
3636
CLI --> PROTO
37-
CLI --> LOG
3837
3938
WSRV --> WAPI
4039
WSRV --> WCON
41-
WSRV --> LOG
4240
WAPI --> CORE
4341
WAPI --> DAEMON
4442
WAPI --> WCON
4543
WAPI --> PROTO
46-
WAPI --> LOG
4744
4845
DAEMON --> CORE
4946
DAEMON --> WR
5047
DAEMON --> GIT
5148
DAEMON --> NOTIF
5249
DAEMON --> PROV
53-
DAEMON --> PROTO
5450
DAEMON --> LOG
51+
DAEMON --> PROTO
5552
5653
GIT --> CORE
5754
GIT --> WR
@@ -60,35 +57,32 @@ graph TD
6057
WR --> CORE
6158
WR --> CONFIG
6259
WR --> PROTO
63-
WR --> LOG
6460
6561
CORE --> STORE
6662
CORE --> CONFIG
6763
CORE --> PROV
6864
CORE --> LLM
65+
CORE --> LOG
6966
CORE --> PROTO
7067
7168
AR --> LLM
7269
AR --> PROTO
73-
AR --> LOG
7470
7571
OAI --> PROTO
76-
OAI --> LOG
7772
7873
STORE --> PROTO
7974
CONFIG --> PROTO
8075
PROV --> PROTO
8176
NOTIF --> PROTO
8277
WCON --> PROTO
78+
LOG --> PROTO
8379
```
8480

85-
**protocol** sits at the foundation -- every crate depends on it for shared wire types, configuration, and IPC contracts.
86-
87-
**orchestrator-core** occupies the middle layer, providing domain logic, state management, and the ServiceHub dependency injection pattern.
81+
`protocol` sits at the foundation for shared types, configuration shapes, and runtime path derivation.
8882

89-
**orchestrator-logging** centralizes tracing initialization and structured file logging for runtime binaries.
83+
`orchestrator-core` provides the domain services and state mutation APIs used by the CLI, web layer, and daemon.
9084

91-
**orchestrator-cli** sits at the top as the main `ao` binary, composing all other crates into the user-facing command surface.
85+
`orchestrator-cli` composes the workspace into the user-facing `ao` command surface.
9286

9387
## Architecture Decision Records
9488

@@ -101,5 +95,5 @@ graph TD
10195
## Deep Dives
10296

10397
- [Crate Map](crate-map.md) -- All 17 crates grouped by responsibility with descriptions
104-
- [ServiceHub Pattern](service-hub.md) -- Dependency injection via the ServiceHub trait
98+
- [ServiceHub Pattern](service-hub.md) -- Dependency injection via the `ServiceHub` trait
10599
- [llm-cli-wrapper Session Backends](llm-cli-wrapper-session-backends.md) -- Planned unified session facade for SDK-backed CLI integrations

docs/architecture/service-hub.md

Lines changed: 39 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,54 @@
11
# ServiceHub Pattern
22

3-
The `ServiceHub` trait is AO's dependency injection mechanism. It provides a uniform interface for accessing all domain service APIs, allowing production code and tests to share the same business logic with different backing implementations.
4-
5-
## The ServiceHub Trait
6-
7-
Defined in `crates/orchestrator-core/src/services.rs`:
8-
9-
```rust
10-
pub trait ServiceHub: Send + Sync {
11-
fn daemon(&self) -> Arc<dyn DaemonServiceApi>;
12-
fn projects(&self) -> Arc<dyn ProjectServiceApi>;
13-
fn tasks(&self) -> Arc<dyn TaskServiceApi>;
14-
fn task_provider(&self) -> Arc<dyn TaskProvider>;
15-
fn subject_resolver(&self) -> Arc<dyn SubjectResolver>;
16-
fn workflows(&self) -> Arc<dyn WorkflowServiceApi>;
17-
fn planning(&self) -> Arc<dyn PlanningServiceApi>;
18-
fn requirements_provider(&self) -> Arc<dyn RequirementsProvider>;
19-
fn project_adapter(&self) -> Arc<dyn ProjectAdapter>;
20-
fn review(&self) -> Arc<dyn ReviewServiceApi>;
21-
}
22-
```
23-
24-
Each accessor returns an `Arc<dyn Trait>`, enabling shared ownership and dynamic dispatch across async boundaries.
3+
The `ServiceHub` trait is AO's dependency injection boundary. It gives the CLI, daemon, tests, and web layers one uniform way to access domain services.
254

26-
## Service API Traits
5+
## The Trait
276

28-
Each domain area is defined as an async trait:
7+
Defined in `crates/orchestrator-core/src/services.rs`, `ServiceHub` exposes the core service APIs:
298

30-
| Trait | Responsibility |
31-
|-------|---------------|
32-
| `DaemonServiceApi` | Start, stop, pause, resume, health, logs |
33-
| `ProjectServiceApi` | List, get, create, upsert, archive, remove projects |
34-
| `TaskServiceApi` | CRUD, status transitions, assignment, checklist, dependencies |
35-
| `WorkflowServiceApi` | Run, resume, pause, cancel, phase completion, merge conflict handling |
36-
| `PlanningServiceApi` | Vision drafting, requirements CRUD, execution |
37-
| `ReviewServiceApi` | Agent handoff requests |
9+
- `daemon()`
10+
- `projects()`
11+
- `tasks()`
12+
- `task_provider()`
13+
- `subject_resolver()`
14+
- `workflows()`
15+
- `planning()`
16+
- `requirements_provider()`
17+
- `project_adapter()`
18+
- `review()`
3819

39-
Provider traits (`TaskProvider`, `RequirementsProvider`, `SubjectResolver`, `ProjectAdapter`, `GitProvider`) abstract external data sources so integrations (Jira, Linear, GitLab) can be swapped in via feature flags.
20+
Each accessor returns an `Arc<dyn Trait>` so callers can share service implementations across async boundaries.
4021

41-
## FileServiceHub (Production)
22+
## Production: `FileServiceHub`
4223

43-
`FileServiceHub` is the production implementation. It persists all state as JSON files under the scoped project directory.
24+
`FileServiceHub` is the production implementation.
4425

45-
```
46-
~/.ao/<repo-scope>/
47-
state/
48-
core-state.json
49-
workflow-config.compiled.json
50-
agent-runtime-config.v2.json
51-
state-machines.v1.json
52-
...
53-
workflows/
54-
<workflow-id>.json
55-
...
56-
```
26+
At startup it:
5727

58-
Construction happens at CLI startup:
28+
1. resolves the project root
29+
2. bootstraps `.ao/` project config and the repo-scoped runtime root under `~/.ao/<repo-scope>/`
30+
3. loads `core-state.json`
31+
4. loads persisted workflows, tasks, and requirements from `workflow.db`
32+
5. returns a service hub backed by filesystem and SQLite state
5933

60-
1. Resolve the project root from the current working directory (or `--project-root` flag)
61-
2. Bootstrap base configs (workflow config, agent runtime config) if missing
62-
3. Load `core-state.json` into an `Arc<RwLock<CoreState>>` for concurrent access
63-
4. Load workflow state from individual workflow JSON files
64-
5. Return the hub, ready for service API calls
34+
Important runtime files:
6535

66-
File locking (`fs2::FileExt`) protects concurrent access when multiple CLI invocations or daemon ticks operate on the same project state.
36+
```text
37+
~/.ao/<repo-scope>/
38+
├── core-state.json
39+
├── resume-config.json
40+
├── workflow.db
41+
├── config/state-machines.v1.json
42+
├── state/
43+
├── daemon/
44+
└── worktrees/
45+
```
6746

68-
## InMemoryServiceHub (Tests)
47+
`FileServiceHub` uses file locking around `core-state.json` mutations so concurrent CLI invocations and daemon work do not trample each other.
6948

70-
`InMemoryServiceHub` holds all state in an `Arc<RwLock<CoreState>>` with no file I/O. This enables fast, isolated unit tests that exercise the same service logic without touching the filesystem.
49+
## Tests: `InMemoryServiceHub`
7150

72-
```rust
73-
let hub = InMemoryServiceHub::new();
74-
let task = hub.tasks().create(TaskCreateInput { ... }).await?;
75-
assert_eq!(task.status, TaskStatus::Backlog);
76-
```
51+
`InMemoryServiceHub` keeps the same service surface but stores everything in memory. That lets tests exercise the same business logic without filesystem I/O.
7752

7853
## Dependency Flow
7954

@@ -84,7 +59,7 @@ graph TD
8459
FILE["FileServiceHub"]
8560
MEM["InMemoryServiceHub"]
8661
APIS["Service API traits"]
87-
STATE["CoreState"]
62+
STATE["CoreState + workflow.db"]
8863
STORE["orchestrator-store"]
8964
9065
CLI --> HUB
@@ -95,7 +70,7 @@ graph TD
9570
FILE --> STATE
9671
MEM --> STATE
9772
FILE --> STORE
98-
STORE -->|"write_json_atomic"| FS["Filesystem"]
73+
STORE --> FS["Filesystem"]
9974
```
10075

101-
All callers depend only on `ServiceHub` and the service API traits. The concrete implementation is chosen at the composition root (CLI main, test setup, or web server initialization).
76+
All higher layers depend on `ServiceHub` and the service traits, not on concrete storage details.

docs/architecture/workflow-first-cli.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
AO now treats workflow dispatch as the primary execution surface.
66

7-
- planning commands dispatch canonical workflow refs such as `ao.vision/draft`
8-
and `ao.requirement/execute`
7+
- workflow and requirements surfaces dispatch canonical workflow refs such as
8+
`ao.task/standard` and `ao.requirement/execute`
99
- task and requirement domain behavior resolves from bundled first-party packs
10-
and project/local overrides
10+
and project-local overrides
1111
- legacy `builtin/*` refs remain as compatibility aliases, not as the preferred
1212
operator-facing surface
1313

@@ -42,8 +42,8 @@ This keeps the runtime aligned with the plugin-pack kernel design:
4242

4343
| Command | Canonical Ref |
4444
|---|---|
45-
| `ao vision draft` | `ao.vision/draft` |
46-
| `ao requirements draft` | `ao.requirement/draft` |
45+
| `ao workflow run ao.vision/draft --title "..." --sync` | `ao.vision/draft` |
46+
| `ao workflow run ao.requirement/draft --title "..." --sync` | `ao.requirement/draft` |
4747
| `ao requirements execute --id REQ-001` | `ao.requirement/execute` |
4848
| `ao workflow run ao.task/standard` | `ao.task/standard` |
4949

docs/concepts/how-ao-works.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ shims, but they are no longer the preferred operator-facing surface.
134134

135135
There is no dedicated `ao vision ...` command in the current CLI. Planning
136136
workflows still exist as canonical refs, but they are consumed through
137-
`ao workflow run` or project-local workflow YAML.
137+
`ao workflow run <workflow_ref>` or project-local workflow YAML.
138138

139139
## MCP and External Runtimes
140140

docs/concepts/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ This section explains the core ideas behind AO. Each page covers one architectur
55
## Pages
66

77
- [How AO Works](./how-ao-works.md) -- Core architecture, the three-layer model, and the big picture.
8-
- [Workflows](./workflows.md) -- Everything is a YAML workflow: builtin, task, and custom workflows.
8+
- [Workflows](./workflows.md) -- Everything is a workflow: bundled refs, pack-qualified workflows, and project-local YAML.
99
- [Subject Dispatch](./subject-dispatch.md) -- The universal work envelope that drives all execution.
1010
- [The Daemon](./daemon.md) -- The dumb scheduler: tick loop, capacity, and execution facts.
1111
- [Agents and Phases](./agents-and-phases.md) -- AI personas, phase execution, rework loops, and phase guards.
1212
- [MCP Integration](./mcp-tools.md) -- How agents use MCP tools to observe and mutate state.
13-
- [State Management](./state-management.md) -- The `.ao/` directory, atomic writes, and mutation policy.
13+
- [State Management](./state-management.md) -- The split between project-local `.ao/` config and repo-scoped runtime state.
1414
- [Worktree Isolation](./worktrees.md) -- Every task gets its own git worktree for safe parallel execution.

0 commit comments

Comments
 (0)