Overview
Vibe coding is the most fun software has been in years: you describe what you want, the agent writes it, you keep moving. On a side project that trade is obviously worth it. Point the same loop at a system that clears customs declarations, prices policies, or moves money, and the trade inverts — not because the agent writes bad code, but because nothing in the loop proves the result is correct. There is no ground truth and no audit trail. When someone asks “how do you know this behaves like the system it replaced?”, the honest answer is a shrug. The wall is not speed. Modernizations do not stall because the code arrived too fast. The wall is proof. Vibe modernization is rebuilding a legacy system by turning a grounded AI agent loose to forward-engineer its behavior into the target architecture — the speed and feel of vibe coding, bolted to verified ground truth so it holds up under audit. This is a mode of code modernization, not a replacement for it. It runs the same six-phase spine as the Code Modernization playbook and reaches the same gates. What makes it its own variant is a single decision about who’s driving — and the disciplines that decision forces. Where the architecture-to-architecture variants (like Monolith → Microservices) specialize the framework by target shape, this one specializes it by execution mode. The two compose: you can run vibe modernization toward a microservices target. CoreStory’s role shifts accordingly. In the base playbook CoreStory is an advisor to a human protagonist — Expert, Navigator, Verifier. Here the agent is the protagonist and CoreStory is the grounding layer that makes agent velocity safe: it accelerates discovery across both the legacy system and the target, and every claim it surfaces is checked against source before it enters a deliverable. Who this is for: Engineering leads and delivery teams who want agent-speed modernization on a system where behavioral parity is a hard requirement — regulated domains, financial calculations, compliance filings, anything where getting behavior wrong is expensive. What you’ll get: A working modernized component and the audit trail that proves it — a gap report per work item, test-first code in the target’s own idiom, a Behavioral Equivalence Report, an independent conformance ledger, and a running provenance record tying every decision back to a source anchor.When to Use This Playbook
Reach for this variant when both of the following hold:- Behavioral parity is the point. The value is in preserving decades of accreted behavior, not re-imagining the product. If the goal is a redesign, this isn’t it — that’s a rewrite, and this playbook’s entire verification apparatus is built to catch exactly the drift a rewrite intends.
- You want agent velocity without giving up the audit trail. The deliverable is a source-traced, independently-verified body of work, not just working code. If nobody will ever ask you to prove equivalence, the overhead here is not worth paying.
When to Skip This Playbook
- You cannot ingest the legacy system. Everything downstream depends on grounding claims in legacy source. Without it you are vibe coding, not vibe modernizing.
- No one can validate the business rules. The behavioral spec is the contract the whole method verifies against. If no domain expert can confirm it, you will build fast against the wrong contract.
- You cannot staff independent verification. The method’s safety property comes from the verifier being separate from the builder. If the same session and the same person write the code, the tests, and the equivalence report, you have re-created the circularity this variant exists to break — and you would be better served by the base playbook’s continuous human review.
- The strategy is Rehost or Relocate. No application-level change means no behavior to forward-engineer. See the 7 Rs.
- The team has no appetite for gates. Agent-led is not agent-unattended. If plan approval and equivalence sign-off will be rubber-stamped, run the base playbook where human judgment is distributed across every phase boundary instead of concentrated at a few points.
Prerequisites
- Two CoreStory projects, both fully ingested — one for the legacy system, one for the target. The dual-project setup is what lets the agent reason across both sides in a single pass. (Greenfield target: the second project comes online as the target takes shape.)
- An AI coding agent with CoreStory MCP configured — see Supercharging AI Agents.
- Direct read access to legacy source for the agent, not just the intelligence layer. Code intelligence accelerates discovery; source decides truth. The agent must be able to open the file and cite the line.
- A named domain expert who can validate the behavioral spec. This is a gate, not a courtesy review.
- A test harness in the target that can run red before it runs green. Test-first is not optional here — it is how the agent proves it understood the requirement before it wrote the code.
- Someone other than the builder available for verification. Separate session at minimum; separate person preferred.
- (Recommended) A working target build you can run locally. An agent that cannot compile cannot self-correct, and the velocity argument collapses.
How It Works
Center of Gravity: Who’s Driving
This is the distinction that generates everything else, so it’s worth stating plainly. The base Code Modernization playbook is human-led and agnostic about the labor split. It prescribes where decisions happen — the HITL gates, mandatory expert review on ambiguous findings, one phase per session, “AI informs; architects decide” — but not how much the agent does between those gates. A team can run it with heavy manual involvement (people read the code, people decide, the agent advises) or lighter-touch, anywhere along that spectrum. Vibe modernization is agent-led and human-gated. It takes the stance the base playbook leaves open: the agent owns the build loop end to end at speed — gap analysis, test-first implementation, verification drafting — and human judgment is concentrated at a few high-leverage gates rather than spread across every phase boundary. The whole arc is arranged to keep the agent running flat-out between a small number of decision points.Base playbook: agnostic about who does the work, defaults to human-led. Vibe modernization: opinionated — the agent drives, humans gate. Same rigor, different center of gravity.The obvious objection is that handing the agent the wheel trades away safety. It doesn’t — it relocates it. When the agent is driving at speed you cannot lean on continuous human review to catch drift, so that job moves to the audit trail and an independent verification pass. You can let the agent drive precisely because the verification discipline catches what pervasive manual oversight otherwise would. That is the safety argument, and it is why the disciplines below are non-negotiable in this variant while remaining optional in the base.
How It Differs from Base Code Modernization
One thing determines which you are running: the center of gravity above. So the distinctions below are not capabilities the base playbook lacks — they are disciplines this variant makes mandatory, because with the agent driving it cannot fall back on continuous human judgment to catch drift.
Discipline 3 is the genuinely new idea. It is what stops “vibe” from meaning “unverified.”
On convergence and the Strangler Fig: the base playbook’s default execution pattern runs old and new side by side behind a façade. Convergence is not a rejection of that — on a live-production cutover you may still wrap the converged code in a coexistence layer for safe rollback. The invariant is that the code is one coherent body rather than a bolted-on port; the façade is a deployment concern and remains available to you.
Standing vs. Greenfield Target
Whether a target architecture already exists is not a reason to choose one playbook over the other. It changes only the shape of the front of the arc:- Standing (brownfield) target — already exists, partially built, with its own architecture and idioms. You skip target design entirely, reverse-engineer both sides, and converge into what’s there. This is the path the walkthrough below is written for.
- Greenfield target — nothing built yet. You fold the base playbook’s Phase 3 back into the arc — select the strategy with the 7 Rs, design the target — and then proceed unchanged. Everything downstream (the grounding, the convergence, the two-check verification) is identical; Step 1 below simply keeps the target’s emerging structure grounded rather than recovering a structure that already exists.
CoreStory MCP Tools Used
The Vibe Modernization Arc
Note: The six steps below are internal to this playbook. They map onto the six-phase modernization framework rather than replacing it — the mapping is in the table under each step heading.
- Recover Both Architectures — reverse-engineer the target’s service design and the legacy’s structure, so the agent knows where legacy behavior will land.
- Extract the Legacy Behavioral Contract — a source-verified behavioral spec. This is the contract everything downstream verifies against.
- Author the Backlog and Test Strategy — the backlog is a deliverable in its own right, authored with the same grounding discipline as the code.
- Gap-Analyze Before Writing Code — per work item, across both projects: what exists in the target, what the legacy requires, what must change. This is the plan-approval gate.
- Converge Into the Target, Test-First — Red → Green, in the target’s own idiom, emitting provenance as it goes.
- Verify Twice — the Behavioral Equivalence Report and an independent conformance audit, both run in sessions separate from the build.
Which Playbook Runs Each Step
Most of the arc is existing playbooks run with the grounding discipline turned up. Only two things are genuinely new.HITL Gates
Agent-led is not agent-unattended. This variant trades many small review moments for few consequential ones — which means the ones that remain carry real weight and cannot be waved through.Gate 1 — Spec validation (after Step 2). A domain expert confirms the legacy behavioral spec. Business rules define “correct”; get them confirmed before anything is built against them. This is the single highest-leverage hour in the engagement.
Gate 2 — Plan approval (Step 4, per work item). The gap-analysis plan is approved by a human before any code is written. The agent proposes; a human decides. This is the gate that keeps velocity from becoming drift.
Gate 3 — Equivalence sign-off (after Step 6). Sign-off happens only when the BER and the conformance audit agree. Disagreement is not an averaging problem — it means one of them is wrong, and you find out which before you sign.A useful check on whether you are running the method honestly: if no gate has ever sent work back, the gates are decorative.
Step-by-Step Walkthrough
Step 1: Recover Both Architectures
Base framework: Phases 1 and 3, collapsed and inverted. In the base playbook, Phase 1 assesses the legacy for readiness and Phase 3 designs the target. When the target already exists, those two collapse: there is nothing to design, so instead of choosing a target you recover the one that already exists — and you understand the legacy well enough to converge onto it. Confirm both projects are ingested:Step 2: Extract the Legacy Behavioral Contract
Base framework: Phase 2 (Business Rules Inventory), carried over almost unchanged. This is the contract everything downstream verifies against, and it is the one step where you should feel no temptation to move fast. Run Business Rules Extraction as written, with one hardening: every behavior must carry a source anchor. Extract with anchors mandatory:Gate 1 — Spec validation. A domain expert confirms the spec before anything is built against it. Bring them the rules that are ambiguous, that look like defects, and that you have classified MODIFY or DISCARD. Do not bring them 400 rules and ask for a blanket approval.What good looks like: each behavior stated with its source anchor and a migration intent, so Step 6 has an unambiguous checklist rather than a judgment call.
Step 3: Author the Backlog and Test Strategy
Base framework: Phase 4 (Decomposition & Sequencing), carried over and hardened. The base playbook decomposes and sequences into work packages. Here the backlog itself is a deliverable, authored with the same grounding discipline as the code — because the agent will execute against it without a human re-deriving the requirement at each ticket. Author tickets with dual provenance:Step 4: Gap-Analyze Before Writing Code
Base framework: Phase 5, pre-implementation. This is the net-new twist. Before any code is written for a work item, run Feature Gap Analysis across both projects at once. Standard gap analysis compares two systems’ capabilities. Here you are asking a sharper question: given what the target already has and what the legacy requires, what is the minimum coherent change? Run the dual-project gap analysis:Gate 2 — Plan approval. A human approves the gap report and the implementation plan before code is written. Read the CONFLICT entries first; they are where the judgment lives. If the plan proposes touching more of the target than the ticket justifies, that is scope drift arriving early, where it is cheap to stop.What good looks like: the plan is specific enough that a reviewer disagreeing with it can say exactly which line they disagree with.
Step 5: Converge Into the Target, Test-First
Base framework: Phase 5 (Iterative Execution), carried over and hardened. This is where “converge, don’t port” becomes an execution pattern. The agent forward-engineers directly into the target so the result is one coherent body rather than a patchwork. Write the failing tests first:Step 6: Verify Twice
Base framework: Phase 6 (Behavioral Verification), carried over and deepened. The base playbook signs off on a Behavioral Equivalence Report. Here that is the first of two independent checks — because the same agent that wrote the feature also wrote its tests and would write its BER, and those three can share a blind spot and rubber-stamp a half-build.Run both checks in sessions separate from the build. Not a fresh prompt in the same session — a separate session, ideally driven by a different person. Session independence is the mechanism; everything else here is bookkeeping.6a — Behavioral Equivalence Report. Run Behavioral Verification as written. Each rule from the Step 2 spec is classified Preserved / Modified / Discarded / Missing, traced to its implementation in the target. 6b — Conformance audit. This is the net-new check, and it is deliberately narrow: read-only, atom-grain, with legacy source as the only oracle. It does not read the BER, and it does not trust the tests.
Gate 3 — Equivalence sign-off. Sign off only when the BER and the conformance audit agree. Where they disagree, resolve against legacy source before signing. A BER that says Preserved and an audit that says STUBBED is not a scoring discrepancy — it is the method working.What good looks like: the conformance audit finds something the tests and the BER both waved through. In the field application that produced this variant, it surfaced a regressed re-import path that had a green test suite and a clean equivalence report over it. That single catch is the argument for the whole step.
The Two Disciplines That Make “Vibe” Safe
Velocity is the easy half. These two are what let you claim the audit trail — call them out explicitly when teaching the method, because they are what people drop first under schedule pressure. 1. Source-grounded validation. Intelligence accelerates discovery; source decides truth. No claim — about legacy behavior, target structure, or a proposed change — enters a deliverable until it has been checked against the actual code and given afile:line anchor. This is ordinary good hygiene rather than a special mechanism, and it is what makes the velocity honest: you move fast because the grounding is cheap, not by skipping it.
The practical test: pick any sentence in any deliverable and ask what it is anchored to. If the answer is “the agent said so,” it is not grounded, however plausible it reads.
2. Anti-circular verification. The same agent that writes a feature also tends to write its test and its equivalence report, so all three can share the same blind spot. The conformance audit breaks the circle: atom grain, independently, with legacy source as the only oracle, run in a session separate from the build. This is the method’s original contribution and the reason “vibe” here does not mean “unverified.”
The practical test: could the verification pass have been written by someone who never saw the implementation session? If not, it is not independent.
Output Formats
Each artifact below is a gate input. A unit of work is not done until its artifacts exist.Gap Report (per work item, Step 4)
Conformance Ledger (Step 6b)
Context Inventory (running, all steps)
The provenance ledger. One entry per non-obvious decision, written when the decision is made.Prompting Patterns Reference
Grounding Patterns
Convergence Patterns
Dual-Project Gap Patterns
Anti-Circular Verification Patterns
Best Practices
One session, one artifact of depth. The temptation with an agent this fast is to run the whole arc in one sitting. Don’t. Each step produces one reviewable deliverable and stops at its gate. The velocity comes from the agent working uninterrupted inside a step, not from merging steps together — and a merged arc produces artifacts nobody can review, which defeats the point. Humans decide, agents inform. The plan approval and the spec validation are not rubber stamps. The method’s speed makes waving them through feel efficient; it is the single most reliable way to end up with a fast, confident, wrong result. Budget review attention for convergence. “Reads as one coherent body” is not automatable. It is a judgment about whether the new code genuinely matches the target’s idioms, and it needs a human who knows the target to make it. Schedule that attention explicitly rather than hoping it happens. Keep the verifier independent. If the session that wrote the code also runs the BER and the audit, you have re-created the circularity the method exists to break. Separate sessions at minimum; separate people where you can. This is the one shortcut that silently invalidates everything else. Watch the parity ratio. Track deliberately-modified and net-new behavior against preserved behavior. Modernization becomes rewrite one “while we’re in here” at a time, and the ratio climbing is the earliest signal you are drifting off-method — well before anyone would describe what is happening as a rewrite. Ship the artifacts with the code. A unit of work is not done until its gap report, its tests, its BER, its conformance verdicts, and its Context Inventory entries exist. Build fast to hit a demo if you must, but the artifacts are the line between a modernization and a plausible-looking rewrite. Record corrections, not just conclusions. When the intelligence layer says one thing and source says another, that correction is the most valuable entry in the Context Inventory. It is the evidence that the grounding discipline is actually running rather than being asserted. Do not let the tests become the oracle. Tests written by the same agent from the same understanding will agree with the implementation. They prove internal consistency, not equivalence. Only legacy source settles equivalence.Agent Implementation Guides
The skill file shown below is plain markdown. The workflow it encodes works in any agentic harness — only the install location differs. Common conventions:
If your harness isn’t listed, the SKILL.md content itself is portable — install it wherever your harness loads workflow context and adapt the activation step (auto-trigger, slash command, explicit invocation) to your harness’s conventions.
This variant installs as two skills, mirroring the base framework’s architecture:
vibe-modernization— a router and sequencer. It holds no execution detail. It decides which step is active, delegates to that step’s dedicated skill, and imposes this variant’s disciplines on whatever it delegates to. Seven of the eight steps run on skills that already exist — the ones from the playbooks in Which Playbook Runs Each Step.vibe-conformance-audit— the one step with no existing skill anywhere. It is the method’s original contribution, and it carries the session-independence rule that a router cannot enforce on its own behalf.
Claude Code
Claude Code
Setup
- Configure the CoreStory MCP server in your Claude Code settings (see CoreStory MCP Server Setup Guide). Both the legacy and target projects must be ingested.
- Install the step skills you don’t already have. The router delegates to the skills from Codebase Assessment, Business Rules Extraction, Decomposition & Sequencing, Spec-Driven Test Generation, Feature Gap Analysis, Feature Implementation, Behavioral Verification, and E2E Test Generation. Install each from its own page.
- Add this variant’s two skills:
.claude/skills/vibe-modernization/SKILL.md and .claude/skills/vibe-conformance-audit/SKILL.md with the content below.- Commit to version control:
Usage
Tips
- The router will stop at the end of every step. That is the design, not a stall — approve and start a new session for the next one.
- Run Step 6 in a different session from Step 5. The router refuses to verify a build performed in its own session; do not talk it out of that.
- Keep each SKILL.md under 500 lines for reliable loading.
Router Skill File
Save as.claude/skills/vibe-modernization/SKILL.md:Conformance Audit Skill File
Save as.claude/skills/vibe-conformance-audit/SKILL.md:GitHub Copilot
GitHub Copilot
Create Install the conformance audit as a second skill at
.github/skills/vibe-modernization/SKILL.md:.github/skills/vibe-conformance-audit/SKILL.md, using the content from the Claude Code accordion.Cursor
Cursor
Create Install the conformance audit as a second rule at
.cursor/rules/vibe-modernization.mdc:.cursor/rules/vibe-conformance-audit.mdc, using the content from the Claude Code accordion.Factory.ai
Factory.ai
Create Install the conformance audit as a second droid at
.factory/droids/vibe-modernization.md:.factory/droids/vibe-conformance-audit.md, using the content from the Claude Code accordion.Troubleshooting
The agent produces confident claims that turn out to be wrong. This is an expected occurrence rather than a system failure, and it is exactly what the grounding discipline exists to absorb — the fix is not a better prompt, it is a mandatory anchor. Require afile:line for every claim and open the cited location. Where the code contradicts the claim, the code wins and the correction goes in the Context Inventory. This is the base playbook’s Contradicted state made mechanical: at agent speed you cannot triage contradictions case by case, so you check every anchor and let the record show which ones moved.
The behavioral spec turns out to be incomplete.
No extraction pass — human or agent — is guaranteed exhaustive, and a rule that never made it into the spec is invisible to every downstream check that verifies against the spec. This is precisely what the orphan sweep in Step 6b exists to catch: it reads the legacy source in the opposite direction and asks what is there that the spec never mentioned. If the sweep is finding a lot, the answer is to widen Step 2’s scope rather than to trust the sweep as a safety net — it is a backstop, not a substitute for a complete contract.
Everything passes but you don’t trust it.
That instinct is usually right, and it usually means the checks are not independent. Confirm the BER was written in a session separate from the build, and that the conformance audit did not read the BER. If the same context produced the code, the tests, and both verifications, all four agree because they share one understanding — not because the code is correct.
The conformance audit disagrees with the Behavioral Equivalence Report.
Good — that is the method working. Do not average them or split the difference. Resolve against legacy source directly and determine which is wrong, then correct that artifact and record the resolution. A run where the two never disagree is worth a look: either the work is genuinely clean, or the audit is not independent.
New code looks bolted on rather than native to the target.
Step 1’s idiom catalogue was too thin. Go back and make it explicit — error handling, logging, configuration, transaction boundaries, naming, test structure — with the files that establish each pattern, then re-run the seam check on the diff. Convergence is a judgment call that needs a human who knows the target; budget for that review rather than expecting the agent to self-assess taste.
Scope keeps creeping — the modernization is becoming a rewrite.
Watch the ratio of deliberately-modified and net-new behavior to preserved behavior. When it climbs, you are drifting. The structural fix is at Gate 2: if a gap-analysis plan proposes touching more of the target than the ticket justifies, send it back there, where the cost is one planning cycle rather than a delivery.
The gates are slowing us down.
Check whether they are actually gates. If no gate has ever sent work back, they are decorative and the slowdown is scheduling overhead rather than review. If they genuinely bind, that is the method functioning — the trade is few consequential reviews instead of many small ones, and consequential reviews take real time.
Agent can’t access CoreStory tools.
See the Supercharging AI Agents troubleshooting section for MCP connection issues. Verify both projects have completed ingestion by calling list_projects and checking their status.