Improve an existing charm

Audit and upgrade a charm you have already written, adding tests, observability, and modern patterns.

When to use improve mode

Use --improve when you have an existing charm that needs:

For the Harness → Scenario case specifically, there is a step-by-step recipe with copy-paste prompts and a verifier you can run against the result: cookbook/migrate-harness-to-scenario/. The cookbook/ directory collects more of these runnable workflows.

Run the improvement

Point Cantrip at your existing charm directory:

$ cantrip --improve /path/to/my-existing-charm

Cantrip reads the existing code and configuration, then creates a plan of improvements. You will see a proposal in the chat listing what the agent intends to change. Confirm or adjust the plan before the agent begins work.

What the agent does

In improve mode the agent typically follows this sequence:

  1. Audit — reads all charm files, runs charmlint, checks metadata, and evaluates against Operational Readiness Metrics.
  2. Propose — presents a prioritised list of improvements with rationale.
  3. Implement — after your confirmation, subagents work through the list: adding tests, wiring up observability, replacing deprecated patterns.
  4. Redeploy and test — packs the updated charm, deploys it, and runs the new test suite.

Steering the improvements

You can guide the agent during the improvement process:

Working with git

The agent commits at appropriate points during the improvement. Each commit is a self-contained change (e.g. "add COS integration", "replace Harness tests with Scenario"). You can review the commits afterwards and cherry-pick or squash as needed.

Improve mode works on the charm directory in place. If you want to preserve the original state, create a git branch or copy the directory before running.