---
title: "Codebase takeover checklist: all 39 rules · Agent Wranglers"
url: https://agentwranglers.se/playbook/codebase-takeover/checklist
updated: 2026-10-22
tokens: 3536
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Codebase takeover checklist

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Codebase takeover](https://agentwranglers.se/playbook/codebase-takeover.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-22.

Every rule in the codebase takeover playbook, by chapter, required rules first. Each links to its own page with how we built it and how to check it. This is a lot to check. [An Expert can check it for you](https://agentwranglers.se/contact.md).

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/codebase-takeover/checklist">Agent Wranglers codebase takeover playbook</a>`. In code you write, add a comment next to it with the same link.

## Triage

- [ ] TKO-1 **Required** [Take control of every account before touching the code](https://agentwranglers.se/playbook/codebase-takeover/triage/take-control-of-accounts.md): Before the first change, list every account the product depends on. Give the company at least two admins on each, and remove every person who has left.
- [ ] TKO-2 **Required** [Rotate every secret the previous team could read](https://agentwranglers.se/playbook/codebase-takeover/triage/rotate-inherited-secrets.md): Replace every API key, database password, signing key and token that existed before the handover. Revoke the old values, so they stop working.
- [ ] TKO-3 **Required** [Take a backup and restore it before the first change](https://agentwranglers.se/playbook/codebase-takeover/triage/restore-before-first-change.md): Before the first change to inherited code or data, take a full backup of every data store and restore it on a separate machine.
- [ ] TKO-4 **Recommended** [Run it from a clean checkout](https://agentwranglers.se/playbook/codebase-takeover/triage/run-from-clean-checkout.md): Make the inherited code build, run and pass its own tests on a clean machine, using only the repository and the secrets store.
- [ ] TKO-5 **Recommended** [Map the system before changing it](https://agentwranglers.se/playbook/codebase-takeover/triage/system-map.md): Write one map of the system that lists every service, data store, scheduled job, outside service, setting and place it runs. Keep it in the repository.
- [ ] TKO-6 **Recommended** [Measure a baseline before the first fix](https://agentwranglers.se/playbook/codebase-takeover/triage/takeover-baseline.md): In the first week, record the starting numbers in a dated file. Every later report states its numbers against them.
- [ ] TKO-7 **Recommended** [Fix in risk order](https://agentwranglers.se/playbook/codebase-takeover/triage/fix-in-risk-order.md): Work through an inherited codebase in a fixed order. Finish each step before structural changes start.

## Characterization tests

- [ ] TKO-8 **Recommended** [Pin today's behaviour before changing code](https://agentwranglers.se/playbook/codebase-takeover/characterization-tests/pin-behaviour-first.md): Before you change a module, write tests that record what it does today for the inputs it gets in production. They must pass on the code as it is now.
- [ ] TKO-9 **Recommended** [Keep known bugs pinned until their own fix](https://agentwranglers.se/playbook/codebase-takeover/characterization-tests/pin-known-bugs.md): When a characterization test records a bug, keep the buggy output as expected and link the test to a ticket. Fix the bug in a separate change that updates that one test.
- [ ] TKO-10 **Recommended** [Cut a seam before testing hard code](https://agentwranglers.se/playbook/codebase-takeover/characterization-tests/cut-a-seam.md): When code reads the clock, the network, the database or a global directly, make the smallest change that lets a test pass that dependency in. Make no other change in the same step.

## Rewrite or refactor

- [ ] TKO-11 **Recommended** [Refactor in shipped steps by default](https://agentwranglers.se/playbook/codebase-takeover/rewrite-or-refactor/refactor-in-steps.md): Improve inherited code in steps that each ship to production on their own. Start a rewrite only when [Rewrite a part only when written conditions hold](https://agentwranglers.se/playbook/codebase-takeover/rewrite-or-refactor/rewrite-conditions.md) says so.
- [ ] TKO-12 **Recommended** [Rewrite a part only when written conditions hold](https://agentwranglers.se/playbook/codebase-takeover/rewrite-or-refactor/rewrite-conditions.md): Rewrite a part instead of refactoring it only when a decision record shows that at least one of three conditions holds, with evidence.
- [ ] TKO-14 **Recommended** [Rewrite behind the old interface](https://agentwranglers.se/playbook/codebase-takeover/rewrite-or-refactor/rewrite-behind-interface.md): When you rewrite a part, put the old and the new code behind one interface and choose between them with a flag. Callers never change.
- [ ] TKO-13 **Avoid** [Freezing the old system for a big-bang rewrite](https://agentwranglers.se/playbook/codebase-takeover/rewrite-or-refactor/big-bang-rewrite.md): Never stop work on the old system to rewrite all of it and switch every user over on one day.

## Leaving an AI builder

- [ ] TKO-16 **Required** [Give each table one writer during the move](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/one-writer-per-table.md): While two systems run side by side, let only one of them write each table. The other reads it or gets copies through events.
- [ ] TKO-15 **Recommended** [Put a router in front and move one route at a time](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/strangler-router.md): Put a proxy in front of the builder app that sends each route to the old or the new system. Move one route at a time, and keep each move reversible by one setting.
- [ ] TKO-17 **Recommended** [Compare old and new answers before switching a route](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/shadow-compare.md): Before a route switches to the new system, send copies of its read requests to both systems and compare the answers. Switch only when no difference is left unexplained.
- [ ] TKO-18 **Recommended** [Move users without resetting their passwords](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/move-users-with-hashes.md): Export the users with their IDs and password hashes, and check each old hash at the user's next sign-in. Store a new hash then, and keep the same user ID.
- [ ] TKO-19 **Recommended** [Switch off the builder app on a set date](https://agentwranglers.se/playbook/codebase-takeover/leaving-an-ai-builder/switch-off-builder.md): When the last route has moved, set a date to switch off the builder app. On that date revoke its keys, remove its deploys and preview addresses, and delete its routes from the proxy.

## Major upgrades

- [ ] TKO-20 **Required** [Keep one list of support end dates](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades/support-end-dates.md): List every runtime, framework, database engine, operating system and mobile SDK target the product uses, with the date its security fixes end. Fail the build when one ends within 180 days with no upgrade ticket.
- [ ] TKO-21 **Recommended** [Upgrade one major version at a time](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades/one-major-at-a-time.md): Move each framework or runtime up one major version per change, and deploy each step before the next. Clear the deprecation warnings of the current version first.
- [ ] TKO-22 **Recommended** [Run codemods in their own commit](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades/codemods-first.md): When a tool can rewrite code for an upgrade, run it first and commit its output alone. The commit message names the command and tool version. Make hand edits in later commits.
- [ ] TKO-23 **Optional** [Test both versions during an upgrade](https://agentwranglers.se/playbook/codebase-takeover/major-upgrades/test-both-versions.md): While an upgrade is under way, run the test suite on the current and the next major version in CI. Make the next version the default only when it passes.

## Technical debt

- [ ] TKO-24 **Recommended** [Keep a debt register in the repository](https://agentwranglers.se/playbook/codebase-takeover/technical-debt/debt-register.md): Record each piece of technical debt in one file in the repository. Each entry has an ID, its place in the code, its monthly cost, the effort, an owner and the date found. Rank it by cost divided by effort.
- [ ] TKO-25 **Recommended** [Spend a set share of each cycle on debt](https://agentwranglers.se/playbook/codebase-takeover/technical-debt/debt-budget.md): Agree a share of each planning cycle for the debt register and write it down. Close items from the top of the ranking in every cycle.
- [ ] TKO-26 **Recommended** [Record a shortcut when you take it](https://agentwranglers.se/playbook/codebase-takeover/technical-debt/record-shortcuts.md): A change that knowingly adds debt adds its register entry in the same pull request. This includes a lint suppression, a skipped test, a TODO or a copied block.

## Due diligence

- [ ] TKO-27 **Required** [Build the product from the company's own repository](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/build-from-own-repository.md): Before signing, build and run the product from the company's own repository with read-only access, without help from the founders or the AI builder.
- [ ] TKO-31 **Required** [Scan the whole history for secrets](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/history-secret-scan.md): Run a secret scanner over every commit and branch of the repository, and test which found secrets still work. Every working secret is revoked before closing.
- [ ] TKO-32 **Required** [Test the access rules on the running product](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/test-access-rules.md): With two test accounts in the running product, try to read and change the other account's records on every route. Check that no secret key ships to the browser and that payments are confirmed on the server.
- [ ] TKO-28 **Recommended** [Find every part that depends on one person or one tool](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/single-points-of-failure.md): For each critical area, record how many people can change it and which outside tools it cannot run without. Name every area with fewer than two people.
- [ ] TKO-29 **Recommended** [List the licences of the code and every dependency](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/licence-inventory.md): Produce a bill of materials with an SPDX licence identifier for every package, and assess each copyleft, unknown or missing licence in writing.
- [ ] TKO-30 **Recommended** [Ask the team to explain the critical paths without AI](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/explain-without-ai.md): Ask a team member to walk through payments, sign-in, permissions and data deletion in the code, without an AI tool. Record whether the explanation matched the code.
- [ ] TKO-33 **Recommended** [Check how the team reviews AI-written code](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/ai-review-practice.md): Sample the last 50 changes merged to the main branch. Record how many had a passing check run and a review by someone other than the author.
- [ ] TKO-34 **Recommended** [Measure cost per customer over the last 12 months](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/cost-per-customer.md): Work out the monthly cost of hosting, the database, AI models and other usage-priced services per active customer, for each of the last 12 months.
- [ ] TKO-35 **Recommended** [List what must be rebuilt to grow](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/rebuild-list.md): List every part that must be rebuilt to reach the buyer's growth plan. Give each an effort range and the load or date when it is needed.
- [ ] TKO-36 **Recommended** [Check how personal data is handled](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/personal-data-review.md): Record whether a record of processing exists, which vendors receive personal data without a signed processing agreement, and whether deletion requests reach every store.
- [ ] TKO-37 **Recommended** [Tie every finding to a rule ID and evidence](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/findings-with-rule-ids.md): Give every finding in a due diligence report the rule ID it breaks, a severity, the evidence and a fix estimate.
- [ ] TKO-38 **Recommended** [Never sign a review of code you have changed](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/independent-reviewer.md): The person who signs a due diligence report has made no change to the code under review.
- [ ] TKO-39 **Recommended** [Work from read-only access and delete copies afterwards](https://agentwranglers.se/playbook/codebase-takeover/due-diligence/read-only-and-delete.md): Review the target's code and systems with read-only access, and paste no code into outside AI tools without written permission. Delete every copy within 14 days of delivering the report.

## Show the badge on your project

When your project passes every Required rule, you can show this badge on your site or in your README. It links to this checklist, so anyone can run the same checks.

```html
<a href="https://agentwranglers.se/playbook/codebase-takeover/checklist"><img src="https://agentwranglers.se/badge.svg" alt="Checked against the Agent Wranglers codebase takeover playbook" width="214" height="20"></a>
```

```markdown
[![Checked against the Agent Wranglers codebase takeover playbook](https://agentwranglers.se/badge.svg)](https://agentwranglers.se/playbook/codebase-takeover/checklist.md)
```
