> Agent-ready spec from Diff of the Day (2026-11-27, From the big ones 1). Based on GitHub's post on choosing the next safe modernization step. Give this file to your coding agent and review its plan before it changes anything.

# Spec: Modernization decision record for one legacy service

## Problem Statement
Small teams keep old services running because a rewrite feels risky and nobody has time to study the system. GitHub's approach replaces "the code is old" with evidence: an inventory of what the service really depends on, a per-component decision from keep to rewrite, and a stated level of regression protection. A small team can apply the same method to one service in a few days, without GitHub's tooling or scale.

## Goals
- An evidence inventory for one service, with every finding labelled documented, inferred or unverified.
- A decision (keep, upgrade, swap, wrap or rewrite) for each component, each backed by evidence.
- One approved first step that is smaller than a rewrite, with its safety level and remaining risk written down.

## Non-Goals
- Modernizing the whole system: one bounded service only.
- Doing the upgrade itself: this spec produces the decision record and one feasibility check.
- Removing capabilities: removal needs the owner's confirmation and is a separate decision.

## User Stories
- As the developer who owns an old service, I want a list of its real dependencies, runtimes and external contracts so that I stop guessing what an upgrade touches.
- As that developer, I want each component's option justified by evidence so that I can defend "upgrade" or "wrap" instead of a rewrite.
- As a team lead, I want the safety level and remaining risk stated so that I can approve one small step.
- Edge case: as the developer, I want unknowns recorded as unverified rather than filled in so that the record never pretends to know.

## Requirements
### P0 (must have)
1. **Evidence inventory** `modernization/inventory.md` for the chosen service.
   - [ ] Lists manifests and lockfiles, verified install, build, test and run commands, runtime pins (containers, CI, deployment, dev tools), external contracts (APIs, database behaviour, file formats, user workflows) and end-of-life dependencies.
   - [ ] Every finding is labelled documented, inferred or unverified.
   - [ ] Given a command the agent did not run successfully, when the inventory is written, then that command is labelled unverified.
2. **Decision table** `modernization/decisions.md`: one row per component with option (keep, upgrade, swap, wrap, rewrite), the evidence, and why a less disruptive option does not fit.
   - [ ] Rewrite appears only where no supported upgrade path exists or the design cannot meet a stated requirement, and the row names that evidence.
3. **Feasibility check** for the first step, time-boxed to half a day: try to run the old component at its current pins and record the result.
   - [ ] If it runs at acceptable cost, the plan is: capture current behaviour in tests, then upgrade. If it does not, the plan is: build and verify one small modern slice first.
4. **Safety level** for the first step, L0 (no regression net) to L4 (CI gate with lint, unit, behaviour and end-to-end checks), with the remaining risk in one paragraph.

### P1 (nice to have)
- Behaviour-capture tests for the component chosen for the first step.
- A short summary for the owner to approve, one page.

### P2 (future)
- Turn the method into a reusable agent skill for the team's other services, keeping approved runtimes and approvers outside the skill.

## Success Metrics
- Leading: inventory and decisions written in under two days; fewer than 20% of findings left unverified after the owner review.
- Lagging: the first step ships without a production regression; the next service reuses the same record format.

## Open Questions
- Which service goes first? Pick one that is bounded and has an owner who can review. (you)
- Which runtimes and versions are approved targets? (team lead)

## Timeline
Day 1: inventory. Day 2: decisions, feasibility check, safety level and owner review.

## Agent Instructions
- **Suggested stack**: whatever the service already uses; the agent writes Markdown records and runs the service's own build and test commands.
- **Build order**: read manifests and CI files → run install, build and test, recording exit codes → write the inventory with labels → decision table → feasibility check → safety level → P1.
- **Safety**: read-only on production; do not upgrade, delete or rewrite code during this spec; no secrets in the records; ask before installing tools or using the network.
- **Done when**: the three P0 files exist, every row has evidence, and the owner has reviewed them.

## Sources
- How to choose the next safe step in application modernization (GitHub, Sam Quakenbush): https://github.blog/ai-and-ml/github-copilot/how-to-choose-the-next-safe-step-in-application-modernization/
