KOMU CLI is structured so terminal UX, application workflows, domain models, persistence, providers, and SSH execution remain separable. The current shape is intended to support both continued CLI growth and a future desktop frontend that reuses the same backend services.
Terminal-only presentation.
- Typer entrypoints
- Rich rendering
- interactive shell
- approval prompts
- history and explain views
Application workflow layer.
OperationServicecoordinates planning, execution, repair, and historyPlanningServicechooses playbooks first and providers secondSecurityServiceclassifies command and plan riskExecutionServiceexecutes reviewed plans over SSHRepairServiceprepares repair paths after failuresExplainServiceturns history and plans into operator-facing explanationsHistoryServicepersists task history and reconstructs session summariesProfileServiceowns profile validation and active/default behaviorProviderServiceowns routing, fallback, and provider healthExtensionServicediscovers custom playbook and policy-pack locations
Shared typed data for:
- plans and steps
- rollback guidance
- inspections and execution results
- repair attempts
- playbooks and playbook matches
- providers and provider selections
- security reviews and risk signals
- profiles
- history and session records
- explanation records
- extension manifests
Verified operational flows.
- JSON catalog metadata
- natural-language matching
- renderer methods that build typed plans
Reusable safety policy layer.
- pattern-based risk rules
- policy packs
- command review signals
- plan review summaries
Provider abstraction.
- adapter interface
- built-in adapters
- provider registry
- capability metadata
- controlled fallback
Remote execution boundary.
- session creation
- command execution
- environment inspection
- connection testing
- stdout, stderr, exit code, and timeout capture
Infrastructure support.
- local JSON persistence
- environment loading
- audit JSONL logs
- session JSONL logs
- user-scoped app paths
The CLI does not own planning or execution logic.
A future desktop frontend can reuse:
OperationServicePlanningServiceSecurityServiceExecutionServiceRepairServiceExplainServiceProfileServiceProviderServiceHistoryService- playbook and provider registries
- SSH and storage layers
Only the presentation surface has to change.
The review-first flow is:
- resolve profile context
- inspect the environment when requested
- prefer a verified playbook
- fall back to provider planning only when necessary
- classify every command with the risk engine
- build a plan review summary
- present exact commands and rollback guidance
- request approval
- execute
- record history, session events, and audit logs
The runtime now creates extension directories for:
extensions/playbooksextensions/policies
This lets future custom playbook catalogs and enterprise policy packs plug into the existing service graph without changing the CLI contract.
KOMU is still single-profile at execution time, but the architecture now avoids dead ends:
- plans already support
target_labels - profiles support environments and tags
- history records preserve profile and target context
- the orchestration layer is not hard-coded to one forever-targeted terminal flow