CLI-Anything explained: give an agent a real software boundary
CLI-Anything architecture: command, backend, artifact and preview
Separate the core command path from the visual feedback path.
What you will learn
- The command path
- The preview path
- Where correctness lives
Before you start
- Python packaging basics
- A licensed GUI application with a real backend
Build a narrow proof of concept before publishing a community command.
Key takeaways
- Core commands and previews have different roles.
- Session history should be append-only when replay matters.
- The native artifact is the final evidence.
The command path
A harness parses arguments, validates state, builds or updates a project file, then invokes the real application backend for export. The guide prefers JSON output for agents and explicit errors when dependencies are absent.
A stateful REPL can keep context across commands, while a one-shot CLI should produce deterministic output. Choose the mode according to the application, not the model prompt.
The preview path
The inspected preview helper computes a cache key, creates bundle paths, writes a manifest and can append a live trajectory. It distinguishes current session state from append-only history.
Preview capture is a producer action. A viewer such as CLI-Hub can consume those bundles, but the preview itself should not mutate the source project.
Where correctness lives
Native files must round-trip through the GUI and exported output must be inspected. A generated thumbnail and a successful process exit are weaker checks.
This diagram represents the specification and helper source, not a live trace of one completed harness.
Decision guide
| Criterion | Option A | Option B |
|---|---|---|
| Best when | You need predictable behavior and easy auditing | You need adaptive optimization and have reliable telemetry |
| Main risk | May leave performance on the table | Can become difficult to explain or debug |
Implementation steps
- 1
Trace a command to its native project file.
- 2
Identify the backend process that renders the final artifact.
- 3
Locate preview manifest and compare it with exported output.
Copy-ready example
Command -> project file -> backend export; preview -> separate manifestFrequently asked questions
Is the preview bundle the document?
No. It records preview artifacts and metadata around a project.
Must every harness have a REPL?
No. The guide permits command-oriented and stateful designs.
Sources
- CLI-Anything / cli-anything-plugin/HARNESS.mdSource checked 2026-09-26
- CLI-Anything / cli-anything-plugin/preview_bundle.pySource checked 2026-09-26