From 997ba273a932dfaade3cc10a034ae090f345f42d Mon Sep 17 00:00:00 2001 From: John Lianoglou Date: Sun, 29 Nov 2026 22:49:38 -0500 Subject: [PATCH 1/5] feat(product-development): add the retrofit guide for codebases without specs Add references/retrofit.md: the four steps (a maintainer braindump run like the Vision Grill, eight feature lenses each run by its own subagent, one feature inventory the maintainer approves, routing to modernization, shaping/ or ideas/), a short prompt template per lens with a shared preamble and report format, and the wayfinder rule for large codebases with a link to its public source and the steps that work without it. The inventory's approval scopes the retrofit only and ratifies nothing; the inventory stays outside docs/product/ and is deleted once its features are seeded. Code alone never admits a spec; specs in other formats are evidence for shaping. Retirements follow the modernization guide's approval rules, and market details go to research notes. A synthetic task-tracker example routes one feature to each destination. tests/fixtures/retrofit/ is the bundle it seeds, checked by the profile check (with the 0.1.0 folder pending) and the pinned validator. tests/retrofit.bats checks the mechanical acceptance criteria and is listed in docs/development.md. Refs #47, #35 --- docs/development.md | 1 + .../references/retrofit.md | 240 ++++++++++++ .../features/due-date-reminders/PRD.md | 21 ++ .../features/due-date-reminders/TRD.md | 14 + .../tests/fixtures/retrofit/features/index.md | 5 + .../tests/fixtures/retrofit/ideas/index.md | 5 + .../fixtures/retrofit/ideas/time-tracking.md | 12 + .../tests/fixtures/retrofit/index.md | 16 + .../research/2026-11-24-positioning.md | 20 + .../tests/fixtures/retrofit/research/index.md | 5 + .../tests/fixtures/retrofit/shaping/index.md | 5 + .../index.md | 5 + .../repeat-schedules.md | 24 ++ .../product-development/tests/retrofit.bats | 346 ++++++++++++++++++ 14 files changed, 719 insertions(+) create mode 100644 plugins/product-development/skills/product-development/references/retrofit.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/PRD.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/TRD.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/index.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/index.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/time-tracking.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/2026-11-24-positioning.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/index.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/index.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/index.md create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md create mode 100644 plugins/product-development/skills/product-development/tests/retrofit.bats diff --git a/docs/development.md b/docs/development.md index 9a8bf39..22a6945 100644 --- a/docs/development.md +++ b/docs/development.md @@ -147,6 +147,7 @@ nix develop -c bats plugins/product-development/skills/product-development/tests nix develop -c bats plugins/product-development/skills/product-development/tests/canonization.bats nix develop -c bats plugins/product-development/skills/product-development/tests/feature-tags.bats nix develop -c bats plugins/product-development/skills/product-development/tests/modernization.bats +nix develop -c bats plugins/product-development/skills/product-development/tests/retrofit.bats nix develop -c bats plugins/delivery-engineering/tests/plugin-package.bats nix develop -c bats plugins/okf-bundle/tests/plugin-package.bats nix develop -c bats plugins/branch-guard/tests diff --git a/plugins/product-development/skills/product-development/references/retrofit.md b/plugins/product-development/skills/product-development/references/retrofit.md new file mode 100644 index 0000000..5ed477b --- /dev/null +++ b/plugins/product-development/skills/product-development/references/retrofit.md @@ -0,0 +1,240 @@ +# Retrofit + +Load this reference when a project adopts the skill after its code exists: its features are real but undocumented, or documented only in other formats, such as Spec Kit, OpenSpec, design and plan files from other agent workflows, or old wikis. A retrofit takes the project from "a codebase" to a set of features in the right stages. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +Specs written with version 0.1.0 of this skill are converted by modernization ([modernization.md](modernization.md)), not by a retrofit. A retrofit routes the features that have them there. + +## How it runs + +The agent drafts and the maintainer decides. A retrofit runs four steps in order: a braindump with the maintainer, the feature lenses, one feature inventory the maintainer approves, and routing. It seeds ideas, shaping documents and research notes; it ratifies nothing. + +Two rules hold throughout: + +- Specs in other formats count as evidence for shaping. Code alone never admits a spec to `features/` (`SKILL.md`, Stages): behavior that exists only in code enters through `shaping/` or `ideas/`, and a change whose code has already shipped still goes through promotion. +- Market and positioning details found along the way, such as segments, competitors, pricing comparisons and survey results, go to research notes in `docs/product/research/`, as [product-vision.md](product-vision.md#market-context-research-note) describes. Name each note for when its evidence was gathered and record where each detail came from. + +Before step 1, if `docs/product/` lacks the 0.2.0 scaffold, run `scripts/init.sh`; it never overwrites. The Foundation Gate blocks drafting a PRD, not ideas or shaping, so a retrofit can run before the constitution and vision exist. + +## The four steps + +### 1. Maintainer braindump + +The agent interviews the maintainer the way the Vision Grill does ([product-vision.md](product-vision.md#vision-grill-workflow)): repo evidence first, then one question at a time, asking only what the repository can't answer. Cover what the product does, for whom, which parts matter and which are dead, and where any prior specs live. + +Label each claim in the braindump notes as the Vision Grill labels its synthesis: `Source-backed`, `User-stated`, `Assumption` or `Open question`. The notes are working material, like the inventory: each lens subagent gets a summary of them, and they leave nothing in `docs/product/` except the research notes their market details go to. The braindump approves no vision; what it learns about the product's purpose and audience is evidence for the Vision Grill later. + +After the braindump, check the large-codebase thresholds ([Large codebases](#large-codebases)). + +### 2. Feature lenses + +A feature lens is one discovery strategy, run by its own subagent. Each lens reports candidate features with evidence, in the report format of [Lens prompt templates](#lens-prompt-templates). There are eight: + +- **Domain model**: entities, their operations, and entities nothing uses. +- **Screens and flows**: routes, screens and the flows a user completes in each client. +- **API and CLI surface**: public endpoints, API schemas, CLI commands and SDK exports. +- **Jobs and integrations**: scheduled jobs, queue workers, webhooks and third-party clients. +- **Roles and feature flags**: permissions, plans and entitlements, and flags with what they gate. +- **Tests**: the behavior tests pin, by test name. +- **Prior specs**: Spec Kit, OpenSpec, design and plan files, wikis, and 0.1.0 feature folders. +- **History**: pull requests, conventional-commit scopes and `git blame`. + +Dispatch one subagent per lens, in parallel where the harness allows. Give each the shared preamble, the braindump summary, the scope to read, its lens template and the report format. The main context reads the eight reports, not the code. Where the harness has no subagents, run the lenses one at a time in the main context and keep only each report. + +An `@feature` tag or a `features//` path in code is evidence for any lens ([feature-tags.md](feature-tags.md)). Tags are optional: an untagged codebase is a supported starting point. + +### 3. Feature inventory + +The agent reconciles the lens reports into one inventory: the candidate features, their evidence and the code they span. Reconciling merges a candidate that several lenses found, splits one that mixes unrelated behavior, names each the way its users would, and proposes a destination for each (step 4). Disagreements between lenses and thin evidence become questions for the maintainer. + +The maintainer reviews the inventory: renaming, merging, splitting or striking candidates, changing destinations. A struck candidate, such as dead code, stays listed with its reason, so the approval shows what was left out. Then the maintainer approves it. Approval sets scope for the retrofit only. It ratifies nothing, and no feature reaches `features/` without a promotion PR. + +The inventory is working material. It lists code, which nothing in the product bundle does ([feature-tags.md](feature-tags.md#what-stays-out-of-the-feature-bundle)), and has no OKF type, so it stays outside `docs/product/` and never merges to the default branch. It is deleted once its features are seeded: each idea and shaping document written, and each feature routed to modernization listed in the retrofit PR. Use the format of the [example inventory](#the-inventory). + +### 4. Routing + +Each approved feature goes to one of three places: + +- **Modernization**, when it has 0.1.0 specs: a feature folder under `docs/product/features/` with a PRD and a TRD. Follow [modernization.md](modernization.md), one feature folder at a time. The retrofit writes nothing for it; the retrofit PR lists it with its lens evidence, a starting point for modernization's accounting. +- **`shaping/`**, when its behavior needs to be written up and ratified. Start `shaping/{feature}--{change}/` with a shaping document that writes up the behavior as the feature's first change, named for what it delivers ([changes-and-deltas.md](changes-and-deltas.md#naming)). Its provenance record ([changes-and-deltas.md](changes-and-deltas.md#provenance)) carries the lens evidence: the packages and API surfaces the behavior spans under Current artifacts, and the tests, pull requests and prior specs under Evidence, each linked. It names no list of code files. A prior spec in another format is quoted or linked as evidence; it is not a requirement. From there the change follows the lifecycle: PRD, TRD, stories and scenarios drafted and approved in `shaping/`, then its promotion PR. +- **`ideas/`**, when it is only a direction: half-built work behind a flag that is off, or an intent the maintainer has not committed to. Write `ideas/{idea}.md` with the evidence found. + +Questions the maintainer can't answer yet go to the shaping document they concern, or to the register, `docs/product/open-questions.md`, with a blocking level and a resolution method ([open-questions.md](open-questions.md#homes)). + +Retiring any existing document, such as a Spec Kit spec, an OpenSpec change or a design file, needs the maintainer's approval, under the modernization guide's rules ([modernization.md](modernization.md#7-retire-artifacts-with-approval)). A prior spec of shipped behavior therefore stays until canonization puts its content in the feature spec; a plan or design file can retire once its content is in a shaping document, an ADR or a feature log. + +## Large codebases + +After the braindump, the agent recommends the [`wayfinder`](https://github.com/mattpocock/skills/tree/main/skills/engineering/wayfinder) skill by Matt Pocock when at least two of these hold: + +- more than 5 apps or packages; +- more than about 1,000 source files; +- more than one surface, such as web and mobile, or an API and a CLI; +- two or more sources of prior specs; +- more than about 10 candidate features. + +`wayfinder` charts a large piece of work as a map of decision tickets on the project's issue tracker and resolves them one at a time. It has `disable-model-invocation`, so the agent never invokes it: the agent explains why it is recommending it, naming the thresholds that hold, and the user invokes it. This repository doesn't ship it; install it from its public source if wanted. Its map can settle how to scope the lenses, such as which apps each lens reads; it is not the feature inventory and approves nothing. + +The four steps work without it. When `wayfinder` is not installed, or the user declines it, continue with step 2: split each lens by app or package, one subagent per part, and reconcile the parts in step 3 as usual. + +## Lens prompt templates + +Every lens subagent gets this preamble, then its lens template: + +```text +You are one feature lens in a retrofit of {product}. Work read-only: change no file and write nothing to GitHub. +Braindump summary: {summary} +Scope: {apps, packages or paths to read} +A candidate feature is behavior the product's users can see or rely on, named the way they would name it. +Cite each piece of evidence as a file and line, a pull request or a commit. +Report candidate features with evidence in the report format below, and nothing else. If the lens finds nothing, say so in one line. +List any market or positioning detail you find under "Market and positioning", with its source. +``` + +Report format: + +```markdown +| Candidate feature | What it does | Evidence | Code it spans | Confidence | Ask the maintainer | +|-------------------|--------------|----------|---------------|------------|--------------------| +| recurring-tasks | Repeats a task on a schedule | `Recurrence` entity, `packages/api/src/recurrence/model.ts:12` | `packages/api/src/recurrence/` | high | Is "every weekday" still supported? | +``` + +Confidence is `high`, `medium` or `low`. + +### Domain model + +```text +Lens: domain model. +Read the data model: schema files, database schema changes, ORM entities, core types and the names the code gives them. +Group entities into candidate features: an entity users create, change or see, with the operations on it. +Note entities that nothing reads or writes, as possibly dead. +Return candidate features with evidence: each entity, its file and line, and the operations found. +``` + +### Screens and flows + +```text +Lens: screens and flows. +Read each client app's routes, screens, navigation and forms. +Trace each flow a user can complete, from where it starts to what it produces. +Note screens no navigation reaches, as possibly dead. +Return candidate features with evidence: each route or screen, its file, and the steps of its flow. +``` + +### API and CLI surface + +```text +Lens: API and CLI surface. +Read public endpoints, API schemas such as OpenAPI or GraphQL, CLI commands and flags, SDK exports, and webhooks the product sends. +Group operations into candidate features by what a caller achieves with them. +Return candidate features with evidence: each operation or command, its file and line, and who calls it. +``` + +### Jobs and integrations + +```text +Lens: jobs and integrations. +Read scheduled jobs, queue consumers, workers, webhooks received and third-party API clients. +For each, find its trigger and what a user sees as a result. +Return candidate features with evidence: each job or integration, its trigger, its file and line, and its user-visible result. +``` + +### Roles and feature flags + +```text +Lens: roles and feature flags. +Read permission checks, roles, plans and entitlements, and feature-flag definitions with their values per environment where the repository holds them. +For each, find what it gates. +Mark behavior behind a flag that is off everywhere. +Return candidate features with evidence: each role, plan or flag, what it gates, and its file and line. +``` + +### Tests + +```text +Lens: tests. +Read test names, describe blocks, end-to-end and acceptance tests, and test fixtures. +A test pins behavior someone cared about; group tests by the behavior they pin. +Note skipped or disabled tests. +Return candidate features with evidence: each test file and the test names that state the behavior. +``` + +### Prior specs + +```text +Lens: prior specs. +Find specs in other formats: Spec Kit (such as .specify/ and specs/), OpenSpec (openspec/), design and plan files from other agent workflows, wikis, and READMEs that describe behavior. +Also find feature folders written with version 0.1.0 of the product-development skill: docs/product/features/{feature}/ holding a PRD.md and a TRD.md. +For each document, give its format and date, and whether the code shows it shipped. +Return candidate features with evidence: each document, its path, and what it specifies. Flag each 0.1.0 feature folder. +``` + +### History + +```text +Lens: history. +Read merged pull requests (titles and descriptions), conventional-commit scopes, and git blame on the files that changed most. +Group the work into candidate features by scope and by the files changed together. +Note areas with no commits for a long time, as possibly dead. +Return candidate features with evidence: each scope or pull request, its commit count and date range, and the files it touched. +``` + +## Finishing the retrofit PR + +The retrofit PR writes the seeded ideas, shaping documents and research notes, and lists each feature routed to modernization. Opening it waits for the maintainer's approval, like every write to GitHub (`SKILL.md`, GitHub Writes), and the maintainer merges it. Its body lists each approved feature with its destination and records the maintainer's approval of the inventory; the inventory itself is deleted. + +Regenerate the indexes and run the checks from the project root, the profile check and the pinned upstream validator ([okf-profile.md](okf-profile.md#checks)), with one `--pending` for each 0.1.0 feature folder awaiting modernization, as [modernization.md](modernization.md#how-it-runs) describes: + +```bash +python3 "/scripts/okf-profile.py" index --pending {unconverted} docs/product +python3 "/scripts/okf-profile.py" check --pending {unconverted} docs/product +python3 /tmp/okf-validate.py docs/product +python3 "/scripts/open-questions.py" check --pending {unconverted} docs/product +``` + +Without 0.1.0 folders, drop `--pending`. + +Before asking the maintainer to merge, confirm: + +- every approved feature is an idea, a change in `shaping/` or listed for modernization, and nothing new is in `features/`; +- each shaping document's provenance record carries its evidence; +- each market and positioning detail is in a research note; +- each retirement has the maintainer's approval; +- the inventory and the braindump notes are deleted, and no document in `docs/product/` carries the inventory's lists of code files. + +## Worked example + +A team task tracker has a web app, a CLI and a public REST API in three packages, about 600 source files, no `docs/product/` except one 0.1.0 feature folder, `docs/product/features/due-date-reminders/`, and an `openspec/` directory from an earlier agent workflow. + +**1. Braindump.** The maintainer says the product serves small teams that plan work together; recurring tasks matter most; time tracking was started and paused; CSV import is dead and will be removed. They add that teams move to it from spreadsheets and that competing trackers charge per seat. + +Two thresholds hold: more than one surface (a web app, a CLI and an API) and two sources of prior specs (the 0.1.0 folder and `openspec/`). The agent explains this and recommends that the user invoke `wayfinder`. The maintainer declines, and the retrofit continues without it. + +**2. Lenses.** Eight subagents report. The prior-specs lens flags the 0.1.0 folder and `openspec/specs/recurring-tasks/spec.md`; the roles-and-flags lens finds `time_tracking` off in every environment; the history lens finds 14 pull requests scoped `feat(recurrence)`. + +### The inventory + +**3. Inventory.** The agent reconciles the eight reports. The maintainer strikes `csv-import` and approves: + +```markdown +# Feature inventory: team task tracker + +Approved by the maintainer on 2026-11-26. The approval sets the scope of this retrofit only and ratifies nothing. + +| Feature | What it does | Evidence | Code it spans | Destination | +|---------|--------------|----------|---------------|-------------| +| `due-date-reminders` | Reminds assignees before a task is due | 0.1.0 PRD and TRD in `docs/product/features/due-date-reminders/` (prior specs); hourly `ReminderJob` (jobs and integrations); `reminders.test.ts` (tests) | `packages/api/src/reminders/` | modernization | +| `recurring-tasks` | Repeats a task on a schedule | `openspec/specs/recurring-tasks/spec.md` (prior specs); `Recurrence` entity (domain model); `task repeat` command (API and CLI surface); 14 pull requests scoped `feat(recurrence)` (history) | `packages/api/src/recurrence/`, `packages/cli/src/commands/repeat.ts`, `apps/web/src/tasks/RepeatPicker.tsx` | `shaping/` | +| `time-tracking` | Logs time spent on a task | `time_tracking` flag off in every environment (roles and feature flags); `TimeEntry` table nothing reads (domain model); the maintainer calls it a direction, not a commitment (braindump) | `packages/api/src/time/` | `ideas/` | + +Struck: `csv-import`, dead according to the maintainer (braindump); not routed. +Market and positioning: teams moving from spreadsheets and per-seat pricing at competitors, for a research note. +``` + +**4. Routing.** The retrofit PR: + +- lists `due-date-reminders` for modernization, with its evidence; the checks name it with `--pending due-date-reminders`; +- starts `shaping/recurring-tasks--repeat-schedules/` with a shaping document whose provenance record cites the OpenSpec spec, the packages it spans and the history. The OpenSpec spec stays: it describes shipped behavior, so it can retire only once canonization puts its content in the feature spec, and then only with the maintainer's approval; +- writes `ideas/time-tracking.md`; +- writes `research/2026-11-24-positioning.md` with the spreadsheet and pricing details. + +Once the PR is drafted, the inventory and the braindump notes are deleted. The skill's test fixture, `tests/fixtures/retrofit/`, is the seeded `docs/product/` bundle, and `tests/retrofit.bats` checks it. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/PRD.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/PRD.md new file mode 100644 index 0000000..668a5ed --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/PRD.md @@ -0,0 +1,21 @@ +# PRD: Due-date reminders + +**Status:** Implemented +**Created:** 2026-02-10 + +## Problem + +Assignees miss due dates on tasks they forgot about. + +## Requirements + +| ID | Requirement | +|----|-------------| +| FR-1 | An assignee is reminded one day before a task is due | +| FR-2 | No reminder for a completed task | + +## Changelog + +| Date | Change | Rationale | +|------|--------|-----------| +| 2026-02-10 | Initial version | - | diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/TRD.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/TRD.md new file mode 100644 index 0000000..cbc7ca3 --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/due-date-reminders/TRD.md @@ -0,0 +1,14 @@ +# TRD: Due-date reminders + +**Status:** Implemented +**Created:** 2026-02-10 + +## Design + +An hourly job finds tasks due within a day and notifies their assignees. + +## Changelog + +| Date | Change | Rationale | +|------|--------|-----------| +| 2026-02-10 | Initial version | - | diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/index.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/index.md new file mode 100644 index 0000000..e3850fd --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/features/index.md @@ -0,0 +1,5 @@ + + +# Directories + +* [due-date-reminders/](due-date-reminders/) diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/index.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/index.md new file mode 100644 index 0000000..2760118 --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/index.md @@ -0,0 +1,5 @@ + + +# Documents + +* [Time tracking](time-tracking.md) - Let people log the time they spend on a task. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/time-tracking.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/time-tracking.md new file mode 100644 index 0000000..9efe541 --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/ideas/time-tracking.md @@ -0,0 +1,12 @@ +--- +type: idea +title: Time tracking +description: Let people log the time they spend on a task. +status: draft +--- + +# Time tracking + +Some teams want to see where their week went. Work on this started and paused: a `time_tracking` flag, off in every environment, hides a timer on the task page, and a `TimeEntry` table holds no rows that anything reads. + +The maintainer calls it a direction, not a commitment. Nobody is shaping it yet. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md new file mode 100644 index 0000000..fce1205 --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md @@ -0,0 +1,16 @@ +--- +okf_version: "0.3" +title: Team task tracker product documents +description: Ideas, shaping and research for a team task tracker, seeded by a retrofit. Use it for product intent. +license: CC-BY-4.0 +x-maintainer: human:product-owner +--- + + + +# Directories + +* [features/](features/) - Feature bundles: shipped behavior, ratified changes and their history. +* [ideas/](ideas/) - Early sketches with no requirements authority. +* [research/](research/) - Research notes: evidence and market context. +* [shaping/](shaping/) - Changes being shaped: tentative designs, one directory per change. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/2026-11-24-positioning.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/2026-11-24-positioning.md new file mode 100644 index 0000000..a3e4daa --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/2026-11-24-positioning.md @@ -0,0 +1,20 @@ +--- +type: research-note +title: Positioning from the retrofit braindump +description: Where the team task tracker's users come from and how competing trackers price, as the maintainer described them. +status: stable +--- + +# Positioning from the retrofit braindump + +## Segments + +Small teams that plan work together, many moving from shared spreadsheets. + +## Competitive alternatives + +Competing trackers charge per seat. + +## Sources + +The maintainer, in the retrofit braindump on 2026-11-24. Neither claim has other evidence yet. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/index.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/index.md new file mode 100644 index 0000000..6cdb89d --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/research/index.md @@ -0,0 +1,5 @@ + + +# Documents + +* [Positioning from the retrofit braindump](2026-11-24-positioning.md) - Where the team task tracker's users come from and how competing trackers price, as the maintainer described them. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/index.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/index.md new file mode 100644 index 0000000..5a4f675 --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/index.md @@ -0,0 +1,5 @@ + + +# Directories + +* [recurring-tasks--repeat-schedules/](recurring-tasks--repeat-schedules/) - Write up the shipped recurring-task behavior as the first change of the recurring-tasks feature. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/index.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/index.md new file mode 100644 index 0000000..5c7ae33 --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/index.md @@ -0,0 +1,5 @@ + + +# Documents + +* [Repeat tasks on a schedule](repeat-schedules.md) - Write up the shipped recurring-task behavior as the first change of the recurring-tasks feature. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md new file mode 100644 index 0000000..fb9bd4b --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md @@ -0,0 +1,24 @@ +--- +type: shaping +title: Repeat tasks on a schedule +description: Write up the shipped recurring-task behavior as the first change of the recurring-tasks feature. +status: draft +--- + +# Repeat tasks on a schedule + +A task can repeat daily, weekly or monthly. When a repeating task is completed, the next one is created with the same title, assignee and checklist, due one interval later. People set the schedule from the task page or with `task repeat`. + +This behavior has shipped, but no ratified spec describes it. This change writes it up as the feature's first change, so its promotion PR can admit it to `features/`. + +## Provenance + +| Record | What it holds | +|--------|---------------| +| Current artifacts | The recurrence service in the API package, the `task repeat` command in the CLI package and the repeat picker in the web app; the public `POST /tasks/{id}/recurrence` endpoint | +| Affected consumers | Web, CLI and API users who set schedules; no external integration reads recurrences | +| Compatibility constraints | Existing schedules keep working; the endpoint's request shape stays as it is | +| Decisions | On 2026-11-26 the maintainer approved the retrofit's scope, which routed this feature to shaping. That approval ratified nothing. | +| Evidence | The OpenSpec spec `openspec/specs/recurring-tasks/spec.md`, which describes daily and weekly schedules; the recurrence tests, which also cover monthly schedules; 14 pull requests scoped `feat(recurrence)` | +| Rejected alternatives | Treating the OpenSpec spec as the requirement: specs in other formats are evidence for shaping, and code alone never admits a spec | +| Non-goals and boundaries | No new schedule types; no change to the recurrence code | diff --git a/plugins/product-development/skills/product-development/tests/retrofit.bats b/plugins/product-development/skills/product-development/tests/retrofit.bats new file mode 100644 index 0000000..3cc78c8 --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/retrofit.bats @@ -0,0 +1,346 @@ +#!/usr/bin/env bats + +# Tests for the retrofit guide: the reference that takes a codebase with no +# specs, or specs only in other formats, to a set of features in the right +# stages. The retrofit is the maintainer's and the agent's work, so these +# tests check what can be checked mechanically: the reference's sections and +# statements, the lens prompt templates, the example inventory, the links to +# it, and the synthetic fixture of what the example seeds. + +export PYTHONDONTWRITEBYTECODE=1 + +SCRIPT_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)" +REPO_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)" +REF="$SCRIPT_DIR/references/retrofit.md" +SKILL="$SCRIPT_DIR/SKILL.md" +PROFILE="$SCRIPT_DIR/scripts/okf-profile.py" +VALIDATOR="$SCRIPT_DIR/tests/vendor/okf/validate.py" +FIXTURE="$SCRIPT_DIR/tests/fixtures/retrofit" +WAYFINDER_URL="https://github.com/mattpocock/skills/tree/main/skills/engineering/wayfinder" + +LENSES=( + "Domain model" + "Screens and flows" + "API and CLI surface" + "Jobs and integrations" + "Roles and feature flags" + "Tests" + "Prior specs" + "History" +) + +setup() { + WORK="$(mktemp -d)" +} + +teardown() { + rm -rf "$WORK" +} + +# Fails unless grep runs and finds no match. A bare `! grep` mid-test never +# fails a bats test, and a missing file must not pass as "no match". +refute_grep() { + local rc=0 + grep "$@" >/dev/null || rc=$? + [ "$rc" -eq 1 ] || { echo "refute_grep $* exited $rc" >&2; return 1; } +} + +# Prints a file with wrapped lines joined, so a sentence matches wherever +# it breaks. +joined() { + tr -s '\n ' ' ' < "$1" +} + +# The text of the reference section whose heading matches the given ERE, +# up to the next heading of the same or a higher level, wrapped lines +# joined. A heading inside a code fence doesn't end the section. +section() { + awk -v pat="$1" ' + /^(```|~~~)/ { fence = !fence } + !fence && /^#+ / { + level = length($0) - length(substr($0, index($0, " "))) + if (on && level <= depth) on = 0 + if (!on && $0 ~ pat) { on = 1; depth = level } + } + on' "$REF" | tr -s '\n ' ' ' +} + +# The body of the first fenced block under the lens template heading for +# the given lens. +lens_template() { + awk -v name="$1" ' + !fence && /^#+ / { on = ($0 == "### " name) } + on && /^```/ { if (fence) exit; fence = 1; next } + on && fence' "$REF" +} + +# The example inventory: the fenced block under the worked example's +# inventory heading. +example_inventory() { + awk ' + !fence && /^#+ / { on = ($0 ~ /^### The inventory/) } + on && /^```/ { if (fence) exit; fence = 1; next } + on && fence' "$REF" +} + +# --- The reference --- + +@test "retrofit reference documents the four steps in order" { + [ -f "$REF" ] + local steps + steps=$(grep '^### [1-9]\. ' "$REF") + [ "$steps" = "$(printf '%s\n' \ + '### 1. Maintainer braindump' \ + '### 2. Feature lenses' \ + '### 3. Feature inventory' \ + '### 4. Routing')" ] +} + +@test "step 1 interviews the maintainer the way the Vision Grill does" { + local text + text=$(section '^### 1\. ') + grep -q "Vision Grill" <<< "$text" + grep -q "one question at a time" <<< "$text" + grep -qi "what the product does" <<< "$text" + grep -qi "for whom" <<< "$text" + grep -qi "which parts matter and which are dead" <<< "$text" +} + +@test "step 2 names the eight lenses, each run by its own subagent" { + local text lens + text=$(section '^### 2\. ') + grep -q "its own subagent" <<< "$text" + grep -q "candidate features with evidence" <<< "$text" + for lens in "${LENSES[@]}"; do + grep -qi "\*\*$lens\*\*" <<< "$text" || { echo "step 2 lacks lens: $lens" >&2; return 1; } + done + # @feature tags are optional evidence, per the feature-tags reference. + grep -q "feature-tags.md" <<< "$text" +} + +@test "each lens has a short prompt template that returns candidate features with evidence" { + local lens template lines + for lens in "${LENSES[@]}"; do + template=$(lens_template "$lens") + [ -n "$template" ] || { echo "no template for lens: $lens" >&2; return 1; } + grep -qi "candidate features" <<< "$template" || { echo "$lens: no candidate features" >&2; return 1; } + grep -qi "evidence" <<< "$template" || { echo "$lens: no evidence" >&2; return 1; } + lines=$(wc -l <<< "$template") + [ "$lines" -le 15 ] || { echo "$lens: template has $lines lines" >&2; return 1; } + done + # Exactly eight lens templates. + [ "$(awk '/^## Lens prompt templates/{on=1; next} on && /^## /{on=0} on && /^### /' "$REF" | wc -l | tr -d ' ')" -eq 8 ] +} + +@test "the lens report format has evidence and the code each candidate spans" { + local text + text=$(section '^## Lens prompt templates') + grep -qE '\| Candidate feature \|.*\| Evidence \| Code it spans \|' <<< "$text" + grep -qi "read-only" <<< "$text" +} + +@test "step 3 reconciles one inventory the maintainer approves, which ratifies nothing" { + local text + text=$(section '^### 3\. ') + grep -q "maintainer approves" <<< "$text" + grep -q "scope for the retrofit only" <<< "$text" + grep -q "ratifies nothing" <<< "$text" + grep -q "no feature reaches \`features/\` without a promotion PR" <<< "$text" + grep -q "the code they span" <<< "$text" +} + +@test "the inventory is working material, kept out of docs/product/, deleted once the features are seeded" { + local text + text=$(section '^### 3\. ') + grep -q "working material" <<< "$text" + grep -q "deleted once its features are seeded" <<< "$text" + grep -q "outside \`docs/product/\`" <<< "$text" +} + +@test "step 4 routes each approved feature to modernization, shaping/ or ideas/" { + local text + text=$(section '^### 4\. ') + grep -q "\[modernization.md\](modernization.md)" <<< "$text" + grep -q "0\.1\.0 specs" <<< "$text" + grep -q '`shaping/`' <<< "$text" + grep -q '`ideas/`' <<< "$text" + grep -q "only a direction" <<< "$text" +} + +@test "specs in other formats are evidence for shaping, and code alone never admits a spec" { + local text + text=$(joined "$REF") + grep -q "Specs in other formats count as evidence for shaping" <<< "$text" + grep -q "Code alone never admits a spec to \`features/\`" <<< "$text" + grep -q "Spec Kit" <<< "$text" + grep -q "OpenSpec" <<< "$text" +} + +@test "market and positioning details go to research notes" { + local text + text=$(joined "$REF") + grep -q "Market and positioning details" <<< "$text" + grep -q "product-vision.md#market-context-research-note" <<< "$text" +} + +@test "retiring a document needs the maintainer's approval under the modernization guide's rules" { + local text + text=$(joined "$REF") + grep -q "modernization.md#7-retire-artifacts-with-approval" <<< "$text" + grep -q "maintainer's approval" <<< "$text" +} + +@test "the wayfinder rule: five thresholds, two of them, and the user invokes it" { + local text + text=$(section '^## Large codebases') + [ -n "$text" ] + grep -q "at least two" <<< "$text" + grep -q "more than 5 apps or packages" <<< "$text" + grep -q "more than about 1,000 source files" <<< "$text" + grep -q "more than one surface" <<< "$text" + grep -q "two or more sources of prior specs" <<< "$text" + grep -q "more than about 10 candidate features" <<< "$text" + grep -q "disable-model-invocation" <<< "$text" + grep -q "the user invokes it" <<< "$text" + grep -q "explains why" <<< "$text" + grep -q "doesn't ship it" <<< "$text" +} + +@test "the wayfinder rule links its public source, and the four steps work without it" { + local text + text=$(section '^## Large codebases') + grep -qF "]($WAYFINDER_URL)" <<< "$text" + grep -q "The four steps work without it" <<< "$text" + grep -q "not installed" <<< "$text" +} + +@test "the reference uses the glossary's terms and names no real project" { + local text named + text=$(joined "$REF") + grep -q "CONTEXT.md" <<< "$text" + # Words the glossary avoids for retrofit, feature inventory, feature lens + # and modernization. + refute_grep -qiE "\bonboard|\bbackfill|feature map|survey angle|\bmigrat|\bupgrad|\bphase\b" "$REF" + # Every feature it names is a placeholder or one of the example's. + named=$(grep -oE '(features|shaping|ideas)/[A-Za-z0-9{}<>_-]+' "$REF" | sort -u | + grep -vxE '(features|shaping|ideas)/(\{feature\}(--\{change\})?|\{idea\}||due-date-reminders|recurring-tasks--repeat-schedules|time-tracking)' || true) + [ -z "$named" ] || { echo "unexpected names: $named" >&2; return 1; } + # Its only links outside the skill are the wayfinder source. + refute_grep -qE 'https?://' <<< "$(grep -oE 'https?://[^ )>]+' "$REF" | grep -vxF "$WAYFINDER_URL" || true)" + grep -qF "tests/fixtures/retrofit/" <<< "$text" +} + +@test "every relative link in the reference resolves, anchors included" { + run python3 -I - "$REF" <<'EOF' +import re, sys +from pathlib import Path + +ref = Path(sys.argv[1]) + +def slugs(path): + out, fence = set(), False + for line in path.read_text().splitlines(): + if line.startswith(("```", "~~~")): + fence = not fence + if fence or not line.startswith("#"): + continue + title = line.lstrip("#").strip().lower() + title = re.sub(r"[^\w\- ]", "", title) + out.add(title.replace(" ", "-")) + return out + +bad = [] +text = re.sub(r"```.*?```", "", ref.read_text(), flags=re.S) +for target in re.findall(r"\]\(([^)]+)\)", text): + if re.match(r"[a-z]+://", target): + continue + path, _, anchor = target.partition("#") + dest = (ref.parent / path).resolve() if path else ref + if not dest.exists(): + bad.append(target) + elif anchor and dest.is_file() and anchor not in slugs(dest): + bad.append(target) +print("\n".join(bad)) +sys.exit(1 if bad else 0) +EOF + [ "$status" -eq 0 ] || { echo "broken links: $output" >&2; return 1; } +} + +# --- The worked example --- + +@test "the example inventory routes one feature to each destination" { + local inventory destinations + inventory=$(example_inventory) + [ -n "$inventory" ] + grep -q "ratifies nothing" <<< "$inventory" + # The Destination column of each data row. + destinations=$(grep -E '^\| `' <<< "$inventory" | awk -F'|' '{ gsub(/^ +| +$/, "", $(NF-1)); print $(NF-1) }' | sort) + [ "$destinations" = "$(printf '%s\n' '`ideas/`' '`shaping/`' 'modernization' | sort)" ] || + { echo "destinations: $destinations" >&2; return 1; } +} + +@test "the example uses a synthetic task-tracker product and runs without wayfinder" { + local text + text=$(section '^## Worked example') + grep -q "task tracker" <<< "$text" + grep -q "wayfinder" <<< "$text" + grep -qi "declines" <<< "$text" +} + +# --- The fixture: what the example seeds --- + +@test "fixture: the seeded documents sit in their stages" { + [ -f "$FIXTURE/ideas/time-tracking.md" ] + [ -f "$FIXTURE/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md" ] + [ -f "$FIXTURE/features/due-date-reminders/PRD.md" ] + [ -f "$FIXTURE/features/due-date-reminders/TRD.md" ] + ls "$FIXTURE"/research/*.md | grep -vq '/index\.md$' + # Code alone admits nothing: no feature bundle came from the retrofit. + refute_grep -rlq "type: feature-spec" "$FIXTURE/features" + # The feature routed to modernization keeps its 0.1.0 documents untouched. + refute_grep -q '^---$' "$FIXTURE/features/due-date-reminders/PRD.md" +} + +@test "fixture: the shaping document cites the prior spec as evidence and has no x-amends" { + local doc="$FIXTURE/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md" + grep -q "^type: shaping$" "$doc" + refute_grep -q "^x-amends:" "$doc" + grep -q "OpenSpec" "$doc" + grep -q "| Evidence |" "$doc" +} + +@test "fixture: the feature inventory was deleted once the features were seeded" { + refute_grep -rilq "feature inventory" "$FIXTURE" + [ -z "$(find "$FIXTURE" -iname '*inventory*')" ] +} + +@test "fixture: the seeded bundle passes the profile check and the validator, modernization pending" { + local bundle="$WORK/product" + cp -R "$FIXTURE" "$bundle" + run python3 "$PROFILE" index --check --pending due-date-reminders "$bundle" + [ "$status" -eq 0 ] || { echo "index: $output" >&2; return 1; } + run python3 "$PROFILE" check --pending due-date-reminders "$bundle" + [ "$status" -eq 0 ] || { echo "check: $output" >&2; return 1; } + run python3 "$VALIDATOR" "$bundle" + [ "$status" -eq 0 ] || { echo "validator: $output" >&2; return 1; } +} + +# --- Links to the reference --- + +@test "SKILL.md links the retrofit reference and routes codebases without specs to it" { + grep -q '\*\*`references/retrofit.md`\*\*' "$SKILL" + grep -qE '^\| .*no product docs.* \| Retrofit \(`references/retrofit.md`\) \|$' "$SKILL" + grep -q "retrofit" <<< "$(sed -n '3p' "$SKILL")" + grep -q '^## Retrofit$' "$SKILL" + grep -qE '^\| Feature lens \|.*references/retrofit.md' "$SKILL" +} + +@test "the feature-tags, modernization and vision references link the retrofit guide" { + grep -q "\](retrofit.md)" "$SCRIPT_DIR/references/feature-tags.md" + grep -q "\](retrofit.md)" "$SCRIPT_DIR/references/modernization.md" + grep -q "\](retrofit.md)" "$SCRIPT_DIR/references/product-vision.md" +} + +@test "docs/development.md runs this suite" { + grep -qF 'nix develop -c bats plugins/product-development/skills/product-development/tests/retrofit.bats' "$REPO_ROOT/docs/development.md" +} From 16193230d0e2bf49a47ce0e2d97df8315df3f395 Mon Sep 17 00:00:00 2001 From: John Lianoglou Date: Sun, 29 Nov 2026 22:49:45 -0500 Subject: [PATCH 2/5] docs(product-development): link the retrofit guide from the skill SKILL.md gains a Retrofit workflow section (trigger, process, gate), a workflow-selection row for codebases whose features have no product docs or only specs in other formats, a feature-lens row in the sub-agent dispatch table, a reference-list entry, and "retrofit a codebase that has no specs" in its description. The one-behavior case still routes to Discovery and Design. The feature-tags reference now links the retrofit guide where it calls tags optional evidence, and the modernization and vision references replace their pending issue mentions with links to it. Refs #47, #35 --- .../skills/product-development/SKILL.md | 15 +++++++++++++-- .../references/feature-tags.md | 2 +- .../references/modernization.md | 2 +- .../references/product-vision.md | 2 +- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/plugins/product-development/skills/product-development/SKILL.md b/plugins/product-development/skills/product-development/SKILL.md index c7b0962..5b0622a 100644 --- a/plugins/product-development/skills/product-development/SKILL.md +++ b/plugins/product-development/skills/product-development/SKILL.md @@ -1,6 +1,6 @@ --- name: product-development -description: "Use when the user asks to create a feature, write a PRD or TRD, add user stories, write scenarios, create acceptance criteria, capture an idea, shape a change, run a spike, promote a change, ratify a change, review a promotion PR, triage open questions, draft or send the implementation handoff, draft downstream comments, make a tech decision, research compliance or standards, run the pre-ship Release Check, execute a delivery-plan step (for example a rollout), record a ship signal, canonize a shipped change, hand a ratified change to implementation, map change states to a project board, modernize specs written with version 0.1.0 of this skill, initialize product docs, set up product documentation, create, approve, amend, or validate a Product Constitution, run the Constitution Grill, create or maintain Product Vision, run a Vision Grill, or work anywhere in the product development lifecycle from project setup through canonization." +description: "Use when the user asks to create a feature, write a PRD or TRD, add user stories, write scenarios, create acceptance criteria, capture an idea, shape a change, run a spike, promote a change, ratify a change, review a promotion PR, triage open questions, draft or send the implementation handoff, draft downstream comments, make a tech decision, research compliance or standards, run the pre-ship Release Check, execute a delivery-plan step (for example a rollout), record a ship signal, canonize a shipped change, hand a ratified change to implementation, map change states to a project board, modernize specs written with version 0.1.0 of this skill, retrofit a codebase that has no specs, initialize product docs, set up product documentation, create, approve, amend, or validate a Product Constitution, run the Constitution Grill, create or maintain Product Vision, run a Vision Grill, or work anywhere in the product development lifecycle from project setup through canonization." --- # Product Development Lifecycle @@ -244,6 +244,14 @@ Release questions can also name a delivery-plan step, by path and anchor. Before **Gate:** Opening the modernization PR waits for the maintainer's approval. The maintainer rules on every mismatch and approves every retirement before it merges. Work carried forward is not ratified: it needs its own promotion PR. +## Retrofit + +**Trigger:** The project has features in code but no product docs for them, or specs only in other formats, such as Spec Kit, OpenSpec, or design and plan files from other agent workflows. + +**Process:** Follow `references/retrofit.md`: interview the maintainer in a braindump run like the Vision Grill, run the eight feature lenses, each in its own subagent, reconcile their reports into one feature inventory, and route each approved feature to modernization, `shaping/` or `ideas/`. When at least two of the guide's large-codebase thresholds hold, explain why and recommend that the user invoke `wayfinder`; the agent never invokes it, and the retrofit works without it. + +**Gate:** The maintainer approves the feature inventory before anything is seeded. The approval sets the scope of the retrofit only and ratifies nothing: no feature reaches `features/` without a promotion PR. Opening the retrofit PR waits for the maintainer's approval, and the inventory is deleted once its features are seeded. + ## Gates and Review Passes ### Gate behavior @@ -343,6 +351,7 @@ For each writing workflow, dispatch a sub-agent with only the inputs it needs: | Promotion review | The promotion PR's diff, `references/promotion-review.md`, `CONTEXT.md` | Findings with severity labels and citations | | Tech decision or compliance research | The decision or research charter, `references/tech-decisions.md` or `references/compliance-research.md` | Findings with primary sources | | Idea discovery | Summary of the work, `docs/product/ideas/`, report format from `references/idea-discovery-and-spikes.md` | Report of relevant ideas, nothing else | +| Feature lens | Braindump summary, the scope to read, the shared preamble, its lens template and the report format from `references/retrofit.md` | Candidate features with evidence, nothing else | | User Stories | Approved PRD, TRD, constitution, vision, `references/user-stories.md` | Story files written to disk | | BDD Scenarios | User stories, TRD, constitution, vision, `references/bdd-scenarios.md` | `.feature` files written to disk | @@ -389,7 +398,8 @@ Not every feature starts at the beginning. Match the entry point to the current | About to execute a step in the delivery plan | Release Check | | Ship signal fired for a ratified change | Ship Signal and Canonization | | Shipped change waiting for canonization | Ship Signal and Canonization | -| Code exists with no spec | Discovery and Design (code alone never admits a spec) | +| One behavior exists in code with no spec | Discovery and Design (code alone never admits a spec) | +| A codebase whose features have no product docs, or specs only in other formats (Spec Kit, OpenSpec, design and plan files) | Retrofit (`references/retrofit.md`) | | Specs written with version 0.1.0 of this skill (a PRD and TRD per feature folder, changelog tables, committed plans) | Modernization (`references/modernization.md`) | Clear requirements may skip brainstorming only after Foundation Gate passes. If this is the first PRD and `docs/product/constitution.md` or `docs/product/vision.md` is missing, unapproved, or unversioned, run the Foundation workflow before Requirements. @@ -440,6 +450,7 @@ Detailed guidance for each workflow lives in reference files to keep context tar - **`references/implementation-handoff.md`** — The handoff: its contents, when it is drafted and sent, and an example for a feature's first change - **`references/canonization.md`** — Recording the ship signal, the five canonization steps, the canonization PR, and a worked example with a change in meaning, a deferral and a rebased delta - **`references/modernization.md`** — Converting a feature folder written with 0.1.0 into a feature bundle: the seven steps, archived originals, mismatch rulings, retirements, and a worked example +- **`references/retrofit.md`** — Taking a codebase without specs to features in the right stages: the maintainer braindump, the eight feature lenses with their prompt templates, the feature inventory, routing, the `wayfinder` rule for large codebases, and a worked example - **`references/downstream-comments.md`** — Drafting comments for downstream owners; posting waits for the maintainer's approval - **`references/tech-decisions.md`** — Technology choices for a change's TRD, with an ADR when consequential - **`references/compliance-research.md`** — Source-cited research on laws, regulations and standards, without overclaims diff --git a/plugins/product-development/skills/product-development/references/feature-tags.md b/plugins/product-development/skills/product-development/references/feature-tags.md index ba341eb..976743a 100644 --- a/plugins/product-development/skills/product-development/references/feature-tags.md +++ b/plugins/product-development/skills/product-development/references/feature-tags.md @@ -91,7 +91,7 @@ A file with no tag that sits outside any `features//` directory is u Files whose location the tooling fixes, such as lockfiles, package manifests and framework-mandated entry points, stay unmapped. Don't move them under `features/` to map them. -An untagged codebase is a supported starting point. Tags are optional evidence when discovering a codebase's features, and tagging can follow once those features are ratified. +An untagged codebase is a supported starting point. Tags are optional evidence when discovering a codebase's features in a [retrofit](retrofit.md), and tagging can follow once those features are ratified. ## What stays out of the feature bundle diff --git a/plugins/product-development/skills/product-development/references/modernization.md b/plugins/product-development/skills/product-development/references/modernization.md index 9a0ebb5..e83a9f3 100644 --- a/plugins/product-development/skills/product-development/references/modernization.md +++ b/plugins/product-development/skills/product-development/references/modernization.md @@ -2,7 +2,7 @@ Load this reference when a project has specs written with version 0.1.0 of this skill. In 0.1.0, each feature was a folder, `docs/product/features/{feature}/`, holding one PRD and one TRD edited in place, each with a status field and a changelog table, beside its stories and scenarios. Implementation plans and design documents were committed under `docs/plans/`. Modernization converts that folder into a feature bundle ([feature-bundles.md](feature-bundles.md)), separating shipped behavior, approved unbuilt work and drafts. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md); "feature folder" here means the 0.1.0 layout, never a feature bundle. -A codebase with no specs at all is a retrofit, not a modernization: see #47 (the retrofit guide). +A codebase with no specs at all is a retrofit, not a modernization: see [retrofit.md](retrofit.md). ## How it runs diff --git a/plugins/product-development/skills/product-development/references/product-vision.md b/plugins/product-development/skills/product-development/references/product-vision.md index 6a0ed00..a62dfb4 100644 --- a/plugins/product-development/skills/product-development/references/product-vision.md +++ b/plugins/product-development/skills/product-development/references/product-vision.md @@ -182,7 +182,7 @@ How the product expects to reach people, and the launch-market hypotheses. An as The source behind each claim: who said it, where and when. ``` -The modernization (#46, modernization guide) and retrofit (#47, retrofit guide) workflows route market details found in old documents to research notes before those documents retire. +The [modernization](modernization.md) and [retrofit](retrofit.md) workflows route market details found in old documents to research notes before those documents retire. ## Splitting an existing vision From 8a7e36b107c697e10dd7a85685976b45f72c2673 Mon Sep 17 00:00:00 2001 From: John Lianoglou Date: Sun, 29 Nov 2026 23:03:32 -0500 Subject: [PATCH 3/5] test(product-development): cover open questions and provenance links in the retrofit fixture The seeded shaping document now records a design-level open question ("every weekday" schedules) and the fixture carries the register, docs/product/open-questions.md, with a regenerated index that lists it, so the suite exercises the path where a retrofit records a question. The provenance record's Evidence row links each source with synthetic links: the OpenSpec spec, the recurrence test file and its group, and the feat(recurrence) pull requests (#123-style placeholders on github.com/example). A new test requires those links and refuses any non-synthetic URL in the fixture. The features/ assertion now lists the exact files expected there instead of grepping for an unquoted feature-spec type, which quoted YAML would bypass. The inventory test is relabelled as bundle exclusion and also checks that no inventory sits beside the fixture. Refs #47, #35 --- .../tests/fixtures/retrofit/index.md | 4 +++ .../tests/fixtures/retrofit/open-questions.md | 27 ++++++++++++++ .../repeat-schedules.md | 8 ++++- .../product-development/tests/retrofit.bats | 35 +++++++++++++++++-- 4 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md index fce1205..6d3cae4 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/index.md @@ -8,6 +8,10 @@ x-maintainer: human:product-owner +# Documents + +* [Open questions](open-questions.md) - Product-wide open questions, and a generated index of every open or deferred question in docs/product/. + # Directories * [features/](features/) - Feature bundles: shipped behavior, ratified changes and their history. diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md new file mode 100644 index 0000000..8eb05db --- /dev/null +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/open-questions.md @@ -0,0 +1,27 @@ +--- +type: open-questions +title: Open questions +description: Product-wide open questions, and a generated index of every open or deferred question in docs/product/. +status: stable +--- + +# Open questions + +Questions about the whole of the team task tracker go in the table below. A question about one document stays in that document's own Open Questions table. Each question records what it blocks and how it will be answered; see the product-development skill's `references/open-questions.md`. + +When a question is answered, remove its row and put the answer in the spec, an ADR or the feature log. + +## Product-wide questions + +| ID | Question | Blocking level | Blocks | Resolution | Deferred to | Approval | +|----|----------|----------------|--------|------------|-------------|----------| + +## Index + +Every open or deferred question in `docs/product/`, generated by the product-development skill's `scripts/open-questions.py index docs/product`. Do not edit between the markers. + + +| Question | Blocking level | Blocks | Deferred to | Text | +|----------|----------------|--------|-------------|------| +| [shaping/recurring-tasks--repeat-schedules/repeat-schedules.md#oq-1](shaping/recurring-tasks--repeat-schedules/repeat-schedules.md#oq-1) | design | recurring-tasks/repeat-schedules | — | Is "every weekday" still a supported schedule? The CLI accepts it, but its test is skipped. | + diff --git a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md index fb9bd4b..ccdf679 100644 --- a/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md +++ b/plugins/product-development/skills/product-development/tests/fixtures/retrofit/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md @@ -19,6 +19,12 @@ This behavior has shipped, but no ratified spec describes it. This change writes | Affected consumers | Web, CLI and API users who set schedules; no external integration reads recurrences | | Compatibility constraints | Existing schedules keep working; the endpoint's request shape stays as it is | | Decisions | On 2026-11-26 the maintainer approved the retrofit's scope, which routed this feature to shaping. That approval ratified nothing. | -| Evidence | The OpenSpec spec `openspec/specs/recurring-tasks/spec.md`, which describes daily and weekly schedules; the recurrence tests, which also cover monthly schedules; 14 pull requests scoped `feat(recurrence)` | +| Evidence | The OpenSpec spec [`openspec/specs/recurring-tasks/spec.md`](https://github.com/example/task-tracker/blob/3c1e9a7/openspec/specs/recurring-tasks/spec.md), which describes daily and weekly schedules; the "repeat schedules" group in [`packages/api/src/recurrence/recurrence.test.ts`](https://github.com/example/task-tracker/blob/3c1e9a7/packages/api/src/recurrence/recurrence.test.ts), which also covers monthly schedules and skips "every weekday"; [14 pull requests scoped `feat(recurrence)`](https://github.com/example/task-tracker/pulls?q=is%3Apr+is%3Amerged+feat%28recurrence%29), from [#123](https://github.com/example/task-tracker/pull/123), which added daily and weekly schedules, to [#187](https://github.com/example/task-tracker/pull/187), which added monthly ones | | Rejected alternatives | Treating the OpenSpec spec as the requirement: specs in other formats are evidence for shaping, and code alone never admits a spec | | Non-goals and boundaries | No new schedule types; no change to the recurrence code | + +## Open Questions + +| ID | Question | Blocking level | Blocks | Resolution | Deferred to | Approval | +|----|----------|----------------|--------|------------|-------------|----------| +| OQ-1 | Is "every weekday" still a supported schedule? The CLI accepts it, but its test is skipped. | design | this change | maintainer decision | — | — | diff --git a/plugins/product-development/skills/product-development/tests/retrofit.bats b/plugins/product-development/skills/product-development/tests/retrofit.bats index 3cc78c8..354a5a4 100644 --- a/plugins/product-development/skills/product-development/tests/retrofit.bats +++ b/plugins/product-development/skills/product-development/tests/retrofit.bats @@ -295,8 +295,12 @@ EOF [ -f "$FIXTURE/features/due-date-reminders/PRD.md" ] [ -f "$FIXTURE/features/due-date-reminders/TRD.md" ] ls "$FIXTURE"/research/*.md | grep -vq '/index\.md$' - # Code alone admits nothing: no feature bundle came from the retrofit. - refute_grep -rlq "type: feature-spec" "$FIXTURE/features" + # Code alone admits nothing: features/ holds only the 0.1.0 folder + # routed to modernization, and the generated index. + local features + features=$(cd "$FIXTURE/features" && find . -type f | sort) + [ "$features" = "$(printf '%s\n' ./due-date-reminders/PRD.md ./due-date-reminders/TRD.md ./index.md)" ] || + { echo "features/: $features" >&2; return 1; } # The feature routed to modernization keeps its 0.1.0 documents untouched. refute_grep -q '^---$' "$FIXTURE/features/due-date-reminders/PRD.md" } @@ -309,9 +313,34 @@ EOF grep -q "| Evidence |" "$doc" } -@test "fixture: the feature inventory was deleted once the features were seeded" { +@test "fixture: the provenance evidence links each source, with synthetic links only" { + local doc="$FIXTURE/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md" evidence urls + evidence=$(grep '^| Evidence |' "$doc") + grep -qE '\]\([^)]*openspec/specs/recurring-tasks/spec\.md\)' <<< "$evidence" + grep -qE '\]\([^)]*recurrence[^)]*\.test\.ts[^)]*\)' <<< "$evidence" + grep -qE '\]\([^)]*/pull/[0-9]+\)' <<< "$evidence" + grep -qE '\]\([^)]*pulls\?q=[^)]*\)' <<< "$evidence" + # Every link in the fixture is synthetic. + urls=$(grep -rhoE 'https?://[^ )>]+' "$FIXTURE" | grep -vE '^https://(github\.com/example/|([a-z]+\.)?example\.com/)' || true) + [ -z "$urls" ] || { echo "non-synthetic links: $urls" >&2; return 1; } +} + +@test "fixture: the shaping document holds a live question that the register's index lists" { + local doc="$FIXTURE/shaping/recurring-tasks--repeat-schedules/repeat-schedules.md" + local register="$FIXTURE/open-questions.md" bundle="$WORK/product" + grep -qF '| OQ-1 |' "$doc" + grep -q "^type: open-questions$" "$register" + # The register's index lists the shaping document's question. + grep -qF '(shaping/recurring-tasks--repeat-schedules/repeat-schedules.md#oq-1)' "$register" + cp -R "$FIXTURE" "$bundle" + run python3 "$SCRIPT_DIR/scripts/open-questions.py" check --pending due-date-reminders "$bundle" + [ "$status" -eq 0 ] || { echo "open-questions check: $output" >&2; return 1; } +} + +@test "fixture: the seeded bundle holds no feature inventory, and none sits beside it" { refute_grep -rilq "feature inventory" "$FIXTURE" [ -z "$(find "$FIXTURE" -iname '*inventory*')" ] + [ -z "$(find "$(dirname "$FIXTURE")" -maxdepth 1 -iname '*inventory*')" ] } @test "fixture: the seeded bundle passes the profile check and the validator, modernization pending" { From 9b1ba402ca7b9ab26356fec72a360b5e7370042f Mon Sep 17 00:00:00 2001 From: John Lianoglou Date: Sun, 29 Nov 2026 23:03:40 -0500 Subject: [PATCH 4/5] fix(product-development): close review gaps in the retrofit guide - Finishing: regenerate the open-questions index, with the same --pending flags, before open-questions.py check, so a retrofit that records a question no longer fails with "index is stale". A test runs the reference's command block as written on a copy of the fixture with a stale index. - Lenses: one subagent per lens in every case. Without wayfinder each lens reads package by package as needed and always reads the shared root files and the whole repository's history; the preamble's Scope and the worked example say the same, so the example's root-level openspec/ is in every lens's scope. - Mixed projects: when 0.1.0 left docs/product/AGENTS.md and README.md, reconcile them before seeding, linking modernization's setup rather than restating it. The worked example now has that scaffolding. - wayfinder: on a GitHub-backed tracker its map and child issues are GitHub writes, so the maintainer approves each one under SKILL.md's GitHub Writes rule; local Markdown tracker operations fall outside it. SKILL.md's Retrofit process says the same. - Already-live behavior: the guide stops at the promotion PR, and the ratified change records no Shipped entry until the skill settles what evidence and release check apply. Refs #47, #35 --- .../skills/product-development/SKILL.md | 2 +- .../references/retrofit.md | 28 ++++-- .../product-development/tests/retrofit.bats | 91 +++++++++++++++++++ 3 files changed, 111 insertions(+), 10 deletions(-) diff --git a/plugins/product-development/skills/product-development/SKILL.md b/plugins/product-development/skills/product-development/SKILL.md index 5b0622a..fba6012 100644 --- a/plugins/product-development/skills/product-development/SKILL.md +++ b/plugins/product-development/skills/product-development/SKILL.md @@ -248,7 +248,7 @@ Release questions can also name a delivery-plan step, by path and anchor. Before **Trigger:** The project has features in code but no product docs for them, or specs only in other formats, such as Spec Kit, OpenSpec, or design and plan files from other agent workflows. -**Process:** Follow `references/retrofit.md`: interview the maintainer in a braindump run like the Vision Grill, run the eight feature lenses, each in its own subagent, reconcile their reports into one feature inventory, and route each approved feature to modernization, `shaping/` or `ideas/`. When at least two of the guide's large-codebase thresholds hold, explain why and recommend that the user invoke `wayfinder`; the agent never invokes it, and the retrofit works without it. +**Process:** Follow `references/retrofit.md`: interview the maintainer in a braindump run like the Vision Grill, run the eight feature lenses, each in its own subagent, reconcile their reports into one feature inventory, and route each approved feature to modernization, `shaping/` or `ideas/`. When at least two of the guide's large-codebase thresholds hold, explain why and recommend that the user invoke `wayfinder`; the agent never invokes it, each GitHub write it makes still waits for the maintainer's approval (GitHub Writes), and the retrofit works without it. **Gate:** The maintainer approves the feature inventory before anything is seeded. The approval sets the scope of the retrofit only and ratifies nothing: no feature reaches `features/` without a promotion PR. Opening the retrofit PR waits for the maintainer's approval, and the inventory is deleted once its features are seeded. diff --git a/plugins/product-development/skills/product-development/references/retrofit.md b/plugins/product-development/skills/product-development/references/retrofit.md index 5ed477b..58a7763 100644 --- a/plugins/product-development/skills/product-development/references/retrofit.md +++ b/plugins/product-development/skills/product-development/references/retrofit.md @@ -15,6 +15,8 @@ Two rules hold throughout: Before step 1, if `docs/product/` lacks the 0.2.0 scaffold, run `scripts/init.sh`; it never overwrites. The Foundation Gate blocks drafting a PRD, not ideas or shaping, so a retrofit can run before the constitution and vision exist. +A project can mix 0.1.0 feature folders with undocumented features. Version 0.1.0 also installed `docs/product/AGENTS.md` and `docs/product/README.md`, which `scripts/init.sh` keeps, and their instructions still tell agents to edit PRDs in place under `features/`. When they are present, reconcile them before seeding, as modernization's setup describes ([modernization.md](modernization.md#how-it-runs)), in the retrofit PR or a PR of its own before it. + ## The four steps ### 1. Maintainer braindump @@ -38,7 +40,7 @@ A feature lens is one discovery strategy, run by its own subagent. Each lens rep - **Prior specs**: Spec Kit, OpenSpec, design and plan files, wikis, and 0.1.0 feature folders. - **History**: pull requests, conventional-commit scopes and `git blame`. -Dispatch one subagent per lens, in parallel where the harness allows. Give each the shared preamble, the braindump summary, the scope to read, its lens template and the report format. The main context reads the eight reports, not the code. Where the harness has no subagents, run the lenses one at a time in the main context and keep only each report. +Dispatch one subagent per lens, in parallel where the harness allows. Give each the shared preamble, the braindump summary, the scope to read, its lens template and the report format. The scope covers every app and package in the retrofit, plus the shared root files and the whole repository's history. The main context reads the eight reports, not the code. Where the harness has no subagents, run the lenses one at a time in the main context and keep only each report. An `@feature` tag or a `features//` path in code is evidence for any lens ([feature-tags.md](feature-tags.md)). Tags are optional: an untagged codebase is a supported starting point. @@ -58,6 +60,8 @@ Each approved feature goes to one of three places: - **`shaping/`**, when its behavior needs to be written up and ratified. Start `shaping/{feature}--{change}/` with a shaping document that writes up the behavior as the feature's first change, named for what it delivers ([changes-and-deltas.md](changes-and-deltas.md#naming)). Its provenance record ([changes-and-deltas.md](changes-and-deltas.md#provenance)) carries the lens evidence: the packages and API surfaces the behavior spans under Current artifacts, and the tests, pull requests and prior specs under Evidence, each linked. It names no list of code files. A prior spec in another format is quoted or linked as evidence; it is not a requirement. From there the change follows the lifecycle: PRD, TRD, stories and scenarios drafted and approved in `shaping/`, then its promotion PR. - **`ideas/`**, when it is only a direction: half-built work behind a flag that is off, or an intent the maintainer has not committed to. Write `ideas/{idea}.md` with the evidence found. +A change in `shaping/` whose behavior was already live when the retrofit found it has no settled path past ratification: the skill does not yet say what evidence establishes Shipped for it, or which release check comes before recording that historical signal. For such a change this guide stops at the promotion PR. Once it merges, the change stays Ratified: record no Shipped entry in the feature log, and fire no ship signal for behavior that is already live. Because canonization starts only from Shipped, a prior spec of that behavior stays too. + Questions the maintainer can't answer yet go to the shaping document they concern, or to the register, `docs/product/open-questions.md`, with a blocking level and a resolution method ([open-questions.md](open-questions.md#homes)). Retiring any existing document, such as a Spec Kit spec, an OpenSpec change or a design file, needs the maintainer's approval, under the modernization guide's rules ([modernization.md](modernization.md#7-retire-artifacts-with-approval)). A prior spec of shipped behavior therefore stays until canonization puts its content in the feature spec; a plan or design file can retire once its content is in a shaping document, an ADR or a feature log. @@ -74,7 +78,9 @@ After the braindump, the agent recommends the [`wayfinder`](https://github.com/m `wayfinder` charts a large piece of work as a map of decision tickets on the project's issue tracker and resolves them one at a time. It has `disable-model-invocation`, so the agent never invokes it: the agent explains why it is recommending it, naming the thresholds that hold, and the user invokes it. This repository doesn't ship it; install it from its public source if wanted. Its map can settle how to scope the lenses, such as which apps each lens reads; it is not the feature inventory and approves nothing. -The four steps work without it. When `wayfinder` is not installed, or the user declines it, continue with step 2: split each lens by app or package, one subagent per part, and reconcile the parts in step 3 as usual. +On a GitHub-backed tracker, `wayfinder` creates the map and child issues, and those are GitHub writes (`SKILL.md`, GitHub Writes). The user invoking it starts it, but the maintainer must still see and approve each GitHub write it makes, as for any helper workflow; when recommending it, the agent says so. Operations on a local Markdown tracker write nothing to GitHub and fall outside that rule. + +The four steps work without it. When `wayfinder` is not installed, or the user declines it, continue with step 2 as written: one subagent per lens. In a large codebase each lens subagent reads package by package as needed, and still reads the shared root files, such as root-level spec directories and configuration, and the whole repository's history, so material outside any package is not missed. Step 3 reconciles the eight reports as usual. ## Lens prompt templates @@ -83,7 +89,7 @@ Every lens subagent gets this preamble, then its lens template: ```text You are one feature lens in a retrofit of {product}. Work read-only: change no file and write nothing to GitHub. Braindump summary: {summary} -Scope: {apps, packages or paths to read} +Scope: {apps, packages or paths to read}, package by package, plus the shared root files and the whole repository's history A candidate feature is behavior the product's users can see or rely on, named the way they would name it. Cite each piece of evidence as a file and line, a pull request or a commit. Report candidate features with evidence in the report format below, and nothing else. If the lens finds nothing, say so in one line. @@ -182,10 +188,11 @@ Return candidate features with evidence: each scope or pull request, its commit The retrofit PR writes the seeded ideas, shaping documents and research notes, and lists each feature routed to modernization. Opening it waits for the maintainer's approval, like every write to GitHub (`SKILL.md`, GitHub Writes), and the maintainer merges it. Its body lists each approved feature with its destination and records the maintainer's approval of the inventory; the inventory itself is deleted. -Regenerate the indexes and run the checks from the project root, the profile check and the pinned upstream validator ([okf-profile.md](okf-profile.md#checks)), with one `--pending` for each 0.1.0 feature folder awaiting modernization, as [modernization.md](modernization.md#how-it-runs) describes: +Regenerate both indexes, the bundle's and the open-questions index ([open-questions.md](open-questions.md#the-index-generator)), then run the checks from the project root, the profile check and the pinned upstream validator ([okf-profile.md](okf-profile.md#checks)), with one `--pending` for each 0.1.0 feature folder awaiting modernization, as [modernization.md](modernization.md#how-it-runs) describes. A question recorded during the retrofit leaves the open-questions index stale until it is regenerated: ```bash python3 "/scripts/okf-profile.py" index --pending {unconverted} docs/product +python3 "/scripts/open-questions.py" index --pending {unconverted} docs/product python3 "/scripts/okf-profile.py" check --pending {unconverted} docs/product python3 /tmp/okf-validate.py docs/product python3 "/scripts/open-questions.py" check --pending {unconverted} docs/product @@ -203,13 +210,13 @@ Before asking the maintainer to merge, confirm: ## Worked example -A team task tracker has a web app, a CLI and a public REST API in three packages, about 600 source files, no `docs/product/` except one 0.1.0 feature folder, `docs/product/features/due-date-reminders/`, and an `openspec/` directory from an earlier agent workflow. +A team task tracker has a web app, a CLI and a public REST API in three packages, about 600 source files, and a root-level `openspec/` directory from an earlier agent workflow. Its `docs/product/` holds only what version 0.1.0 left: `AGENTS.md`, `README.md` and one feature folder, `features/due-date-reminders/`. Setup runs `scripts/init.sh` and, before anything is seeded, the agent drafts the reconciled `AGENTS.md` and `README.md` from the current templates, keeping the project's own conventions, for the retrofit PR. **1. Braindump.** The maintainer says the product serves small teams that plan work together; recurring tasks matter most; time tracking was started and paused; CSV import is dead and will be removed. They add that teams move to it from spreadsheets and that competing trackers charge per seat. -Two thresholds hold: more than one surface (a web app, a CLI and an API) and two sources of prior specs (the 0.1.0 folder and `openspec/`). The agent explains this and recommends that the user invoke `wayfinder`. The maintainer declines, and the retrofit continues without it. +Two thresholds hold: more than one surface (a web app, a CLI and an API) and two sources of prior specs (the 0.1.0 folder and `openspec/`). The agent explains this and recommends that the user invoke `wayfinder`, noting that the project's tracker is on GitHub, so each map and child issue it would create needs the maintainer's approval first. The maintainer declines, and the retrofit continues without it. -**2. Lenses.** Eight subagents report. The prior-specs lens flags the 0.1.0 folder and `openspec/specs/recurring-tasks/spec.md`; the roles-and-flags lens finds `time_tracking` off in every environment; the history lens finds 14 pull requests scoped `feat(recurrence)`. +**2. Lenses.** Eight subagents report, one per lens. Each reads the three packages one at a time, plus the shared root files and the whole repository's history, so the root-level `openspec/` sits in every lens's scope. The prior-specs lens flags the 0.1.0 folder and `openspec/specs/recurring-tasks/spec.md`; the roles-and-flags lens finds `time_tracking` off in every environment; the history lens finds 14 pull requests scoped `feat(recurrence)`. ### The inventory @@ -233,8 +240,11 @@ Market and positioning: teams moving from spreadsheets and per-seat pricing at c **4. Routing.** The retrofit PR: - lists `due-date-reminders` for modernization, with its evidence; the checks name it with `--pending due-date-reminders`; -- starts `shaping/recurring-tasks--repeat-schedules/` with a shaping document whose provenance record cites the OpenSpec spec, the packages it spans and the history. The OpenSpec spec stays: it describes shipped behavior, so it can retire only once canonization puts its content in the feature spec, and then only with the maintainer's approval; +- carries the reconciled `docs/product/AGENTS.md` and `README.md`; +- starts `shaping/recurring-tasks--repeat-schedules/` with a shaping document whose provenance record names the packages it spans and links its evidence: the OpenSpec spec, the recurrence test file and the `feat(recurrence)` pull requests. The maintainer can't yet say whether "every weekday" is still a supported schedule, so the document records that as a design-level open question, and the regenerated register index lists it. The OpenSpec spec stays: it describes shipped behavior, so it can retire only once canonization puts its content in the feature spec, and then only with the maintainer's approval; - writes `ideas/time-tracking.md`; - writes `research/2026-11-24-positioning.md` with the spreadsheet and pricing details. -Once the PR is drafted, the inventory and the braindump notes are deleted. The skill's test fixture, `tests/fixtures/retrofit/`, is the seeded `docs/product/` bundle, and `tests/retrofit.bats` checks it. +The recurring-tasks behavior was already live, so for that change the guide ends at its promotion PR, and no Shipped entry is recorded once it merges (step 4). + +Once the PR is drafted, the inventory and the braindump notes are deleted. The skill's test fixture, `tests/fixtures/retrofit/`, is the seeded `docs/product/` bundle, less the reconciled `AGENTS.md` and `README.md`, which the modernization fixture covers; `tests/retrofit.bats` checks it. diff --git a/plugins/product-development/skills/product-development/tests/retrofit.bats b/plugins/product-development/skills/product-development/tests/retrofit.bats index 354a5a4..2731a3b 100644 --- a/plugins/product-development/skills/product-development/tests/retrofit.bats +++ b/plugins/product-development/skills/product-development/tests/retrofit.bats @@ -214,6 +214,97 @@ example_inventory() { grep -q "not installed" <<< "$text" } +@test "wayfinder's issues on a GitHub tracker are GitHub writes the maintainer approves" { + local text + text=$(section '^## Large codebases') + grep -q "GitHub Writes" <<< "$text" + grep -q "map and child issues" <<< "$text" + grep -q "invoking it starts it" <<< "$text" + grep -q "approve each GitHub write" <<< "$text" + grep -q "helper workflow" <<< "$text" + grep -qi "local Markdown tracker" <<< "$text" +} + +@test "one subagent per lens, which covers each package, the shared root files and the whole history" { + local step2 large preamble + step2=$(section '^### 2\. ') + large=$(section '^## Large codebases') + grep -q "one subagent per lens" <<< "$step2" + grep -q "one subagent per lens" <<< "$large" + grep -q "package by package" <<< "$large" + grep -q "shared root files" <<< "$large" + grep -q "whole repository's history" <<< "$large" + # No per-package split that would multiply subagents or miss the root. + refute_grep -qiE "one subagent per (part|app|package)|split each lens" <<< "$large" + preamble=$(awk '/^Every lens subagent gets this preamble/{on=1} on && /^```/{n++; if (n==2) exit; next} on && n==1' "$REF") + grep -q "shared root files" <<< "$preamble" + grep -q "whole repository's history" <<< "$preamble" + # The worked example runs eight subagents and reads the root-level openspec/. + grep -q "Eight subagents" <<< "$(section '^## Worked example')" + grep -q "root-level \`openspec/\`" <<< "$(section '^## Worked example')" +} + +@test "a project with 0.1.0 scaffolding reconciles it before seeding, as modernization does" { + local text + text=$(section '^## How it runs') + grep -qF "(modernization.md#how-it-runs)" <<< "$text" + grep -q "docs/product/AGENTS.md" <<< "$text" + grep -q "before seeding" <<< "$text" + # The worked example has 0.1.0 scaffolding and reconciles it. + grep -q "reconcile" <<< "$(section '^## Worked example')" +} + +@test "an already-live change stops at its promotion PR and gets no invented ship signal" { + local text + text=$(section '^### 4\. ') + grep -q "stops at the promotion PR" <<< "$text" + grep -q "no Shipped entry" <<< "$text" + grep -q "stays Ratified" <<< "$text" +} + +@test "the finish commands regenerate both indexes before their checks" { + local block + block=$(awk ' + !fence && /^## / { on = ($0 == "## Finishing the retrofit PR") } + on && /^```/ { if (fence) exit; fence = 1; next } + on && fence' "$REF") + [ -n "$block" ] + local oq_index oq_check + oq_index=$(grep -n 'open-questions.py" index --pending {unconverted} docs/product$' <<< "$block" | cut -d: -f1) + oq_check=$(grep -n 'open-questions.py" check --pending {unconverted} docs/product$' <<< "$block" | cut -d: -f1) + [ -n "$oq_index" ] && [ -n "$oq_check" ] && [ "$oq_index" -lt "$oq_check" ] +} + +@test "the finish commands run as written on the freshly seeded bundle" { + local bundle="$WORK/product" block line + cp -R "$FIXTURE" "$bundle" + # A freshly seeded bundle: the question is recorded, the index not yet regenerated. + python3 -I - "$bundle/open-questions.md" <<'EOF' +import re, sys +p = sys.argv[1] +t = open(p).read() +t = re.sub(r"(index: begin[^\n]*\n).*?(