Build Juju charms
with AI

Describe your workload. Cantrip researches it, designs the charm, writes the code, deploys it, and runs the tests — autonomously, with citations and a tight cost loop.

Free & open source · Apache 2.0

Everything you need to build production charms

Cantrip handles the full lifecycle — from research to Charmhub publishing.

Research-Driven Design

Cantrip analyses your workload — documentation, source code, existing charms — and proposes a design grounded in real operational best practices, including companion charms for databases, caches, and ingress. A cross-charm Librarian surfaces existing Charmhub and Launchpad work before the agent reinvents it.

Cited Charm-Ecosystem Retrieval

Index Juju, ops, charmcraft, rockcraft, jubilant, and Charmhub locally with one command. The agent cites official URLs instead of paraphrasing from memory, and the @docs mention pulls top passages straight into a chat message — every claim traceable.

Autonomous Building

A background work loop plans, scaffolds, writes charm code, and packs — without waiting for instructions. Concurrent subagents tackle research, build, deploy, test, and debug tasks in parallel.

Cost-Aware Multi-Model

Architect-then-editor mode runs each turn as propose on a strong model, edit on a cheap one — design quality without paying for design tokens on every diff. Light models handle research and summarisation; the /cost slash command shows spend per role so the bill never surprises you.

Acceptance Testing

Integration tests are written before charm code. After red/green iteration, acceptance tests exercise every action, relation, config option, and endpoint — failures automatically trigger fix tasks.

Full Observability

Every charm ships with COS integration — traces, metrics, logs, and dashboards wired up automatically via ops-tracing, Prometheus, Loki, and Grafana. Multi-controller COS is detected and configured automatically.

Event-Driven Debugging

A watcher monitors your deployment in real time. When something breaks, the agent diagnoses the failure using Tempo traces and Loki logs, then fixes and redeploys.

Improve Existing Charms

cantrip --improve /path/to/charm audits an existing charm, adds tests, fills COS gaps, modernises deprecated APIs, checks operational readiness, and prepares it for Charmhub listing.

Operational Readiness

Evaluates charms against Canonical’s Operational Readiness Metrics across five pillars: best practices, documentation, reliability, maintainability, and security. Generates scored reports and targeted fix tasks.

Day-2 Operations

After initial build and deploy, the agent researches day-2 concerns — backup/restore, scaling, HA, upgrades, security hardening — and drives additional charm features from confirmed operational needs.

Charm Linting

Standalone charmlint tool with 40+ deterministic lint rules across 12 categories — metadata, observability, testing, deprecated APIs, libraries, actions, config quality, status reporting, security, structure, and more. Optional Rust backend completes a full lint in under 30 ms.

Quickpack

Ultra-fast local charm packing that skips LXD, linting, and analysis — 20–100× faster than charmcraft pack for development deploys. Optional Rust backend drops startup latency to under 50 ms, keeping the build–test loop tight.

Durable Memory

Cantrip remembers lessons across sessions and across charms. User corrections are auto-captured as rules; hard-won workarounds become lessons with SHA-256 citations that revalidate against the source and self-quarantine when it drifts. Export as a shareable SKILL.md bundle. Drive it manually with /memory, /remember, and /forget.

Inline @-Mention Context

Drop file excerpts, git diffs, charm metadata, live juju status, indexed-docs passages, or fetched URLs straight into a chat message with Tab-completable @ mentions — substituted before the LLM sees the message, no extra tool round-trip.

Plan, Branch, Ralph, Yolo

Pick the loop that fits the task: /plan for a read-only proposal, /branch to fork a session and explore alternatives, --ralph N to iterate until green, --yolo for unattended CI. Every mode shares the same agent, permissions, and snapshots.

MCP Extensibility

Plug in third-party tools via the Model Context Protocol. Configure stdio or HTTP servers in cantrip.mcp.yaml and they appear as mcp__<server>__<tool> alongside the built-ins — OAuth 2.1, per-server token storage, mid-task elicitation, and marketplace discovery all handled.

How it works

Two concurrent loops. You steer; the agent drives.

  1. Describe your workload

    “Build a charm for Redis” — or point it at your source repo, or use --improve on an existing charm.

  2. Review the design

    Cantrip researches the workload via web search, Charmhub, and a searchable index of canonical charm-ecosystem documentation, then proposes integrations, config, actions, companion charms, and operational patterns — with citation URLs on every recommendation.

  3. Watch it build

    Concurrent subagents write integration tests, charm code, deploy, and iterate until green — visible in a live task checklist. Acceptance tests exercise every action, relation, and config option.

  4. Validate and ship

    Operational readiness assessment, charm linting, load testing, demo generation, and Charmhub publishing — with full COS observability baked in.

Built on the Canonical ecosystem

Cantrip showcases the tools that power production infrastructure.

JujuOrchestration
CharmcraftPackaging
OpsFramework
RockcraftOCI images
JubilantTesting
ConciergeSetup
COSObservability
Canonical K8sKubernetes
PebbleProcess supervisor
UbuntuOperating system

Get started in seconds

Terminal
$ uv tool install juju-cantrip
$ export GEMINI_API_KEY="your-key"
$ mkdir my-charm && cd my-charm
$ cantrip

# Or use the Web UI:
$ cantrip --web

# Or improve an existing charm:
$ cantrip --improve /path/to/existing-charm

# Or run entirely on local models:
$ cantrip --provider inference-snap --snap gemma3

Chat works with Claude, Gemini, Fireworks.ai, OpenRouter, OpenCode Zen, any OpenAI-compatible endpoint, or a local inference snap — stock or custom-built, no API key needed. Embeddings and rerank route through Voyage or OpenAI, and a custom inference snap can serve embeddings too.

Multiple ways to use it

TUI

Rich terminal interface with task checklist, Juju status, integration graph, theming, and chat — built with Textual.

cantrip

Web UI

Browser-based interface with live WebSocket updates, Markdown chat, integration graph, and Juju status panel.

cantrip --web

CLI

Minimal REPL for scripting and headless environments.

cantrip --no-tui

Print mode

Non-interactive one-shot for pipelines and CI — emits an NDJSON event stream or plain progress lines, and combines with --yolo and --ralph N for unattended runs.

cantrip --print "build a redis charm"

Standalone CLIs

The bundled charmlint runs 40+ lint rules and quickpack packs a charm in under 50 ms — both work without the agent loop and need no API key.

charmlint ./my-charm

Export

Export session transcripts as HTML (with pagination), Markdown, or JSONL — filterable by task, phase, or timestamp.

cantrip export-transcript ./my-charm