You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Large flat folders make ownership unclear. Broad modules increase change impact and test scope. Runtime cycles make module initialization order part of behavior.
Desired outcome
Use feature ownership first. Use explicit layers inside each feature.
Keep these repository-wide layers:
src/commands/ for oclif command adapters.
src/composition/ for dependency wiring.
src/platform/ for Docker, OpenShell, process, filesystem, and HTTP adapters.
src/cli/ for CLI framework and presentation code.
src/foundation/ for dependency-light primitives.
Put product behavior under feature-owned modules such as onboarding, sandboxes, inference, messaging, policy, shields, sessions, MCP, and credentials.
Constraints
Preserve supported behavior and persisted data formats.
Use compatibility exports only for current consumers.
Do not add a new integration or product surface.
Keep PRs issue-scoped and mechanically reviewable.
Add guardrails before structural changes.
Ratchet each measured hotspot downward.
Keep runtime dependency graphs acyclic.
Require cross-feature imports to use an explicit public module.
Important
Reserved for @cv. Do not self-assign this issue. Do not open an implementation PR unless @cv requests help.
Problem
The source layout has command, action, domain, adapter, and state layers. Transitional folders now contain multiple product concepts and stack layers.
Current examples include:
src/lib/onboard/: 358 production files and about 66,600 lines.src/lib/actions/: 227 production files and about 50,900 lines.src/lib/state/registry.ts: more than 100 production dependents.src/lib/onboard.ts: more than 200 direct runtime dependencies.Large flat folders make ownership unclear. Broad modules increase change impact and test scope. Runtime cycles make module initialization order part of behavior.
Desired outcome
Use feature ownership first. Use explicit layers inside each feature.
Keep these repository-wide layers:
src/commands/for oclif command adapters.src/composition/for dependency wiring.src/platform/for Docker, OpenShell, process, filesystem, and HTTP adapters.src/cli/for CLI framework and presentation code.src/foundation/for dependency-light primitives.Put product behavior under feature-owned modules such as onboarding, sandboxes, inference, messaging, policy, shields, sessions, MCP, and credentials.
Constraints
Work sequence
Items 1 through 4 are complete. Item 5 is in progress.
Item 5 has these remaining phases:
Items 6 through 9 remain open.
Completion criteria