Skip to content
Powered by BridgeApp

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 --trust on 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.

Terminal window
coder \
--trust \
--automagic \
--query "fix the failing tests and stop when done"

That command:

  1. Trusts the workspace for this run.
  2. Sends "fix the failing tests and stop when done" as the first user message.
  3. Auto-approves every shell command and file edit Magic Coder wants to run.
  4. 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.

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 --trust to 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 --workdir arguments if the task legitimately needs other directories.

Combine --plan with --automagic for “investigate first, then implement, then exit”:

Terminal window
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).

Automagic doesn’t open a browser. Make sure you’ve signed in at least once interactively first:

Terminal window
coder # sign in via browser
/exit # back to your shell
coder --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.

All the usual flags work in automagic:

Terminal window
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.

Terminal window
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.

  • 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.

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.