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

Diagnostics

Most build tools hand you a wall of text and leave you to reason out whether the failure is your change, your environment, or a bug in the tool. magus treats that reasoning as the tool's job, not yours. Every diagnostic magus emits is a pointable coded error with a name, a cause, and a resolution, designed for a human to act on, not for a machine to parse.

Anatomy of a diagnostic

[MGS4005] generated output drifted but its declared inputs are unchanged; the committed
form is produced by the pinned release and you are running a dev build (v0.1.0-5-gabc123)
- not your change, do not commit (see: https://.../codes/race/MGS4005.md)

Three things come with every code, for free:

  • A stable code (MGSxxxx) you can search, grep your CI logs for, or paste to a teammate. Codes never move once assigned.
  • A handwritten resolution page at the see: URL: a real Why and Resolution written by a person, so neither you nor an agent has to reverse-engineer the fix.
  • A queryable graph node. Every code is a node in the knowledge graph: magus explain MGS4005 prints the card, and the code page is a first-class doc-site page. Nothing is ad-hoc free text.

Codes are grouped into families

The prefix tells you the domain at a glance:

Range Domain
MGS1xxx magusfile authoring
MGS2xxx sandbox / permissions
MGS3xxx workspace scope
MGS4xxx determinism and drift
MGS5xxx services
MGS6xxx charms
MGS7xxx knowledge-graph extraction
MGS8xxx output references
MGS9xxx auth / connectors

A worked example: drift classification

The clearest expression of the philosophy is what magus does when a generated file drifts. A generate gate re-runs the generators and checks whether the tree went dirty. When it did, vcs\diagnoseDrift names why, instead of just failing:

  • MGS4006: stale generated output. A declared input changed. Real drift: regenerate and commit.
  • MGS4005: environmental drift. The declared inputs are byte-identical to what is committed, but a dev build (or a locally installed tool at a different version than the pinned release) rendered them differently, the classic markdown-emphasis case, *x* versus _x_. Not your change; do not commit.
  • MGS4003: non-deterministic output. Same inputs, same generator version, output still differs: a reproducibility bug in the generator.

magus already holds every fact to make that call: a content hash of the declared inputs, a version fingerprint of the generator and tools, and the produces/consumes edges in the graph, so it makes the call for you. An agent no longer reads a 25-file diff and reasons about markdown emphasis to conclude "toolchain noise, ignore." The code says it.

Why this matters

The same diagnostic serves three audiences with no extra work:

  • A human gets a named cause and a linked resolution instead of a hunt.
  • An agent gets a stable code it can branch on, so it stops burning context re-deriving "is this my problem?" every session.
  • CI gets an identical, coded signal: the drift gate on a clean checkout with the pinned release stays a true content-drift gate, now with a code attached.

This is deliberate design: the cost of diagnosing a failure should be paid once, in the tool, not re-paid by every person and every agent that hits it.

diagnosticserrorscodesMGSDXdriftactionable
Last updated (353014be)
Earlier changes on this page (4)

Full history ↗ · Blame source ↗

Glossary

Workspace

The magus root directory that owns a set of projects and shared config; the unit magus operates over. Workspace in full.

Magusfile

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

Op

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

Charm

An execution modifier attached with : (lint:rw) that changes how a target runs, not which one; the built-in rw flips a check-only target to mutate in place, and ci always strips it. Charm in full.

Engine

The interpreter a magusfile runs on; magus embeds the Buzz engine. Engine in full.

Sandbox

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

Service

A long-running or shared process magus manages across runs, distinct from a one-shot target. Service in full.

CI

An ordinary target you compose yourself with ctx.needs; magus does not hardcode its stages. It is the anchor magus affected ci keys off, and ci strips the rw charm. CI in full.

Output reference

A short, shareable id such as out1a2b3c for one target execution's captured output; magus query output prints those exact bytes. In OpenTelemetry terms it names a span. Output reference in full.

Knowledge graph

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

Agent

A model working through an agent host such as Claude Code, Codex, Cursor or OpenCode. magus treats an agent as one more caller of its CLI, MCP tools and console, held to the same checks as a person. Agent in full.

Tool

An action a model can call through its host: a name, a description, a typed input and a result. magus serves its tools over MCP, each a read of the workspace model or a run of the CLI it already has. Tool in full.

Session

An agent host's conversation, by the id the host delivers to its hooks. magus never mints one: a record with no session is unattributed, and the OS user it carries says whose account ran it. Session in full.

Job

The unit of delegated work, and one row of the job store: what an orchestrating agent handed out, with its goal, the checkpoint it was cut against, the paths it may write or must not touch, and the one check it runs. A job's holder is either a session, for work an orchestrator handed out, or the daemon, for its own maintenance. The store records; the agent guard is what reads those facts back when grading a write. Job in full.

Run

One target executing under one magus invocation, such as magus run test web or magus affected ci. A run keeps its captured output behind an output reference. Every magus run is a run whether or not any job asked for it; see Job for how the two relate. Run in full.

Lease

The grant a holder takes on a job: the write and read paths that job declared, enforced in the checkout that took it with magus job exec. A job is the piece of work; a lease is permission over it. Lease in full.

Conventions

This page uses none of the site's convention markers. The full set is on the conventions page.