Maxxwell by Rindler
Writing

Running a risky migration with agent lanes

2026-11-29

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.


Prerequisites

Before step 1, have this in place:

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.


1. Define the migration goal and cut it into lanes

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:

  1. Write down the migration goal in one paragraph.

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

  1. Choose an incremental migration pattern:
    • Strangler Fig (Fowler): introduce new endpoints / modules alongside old, then cut over.
    • Branch by Abstraction: define a new interface, refactor callers, swap implementation.
  1. Break work into lanes that sound like GitHub issues:
    • "Define NewAuth abstraction and interfaces."
    • "Add migration flag and dual-write plumbing."
    • "Port api/ endpoints to NewAuth behind flag."
    • "Port web/ session middleware to NewAuth behind flag."
    • "Clean up dead LegacyAuth code after cut-over."
  1. Write an 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:


2. Start Maxxwell and create an orchestrator session

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:

  1. Launch Maxxwell and point it at your repo.
  1. Create an orchestrator session with a written brief that owns the migration.

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.
  1. Confirm the orchestrator shows up in Maxxwell with a state like working or idle, and that you can interact with it like any other coding agent.

What Maxxwell does here:


3. Attach Cogagent workers as real terminal sessions

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:

  1. For each lane, start a Cogagent worker in a terminal, with a narrow, issue-like prompt.

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 ./
  1. Attach each of these terminals as sessions in Maxxwell, one per lane.
  1. In the Maxxwell UI, confirm you now see multiple sessions with states:
    • 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.
  1. Label each session with its lane name so you can read the fleet at a glance.

What this buys you:


4. Use Maxxwell’s orchestrator to queue and aim tasks

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:

  1. Talk to the orchestrator session, not to each worker.

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.
  1. Let the orchestrator draft fleet controls.

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.

  1. Choose which commands to send to the api-endpoints Cogagent session. Paste and run them explicitly in that worker’s terminal.
  1. Ask the orchestrator for status:
    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.
  1. Use Maxxwell’s state view to confirm the orchestrator’s picture matches reality. If a lane looks working but the terminal is clearly stuck, this is your signal to intervene.

Key point:


5. Detect stalls and drift before they waste hours

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:

  1. Watch for the 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.
  1. When a session looks stalled, attach to it directly — you land in the real Cogagent terminal.
  1. Inspect the last few actions:
    • Is Cogagent editing files unrelated to auth?
    • Is it stuck trying to resolve flaky tests?
    • Did it silently switch tasks because the prompt was too broad?
  1. Correct drift by narrowing the task.

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.
  1. Update 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:


6. Validate agent-generated changes with tests and audits

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:

  1. Make tests first-class tasks for a dedicated "validator" worker.

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 ./
  1. Use the orchestrator to define validation steps per lane:
    • "Run npm test -- auth and summarize only auth-related failures."
    • "Scan for remaining LegacyAuth references in api/ and web/."
    • "Check that migration flag is wired into all new code paths."
  1. Run tests via Maxxwell-drafted commands, but you still execute:
    # Drafted by orchestrator, run by you
    npm test -- auth
  1. For a large repo, consider an audit protocol similar to the 717,725-line TypeScript case study: multiple passes to converge.

For example:

  1. Gate merges on validation.
    • No PR merges from agent branches without at least one validator pass.
    • Document failed validations in AGENTS.md and in Maxxwell’s return reports.

Tip:


7. Implement a rollback and audit trail for agent changes

If the migration goes sideways in production, you need to know what changed and how to revert cleanly.

What you do:

  1. Enforce branch isolation for agent work.

Example:

   git checkout -b migration/newauth

Ensure all Cogagent sessions work only on migration/* branches.

  1. Require structured commit messages from agents.

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
  1. Track which lane owns which commits.

Simple convention:

  1. Keep a manual rollback playbook.
    # 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.
  1. Use Maxxwell’s return reports to separate:
    • What landed: commits on migration/* branches.
    • What is waiting on you: drafted changes, unsent commands.

Outcome:


8. Run staged rollouts and monitor production behavior

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:

  1. Implement a migration flag early (one of your initial lanes).

Example in code:

   // config/auth.ts
   export const MIGRATION_AUTH_ENABLED = process.env.MIGRATION_AUTH === 'true';
  1. Use Cogagent to wire the flag through api/ and web/, but always behind your explicit commands.
  1. Define rollout stages in 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.
  1. For each stage, tell the orchestrator:
    We are entering rollout stage 2 (10% traffic).
    List the checks we must run before and after the flip, focusing on auth behavior.
  1. Execute only the rollout commands you agree with.
    • Config changes are never auto-applied by Maxxwell.
    • You press enter on flag flips and deployment commands.
  1. Monitor metrics and logs manually or via your existing tooling. Agents can suggest queries, but they don’t own production decisions.

Result:


9. Compare Maxxwell to DIY tmux and other orchestration tools

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:

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.


FAQ: Troubleshooting Cogagent migrations with Maxxwell

Q1: Cogagent keeps drifting off the migration task. How do I prevent this?

Q2: One session shows working but no code changes appear. Is Maxxwell stuck?

Q3: How do I avoid context bloat across a long migration?

Q4: Can Maxxwell automatically roll back bad agent changes?

Q5: How do I know when a migration lane is "done"?