Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 2 additions & 3 deletions .cleo/DATA-SAFETY-IMPLEMENTATION-SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Successfully implemented comprehensive data safety and naming standardization ac
**Status**: COMPLETE
**Task ID**: T4749 (child of T4748 - Naming Standardization Epic)

**Created**: `src/scripts/migrate-todo-to-tasks.ts`
**Historical note**: A legacy todo-migration script existed during the T4749 migration phase and was later removed as dead code in T5303.

**Features**:
- **Atomic operation pattern**: backup β†’ migrate β†’ validate β†’ cleanup
Expand Down Expand Up @@ -139,11 +139,10 @@ npm run migrate:todos -- --keep-backups

## Files Changed

### New Files
### New Files (historical at time of original write-up)
```
src/store/data-safety-central.ts # Centralized safety functions
src/store/safety-data-accessor.ts # Safety wrapper class
src/scripts/migrate-todo-to-tasks.ts # Migration script
```

### Modified Core Files
Expand Down
30 changes: 18 additions & 12 deletions .cleo/adrs/ADR-007-domain-consolidation.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CLEO currently operates with **11 MCP domains**: tasks, session, orchestrate, re
- **Confirmed duplicates**: 8+ operations with identical or near-identical implementations across domains
- **80/20 usage pattern**: 80% of agent sessions use only tasks + session (8 operations), yet all 11 domains are exposed
- **Naming collisions**: "validate" domain vs. validate operations in orchestrate, pipeline
- **Identity misalignment**: CLEO's Brain/Memory identity (vision.mdx, PORTABLE-BRAIN-SPEC.md) is not reflected in domain naming
- **Identity misalignment**: CLEO's Brain/Memory identity (CLEO-VISION.mdx, PORTABLE-BRAIN-SPEC.md) is not reflected in domain naming

**Additional Critical Issue: Parallel Routing Architectures**

Expand Down Expand Up @@ -89,7 +89,7 @@ The following domain models were evaluated during T4797 research:

## 3. Decision

**CLEO SHALL consolidate 11 MCP domains into 10 intent-based domains** (9 project-local + 1 global) aligned with CLEO's Brain/Memory identity, progressive disclosure tiers, RCSD-IVTR pipeline, and BRAIN specification forward compatibility. (Originally 9 domains; the sharing domain was added by ADR-015.)
**CLEO SHALL consolidate 11 MCP domains into 10 intent-based domains** (9 project-local + 1 global) aligned with CLEO's Brain/Memory identity, progressive disclosure tiers, RCASD-IVTR pipeline, and BRAIN specification forward compatibility. (Originally 9 domains; the sharing domain was added by ADR-015.)

**ADDITIONALLY, CLEO SHALL mandate that ALL operations (CLI and MCP) MUST route through the unified CQRS dispatch layer** at `src/dispatch/`, eliminating the parallel DomainRouter architecture.

Expand All @@ -99,9 +99,9 @@ The following domain models were evaluated during T4797 research:
|---|--------|---------|---------------|-------------|------|-----|
| 1 | **tasks** | Task CRUD, hierarchy, start/stop/current, analysis, labels | Neurons | Portable Memory | 0 | ~29 |
| 2 | **session** | Session lifecycle, decisions, assumptions, context | Working Memory | Portable Memory | 0 | 13 |
| 3 | **memory** | Research manifests, knowledge store, retrieval | Long-term Memory | Cognitive Retrieval | 1 | 12 |
| 3 | **memory** | BRAIN cognitive memory β€” brain.db abstractions (observations, decisions, patterns, learnings) | Long-term Memory | Cognitive Retrieval | 1 | 17 |
| 4 | **check** | CLEO validation + project quality assurance | Immune System | Deterministic Safety | 1 | 12 |
| 5 | **pipeline** | RCSD-IVTR state machine + release execution | Executive Pipeline | Provenance | 2 | ~17 |
| 5 | **pipeline** | RCASD-IVTR state machine + release execution + LOOM artifact ledger (manifest.*) | Executive Pipeline | Provenance | 2 | ~24 |
| 6 | **orchestrate** | Multi-agent coordination, spawning, waves | Executive Function | Agent Coordination | 2 | ~15 |
| 7 | **tools** | Skills, providers, issue management | Capabilities | Interoperable Interfaces | 2 | ~20 |
| 8 | **admin** | System config, backup, migration, observability | Autonomic System | Infrastructure | 2 | ~20 |
Expand All @@ -118,7 +118,7 @@ The following domain models were evaluated during T4797 research:
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ UNIFIED ENTRY POINT ARCHITECTURE β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ CLI (76 commands) β”‚ MCP Gateway (cleo_query/mutate) β”‚
β”‚ CLI (76 commands) β”‚ MCP Gateway (query/mutate) β”‚
β”‚ β”‚ β”‚
β”‚ Commander.js registration β”‚ 2-tool CQRS interface β”‚
β”‚ β†’ parse arguments β”‚ β†’ validate params β”‚
Expand Down Expand Up @@ -483,7 +483,7 @@ Passβ”‚ β”‚Fail
- Implementation: `tasks` (work tracking) + `orchestrate` (agent coordination)
- Validation: `check` domain (quality gates)
- Testing: `check` domain (test execution)
- Release: `pipeline` domain (RCSD-IVTR state + release execution)
- Release: `pipeline` domain (RCASD-IVTR state + release execution)

### 3.8 Domain Consolidation Mapping

Expand Down Expand Up @@ -534,7 +534,7 @@ The system domain (28-40 ops) SHALL be decomposed:
The 9-domain model is derived from seven convergent evidence streams:

1. **Agent workflow clustering** (T4797 Finding 2): 80% of agents use only tasks+session β†’ domains tiered by access frequency
2. **CLEO Brain/Memory identity** (vision.mdx, PORTABLE-BRAIN-SPEC.md): Domains map to cognitive functions aligned with 5 pillars
2. **CLEO Brain/Memory identity** (CLEO-VISION.mdx, PORTABLE-BRAIN-SPEC.md): Domains map to cognitive functions aligned with 5 pillars
3. **src/core/ natural clustering** (T4797 Finding 3): 13 core modules group into ~9 cohesive clusters when measured by cohesion
4. **System domain junk drawer** (T4797 Finding 4): 28-40 ops mixing 7 concerns must be decomposed
5. **RCASD-IVTR pipeline**: 9-stage lifecycle (+ contribution cross-cutting) with clear phase boundaries and iteration support
Expand Down Expand Up @@ -581,12 +581,16 @@ The 5 BRAIN dimensions map to the 9 canonical domains as follows. This table cov
| Operation | Domain | Phase | Status |
|-----------|--------|-------|--------|
| Task/session persistence | `tasks.*`, `session.*` | Current | Shipped |
| Research artifacts | `memory.manifest.*` | Current | Shipped |
| Research artifacts | `pipeline.manifest.*` | Current | **Shipped (moved from memory, ADR-021)** |
| Contradiction detection | `memory.contradictions` | Current | Shipped |
| 3-layer retrieval: find | `memory.find` | Current | **Shipped (T5149/T5241)** |
| 3-layer retrieval: timeline | `memory.timeline` | Current | **Shipped (T5149/T5241)** |
| 3-layer retrieval: fetch | `memory.fetch` | Current | **Shipped (T5149/T5241)** |
| Observation write | `memory.observe` | Current | **Shipped (T5149/T5241)** |
| Context persistence | `session.context.*` | 1 | Planned |
| Decision memory (store/recall/search) | `memory.decision.*` | 2 | Planned |
| Pattern memory (store/extract/search) | `memory.pattern.*` | 2 | Planned |
| Learning memory (store/search) | `memory.learning.*` | 3 | Planned |
| Decision memory (store/find) | `memory.decision.*` | 2 | **Shipped (T5149)** |
| Pattern memory (store/find/stats) | `memory.pattern.*` | 2 | **Shipped (T4768/T5241)** |
| Learning memory (store/find/stats) | `memory.learning.*` | 3 | **Shipped (T4769/T5241)** |
| Memory consolidation | `memory.consolidate` | 3 | Planned |
| Memory export/import (JSONL portability) | `memory.export`, `memory.import` | 2 | Planned |

Expand Down Expand Up @@ -936,6 +940,8 @@ This ADR formalizes the consensus reached in T4797 (Domain Model Research). The

---

**[T4894, 2026-02-25]** Schema-first `ParamDef[]` interface added to `OperationDef` in `src/dispatch/registry.ts`, making the registry the single source of truth for both CLI Commander registration and MCP `input_schema` generation. Utility functions in `src/dispatch/lib/param-utils.ts` derive Commander arguments and JSON Schema from `ParamDef[]` automatically. Dynamic CLI registration implemented via `registerDynamicCommands()` in `src/cli/commands/dynamic.ts`, adding domain-namespaced commands (`ct tasks show`, `ct session status`, etc.) alongside legacy flat commands during the transition period. MCP gateway fully integrated with dispatch adapter β€” `src/mcp/index.ts` routes all `cleo_query`/`cleo_mutate` calls through `handleMcpToolCall()` in `src/dispatch/adapters/mcp.ts`. CLI migration completed for 36 command files through T4903 (Tier-0) and T4904 (Tier-1/2); 28 CLI commands have `// TODO T4894` markers pending registry operation creation.
**[T4894, 2026-02-25]** Schema-first `ParamDef[]` interface added to `OperationDef` in `src/dispatch/registry.ts`, making the registry the single source of truth for both CLI Commander registration and MCP `input_schema` generation. Utility functions in `src/dispatch/lib/param-utils.ts` derive Commander arguments and JSON Schema from `ParamDef[]` automatically. Dynamic CLI registration implemented via `registerDynamicCommands()` in `src/cli/commands/dynamic.ts`, adding domain-namespaced commands (`ct tasks show`, `ct session status`, etc.) alongside legacy flat commands during the transition period. MCP gateway fully integrated with dispatch adapter β€” `src/mcp/index.ts` routes all `query`/`mutate` calls through `handleMcpToolCall()` in `src/dispatch/adapters/mcp.ts`. CLI migration completed for 36 command files through T4903 (Tier-0) and T4904 (Tier-1/2); 28 CLI commands have `// TODO T4894` markers pending registry operation creation.

**Amended By**: ADR-021 (Memory Domain Refactor β€” Cognitive-Only Cutover, 2026-03-03)

**END OF ADR-007**
12 changes: 6 additions & 6 deletions .cleo/adrs/ADR-008-CLEO-CANONICAL-ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
**Accepted**: 2026-02-22
**Related Tasks**: T4797, T4781, T4813, T4863, T4800
**Amended By**: ADR-017, ADR-020
**Summary**: Defines the canonical shared-core + CQRS dispatch architecture. src/core/ is the single source of truth for all business logic. CLI and MCP are thin wrappers that parse/translate then delegate to core. Introduces the dispatch layer (cleo_query/cleo_mutate) as the uniform interface.
**Summary**: Defines the canonical shared-core + CQRS dispatch architecture. src/core/ is the single source of truth for all business logic. CLI and MCP are thin wrappers that parse/translate then delegate to core. Introduces the dispatch layer (query/mutate) as the uniform interface.
**Keywords**: architecture, shared-core, cqrs, dispatch, mcp, cli, core, canonical
**Topics**: admin, orchestrate, tools, naming

Expand Down Expand Up @@ -355,8 +355,8 @@ src/
β”œβ”€β”€ index.ts # MCP module entry
β”‚
β”œβ”€β”€ gateways/ # MCP Tool Entry Points
β”‚ β”œβ”€β”€ query.ts # cleo_query gateway (75 operations)
β”‚ └── mutate.ts # cleo_mutate gateway (65 operations)
β”‚ β”œβ”€β”€ query.ts # query gateway (75 operations)
β”‚ └── mutate.ts # mutate gateway (65 operations)
β”‚
β”œβ”€β”€ domains/ # DEPRECATED: Domain handlers
β”‚ β”œβ”€β”€ tasks.ts # β†’ Migrate to dispatch/domains/
Expand Down Expand Up @@ -411,7 +411,7 @@ src/
β”‚ ENTRY POINTS β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ CLI Command β”‚ MCP Gateway β”‚
β”‚ (e.g., cleo show T1) β”‚ (cleo_query) β”‚
β”‚ (e.g., cleo show T1) β”‚ (query) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β–Ό β–Ό
Expand Down Expand Up @@ -504,7 +504,7 @@ src/
β”‚ ENTRY POINTS β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ CLI Command β”‚ MCP Gateway β”‚
β”‚ (e.g., cleo add ...) β”‚ (cleo_mutate) β”‚
β”‚ (e.g., cleo add ...) β”‚ (mutate) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚ β”‚
β–Ό β–Ό
Expand Down Expand Up @@ -1109,7 +1109,7 @@ export class CliAdapter {
// src/mcp/gateways/query.ts

export const queryGateway = {
name: 'cleo_query',
name: 'query',
description: 'Query CLEO data (read-only)',
inputSchema: QueryParamsSchema,
async handler(params: QueryParams): Promise<QueryResult> {
Expand Down
Loading