CLEO System Architecture Specification
Version: 1.0.0 Status: DRAFT Created: 2025-12-29 Last Updated: 2025-12-29 Purpose: High-level architecture connecting all CLEO subsystemsRFC 2119 Conformance
The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “NOT RECOMMENDED”, “MAY”, and “OPTIONAL” in this document are to be interpreted as described in BCP 14 RFC 2119 RFC 8174 when, and only when, they appear in all capitals, as shown here.Preamble
Purpose
This specification provides the definitive high-level architecture for CLEO, showing how all subsystems connect into a unified task management and development orchestration platform. It serves as the “system nervous system” view, establishing the complete lifecycle from idea inception through implementation, release, and feedback.Authority
This specification is AUTHORITATIVE for:- System-wide architecture and subsystem boundaries
- Inter-spec relationships and data flow
- Complete lifecycle model (Idea → Release → Feedback)
- Pipeline stage boundaries and handoff protocols
- Single source of truth principles
- Exit code range allocation across subsystems
Core Principle
Everything is a Task. All work in CLEO is represented as Tasks or Epics. There are no separate “issue”, “bug”, or “feature” entities. Different work types are distinguished by fields (origin,labels,epicLifecycle), not by entity type.
Part 1: The Complete CLEO Lifecycle
1.1 Lifecycle Overview
1.2 Stage Summary Table
| Stage | Input | Output | Authoritative Spec | Exit Codes |
|---|---|---|---|---|
| Ingestion & Triage | External inputs, ideas | Triaged Task/Epic | ISSUE-LIFECYCLE-SPEC | 60-69 |
| RCSD Pipeline | Epic requiring research | Decomposed tasks | RCSD-PIPELINE-SPEC | 30-39 |
| Implementation | Ready tasks | Verified code | IMPLEMENTATION-ORCHESTRATION-SPEC | 40-49 |
| Release | Completed Epics | Shipped release | RELEASE-MANAGEMENT-SPEC | 50-59 |
Part 2: The Data Model
2.1 Single Source of Truth: todo.json
All state is stored in.cleo/todo.json. There are no separate issue trackers, feature databases, or release registries. Everything is derived from or stored in this single file:
2.2 The Task Entity
Every work item is a Task with optional extensions:2.3 Schema Extensions by Spec
| Spec | Adds to Task | Adds to Root |
|---|---|---|
| IMPLEMENTATION-ORCHESTRATION | verification, epicLifecycle | - |
| RELEASE-MANAGEMENT | release | releases |
| ISSUE-LIFECYCLE | origin | - |
Part 3: Subsystem Boundaries
3.1 Specification Authority Matrix
3.2 Exit Code Allocation
| Range | Subsystem | Authoritative Spec |
|---|---|---|
| 0-9 | Core CLI | LLM-AGENT-FIRST-SPEC |
| 10-19 | Hierarchy | TASK-HIERARCHY-SPEC |
| 20-29 | Session | MULTI-SESSION-SPEC |
| 30-39 | RCSD Pipeline | RCSD-PIPELINE-SPEC |
| 40-49 | Implementation | IMPLEMENTATION-ORCHESTRATION-SPEC |
| 50-59 | Release | RELEASE-MANAGEMENT-SPEC |
| 60-69 | Issue/Bug | ISSUE-LIFECYCLE-SPEC |
| 100+ | Special (not errors) | LLM-AGENT-FIRST-SPEC |
3.3 Inter-Spec Data Flow
Part 4: The Two-Dimensional Work Model
4.1 Epics vs Phases
From PROJECT-LIFECYCLE-SPEC, work is organized in two dimensions:- Phases are WHERE you are in the project lifecycle (stored in
project.currentPhase) - Epics are WHAT capabilities you’re building (tracked via
epicLifecycle) - Tasks are HOW you build them (at the intersection, with
phasefield) - Waves are computed execution order from dependency DAG (not stored)
4.2 Epic Lifecycle vs Task Status
| Field | Purpose | Values | Scope |
|---|---|---|---|
task.status | Current work state | pending, active, blocked, done, cancelled | All tasks |
epic.epicLifecycle | Epic journey stage | backlog, planning, active, review, released, archived | Epics only |
project.currentPhase | Project-wide focus | setup, core, testing, polish, maintenance | Global |
4.3 Wave Computation
Waves are parallel execution groups computed from dependencies:Part 5: Agent Architecture
5.1 Agent Types by Pipeline Stage
| Stage | Agent | Purpose | Claude Code subagent_type |
|---|---|---|---|
| RCSD | Research | Multi-source evidence | deep-research-agent |
| RCSD | Consensus (5) | Adversarial validation | Custom per role |
| RCSD | Synthesis | Artifact generation | technical-writer |
| Impl | Planner | Task selection, orchestration | Main session (HITL) |
| Impl | Coder | Code implementation | python-expert, backend-architect |
| Impl | Testing | Test execution | quality-engineer |
| Impl | QA | Acceptance validation | frontend-architect |
| Impl | Cleanup | Refactoring, docs | refactoring-expert |
| Impl | Security | Vulnerability scanning | security-engineer |
| Impl | Docs | Documentation | technical-writer |
5.2 Agent-CLEO Integration
All agents interact with CLEO via CLI commands:Part 6: Immutable Principles
6.1 Core Principles
| # | Principle | Rationale |
|---|---|---|
| 1 | Everything is a Task | Issues, bugs, features, research - all become Tasks/Epics. One data model. |
| 2 | Single Source of Truth | All state in .cleo/todo.json (+ minimal registry files like releases). |
| 3 | Epics traverse phases | Epic contains tasks across setup→core→testing→polish→maintenance. |
| 4 | Epic has its own lifecycle | Independent of individual task statuses (epicLifecycle field). |
| 5 | Releases aggregate completed work | Computed from tasks/Epics with release field. |
| 6 | Changelog is derived, not authored | Generated from completed task metadata. |
| 7 | Waves are computed, not stored | Parallel execution groups from dependency DAG. |
| 8 | Deterministic queries | Same input → same output, always. |
| 9 | CLI is the API | Agents interact via CLI, never by editing JSON directly. |
6.2 Data Integrity Rules
From LLM-AGENT-FIRST-SPEC:- Atomic operations - All writes use temp → validate → backup → rename
- JSON Schema validation - Every write validated against schema
- Append-only audit log - All operations logged to todo-log.jsonl
- Anti-hallucination - Every task has title AND description (different content)
- Unique IDs - No duplicates across todo.json and archive
Part 7: Configuration Integration
7.1 Pipeline Configuration
7.2 Multi-Session Configuration
Part 8: Quick Reference
8.1 Complete Command Reference by Stage
Ingestion & Triage:8.2 State Transitions Summary
Part 9: Related Specifications
9.1 Specification Index
Foundation Layer (Immutable/Core)
| Spec | Purpose | Status |
|---|---|---|
| SPEC-BIBLE-GUIDELINES | How to write specifications | IMMUTABLE |
| LLM-TASK-ID-SYSTEM-DESIGN-SPEC | Task ID format (T### format) | IMMUTABLE |
| LLM-AGENT-FIRST-SPEC | CLI design, JSON output, exit codes | ACTIVE |
Infrastructure Layer
| Spec | Purpose | Status |
|---|---|---|
| CONFIG-SYSTEM-SPEC | Configuration management | ACTIVE |
| FILE-LOCKING-SPEC | Concurrency & atomic operations | ACTIVE |
| BACKUP-SYSTEM-SPEC | Backup & recovery | ACTIVE |
| MIGRATION-SYSTEM-SPEC | Schema migrations | ACTIVE |
Task Management Layer
| Spec | Purpose | Status |
|---|---|---|
| TASK-HIERARCHY-SPEC | Epic→Task→Subtask structure | APPROVED |
| PHASE-SYSTEM-SPEC | Project phases (setup→maintenance) | ACTIVE |
| TASK-DECOMPOSITION-SPEC | Breaking work into atomic tasks | ACTIVE |
Session & Lifecycle Layer
| Spec | Purpose | Status |
|---|---|---|
| MULTI-SESSION-SPEC | Concurrent agent sessions | ACTIVE |
| EPIC-SESSION-SPEC | Epic-bound session architecture | ACTIVE |
| PROJECT-LIFECYCLE-SPEC | Greenfield/brownfield patterns | DRAFT |
Pipeline Layer (Work Flow)
| Spec | Purpose | Exit Codes |
|---|---|---|
| ISSUE-LIFECYCLE-SPEC | Bug/issue ingestion & triage | 60-69 |
| RCSD-PIPELINE-SPEC | Research→Consensus→Spec→Decompose | 30-39 |
| CONSENSUS-FRAMEWORK-SPEC | Multi-agent adversarial validation | - |
| IMPLEMENTATION-ORCHESTRATION-SPEC | 7-agent implementation workflow | 40-49 |
| RELEASE-MANAGEMENT-SPEC | Release lifecycle & changelog | 50-59 |
Integration Layer
| Spec | Purpose | Status |
|---|---|---|
| CLEO-SYSTEM-ARCHITECTURE-SPEC | This document - System overview | DRAFT |
| TODOWRITE-SYNC-SPEC | Claude Code TodoWrite sync | ACTIVE |
Reference Documents
| Doc | Purpose |
|---|---|
| SCHEMA-CHANGES-SUMMARY | Pending schema updates from new specs |
9.2 Dependency Graph
Part 10: Conformance
10.1 Conformance Requirements
A conforming CLEO implementation MUST:- Store all state in
.cleo/todo.json(single source of truth) - Implement the Task schema with all extensions
- Support all four pipeline stages
- Use exit codes within allocated ranges
- Follow LLM-AGENT-FIRST-SPEC for CLI output
- Implement atomic write operations
- Implement all agent types in Implementation Orchestration
- Support multi-session concurrent work
- Generate changelogs from task metadata
- Integrate with git for tagging
- Support external tracker sync (GitHub, Jira)
- Implement custom agent types
- Add custom workflow hooks
- Extend schema with project-specific fields
Appendix A: Version History
Version 1.0.0 (2025-12-29)
- Initial specification
- Complete lifecycle model
- Subsystem boundaries and exit code allocation
- Data flow documentation
- Agent architecture overview
- Integration with all domain specs
End of Specification
