Automagic — non-interactive runs
Automagic is Magic Coder’s hands-off mode. Pass --automagic and Magic Coder:
- auto-approves every tool-execution prompt that would normally ask
- requires a startup target —
--query,--continue, or both - requires a trusted workspace — either already trusted, or
--truston the same run - requires pre-saved auth — sign in once interactively first, so credentials are cached
- exits automatically when the agent finishes the task
It’s the right tool when you trust the agent to drive the loop and you don’t want to babysit. It’s the wrong tool when you need to make case-by-case judgment calls about what edits are acceptable.
A typical invocation
Section titled “A typical invocation”coder \ --trust \ --automagic \ --query "fix the failing tests and stop when done"That command:
- Trusts the workspace for this run.
- Sends
"fix the failing tests and stop when done"as the first user message. - Auto-approves every shell command and file edit Magic Coder wants to run.
- Exits when the agent finishes.
If you forget --query or --continue, Magic Coder refuses to start: there’s no startup target, so there’s nothing to do.
What gets auto-approved
Section titled “What gets auto-approved”Every approval prompt that would have stopped the agent: shell commands, diffs, file deletes. The same approvals you’d grant by tapping a in interactive mode are granted automatically.
What is not auto-approved:
- The trust prompt. If the workspace isn’t trusted, Magic Coder refuses to start automagic. Pass
--trustto mark it trusted on this run. - Sign-in. If there’s no saved credential, Magic Coder won’t try to open a browser for an automagic run. Sign in interactively first.
- Operations outside the configured workspace roots. Automagic doesn’t widen the file boundary. Pass extra
--workdirarguments if the task legitimately needs other directories.
Plan mode + automagic
Section titled “Plan mode + automagic”Combine --plan with --automagic for “investigate first, then implement, then exit”:
coder \ --plan \ --trust \ --automagic \ --query "migrate the legacy json importer to the new pipeline"Magic Coder will read the repo, produce a grounded plan, and then execute it without asking. This is a good shape for CI runs and well-defined batch tasks.
For day-to-day work where the goal is “I want a PR-shaped result without supervising,” many teams prefer --plan without --automagic: you sign off on the plan, then walk away while the implementation runs interactively (the plan-approved direction is usually enough that approvals are minimal).
Pre-saved auth
Section titled “Pre-saved auth”Automagic doesn’t open a browser. Make sure you’ve signed in at least once interactively first:
coder # sign in via browser/exit # back to your shellcoder --automagic --trust --query "..."If you’re scripting from a fresh machine and can’t run an interactive sign-in, you’ll need to provision credentials out of band — either set MAGIC_CODER_OAUTH_TOKEN or pass --oauth-credentials-file <path>. See Sign in for the full headless / CI flow.
Combining with model and reasoning flags
Section titled “Combining with model and reasoning flags”All the usual flags work in automagic:
coder \ --trust --automagic \ --model gpt-5.5 \ --reasoning-effort high \ --allow-long-context \ --query "audit the auth module for unsafe deserialization"The model and reasoning effort apply for the whole run. Long-context mode is honored for the whole thread.
Resuming a thread under automagic
Section titled “Resuming a thread under automagic”coder --continue <uuid> --automagic --trust --query "now also update the docs"Useful when you’ve seen the agent drive a thread interactively and you want to push a follow-up step without watching it work.
What automagic doesn’t change
Section titled “What automagic doesn’t change”- The local tool boundary stays the same — only configured workspace roots are writable.
- Built-in deny rules and any “deny & remember” decisions are honored. Automagic doesn’t override an explicit denial.
- Exit code reflects the run: zero on a clean finish, non-zero if the agent encountered a fatal error or you interrupted it.
When to prefer interactive
Section titled “When to prefer interactive”If you’re doing exploratory work, learning a new codebase, refactoring a module you care deeply about, or working in a repo where small differences in approach matter, run interactively. Automagic is for known shapes — fix this kind of bug, add this kind of test, regenerate this kind of artifact — not for one-off creative work.