Maintaining Old Projects
Map an unfamiliar or legacy codebase, find the root cause of a problem, and fix it.
This playbook starts with understanding the code and only then changes it.
Best for: Legacy codebases, inherited projects, unfamiliar code Time estimate: 30 to 60 minutes Skills used: mk:scout, mk:investigate, mk:fix, mk:freeze Agents involved: developer, tester, journal-writer
Step 1: Map the codebase
/mk:scout project structuremk:scout splits the project into segments, searches them with parallel Explore agents (up to six, one per directory or package), and returns a consolidated report of entry points, key directories and patterns. It runs on Claude Code only.
Step 2: Investigate the problem
/mk:investigate users report slow page loads on the dashboardmk:investigate collects symptoms, traces the failure to a root cause and writes a diagnostic report under tasks/reports/. It does not edit code. For a recurring or complex failure it picks an RCA method (5 Whys, Ishikawa, 8D) first.
Step 3: Fix with the cause in hand
/mk:fix tasks/reports/<diagnostic-report>.mdmk:fix always scouts and diagnoses before it edits. It treats a supplied report as evidence to check, not as a replacement for its own diagnosis. It needs six things before it edits: the exact symptom, reproduction evidence, expected against actual behaviour, the root cause with file:line, why it happens now, and the blast radius. It then fixes the cause, runs a before and after check, and stops after three failed attempts.
To keep edits inside the affected module while you work, run mk:freeze with that path. It blocks Edit and Write outside the allowed directory.
Step 4: Record what you learned
mk:fix appends one entry to .meowkit/memory/gotchas.md, through mewkit note, only when the lesson cannot be read from the code, the diff or git log. An entry looks like this:
## Dashboard service makes per-user order queries <!-- 2026-11-20 -->
Why: the repository layer loads orders one user at a time.
Apply when: a service loops over records and calls the database in the loop.
Source: tasks/reports/<diagnostic-report>.mdThe next mk:fix or mk:investigate run greps .meowkit/memory/ at the start and opens matching entries.
Step 5: Write a journal entry for hard cases
For a failure that took several attempts, the journal-writer agent writes docs/journal/YYMMDD-title.md: what happened, what was tried, the root cause and how to prevent it.
How this differs from feature work
| Concern | Feature work | Maintenance |
|---|---|---|
| First step | Plan the feature | Map the codebase |
| Context | You know the code | mk:scout builds it |
| Memory | Read at task start | Read at task start, matters more here |
| Scope | Set by the plan | Set by the diagnosis, optionally held by mk:freeze |
| Output | Feature and tests | Fix, regression test, gotcha entry |