The spec is the last thing you write.

magic takes an execution-ready plan and runs a coding agent through build, test, docs, review, and the pull request. Headless, in its own worktree, with one human gate at the start.

npm install -g @anupam-io/magic View on GitHub

One gate. Then no questions until the pull request.

Most agent workflows interrupt you a dozen times between the ticket and the diff. magic moves every decision to the front: a spec that names the requirements, the exact files to touch, the proof for each, and the one command that decides done.

Once that spec passes the check, the agent runs to completion. Open questions are resolved inside the plan's scope and logged, never asked.

  1. 1checkPlan must be READY_TO_EXECUTE with a blocks table and no open questions. The only human gate.
  2. 2buildEach block implemented and proved in turn, in a fresh git worktree on the plan's branch.
  3. 3testThe spec's unit tests written and run. Application code fixed until the Done-when command is green.
  4. 4docsOnly the existing docs the diff made stale. Nothing new.
  5. 5confirmA yes-or-no pass against every requirement. Two DONE in a row end it.
  6. 6commitA conventional commit with the plan's type and title. Local only.
  7. 7reviewA second, fresh session reviews the diff against the repo's own standards and fixes what it finds.
  8. 8pull requestWith --pr and a clean review: push, open a draft, title carries the review status.

Build, test, docs, and confirm share one agent conversation so context carries forward. Review starts cold on purpose, so it reads the diff the way a colleague would. Reruns skip any step already recorded in changes.md.

What the check demands

  • StatusREADY_TO_EXECUTE. The /spec skill ends there after you have nodded the requirements and the block list.
  • QuestionsNone open. Anything unresolved is written to questions.md and the run refuses to start.
  • BlocksA table of file, change, precedent, proof command, and the requirement each block serves.
  • TestsUnit specs only. Integration and end-to-end checks belong in the Done-when command, run once.
๐Ÿ”Ž magic check

  ๐Ÿ“„ plan      .claude/plans/2026-10-02-webhook-retries/plan.md
  ๐Ÿšง status    BLOCKS_PENDING
  ๐Ÿšง questions 2 open
  โœ… blocks    yes
  โœ… tests     unit only

๐Ÿ™‹ open questions
  Q1 Should retries back off exponentially or at a fixed interval?
  Q2 Does the dead-letter table already exist in staging?

stored in .claude/plans/2026-10-02-webhook-retries/questions.md
โŒ magic: not executable; fix with /spec plan.md, then rerun

The agent works inside a fence

It can

  • Read, edit, and create files in the worktree
  • Run yarn, npm, and npx scripts
  • Inspect git diff, status, and log
  • Decide open questions inside the plan's scope, and log each one under Assumptions

It cannot

  • Commit, push, or touch branches. magic does that itself
  • Call gh or reach the network
  • Invent a migration, env var, config key, or external contract the plan does not name
  • Fix failures in files the plan does not touch. Those are noted and left alone

Reference

Install

npm install -g @anupam-io/magic

# the /spec skill runs inside Claude Code; link it once
ln -s "$(npm root -g)/@anupam-io/magic/skills/spec" ~/.claude/skills/spec

Requires git, jq, python3, gh for --pr, and one engine: the claude CLI (default) or codex. macOS and Linux.

Usage

magic <plan dir | plan.md> [--claude|--codex] [--pr] [--dev] [--force] [--branch <name>] [--no-beep]
FlagEffect
--claude, --codexEngine. magic-claude and magic-codex are shorthands.
--prAfter a clean review: push and open a draft PR, plus a two-line "Contributed with Magic" comment.
--devEverything runs, including local commits, but nothing leaves the machine. No push, no gh.
--forceRerun steps already recorded in changes.md.
--branch <name>Branch when the plan has no Branch line. Default is type/slug, type inferred from the plan title.
--no-beepSilence the finish sound.

Environment

VariableDefaultMeaning
MAGIC_ENGINEclaudeclaude or codex
MAGIC_MODELclaude-fable-5-1Claude model. Falls back to claude-opus-5-5 when unavailable.
MAGIC_CODEX_MODELcodex defaultCodex model
MAGIC_MAX_ROUNDS15Confirm passes before the run gives up
MAGIC_CTX_LIMIT180000Context tokens after which a Claude session is rotated
MAGIC_HOME~/.magicWhere per-repo, per-branch timings accumulate across runs
MAGIC_DEV01 is the same as --dev

What a run leaves behind

In the worktree's plan directory: changes.md with every step, assumption, verify entry, and the review; magic-run.md with the timing and cost table; rows.tsv. The PR body draft is at debug/pr.md. The plan directory must live inside the target repo at .claude/plans/<name>/.