Skip to main content
AI & Models8 min read

From pilot to production AI for large-repo maintenance: using GPT-5.4’s 1M-token context without shipping a “big bang” diff

Large-context models can finally “see” enough of your codebase to plan meaningful modernization—dependency upgrades, deprecations, and cross-repo refactors—without guessing. The risk is that the same capability can produce oversized diffs and subtle behavior changes that are hard to review. This post outlines a production-safe workflow for using GPT-5.4’s 1M-token context to keep upgrades incremental, testable, and reviewable.

Engineering teams don’t fear change—they fear unreviewable change. And that’s the trap many organizations fall into when they first apply large-language models to maintenance work: the pilot looks great, but the first real modernization attempt becomes a single massive PR that nobody can confidently approve.

GPT-5.4 changes what’s feasible for large-repo maintenance because it can operate with a 1M-token context window and strong tool use. But “the model can see everything” should not translate into “let’s change everything at once.” The win is using that context to produce better plans and smaller, safer increments.

Context: why large-context models matter for maintenance

Modernization work is rarely hard because any single file is complex. It’s hard because the blast radius crosses boundaries:

  • A dependency upgrade breaks three transitive imports.
  • A deprecation touches runtime code, build scripts, and documentation.
  • A refactor needs coordinated changes across packages, services, and CI.

Historically, you either (a) did lots of manual code archaeology, or (b) accepted local fixes that accumulated more tech debt.

In “Introducing GPT-5.4” (OpenAI Blog), GPT-5.4 is presented as OpenAI’s most capable and efficient frontier model for professional work, highlighting state-of-the-art coding and tool use (including tool search) and support for a 1M-token context window. That combination is uniquely relevant to maintenance: planning and executing changes across a large surface area is exactly where tool use + long context can reduce time-to-understanding.

The catch: capability amplifies both speed and mistakes.

The new risks: big-context, big-bang PRs, and hidden behavior changes

Large-context models reduce one of the historical constraints—limited project awareness. But they introduce new process risks if you treat them like a “magic refactor button.”

Risk #1: Oversized diffs that defeat human review

When a model can see the whole repo (or multiple repos), it can propose sweeping changes: rename patterns, move modules, update configs, and “clean up” along the way. That often produces PRs where:

  • The intent is unclear because too much changed.
  • Reviewers can’t isolate which changes are required vs. opportunistic.
  • Git history loses meaningful signal.

Risk #2: Subtle behavior changes masked as refactors

Maintenance changes frequently sit near tricky edges: serialization, timeouts, auth, caching, and concurrency. A model may rewrite code “idiomatically” and unintentionally alter behavior (e.g., changing error handling, default values, or ordering guarantees).

Risk #3: Tool-driven confidence without sufficient verification

GPT-5.4’s tool use (including tool search) helps it find references and navigate code, but tool results aren’t the same as verification. You still need test strategy, regression gates, and rollback plans.

A production-safe workflow: use 1M tokens for planning, not for one giant commit

The core pattern is simple:

  1. Use the large context window to create a complete map of impacts.
  2. Translate that map into a staged plan with hard limits.
  3. Execute as incremental, reviewable PRs with automated gates.

Below is a workflow we see work well for teams modernizing large repos on Vibgrate.

1) Start with a “repo briefing” prompt, not a “make changes” prompt

Instead of asking the model to upgrade a dependency immediately, ask it to produce:

  • A dependency graph summary (runtime + build + tooling)
  • Hotspots where version constraints are likely to break
  • A list of code patterns that are tied to the old API
  • A proposed migration plan with stages
  • A test strategy per stage

Because GPT-5.4 can hold a large amount of code and docs in context, it’s well-suited for this “briefing” step. The goal is to convert global awareness into a plan you can budget.

Output artifact: a migration design doc (even a lightweight one) with stages, risks, and success metrics.

2) Enforce “change budgets” to prevent scope creep

A change budget is a hard constraint that keeps modernization incremental even when the model can see the whole universe.

Examples:

  • “PRs must be under 300 changed lines unless approved by the tech lead.”
  • “No file moves in the same PR as behavior changes.”
  • “No formatting-only changes.”
  • “One package at a time; no cross-cutting refactors unless required for compilation.”

In practice, this keeps reviewers effective. It also makes rollbacks realistic.

3) Create a test-first upgrade branch with visible gates

For maintenance, the safest sequence is often:

  1. Add missing characterization tests (or snapshot tests) around fragile behavior.
  2. Add targeted integration tests for critical flows.
  3. Establish performance baselines where regressions are common (serialization, DB access, startup time).
  4. Only then upgrade or refactor.

This mirrors what high-performing teams do manually, but the model can accelerate test discovery: locating edge cases, identifying untested branches, and suggesting minimal test harnesses.

Automated regression gates to consider:

  • Full unit + integration suites
  • Contract tests for external APIs
  • Static analysis/lint rules scoped to the migration
  • Dependency vulnerability and license checks
  • Golden-file or snapshot comparisons where applicable

4) Chunk the migration by “behavior boundaries,” not by files

When teams chunk by directories, they often end up splitting a single behavior across multiple PRs, increasing risk.

Instead, chunk by boundaries like:

  • One API surface (e.g., auth middleware)
  • One runtime path (e.g., request decoding)
  • One dependency usage pattern (e.g., logging adapters)
  • One build target or package

GPT-5.4’s large context is valuable here: it can identify all call sites that participate in a behavior and propose a coherent slice—while you still keep the diff small.

5) Use “tool search” to drive completeness checks, then prove correctness with tests

From the OpenAI announcement, GPT-5.4 emphasizes strong coding plus tool use (including tool search). Treat tool search as a completeness assistant:

  • Find all references to deprecated APIs
  • Locate version pins and build flags
  • Identify duplicated wrappers or adapters

But correctness still comes from:

  • running tests,
  • verifying runtime behavior in staging,
  • and using observability to compare pre/post.

A practical pattern is to require the model to output a “coverage checklist” per PR:

  • Which call sites were updated (with paths)
  • Which were intentionally left (and why)
  • Which tests validate the change
  • What runtime metrics should remain stable

6) Code review strategies that keep humans in control

Large-context AI should make code review easier, not harder. A few tactics that work well:

Require a PR narrative

Every PR should include:

  • Intent: what problem this PR solves
  • Non-goals: what it explicitly does not change
  • Risk: what could break
  • Validation: tests run + how to reproduce

You can have the model draft this, but the author owns accuracy.

Separate mechanical changes from semantic changes

If you must do a widespread rename or import rewrite, keep it in a PR that is:

  • mechanically verifiable,
  • behavior-preserving,
  • and easy to scan.

Then follow with small semantic changes that are test-backed.

Demand “diff explainability”

Ask for a short mapping of “old behavior → new behavior,” especially around:

  • error handling,
  • retries/timeouts,
  • serialization,
  • concurrency,
  • and security checks.

This is also aligned with the broader OpenAI safety research direction around monitorability and control (see OpenAI’s discussion of reasoning models and monitoring implications in related safety posts). The practical takeaway for engineering leaders: don’t just accept output—require artifacts that improve oversight.

Practical implications for engineering teams (and how Vibgrate fits)

Moving from pilots to production AI in maintenance is mostly about process design.

For developers: faster archaeology, safer execution

  • Use GPT-5.4’s long context to build an impact map quickly.
  • Convert the map into small PRs with explicit boundaries.
  • Let tools (search, linters, tests) enforce completeness.

For engineering managers: measurable modernization throughput

  • Define migration KPIs: lead time per PR, rollback rate, escaped defect rate.
  • Standardize change budgets by repo type.
  • Require consistent PR narratives and validation checklists.

For CTOs: governance without killing momentum

  • Establish “AI-assisted change” guardrails: test gates, review requirements, and deployment policies.
  • Treat large upgrades as programs with milestones, not as a single deliverable.
  • Prefer incremental modernization because it protects availability and keeps teams learning.

Vibgrate’s maintenance and modernization workflows align naturally with this approach: keep changes incremental, enforce regression gates, and make work auditable. The model’s large context can accelerate planning and discovery, while the platform and your SDLC ensure changes ship safely.

A concrete “incremental modernization” playbook (copy/paste for your team)

  1. Briefing (AI-assisted): generate an impact map + staged plan.
  2. Budgets: set PR size limits and forbid opportunistic refactors.
  3. Test-first branch: add characterization/integration tests and baselines.
  4. Stage execution: one behavior boundary per PR.
  5. Gates: CI + regression + security checks required for merge.
  6. Review: PR narrative + diff explainability + validation checklist.
  7. Release: progressive rollout, monitor key metrics, keep rollback simple.

Conclusion: “see everything” is not permission to change everything

GPT-5.4’s 1M-token context and strong coding/tooling capabilities (as described in OpenAI’s “Introducing GPT-5.4”) are a real step forward for professional engineering work. They make it realistic to understand broad dependencies and coordinate changes across large repos—tasks that used to take weeks of manual effort.

The teams that get production value won’t be the ones generating the biggest diffs. They’ll be the ones using large context to create better plans, then executing those plans through incremental PRs with tight change budgets, test-first branches, automated regression gates, and disciplined review. That’s how you modernize continuously—without ever shipping a “big bang” change.

Vibgrate CLI

See a real scan run

A replay of the actual CLI running against our test repositories — live progress, real findings, a genuine DriftScore. Nothing executes in your browser.

Replay
demo@vibgrate — bash
❯ npx @vibgrate/cli scan
 
╭──────────────────────────────────────────╮
│ Vibgrate Drift Report │
╰──────────────────────────────────────────╯
 
── node-turborepo (node) .
Runtime: >=18.0.0 (6 majors behind)
Frameworks:
Turbo: 1.13.4 → 2.11.8 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
1 current 1 1-behind 3 2+ behind 1 unknown
 
── @repo/admin (node) apps/admin
Frameworks:
TanStack Query: 5.104.2 → 5.104.2 (current)
React: 18.3.1 → 19.3.0 (1 behind)
React DOM: 18.3.1 → 19.3.0 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Vite: 5.4.21 → 8.3.4 (3 behind)
Dependencies:
3 current 9 1-behind 3 2+ behind 4 unknown
 
── @repo/api (node) apps/api
Frameworks:
Express: 4.22.3 → 5.3.0 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Vitest: 1.6.1 → 5.0.4 (4 behind)
Dependencies:
7 current 4 1-behind 4 2+ behind 4 unknown
 
── @repo/web (node) apps/web
Frameworks:
Next.js: 14.2.35 → 16.4.0 (2 behind)
React: 18.3.1 → 19.3.0 (1 behind)
React DOM: 18.3.1 → 19.3.0 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
2 current 6 1-behind 3 2+ behind 5 unknown
 
── @repo/config (node) packages/config
Frameworks:
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
2 current 2 1-behind 5 2+ behind 0 unknown
 
── @repo/database (node) packages/database
Frameworks:
Prisma: 5.22.0 → 7.10.0 (2 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
1 current 0 1-behind 3 2+ behind 1 unknown
 
── @repo/types (node) packages/types
Frameworks:
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Dependencies:
0 current 0 1-behind 1 2+ behind 1 unknown
 
── @repo/ui (node) packages/ui
Frameworks:
React: 18.3.1 → 19.3.0 (1 behind)
TypeScript: 5.9.3 → 7.0.2 (2 behind)
React: 18.3.1 → 19.3.0 (1 behind)
Dependencies:
1 current 4 1-behind 1 2+ behind 1 unknown
 
── @repo/utils (node) packages/utils
Frameworks:
TypeScript: 5.9.3 → 7.0.2 (2 behind)
Vitest: 1.6.1 → 5.0.4 (4 behind)
Dependencies:
0 current 1 1-behind 2 2+ behind 1 unknown
 
Tech Stack
Frontend: React, React DOM
Meta-frameworks: Next.js
Bundlers: tsx, Turbo, Vite
CSS / UI: Autoprefixer, PostCSS, Tailwind CSS
Backend: Express
ORM / Database: Prisma, Prisma Client
Testing: Vitest
Lint & Format: ESLint, ESLint Prettier, ESLint React, Prettier, typescript-eslint
 
Services & Integrations
Auth: JWT 9.0.3
Databases: Prisma 5.22.0
 
TypeScript
v5.3.3 · strict ✔ · MIXED · target: ES2022
 
Build & Deploy
Package Managers: pnpm
Monorepo: npm-workspaces, pnpm-workspaces, turbo
 
Product Purpose Signals
Frameworks: react, nextjs
Evidence: 177
Top Signals:
- [heading] Dashboard (apps/admin/src/pages/Dashboard.tsx)
- [title] Revenue Overview (apps/admin/src/pages/Dashboard.tsx)
- [copy] workspace:* (packages/ui/package.json)
- [copy] ./dist (packages/ui/tsconfig.json)
- [copy] ./src/index.ts (packages/ui/package.json)
- [copy] @repo/config/tsconfig-base.json (packages/ui/tsconfig.json)
- [copy] @repo/ui (packages/ui/package.json)
- [copy] #3b82f6 (apps/admin/src/pages/Dashboard.tsx)
Unknowns:
- No pricing or billing evidence found.
- No integrations/connectors evidence found.
- No route structure evidence found.
 
Security Posture
Lockfile ✖ · .env ✔ · node_modules ✔
 
Platform
Native modules: turbo
 
Code Quality
Files: 36 · Functions: 183 · Avg complexity: 2.62 · Avg length: 21.13 lines
Max nesting: 2 · Circular deps: 0 · Dead code: 0%
God files: apps/admin/src/pages/Products (448 lines)
 
Database Schema
postgresql · 8 models · 1 enum
Models: Address, CartItem, Category, Order, OrderItem (+3 more)
 
Findings (16 errors, 11 warnings)
✖ @types/node is 6 major versions behind (spec: ^20.11.0, latest: 26.6.5).
vibgrate/dependency-major-lag in .
✖ 60% of dependencies are 2+ major versions behind in node-turborepo.
vibgrate/dependency-rot in .
✖ Node.js runtime ">=18.0.0" reached end-of-life on 2025-04-30 (latest: 24.0.0).
vibgrate/runtime-eol in .
✖ vite is 3 major versions behind (spec: ^5.0.12, latest: 8.3.4).
vibgrate/dependency-major-lag in apps/admin
✖ Vite is 3 major versions behind (current: 5.4.21, latest: 8.3.4).
vibgrate/framework-major-lag in apps/admin
✖ @types/node is 6 major versions behind (spec: ^20.11.0, latest: 26.6.5).
vibgrate/dependency-major-lag in apps/api
✖ vitest is 4 major versions behind (spec: ^1.2.1, latest: 5.0.4).
vibgrate/dependency-major-lag in apps/api
✖ Vitest is 4 major versions behind (current: 1.6.1, latest: 5.0.4).
vibgrate/framework-major-lag in apps/api
✖ @types/node is 6 major versions behind (spec: ^20.11.0, latest: 26.6.5).
vibgrate/dependency-major-lag in apps/web
✖ eslint-plugin-react-hooks is 3 major versions behind (spec: ^4.6.0, latest: 7.1.1).
vibgrate/dependency-major-lag in packages/config
✖ 56% of dependencies are 2+ major versions behind in @repo/config.
vibgrate/dependency-rot in packages/config
✖ 75% of dependencies are 2+ major versions behind in @repo/database.
vibgrate/dependency-rot in packages/database
✖ 100% of dependencies are 2+ major versions behind in @repo/types.
vibgrate/dependency-rot in packages/types
✖ vitest is 4 major versions behind (spec: ^1.2.1, latest: 5.0.4).
vibgrate/dependency-major-lag in packages/utils
✖ 67% of dependencies are 2+ major versions behind in @repo/utils.
vibgrate/dependency-rot in packages/utils
✖ Vitest is 4 major versions behind (current: 1.6.1, latest: 5.0.4).
vibgrate/framework-major-lag in packages/utils
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in .
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in apps/admin
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in apps/api
⚠ Next.js is 2 major versions behind (current: 14.2.35, latest: 16.4.0).
vibgrate/framework-major-lag in apps/web
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in apps/web
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/config
⚠ Prisma is 2 major versions behind (current: 5.22.0, latest: 7.10.0).
vibgrate/framework-major-lag in packages/database
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/database
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/types
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/ui
⚠ TypeScript is 2 major versions behind (current: 5.9.3, latest: 7.0.2).
vibgrate/framework-major-lag in packages/utils
 
╭──────────────────────────────────────────╮
│ Top Priority Actions │
╰──────────────────────────────────────────╯
 
1. Upgrade EOL runtime in node-turborepo
End-of-life runtimes no longer receive security patches and block ecosystem upgrades.
./.
>=18.0.0 → 24.0.0 (6 majors behind)
Impact: −10 drift points (runtime & EOL)
 
2. Fix security posture: no lockfile found
Without a lockfile, installs are non-deterministic. Run the install command to generate one and commit it.
./
Missing: package-lock.json, pnpm-lock.yaml, or yarn.lock
 
3. Upgrade Vitest 1.6.1 → 5.0.4 in @repo/api (+2 more)
4 major versions behind. Major framework drift increases breaking change risk and blocks access to security fixes and performance improvements.
./apps/api
Vitest: 1.6.1 → 5.0.4 (4 majors behind)
./packages/utils
Vitest: 1.6.1 → 5.0.4 (4 majors behind)
./apps/admin
Vite: 5.4.21 → 8.3.4 (3 majors behind)
Impact: −5–15 drift points
 
4. Reduce dependency rot in @repo/types (100% severely outdated)
1 of 1 dependencies are 2+ majors behind. Run `npm outdated` and prioritise packages with known CVEs or breaking API changes.
./packages/types
typescript: 5.9.3 → 7.0.2 (2 majors behind)
Impact: −5–10 drift points
 
5. Reduce dependency rot in @repo/database (75% severely outdated)
3 of 4 dependencies are 2+ majors behind. Run `npm outdated` and prioritise packages with known CVEs or breaking API changes.
./packages/database
@prisma/client: 5.22.0 → 7.10.0 (2 majors behind)
prisma: 5.22.0 → 7.10.0 (2 majors behind)
typescript: 5.9.3 → 7.0.2 (2 majors behind)
Impact: −5–10 drift points
 
╭──────────────────────────────────────────╮
│ Architecture Layers │
╰──────────────────────────────────────────╯
 
Archetype: nextjs (80% confidence)
Files classified: 24 (11 unclassified)
Folders classified: 8
apps/admin/src presentation 100% 4 files
apps/admin/src/pages presentation 100% 2 files
apps/api/src/middleware middleware 100% 2 files
apps/api/src/routes routing 100% 2 files
apps/web/src/app presentation 100% 4 files
apps/web/src/app/products presentation 100% 2 files
apps/web/src/app/products/[id] presentation 100% 1 file
packages/ui/src presentation 100% 6 files
Unclassified source (sample): 11
 
presentation 15 files drift ████████████████████ 100 risk high
routing 4 files drift ████████████████████ 100 risk high
middleware 2 files drift ███████▍░░░░░░░░░░░░ 37 risk moderate
config 2 files drift ░░░░░░░░░░░░░░░░░░░░ 0 risk none
shared 1 file drift ████████████████████ 100 risk high
 
╭──────────────────────────────────────────╮
│ DriftScore Summary │
╰──────────────────────────────────────────╯
 
DriftScore: 70/100
Risk Level: HIGH
Projects: 9
Classified: 8 nano · 1 micro · 0 small · 0 standard
Billable: 0.42 · 9 detected → 0.42 billable projects (micro-project pricing)
0.1 micro · 0.32 nano
These fractions add up across repositories, then round down to whole billable projects.
 
Score Breakdown
Runtime: ████████████████████ 100
Frameworks: ███████████▊░░░░░░░░ 59
Dependencies: ██████▌░░░░░░░░░░░░░ 33
EOL Risk: ████████████████████ 100
 
Scanned at 2026-10-14T06:07:19.277Z · 5.4s · 286 files scanned · 56 workspace files · 27 dirs
❯
Press Run to start.