## Summary - add root `REDUCTION.md` defining the lean AO vs MTO reduction boundary and reversible KEEP / RELOCATE / ARCHIVE / RESEARCH buckets - add `docs/reduction/ao-file-buckets.tsv`, a generated per-file inventory for every current `cli/cmd/ao/*.go` file with bucket, rationale, and import dependency clusters - inventory totals: 637 files = 450 KEEP, 146 RELOCATE, 2 ARCHIVE, 39 RESEARCH ## Validation - `test "$(( $(wc -l < docs/reduction/ao-file-buckets.tsv) - 1 ))" -eq "$(find cli/cmd/ao -maxdepth 1 -name '*.go' | wc -l)"` - `bash scripts/regen-all.sh --check` - `git diff --check` - `PRE_PUSH_SKIP_MKDOCS=1 bash scripts/pre-push-gate.sh --fast` passed; warning-only executable-spec drift remains pre-existing (`scenarios --lint`, `trace --orphans`) BR: cp-q4d
3.6 KiB
AgentOps Reduction Plan
This plan categorizes the ao command implementation for the lean image
distillation. It does not remove code by itself; it defines the reversible
KEEP / RELOCATE / ARCHIVE / RESEARCH decision surface for the next beads.
Source boundary: /Users/bo/dev/control-plane/AO-MTO-BOUNDARY.md.
Boundary Rule
AgentOps (ao) must stay self-contained: one image can run the local loop,
local Themis, local corpus, and local flywheel without a fleet. MTO owns the
outer factory: fleet dispatch, leases, fleet Themis/quorum, fleet corpus
aggregation, and cross-instance scheduling.
Buckets
| Bucket | Meaning | Next action |
|---|---|---|
| KEEP | Belongs in the lean AO image: local loop, mind, local Themis, local flywheel, corpus, evidence, operator ergonomics, and vendor image adapters required for self-contained operation. | Keep in ao; slim only by local refactor. |
| RELOCATE | Belongs at the MTO/factory or image-adapter boundary: outer orchestration, runtime supervision, CI/fleet coordination, sidecars, schedulers, or worker dispatch. | Move behind an MTO/factory seam or image-specific adapter. |
| ARCHIVE | Legacy, deprecated, retired, or compatibility-only code that should not ship in the lean image once callers are migrated. | Remove from image; keep recoverable through git history. |
| RESEARCH | Ownership is unclear from filename/import shape. | Inspect before moving or cutting. |
Per-File Inventory
The complete per-file table is generated at
docs/reduction/ao-file-buckets.tsv.
It covers every current cli/cmd/ao/*.go file and records:
- file path
- bucket
- bucket rationale
- import dependency clusters
Current inventory count:
| Bucket | Files |
|---|---|
| KEEP | 450 |
| RELOCATE | 146 |
| ARCHIVE | 2 |
| RESEARCH | 39 |
| Total | 637 |
Validation command:
test "$(( $(wc -l < docs/reduction/ao-file-buckets.tsv) - 1 ))" -eq "$(find cli/cmd/ao -maxdepth 1 -name '*.go' | wc -l)"
Import-Dependency Shape
All files in cli/cmd/ao/ compile into the same Go package (main), so they
do not import each other directly. The dependency graph that matters for this
reduction is the external package cluster graph captured per file in the TSV:
internal/*clusters are AO-local domain ports and adapters.github.com/...,gopkg.in/..., and other third-party clusters are external dependencies that should be minimized in the lean image.- Files with no non-stdlib imports are usually command glue, tests, or pure helpers and are cheaper to keep unless their command surface belongs outside AO.
Initial Decisions
KEEP is the default for local AO capabilities: beads, claim, ready,
close, tick, gate, goals, loop, corpus, forge, mine, inject,
compile, curate, flywheel, knowledge, findings, ratchet,
validate, session, skills, and supporting operator UX.
RELOCATE is the default for outer orchestration and fleet-like surfaces:
rpi, swarm, agent(s), ci, cron, mcp, orchestrate, worktree,
next_work, runtime supervision, workers, schedulers, sidecars, and daemon
serving surfaces. These are valuable, but they sit one altitude up from the
lean local image.
ARCHIVE is limited to explicitly legacy or deprecated surfaces in this pass. Anything not confidently classified is marked RESEARCH rather than cut.
Reversibility
This is a plan artifact. The next beads may move or remove code, but each move
must cite the row(s) from docs/reduction/ao-file-buckets.tsv, update this
document if a bucket changes, and pass the normal generated-artifact and CI
gates before merge.