|
1 | 1 | # Architecture |
2 | 2 |
|
3 | | -ARCHITECTURE PATTERN: CLI orchestration with subprocess delegation and a 3‑phase implement/review/finalize loop. |
4 | | -DIRECTORY STRUCTURE: Flat `src/` of single‑purpose modules; `.plans/` for PRD/tasks/progress; `.agents-docs/` for generated docs; tests co‑located in `src/`. |
5 | | -DESIGN PATTERNS: Command-style CLI (Commander), client abstraction (AgentClient), strategy via agent type, prompt builder/templates, atomic file ops for writes/moves. |
6 | | -DATABASE: None; state persisted as YAML/Markdown in `.plans/`. |
7 | | -API DESIGN: Not applicable; CLI commands drive subprocess agents and file-based workflows. |
8 | | - |
9 | | -- Code organization: TypeScript modules for config, agent spawning, prompts, PRD/task generation, status, pruning, logging, errors (`src/*.ts`). |
10 | | -- Config management: `.plans/hone.config.yml` with defaults + validation + phase overrides (`src/config.ts`). |
11 | | -- Dependency injection: None; config passed explicitly; logger uses module-level verbosity flag. |
12 | | -- Error handling: Centralized `HoneError`, formatted exits, classification + retry/backoff for network (`src/errors.ts`, `src/agent-client.ts`). |
13 | | -- Logging/monitoring: Verbose toggle + stdout/stderr passthrough; no metrics/tracing (`src/logger.ts`). |
14 | | -- Security patterns: Path traversal checks + permission validation for archive ops; model format validation (`src/prune.ts`, `src/config.ts`). |
15 | | -- Performance considerations: Subprocess streaming, timeouts, bounded retries; mostly small file I/O. |
16 | | -- Middleware/interceptors: None; direct module calls and CLI orchestration. |
17 | | -- API endpoints: None; interactions via CLI and agent subprocesses. |
| 3 | +ARCHITECTURE PATTERN: CLI orchestration with subprocess delegation and 3-phase implement/review/finalize loop |
| 4 | + |
| 5 | +DIRECTORY STRUCTURE: |
| 6 | +- Flat `src/` with single-purpose TypeScript modules (17 modules + 17 test files co-located) |
| 7 | +- `.plans/` for PRD files, task YAML, and config (`hone.config.yml`) |
| 8 | +- `.agents/` for generated documentation detail files |
| 9 | +- No nested folder hierarchy; one file per concern |
| 10 | + |
| 11 | +DESIGN PATTERNS: |
| 12 | +- **Command Pattern**: Commander.js CLI with discrete commands (`init`, `prd`, `run`, `status`, `prune`) |
| 13 | +- **Client Abstraction**: `AgentClient` mirrors Anthropic SDK API, wraps subprocess spawning |
| 14 | +- **Strategy Pattern**: Agent type (`opencode`/`claude`) determines subprocess command and model arg format |
| 15 | +- **Template/Builder**: `constructPrompt()` builds phase-specific prompts for implement/review/finalize |
| 16 | +- **Atomic Operations**: Temp file + rename for safe writes/moves in prune operations |
| 17 | + |
| 18 | +DATABASE: None - state persisted as YAML (tasks, config) and Markdown (PRDs) in `.plans/` |
| 19 | + |
| 20 | +API DESIGN: Not applicable - pure CLI tool; interactions via: |
| 21 | +- Subprocess spawning of `opencode` or `claude` agents |
| 22 | +- File-based workflows (read/write YAML and Markdown) |
| 23 | +- Signal handling (SIGINT/SIGTERM) for graceful subprocess termination |
| 24 | + |
| 25 | +Key architectural decisions: |
| 26 | +1. **Subprocess delegation**: Core work delegated to AI agent CLIs, hone orchestrates |
| 27 | +2. **Phase-based execution**: 3-phase loop (implement→review→finalize) per iteration |
| 28 | +3. **File-based state**: No database; `.plans/` directory is source of truth |
| 29 | +4. **Model flexibility**: Phase-specific model overrides via config |
| 30 | +5. **Error classification**: Structured error parsing with retry logic for network errors only |
| 31 | +6. **Atomic file ops**: Safe file moves using temp file patterns |
18 | 32 |
|
19 | 33 | --- |
20 | 34 |
|
|
0 commit comments