magus v0.4.2 is out. See what's new
¶ View markdown source · ✎ Suggest an edit
6 min read

Quick start

One page, densely packed, for someone who wants to be productive now and read properly later. Every section links to the page that goes deeper.

If you want the guided, explain-as-you-go version instead, read Getting started. If you want to try magus without installing anything, the playground runs the same engine in your browser.

Install

curl --proto '=https' --tlsv1.2 -sSf https://eli.gladman.cc/magus/install | sh

Prefer to read it first (recommended, and the same two lines the script prints):

curl --proto '=https' --tlsv1.2 -sSf https://eli.gladman.cc/magus/install -o install.sh
less install.sh
sh install.sh

The installer verifies a checksum against a signed release. Package managers, containers, CI setup actions, and building from source are all on Download. To pin a version in CI, use the setup-magus action rather than curling into a runner.

Check it worked, and check the workspace is sane:

magus --help
magus doctor        # config, cache, tools, cycles, guard binary

The one thing to understand

A target is a named operation (build, test, lint, format, generate, ci) declared as a function in a magusfile.buzz. A project is a directory that owns one. A spell binds a toolchain (go, ts, rs, py, ...) so a project gets that toolchain's operations without writing them.

magus knows each target's declared inputs and outputs, so it caches results and can compute which projects a change actually affects. That is the whole value proposition, and it is also why running the raw tool underneath defeats it.

Which looks like this: a cold run does the work, the same command again replays every result from cache, and after one file changes only the project that file reaches runs at all.

A terminal recording: magus ls lists the projects, magus run ci reports 0 cached and 4 ran, the same command again reports 4 cached and 0 ran, then one edited file makes magus affected ci report 4 cached and 1 ran

Deeper: Targets, Workspace, Spells, Cache.

Your first five commands

magus init                  # bootstrap a magusfile in an existing repo
magus ls                    # every project, its spell, sources, outputs, deps
magus describe targets      # every target; -o name for bare names
magus run test              # run a target (cwd project, or all from the root)
magus affected ci           # the gate: full pipeline over what your diff reaches

magus affected ci is the one to run before you call work done. It runs over every project your change reaches, including ones you never edited.

Deeper: Getting started, CLI reference.

Scoping: magus is CWD-relative

A bare magus run acts on the project holding your current directory, or the whole workspace from the root. Do not assume the root. Scope explicitly:

magus run test web          # name the project (positional, after the target)
magus run go::go-test web   # one spell op, when a whole target is too broad
magus run test -- -run TestX  # args after -- are forwarded to the tool
magus where web             # resolve a fuzzy project name to its path

Add --dry-run to any of these to print the exact commands without running them.

Output control

magus has output flags, so you never need to pipe its output through grep, head, or awk. Every one of these works on every command:

flag does
-s / --silent a pass prints a result line plus an output ref; a failure adds a bounded tail
-q / --quiet drops progress, keeps errors and the failing project's full output
-o json / yaml / jsonl machine-readable, schema_version-stamped
-o name bare identifiers, one per line
-o template=<go-template> project exactly the fields you want
-v / -vv / -vvv more log verbosity
--tee <file> mirror structured output to a file

When a target fails it mints an output ref (out1a2b3c). Fetch the full log with magus query output out1a2b3c instead of re-running the target to see the error again.

Deeper: Logging, CLI reference.

Set up your coding agent

magus ships skills for coding agents, and a guard hook that stops an agent bypassing the workspace. Install the skills into whichever directories your host reads:

magus agent install .claude/skills      # Claude Code
magus agent install .agents/skills      # the cross-host convention
magus agent install .opencode/skills    # opencode

If your host reads AGENTS.md instead of a skills directory, install prints the magus block for you to paste in. magus does not write that file - it is yours, and it stays quiet once your copy is current. For a whole starter file to own:

magus agent sample                      # prints an AGENTS.md to adapt; never writes

Any destination your shell can reach works via the tar form, which is also how you install outside the working tree:

magus agent install --tar | tar -xf - -C ~/.config/opencode/skills

Two permutations, both installed

Every skill ships in two hand-authored permutations from one source body, and install writes both. There is no flag to pick between them.

The primary entry is the SHORT form: the enumeration dropped, the judgment kept, for the most capable readers - the ones that can re-derive the steps from the tool surface but not which failures are silent. It is the one always loaded, so it is the one whose size every session pays for.

Beside it goes an always-full <skill>-full twin, loaded only when asked for by name. Reach for that name when you hand work to a smaller model, or when you want the rationale behind a step yourself. The short form bets its reader can re-derive what it drops; the twin is there for every reader who did not make that bet.

Both permutations share ONE content digest, so they version together: a magus upgrade makes both stale at once, never one silently. Check with:

magus doctor

Deeper: Agent skills shows every skill in both forms with its size, and Agents covers host wiring.

The guard hook

The guard reads one command an agent is about to run and returns deny, advise, or pass. It parses the shell rather than pattern-matching it, so a command cannot evade the guard by adding an environment prefix or a shell indirection:

printf '%s' 'go test ./...' | magus session hook -o name               # deny: magus run test covers this
printf '%s' 'env -u GOROOT go test ./...' | magus session hook -o name # deny: same command, prefix peeled
printf '%s' 'magus run test' | magus session hook -o name              # pass

It denies on four triggers: what cannot be undone (whole-tree VCS operations), what WRITES into the working tree (codegen, formatters, build output), what has an exact magus equivalent, and what breaks a provenance guarantee (a note). Everything else it explains or ignores.

Wire it into your host with the ready-made scripts: The guard, with a setup page per host behind Agents.

Point it at a real binary. If the guard cannot find one it says so loudly, and magus doctor's guard binary check names the binary a hook would run and fails when it is older than your working tree - because a stale guard enforces stale rules while looking perfectly healthy. The guard wiring check answers a different question: whether anything actually invokes it. It runs a canary command through the resolved binary and inventories every host hook config it finds, advising when none exists (correct rules, nothing asking them) and failing when a config points at a template file that is stale or missing.

Where to go next

you want read
the guided walkthrough Getting started
every install method Download
what a target is, really Targets
how caching decides a hit Cache
binding a toolchain Spells
sandboxing and what it enforces Sandbox
writing magusfile logic Buzz reference
querying the knowledge graph Knowledge
a diagnostic code you hit Diagnostics
running the daemon and console Daemon, Console
CI wiring CI providers
when something is wrong Debugging, FAQ

Every flag and target set differs per workspace and magus version, so trust magus describe targets, magus describe target <name>, and magus <verb> -h over anything written down - including this page.

getting-startedinstallquickstartagentsskillsclireference
Last updated (d120b58e)
Earlier changes on this page (7)

Full history ↗ · Blame source ↗

Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. See workspace.

Project

A directory magus recognizes as a unit of work (it has a magusfile); the unit of caching, scheduling, and dependency tracking. See workspace.

Magusfile

The magusfile.buzz that declares a project's targets (as export funs) and binds its spells. See targets.

Target

A named operation (build, test, ...) you invoke with magus run <target>; it may compose a spell's tool-native operations and depend on other targets. See targets.

Op

A single tool-native command a target composes (long form: operation); the middle of the work hierarchy (Spell to Op to Target). See operations.

Spell

A language/runtime adapter (e.g. go, md) that maps generic targets onto a toolchain's real commands. See spells.

Ward

A coded diagnostic that inspects a resolved op and nudges or blocks an anti-pattern before it runs. See wards.

Buzz

The language magusfiles are written in (the .buzz engine). See engines.

Engine

The interpreter a magusfile runs on; magus embeds the Buzz engine. See engines.

Cache

The content-addressed store magus consults before running a target, so unchanged work is skipped. See cache.

Affected

The set of projects touched by a change; magus affected <target> runs a target only over them. See affected.

Sandbox

The restricted filesystem and environment a target runs in, so builds stay reproducible and side-effect-free. See sandbox.

Daemon

The background magus host that owns shared state such as services and the warm knowledge graph. See daemon.

CI

An ordinary magusfile-defined target you compose yourself with magus\needs - magus does not hardcode its stages. Magus.RunCI treats it specially only in that it strips the rw charm, it is the anchor magus affected ci keys off, and a selected scope with no project declaring it is a load error rather than a silent no-op. See targets.

Health

The at-a-glance daemon state derived from the pool: healthy when the pool is reporting, degraded when it reports an error, down when there is no pool. The dashboard color-codes each state. See daemon.

Knowledge graph

The queryable graph of a workspace's spells, targets, docs, and code relationships; query it with magus query/explain/path. See knowledge.

Diagnostic code

A stable MGSxxxx identifier attached to a magus warning or error, so it can be referenced and looked up; some are guardrails (see wards), others hard errors.

Session

One magus process's recorded facts - the targets it finished, their outcomes, and the lease it acted as - kept in a repo-scoped store every worktree shares. magus session lists them; the store prunes itself by last-fact age.

Lease

One row of the lease ledger: a piece of work an orchestrating agent handed out, with its goal, the checkpoint it was cut against, and the paths it owns or must not touch. The ledger records; the agent guard is what reads those facts back when grading a write. See doctrine.

Conventions

Placeholders

Angle brackets mark a value you replace with your own - never type the brackets:

magus run <target>
magus completion <shell>    # e.g. bash, zsh, fish

<target>, <path>, <shell>, <name> and the like are stand-ins, not literal text.