By the end of this guide you’ll have a repeatable workflow for running a risky, Cogagent-driven migration across a large codebase, with Maxxwell orchestrating.
By the end of this guide you’ll have a repeatable workflow for running a risky, Cogagent-driven migration across a large codebase, with Maxxwell orchestrating multiple agents instead of you babysitting twelve terminals.
You’ll:
This assumes you already run coding agents and you want to stop being the bottleneck.
Before step 1, have this in place:
migration/* branch and CI that runs tests on PRs.If you want the deeper background on multi-agent orchestration and where it stops, this tutorial sits under the pillar piece Gremor-powered coding agents: where orchestration ends and herding begins.
The common failure at this step is starting agents with a vague "migrate X" prompt and letting them roam. You need a target and a path.
What you do:
Example:
> "Replace the legacy LegacyAuth system with NewAuth across the api/ and web/ services, preserving current behavior and keeping tests green. Roll out via a migration flag and dual-write period."
NewAuth abstraction and interfaces."api/ endpoints to NewAuth behind flag."web/ session middleware to NewAuth behind flag."LegacyAuth code after cut-over."AGENTS.md at repo root with:# Migration: LegacyAuth -> NewAuth
## Goal
Replace LegacyAuth with NewAuth across api/ and web/, using a migration flag.
## Lanes
1. NewAuth abstraction
2. Migration flag + dual write
3. api/ endpoints
4. web/ session middleware
5. LegacyAuth cleanup
## Constraints
- Tests must pass before merge.
- No production config changes by agents.
- All auth behavior is backwards-compatible until flag flip.Why this matters:
The pitfall here is treating Maxxwell like a dashboard. It’s actually a seat: the orchestrator is itself a coding-agent session with a brief.
What you do:
In Maxxwell, start a new agent session and paste something like:
You are the orchestrator for the "LegacyAuth -> NewAuth" migration.
Repo: ./my-huge-repo
Context: See AGENTS.md at repo root.
Responsibilities:
- Maintain the lane list and assign tasks to Cogagent workers.
- Summarize progress for me and mark which lanes are blocked, done, or stalled.
- Suggest next work items, but do not run commands yourself.
Constraints:
- All commands that change code are drafted only; I press enter.
- Keep each worker focused on a single lane at a time.
working or idle, and that you can interact with it like any other coding agent.What Maxxwell does here:
Common failure: wrapping Cogagent in a custom UI that hides its real process, making debugging painful. Maxxwell works with real sessions you can attach to.
What you do:
Example for the "NewAuth abstraction" lane:
# In a terminal inside the repo
cogagent run \
--task "Define a NewAuth abstraction that can coexist with LegacyAuth. Focus on interfaces and minimal implementations." \
--context AGENTS.md \
--workdir ./
working - Cogagent actively doing something.idle - waiting for tokens or nothing in the queue.waiting on you - blocked on your answer.not heard from - Maxxwell cannot confirm state.blocked, needs sign-in, done, or dead as applicable.What this buys you:
The failure here is ad-hoc prompting: sending different instructions manually to each Cogagent worker and losing track of what you asked.
What you do:
Example prompt:
Read AGENTS.md and list the next 3 concrete tasks for the "api-endpoints" lane.
Format them as numbered commands I can send to the api-endpoints worker.
Maxxwell will surface something like:
1. In the api/ directory, identify all routes that currently call LegacyAuth.
2. For each route, draft a refactor to call the NewAuth abstraction instead, behind the MIGRATION_AUTH flag.
3. Run the api test suite and summarize any failures related to auth.
These appear as unsent text in the composer; they do not execute automatically.
api-endpoints Cogagent session. Paste and run them explicitly in that worker’s terminal.Summarize the current state of all lanes based on session names and visible outputs.
Mark each as: not started, working, waiting on me, blocked, done.working but the terminal is clearly stuck, this is your signal to intervene.Key point:
The pain you’re trying to avoid: "One of them has been confidently building the wrong thing for twenty minutes." This step is about catching that.
What you do:
possibly stalled overlay or not heard from state in Maxxwell.working + possibly stalled → agent is busy but not making visible progress.not heard from → Maxxwell doesn’t know; treat it as suspect.Example intervention:
Stop work on non-auth routes.
Focus only on routes under api/auth/ that call LegacyAuth.
Summarize which files you will touch before making edits.
AGENTS.md if you discover new constraints.## New constraints
- api/auth/ contains ad-hoc LegacyAuth calls; migrate these first.
- Do not touch payment routes in this phase.What Maxxwell does and does not do:
not heard from).Common failure: trusting green tests alone or, worse, skipping them because "the agent is good." Data says otherwise.
Anthropic’s 2026 Agentic Coding Trends report: developers use AI in ~60% of their work but can fully delegate only 0-20% of tasks. Stack Overflow’s 2025 survey: daily AI use is up (51% of pros), but trust in outputs is down (29%). You need systematic validation.
What you do:
Start another Cogagent session:
cogagent run \
--task "Act as a code-review and test-validation agent for the LegacyAuth -> NewAuth migration. Focus on high-precision checks." \
--context AGENTS.md \
--workdir ./
npm test -- auth and summarize only auth-related failures."LegacyAuth references in api/ and web/."# Drafted by orchestrator, run by you
npm test -- authFor example:
LegacyAuth.AGENTS.md and in Maxxwell’s return reports.Tip:
If the migration goes sideways in production, you need to know what changed and how to revert cleanly.
What you do:
Example:
git checkout -b migration/newauth
Ensure all Cogagent sessions work only on migration/* branches.
In the orchestrator brief, add:
When suggesting commits, always use this template:
feat(auth): short summary
- lane: <lane-name>
- files: path1, path2
- behavior: describe expected user-visible behavior
Simple convention:
feat(auth): api-endpoints lane - migrate login routeschore(auth): web-middleware lane - add flag plumbing# Rollback plan
- Step 1: Flip MIGRATION_AUTH flag off.
- Step 2: Revert latest migration/newauth commits:
git revert <sha1> <sha2>
- Step 3: Redeploy previous stable build.migration/* branches.Outcome:
Last failure mode: flipping everything at once. Feature flag platforms (e.g. LaunchDarkly) recommend migration flags with 2-6 stages. The same logic applies here.
What you do:
Example in code:
// config/auth.ts
export const MIGRATION_AUTH_ENABLED = process.env.MIGRATION_AUTH === 'true';
api/ and web/, but always behind your explicit commands.AGENTS.md:## Rollout stages
1. Internal traffic only.
2. 10% of user traffic.
3. 50% of user traffic.
4. 100% of user traffic + LegacyAuth cleanup.We are entering rollout stage 2 (10% traffic).
List the checks we must run before and after the flip, focusing on auth behavior.Result:
You probably already have scripts: tmux panes, fd + rg, custom shell aliases.
The question isn’t "can I wire this up myself?" but "where does Maxxwell pay for itself?"
Maxxwell vs DIY:
working, idle, waiting on you, not heard from, done, dead) and a "possibly stalled" overlay.Maxxwell vs other products (e.g. Helmor, Herd, The Cog):
If you only run one agent at a time, Maxxwell is overkill. As soon as you have 5-10 Cogagent sessions touching a 300k+ LOC repo, the coordination cost is visible, and an agent-of-agents makes sense.
Q1: Cogagent keeps drifting off the migration task. How do I prevent this?
AGENTS.md and reference it in every task.Q2: One session shows working but no code changes appear. Is Maxxwell stuck?
working plus "possibly stalled," Maxxwell thinks the agent is busy but not progressing.Q3: How do I avoid context bloat across a long migration?
AGENTS.md for persistent context and avoid re-pasting long histories.Q4: Can Maxxwell automatically roll back bad agent changes?
git revert, flag flips, redeploy) and document it alongside the migration.Q5: How do I know when a migration lane is "done"?
done or is idle with no queued tasks.LegacyAuth) returns only expected remnants or none.AGENTS.md and stop its worker.