Skip to content

EPIC-005: CodeWhale TUI Crate Decomposition (Umbrella) #5316

Description

@aboimpinto

EPIC-005: CodeWhale TUI Crate Decomposition — Umbrella EPIC

This issue is the EpicStyle tracking issue for the CodeWhale TUI crate decomposition. It represents the entire structure below: every sub-EPIC and every FEAT reports here when done, and every PR created under this work is logged here.

The decomposition is the direct answer to the compilation-time discussion in #4991 — see the Developer fast loop section below.

Structure

EPIC-005 is the umbrella EPIC. It does not contain FEATs directly — it holds the map of sub-EPICs, each of which contains its own FEATs.

flowchart TD
    U["EPIC-005: TUI Crate Decomposition (umbrella)"]
    U --> E6["EPIC-006: Commands -> codewhale-commands (P1)"]
    U --> E7["EPIC-007: Tools consolidation -> crates/tools (P1)"]
    U --> E8["EPIC-008: Config consolidation -> crates/config (P2)"]
    U --> E9["EPIC-009: Hooks + Execpolicy + MCP (P2)"]
    U --> E10["EPIC-010: Core extraction -> crates/core (P3)"]
Loading
ID Sub-EPIC Scope Status
EPIC-006 Commands → codewhale-commands crates/tui/src/commands/ (~42k lines incl. tests; 9 groups, registry, discovery) IN PROGRESS — Stage A complete (2/2); Stage B mainline: FEAT-018 merged via #5525, FEAT-021 via #5717, and FEAT-022 via maintainer replacement #5829 (original #5825 closed as superseded). MAINLINE GAP: FEAT-019 and FEAT-020 remain absent from main. FEAT-019 now has maintainer re-land PR #5833; review fixes and current-main reconciliation are clean/mergeable in #5839, awaiting merge into the maintainer branch. FEAT-020 still requires its current-main re-land PR.
EPIC-007 Tools consolidation crates/tui/src/tools/ (~117k lines) → crates/tools (currently 1.3k) NotStarted
EPIC-008 Config consolidation crates/tui/src/config/ (~13k lines) → crates/config (currently 33k) NotStarted
EPIC-009 Hooks + Execpolicy + MCP hooks/ (7k), execpolicy/ (0.5k), mcp/ (8k) → crates/hooks, crates/execpolicy, crates/mcp NotStarted
EPIC-010 Core extraction crates/tui/src/core/ (~42k lines) → crates/core (currently 3.4k); tightly coupled, P3 follow-up NotStarted

Stays in codewhale-tui: tui/ rendering (~205k lines), fleet/ (~27k lines), and the TUI-specific long tail.

Rules (applied to every sub-EPIC)

  1. Behavior-preserving — extraction only, no command/UX behavior changes.
  2. Trait-first — define the boundary interface before moving code (pattern: EPIC-006 CommandContext).
  3. Compiles at every step — bottom-up extraction, workspace stays green at each commit.
  4. CI gate — extracted crate must never depend on codewhale-tui (e.g. cargo check -p codewhale-commands pulls no TUI).
  5. Fork-local until complete — rebase onto upstream main frequently; no upstream PR until the sub-EPIC is done.
  6. Sequencing — EPIC-006 first, then 007/008, then 009, then 010.

Work summary (to be done)

Estimated FEATs under each EPIC. Check a FEAT off and append its PR link when the PR lands; parent EPICs auto-complete when all their FEATs are done. This section is the visual tracker — the Features Breakdown tables in the MemoryBank EPIC documents are the static FEAT-creation source and are not updated per PR.

  • EPIC-006: Commands extraction — staged, one FEAT = one independently green PR
    • Stage A — shapes + infrastructure (COMPLETE 2026-08-19)

      • FEAT-014: Prototype command capability/handler/registration shapes only — merged in #5328 (2026-08-13, merge commit 3b41d0ee); no TUI production rewiring
      • FEAT-015: Add TUI adapters, dual-path dispatch seam, and shrinking migration gate; convert no group — merged in #5506 (2026-08-19, merge commit ae56154c); complete required check matrix green
    • Stage B — adopt shapes inside TUI (files do not move)

      • Least-capability invariant: every contextual registration declares its exact minimum external facet set; the TUI exposes only those facets; pure handlers construct no host bundle; missing required facets fail safely. FEAT-019 through FEAT-035 inherit this pattern, and FEAT-035 enforces it repository-wide.

      [!WARNING]
      Mainline gap (verified against current origin/main on 2026-09-02): FEAT-019 and FEAT-020 are not yet in main. The old codex/v0912-integration-20260823 branch was not the source of release PR #5826. FEAT-019 is actively re-landing through maintainer PR #5833; its review fixes and six-file current-main reconciliation are ready in mergeable #5839. FEAT-020 still has no current-main re-land PR. Keep both unchecked until their mainline PRs merge.

      • FEAT-018: Utility groupshipped in #5525 via v0.9.11 (2026-08-23); complete utility group adopted external command shapes in place
      • FEAT-019: Memory group — RE-LAND OPEN: maintainer PR #5833 reopens/harvests #5609; review findings plus current-main/FEAT-022 reconciliation are resolved in clean, mergeable #5839, awaiting owner merge into reland-feat019 and final feat(memory): FEAT-019 memory capability, memory facet, and typed outcomes (#5609) #5833 CI
      • FEAT-020: Plugins group — RE-LANDING REQUIRED: #5657 merged only into old branch codex/v0912-integration-20260823 (ece99d5), not main; current main does not contain CommandPluginContext
      • FEAT-021: Project group — merged into main in #5717 (2026-08-30, merge commit 2f200ee) — first Stage B FEAT to land directly on main; exact facet destructuring (/init=WORKSPACE, /lsp=project, /share=project, /goal=project+presentation) on main's no-bitmask model, frontier shrunk to 7 groups (memory/plugins still pending on main)
      • FEAT-022: Skills group — merged into main via maintainer replacement #5829 (2026-09-02, 84b3dd694); contributor PR #5825 closed as superseded after its work was harvested and co-author credited
      • FEAT-023: Session lifecycle leaves
      • FEAT-024: Session control / remote paths
      • FEAT-025: Session export
      • FEAT-026: Session structcopy
      • FEAT-027: Config policy/status
      • FEAT-028: Main config module
      • FEAT-029: Debug diagnostics
      • FEAT-030: Debug mutation paths
      • FEAT-031: Core navigation/display leaves
      • FEAT-032: Core model/provider/setup
      • FEAT-033: Core coordination/workflow
      • FEAT-034: Remaining core policy/interaction
      • FEAT-035: Registry/discovery completion + enforce zero direct concrete-App handlers
    • Stage C — focused prerequisites after in-place decoupling

      • FEAT-036: Extract localization behind the existing compatibility path
      • FEAT-037: Move only shared command outcome/action data proven necessary
    • Stage D — bootstrap then move one already-decoupled group per PR

      • FEAT-016: Bootstrap codewhale-commands + shared registry/discovery boundary; move no group
      • FEAT-038: Move utility
      • FEAT-039: Move memory
      • FEAT-040: Move plugins
      • FEAT-041: Move project
      • FEAT-042: Move skills
      • FEAT-043: Move session
      • FEAT-044: Move config
      • FEAT-045: Move debug
      • FEAT-046: Move core
    • Stage E — final validation

      • FEAT-017: Acceptance-test boundary, compatibility-shim removal, and EPIC validation
  • EPIC-007: Tools consolidation
    • FEAT: Audit tools/ vs crates/tools and define the shared boundary
    • FEAT: Move shared tool code into crates/tools
    • FEAT: Wire TUI to the consolidated crate; keep tool UI code in TUI
    • FEAT: Tests, CI gate, and re-export shim
  • EPIC-008: Config consolidation
    • FEAT: Audit TUI config/ vs crates/config (overlap, extensions, UI views)
    • FEAT: Extract non-UI config logic to crates/config (or adopt it)
    • FEAT: Wire TUI to codewhale-config; keep UI views in TUI
    • FEAT: Tests, CI gate, and re-export shim
  • EPIC-009: Hooks/Execpolicy/MCP consolidation
    • FEAT: Consolidate hooks/ with crates/hooks
    • FEAT: Consolidate execpolicy/ with crates/execpolicy
    • FEAT: Consolidate mcp/ with crates/mcp
    • FEAT: Tests, CI gates, and cleanup
  • EPIC-010: Core extraction (follow-up)
    • FEAT: Core audit and coupling map (36 files, ~42k lines)
    • FEAT: Extract decoupled core leaves to crates/core (phase 1)
    • FEAT: Extract remaining core logic (phase 2, after boundary interfaces)
    • FEAT: Wire TUI to codewhale-core; tests and CI gate
  • Final: codewhale-tui reduced from ~700k to ~300k lines focused on UI rendering

Developer fast loop

The whole point of this decomposition: once a sub-EPIC's crate exists (EPIC-006 Feature 3 and later), day-to-day development happens entirely outside the TUI monolith (~700k lines). The TUI is only compiled when you explicitly need it — TUI integration tests, cargo test --workspace, or the final pre-PR validation.

cargo check -p codewhale-commands          # production change check — seconds, not minutes
cargo test -p codewhale-commands           # test loop — compiles only the commands crate + thin test binaries, never the TUI
cargo watch -x "check -p codewhale-commands"  # continuous check while editing (cargo-watch)
cargo nextest run -p codewhale-commands    # optional: parallel test runner, faster startup

Why this stays fast:

  • cargo build / cargo check never compiles #[cfg(test)] code, so production iteration is bounded to the small crate.
  • cargo test compiles each tests/ file as its own small binary crate depending only on the public API — a production change recompiles/relinks only those thin binaries, in parallel.
  • The Gherkin acceptance harnesses live in separate test binaries (or a dedicated acceptance crate), so thousands of acceptance-test lines are never part of the production crate compile.
  • Small white-box unit tests that need private access stay inline — they are cheap and cannot live outside the crate.

Acceptance criterion for every extracted crate: cargo test -p <crate> must compile only that crate and its test binaries — if it pulls in codewhale-tui, the boundary was cut wrong.

The numbers and impact motivating this are documented in #4991 (Discussion: Compilation times and the TUI crate monolith): 476k lines / 82% of the workspace in one crate, 8–16 min release builds, 30+ min test suite, 2–3 iterations per hour.

PR log (updated as work lands)

Date EPIC / FEAT PR Status Summary
2026-08-13 EPIC-006 / FEAT-014 #5328 MERGED Scope-corrected after owner review: small codewhale-command-contract prototype only (7 facets, generic handler/registration shapes, tests, CI guard); no TUI production changes, localization extraction, shared-type move, or command migration. Merged 2026-08-13 (3b41d0ee) after two conflict-resolution merges against main (generated-file regen: source budget 688916, facts v0.9.7; codewhale-core pin 0.9.7).
2026-08-19 EPIC-006 / FEAT-015 #5506 MERGED TUI-owned implementations of all seven command capability facets, authoritative App delegation, portable registration/localization bridge, dual-path registry dispatch, and baseline-aware shrink-or-documented-split migration gate; no production command group converted or moved.

| 2026-08-23 | EPIC-006 / FEAT-018 | #5525 | MERGED (shipped v0.9.11) | Complete utility group adopted external command shapes in place: seven portable registrations, zero concrete-App handlers, exact least-capability declarations with restricted facet exposure, and utility removed from the migration frontier. Temporary result/action data references remain intentionally assigned to FEAT-037; physical movement remains FEAT-038. |
| 2026-09-02 | EPIC-006 / FEAT-019 | #5833 + fix #5839 (harvests #5609) | OPEN — REVIEW FIXES READY | Maintainer re-land PR #5833 restores the memory capability/facet/portable handlers. #5839 resolves the migration-gate blocker and advisory review findings, merges current main, preserves FEAT-022 skills with exact capabilities, passes local command/memory/skills/migration/Clippy validation, and is clean/mergeable; owner merge of #5839 triggers final #5833 CI. |
| 2026-08-30 | EPIC-006 / FEAT-021 | #5717 | MERGED (into main, merge commit 2f200ee) | Project group adopted external command shapes in place on main's no-bitmask model: new CommandProjectContext facet, /init=WORKSPACE//lsp=project//share=project//goal=project+presentation via exact facet destructuring + safe missing-facet errors, /lsp config bridge routed through the TUI adapter, project removed from both frontiers; FEAT-037/FEAT-041 dependency-removal obligations enumerated. Rebased onto main per maintainer request (integration branch will not land); full matrix green after the maintainer's sandbox fix #5724; owner APPROVED with both nits fixed. |
| 2026-08-27 | EPIC-006 / FEAT-020 | #5657 | RE-LANDING REQUIRED — NOT IN main | Plugins-group implementation merged only into old branch codex/v0912-integration-20260823 (ece99d5), which was not the source of release PR #5826. Current main has no CommandPluginContext and still lists plugins in the migration frontier. Forward-port onto current main through a new independently green PR. |
| 2026-09-02 | EPIC-006 / FEAT-022 | #5829 (supersedes #5825) | MERGED INTO main (84b3dd694) | Maintainer rebased/harvested FEAT-022 after #5826, credited @aboimpinto as co-author, and merged the skills command shapes through replacement PR #5829. Original contributor PR #5825 is closed as superseded, not rejected. |

Reporting contract

  • Every FEAT completion updates this issue with its PR link and a one-line summary.
  • Every sub-EPIC completion updates the sub-EPIC row above (status + PR links).
  • EPIC-005 is closed only when all sub-EPICs above are complete.

Paulo Aboim Pinto

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    • Status
      In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions