diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..3c39cf0 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# Vendored upstream files keep their whitespace byte for byte. +plugins/product-development/skills/product-development/tests/vendor/okf/LICENSE.md -whitespace +plugins/product-development/skills/product-development/tests/vendor/okf/validate.py -whitespace diff --git a/.gitignore b/.gitignore index 4662664..e19eb3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .direnv/ - +__pycache__/ +*.pyc diff --git a/CONTEXT-MAP.md b/CONTEXT-MAP.md new file mode 100644 index 0000000..3d40786 --- /dev/null +++ b/CONTEXT-MAP.md @@ -0,0 +1,11 @@ +# Context Map + +Each plugin that defines its own domain language keeps a `CONTEXT.md` beside its skill. This map lists them. + +## Contexts + +- [Product Development](./plugins/product-development/skills/product-development/CONTEXT.md): how a product's intent is written down, approved, changed and kept true, from foundation documents through feature specs + +## Relationships + +None yet. Add a relationship when one context's terms depend on another's. diff --git a/README.md b/README.md index 00148ea..a4a820b 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,14 @@ installs, see `docs/development.md`. | Plugin | Scope | Docs | | --- | --- | --- | -| `product-development` | Product definition: from constitution and vision through PRD/TRD, user stories, scenarios, and the implementation plan. | [`plugins/product-development/README.md`](plugins/product-development/README.md) | +| `product-development` | Product definition: from constitution and vision through PRD/TRD, user stories, scenarios, and the implementation handoff; keeps feature specs true once changes ship. | [`plugins/product-development/README.md`](plugins/product-development/README.md) | | `delivery-engineering` | Engineering delivery: turning an approved plan into merged, shipped, and coordinated work. | [`plugins/delivery-engineering/README.md`](plugins/delivery-engineering/README.md) | | `branch-guard` | Nudges agents away from directly editing a repository's protected branch. | [`plugins/branch-guard/README.md`](plugins/branch-guard/README.md) | | `okf-bundle` | Author, migrate, and check Open Knowledge Format v0.2 bundles. | [`plugins/okf-bundle/README.md`](plugins/okf-bundle/README.md) | -`product-development` and `delivery-engineering` meet at one hand-off: `product-development` ends at an approved -implementation plan; `delivery-engineering` starts there. +`product-development` and `delivery-engineering` meet at one hand-off: `product-development` ends at the handoff of a +ratified change; `delivery-engineering` starts there and plans in the PR body. +Once the change ships, `product-development` canonizes it into the feature spec. ## Getting Started diff --git a/docs/adr/0001-stage-directories-carry-authority.md b/docs/adr/0001-stage-directories-carry-authority.md new file mode 100644 index 0000000..1f8f6e3 --- /dev/null +++ b/docs/adr/0001-stage-directories-carry-authority.md @@ -0,0 +1,16 @@ +# Stage directories carry authority + +The product-development skill files product documents into three stages, `ideas/`, `shaping/` and `features/`, and a document's stage, the authority it carries, comes from the directory it sits in, not from a status field. A status field drifts once code ships unless someone remembers to update it; a path moves in the same pull request as the work, so an agent reading the tree always sees the authority a document has. + +The path settles authority, not every lifecycle state. Some change states also depend on recorded events. Merging the promotion PR marks a change Ratified. The project's ship signal, recorded in the feature log, marks it Shipped. Ratified and Shipped share a path, so a reader tells them apart by those records, not by the directory. + +## Considered options + +- **A `status:` field in front matter.** Rejected: nothing forces it to change when the work moves on, and agents trust whatever it says. A spec marked approved, or a draft never marked approved, misleads every later reader. +- **One directory with a tag per maturity level.** Rejected for the same drift risk, and because agents would have to read every document to learn which ones carry requirements. With stage directories, an `AGENTS.md` per stage tells agents when to read it and when to stay out. + +## Consequences + +- Promotion is a move. Merging a change's promotion PR ratifies it and moves it into `features/`; the merge is the approval record. +- Code alone never admits a spec to `features/`. Behavior found only in code enters through `shaping/` or `ideas/` and is ratified like any other change. +- The Foundation Gate blocks drafting a PRD, not ideas or shaping, so early intent has a home before the foundation documents exist. diff --git a/docs/adr/0002-deltas-with-base-text-canonized-at-ship.md b/docs/adr/0002-deltas-with-base-text-canonized-at-ship.md new file mode 100644 index 0000000..31619f3 --- /dev/null +++ b/docs/adr/0002-deltas-with-base-text-canonized-at-ship.md @@ -0,0 +1,22 @@ +# Deltas with base text, canonized at ship + +The product-development skill describes each feature twice over. The feature spec says what the feature does now and holds shipped behavior only. A change says what one bounded addition or revision will do, including the feature's first version. A change carries deltas: each delta lists the spec units it adds, modifies or removes, named by stable ID (`FR-12`) or as a whole scenario file. A modified or removed unit records its base text, the content the change was written against. The deltas reach the feature spec at canonization, after the change ships, not when it is ratified. + +Base text is what makes parallel changes safe. Without it, two changes that edit one requirement can't tell that the other exists, and whichever is applied second overwrites the first. OpenSpec, which uses a similar delta model, documents exactly this failure: the second archive silently drops the first change's edits. Here two checks prevent it. The overlap check, when a promotion PR is prepared and again just before it merges, finds other in-flight changes that touch the same spec units or add a unit with the same ID, so the maintainer can order or combine them. The base check, at canonization and again just before the canonization PR merges, compares each recorded base text with the latest feature spec; if the spec has drifted, the delta is rebased first and the maintainer confirms any change in meaning. + +Canonizing at ship keeps the feature spec true. A ratified change that never ships, ships late or ships differently never puts unshipped behavior into the spec. + +## Considered options + +- **Edit the PRD and TRD in place, with a changelog table.** Rejected: the document can't hold an approved change that hasn't shipped without mixing it into shipped behavior, and history ends up in tables nobody reads. +- **Apply deltas when the change is ratified.** Rejected: the spec would describe behavior that hasn't shipped, and a dropped or deferred requirement would have to be backed out of it. +- **Deltas without base text, as a list of new versions.** Rejected: nothing detects that the spec changed under a delta, so parallel changes overwrite each other silently. +- **Line diffs against the spec.** Rejected: diffs break on unrelated edits and give no unit to reason about. Units with stable IDs survive moves and reformatting. + +## Consequences + +- Every PRD and TRD describes a change, including the first version. A change record is dated history, so planning tense is correct in it. The feature spec and delta text use durable tense, since canonization applies delta text word for word. +- Spec units need stable IDs, unique within their feature and never reused. Scenario files are units as whole files. +- A change keeps its own stories and scenarios until canonization, so an expectation that hasn't shipped never sits beside shipped ones. +- The archive keeps each change's ratified deltas, so the reason for every spec unit stays traceable to the change that wrote it. +- Each feature's log records ratification, the ship signal and canonization, replacing changelog tables. diff --git a/docs/adr/0003-product-documents-form-one-okf-bundle.md b/docs/adr/0003-product-documents-form-one-okf-bundle.md new file mode 100644 index 0000000..e9b4eb6 --- /dev/null +++ b/docs/adr/0003-product-documents-form-one-okf-bundle.md @@ -0,0 +1,21 @@ +# Product documents form one OKF bundle + +The product-development skill treats `docs/product/` as one Open Knowledge Format (OKF) v0.3 bundle. `docs/product/index.md` is the bundle root and declares `okf_version: "0.3"`. Every directory gets a generated `index.md`; below the root these are plain listings without front matter. Each feature directory is a self-contained subtree with its own `log.md`, and a feature's metadata lives in the front matter of its feature spec overview, `-spec.md`. + +A document's `type` comes from a closed list: `constitution`, `vision`, `research-note`, `idea`, `shaping`, `feature-spec-overview`, `feature-spec-facet`, `prd`, `trd`, `delta`, `story`, `delivery-plan`, `open-questions`. Values are lowercase kebab-case. What a facet spec covers, such as a workflow, a contract or a user type, goes in open `tags`. A closed type list lets checks and agents rely on a fixed set of document kinds; open tags let each product describe its facets in its own words. + +OKF `status` follows from the document's path: `draft` in `ideas/` and `shaping/`, `stable` for ratified changes and feature specs, and `deprecated` for archived changes. The path is the authority, as ADR 0001 (stage directories carry authority) records; `status` mirrors it for OKF consumers, and a check fails when the two disagree. + +## Considered options + +- **No OKF profile.** Rejected: agents would keep navigating by directory listings alone, and nothing would check that a document's kind and readiness match where it sits. +- **One bundle per feature.** Rejected: foundation documents, ideas and shaping would sit outside every bundle, and links between features would cross bundle boundaries. +- **An open `type` vocabulary.** Rejected: checks and agents can't rely on a kind they don't know, and near-duplicate types drift apart. +- **Front matter on every Markdown file.** Rejected: OKF v0.3 does not require it. A file without a `type` is not a concept, so `README.md` and `AGENTS.md` keep their roles, and `.feature` files stay assets. + +## Consequences + +- ADRs, engineering references and test code stay outside `docs/product/`; links to them are external links, which OKF consumers accept even when broken. +- `index.md` and `log.md` are reserved names at every level. Only the bundle-root `index.md` carries front matter. +- Moving a document between stages changes its `status` in the same pull request. +- The profile reference, `references/okf-profile.md` in the skill, describes the index generator and the profile checks, `scripts/okf-profile.py`. The profile checks stay separate from generic OKF conformance, which the upstream validator checks. diff --git a/docs/development.md b/docs/development.md index 7414e4a..22a6945 100644 --- a/docs/development.md +++ b/docs/development.md @@ -7,9 +7,10 @@ consumers. ## Development Environment This repository includes a pinned Nix dev shell for local validation. The shell -uses a fixed Nixpkgs commit and provides `python313`, `bats`, and `node`. +uses a fixed Nixpkgs commit and provides `python313`, `bats`, `jq`, and `node`. `python313` gives the tests stdlib `tomllib` support without adding a PyPI TOML -parser dependency. +parser dependency. `jq` stands in for the `--jq` filters of `gh` in the board-mapping +suite. With direnv: @@ -91,9 +92,16 @@ The init script scaffolds `docs/product/` from templates: | --- | --- | | `docs/product/README.md` | Three-tier documentation hierarchy, artifact flow diagram, boundary rule for scenario placement, directory structure reference | | `docs/product/AGENTS.md` | Agent guidance for organizing product docs, feature workflow checklist, specification evolution conventions | -| `docs/product/features/` | Empty directory ready for the first feature | +| `docs/product/ideas/AGENTS.md` | `ideas/` stage guidance: no requirements authority, read only when named or through idea discovery | +| `docs/product/shaping/AGENTS.md` | `shaping/` stage guidance: tentative context for the change being shaped, promotion rule | +| `docs/product/features/AGENTS.md` | `features/` stage guidance: requirements, admitted only by a merged promotion PR | +| `docs/product/open-questions.md` | Product-wide open questions and the generated open-questions index (`scripts/open-questions.py`) | -Files that already exist are never overwritten. +Files that already exist are never overwritten. Each file renders to a temp +file beside it and is published with a hard link, so a concurrent run or a file +created meanwhile is never replaced, and a failed render leaves nothing behind. +An existing stage directory keeps +its content and gains an `AGENTS.md` only if it has none. The script inspects the target project before prompting: @@ -130,6 +138,16 @@ should reflect the target project's domain. nix develop -c bats tests/marketplace-package.bats nix develop -c bats plugins/product-development/tests/plugin-package.bats nix develop -c bats plugins/product-development/skills/product-development/tests/init.bats +nix develop -c bats plugins/product-development/skills/product-development/tests/feature-evolution.bats +nix develop -c bats plugins/product-development/skills/product-development/tests/open-questions.bats +nix develop -c bats plugins/product-development/skills/product-development/tests/board-mapping.bats +nix develop -c bats plugins/product-development/skills/product-development/tests/okf-profile.bats +nix develop -c bats plugins/product-development/skills/product-development/tests/vision-anatomy.bats +nix develop -c bats plugins/product-development/skills/product-development/tests/lifecycle-review-handoff.bats +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 @@ -141,10 +159,12 @@ git diff --check ```text agent-plugins/ ├── README.md +├── CONTEXT-MAP.md ← points to each plugin's glossary (CONTEXT.md) ├── .agents/plugins/marketplace.json ├── .claude-plugin/marketplace.json ├── .github/plugin/marketplace.json ├── docs/ +│ └── adr/ ← architecture decision records ├── tests/marketplace-package.bats └── plugins/ ├── product-development/ @@ -178,5 +198,5 @@ agent-plugins/ ``` Reference files are loaded by the agent only when it enters the corresponding -workflow, keeping context focused. The `phase-*` reference filenames remain for -compatibility. +workflow, keeping context focused. Each reference file is named for its +workflow. diff --git a/docs/superpowers/plans/2026-05-25-product-vision-resource-integration.md b/docs/superpowers/plans/2026-05-25-product-vision-resource-integration.md index 545ac75..f0b3269 100644 --- a/docs/superpowers/plans/2026-05-25-product-vision-resource-integration.md +++ b/docs/superpowers/plans/2026-05-25-product-vision-resource-integration.md @@ -22,7 +22,7 @@ This is a docs and skill-resource change. No runtime feature code is expected. T - Point to `references/product-vision.md`. - Modify `skills/product-development/references/initialization.md` - Explain post-init Foundation Gate requirement. -- Modify `skills/product-development/references/phase-2-requirements.md` +- Modify `skills/product-development/references/requirements.md` - Legacy compatibility path for the Requirements workflow. - Make approved `docs/product/constitution.md` and approved, versioned `docs/product/vision.md` required before the first PRD. - Add PRD vision alignment checks. @@ -125,7 +125,7 @@ This is a docs and skill-resource change. No runtime feature code is expected. T - Modify: `skills/product-development/SKILL.md` - Modify: `skills/product-development/references/initialization.md` -- Modify: `skills/product-development/references/phase-2-requirements.md` +- Modify: `skills/product-development/references/requirements.md` **Steps:** @@ -191,7 +191,7 @@ This is a docs and skill-resource change. No runtime feature code is expected. T Clarify that vision is not scaffolded because it requires project-specific interrogation. -- [ ] **Step 7: Update `references/phase-2-requirements.md`** +- [ ] **Step 7: Update `references/requirements.md`** Required input list must include: @@ -210,7 +210,7 @@ This is a docs and skill-resource change. No runtime feature code is expected. T - [ ] **Step 8: Commit** ```bash - git add skills/product-development/SKILL.md skills/product-development/references/initialization.md skills/product-development/references/phase-2-requirements.md + git add skills/product-development/SKILL.md skills/product-development/references/initialization.md skills/product-development/references/requirements.md git commit -m "docs: require foundation stage before first PRD" ``` diff --git a/docs/superpowers/plans/2026-05-26-product-constitution-workflow-integration.md b/docs/superpowers/plans/2026-05-26-product-constitution-workflow-integration.md index 51a9a5d..c43f922 100644 --- a/docs/superpowers/plans/2026-05-26-product-constitution-workflow-integration.md +++ b/docs/superpowers/plans/2026-05-26-product-constitution-workflow-integration.md @@ -552,7 +552,7 @@ git commit -m "docs: update initialization foundation guidance" **Files:** -- Modify: `skills/product-development/references/phase-2-requirements.md` +- Modify: `skills/product-development/references/requirements.md` **Goal:** @@ -618,8 +618,8 @@ If this is the first PRD and either foundation document is missing, unapproved, Run: ```bash -rg -n "five constitutional principles|Safety Is Non-Negotiable|Privacy By Default|Local-First Core" skills/product-development/references/phase-2-requirements.md -rg -n "PASS/RISK/FAIL/N/A|FAIL against the constitution|version metadata" skills/product-development/references/phase-2-requirements.md +rg -n "five constitutional principles|Principle \| Status" skills/product-development/references/requirements.md +rg -n "PASS/RISK/FAIL/N/A|FAIL against the constitution|version metadata" skills/product-development/references/requirements.md ``` Expected output: @@ -630,7 +630,7 @@ Expected output: **Commit:** ```bash -git add skills/product-development/references/phase-2-requirements.md +git add skills/product-development/references/requirements.md git commit -m "docs: make constitution alignment dynamic" ``` @@ -643,7 +643,7 @@ git commit -m "docs: make constitution alignment dynamic" - `skills/product-development/references/product-constitution.md` - `skills/product-development/references/product-vision.md` - `skills/product-development/references/initialization.md` - - `skills/product-development/references/phase-2-requirements.md` + - `skills/product-development/references/requirements.md` - `skills/product-development/templates/README.md.tmpl` - `skills/product-development/templates/AGENTS.md.tmpl` - `skills/product-development/scripts/init.sh` @@ -675,7 +675,7 @@ Expected output: both hashes are `cc34e8b2794ade47bb516394755561e60683150124ad21 ```bash rg -n "references/product-constitution.md|source/product-constitution-guide.md|product-constitution-guide.md" skills/product-development/SKILL.md skills/product-development/references/product-constitution.md -rg -n "constitution-grill|future work|five constitutional principles|Safety Is Non-Negotiable" skills/product-development/SKILL.md skills/product-development/references/phase-2-requirements.md +rg -n "constitution-grill|future work|five constitutional principles" skills/product-development/SKILL.md skills/product-development/references/requirements.md ``` Expected output: @@ -715,7 +715,7 @@ git add \ skills/product-development/references/source/product-constitution-guide.md \ skills/product-development/references/product-vision.md \ skills/product-development/references/initialization.md \ - skills/product-development/references/phase-2-requirements.md \ + skills/product-development/references/requirements.md \ skills/product-development/templates/README.md.tmpl \ skills/product-development/templates/AGENTS.md.tmpl \ skills/product-development/scripts/init.sh \ diff --git a/docs/superpowers/specs/2026-05-25-product-vision-resource-design.md b/docs/superpowers/specs/2026-05-25-product-vision-resource-design.md index e09fb08..083e80e 100644 --- a/docs/superpowers/specs/2026-05-25-product-vision-resource-design.md +++ b/docs/superpowers/specs/2026-05-25-product-vision-resource-design.md @@ -206,7 +206,7 @@ Update `skills/product-development/references/initialization.md`: - Clarify that vision is produced by grilling, not scaffolding. - Include the `grill-with-docs` recommendation behavior. -Update `skills/product-development/references/phase-2-requirements.md`: +Update `skills/product-development/references/requirements.md`: - Treat this filename as a legacy compatibility path for the Requirements workflow. - Make approved `docs/product/constitution.md` and approved, versioned `docs/product/vision.md` required inputs for the first PRD. diff --git a/docs/superpowers/specs/2026-05-26-product-constitution-workflow-design.md b/docs/superpowers/specs/2026-05-26-product-constitution-workflow-design.md index 2b77d0b..c243df8 100644 --- a/docs/superpowers/specs/2026-05-26-product-constitution-workflow-design.md +++ b/docs/superpowers/specs/2026-05-26-product-constitution-workflow-design.md @@ -182,7 +182,7 @@ Later PRDs must: ## Requirements Guidance -`references/phase-2-requirements.md` currently includes a hard-coded five-principle constitution table. This should become dynamic. +`references/requirements.md` currently includes a hard-coded five-principle constitution table. This should become dynamic. Every PRD should validate against the actual approved `docs/product/constitution.md`: @@ -216,7 +216,7 @@ Before presenting a constitution for approval, reconcile terminology and decisio - `skills/product-development/references/source/product-constitution-guide.md` - `skills/product-development/references/product-vision.md` - `skills/product-development/references/initialization.md` -- `skills/product-development/references/phase-2-requirements.md` +- `skills/product-development/references/requirements.md` - `skills/product-development/templates/README.md.tmpl` - `skills/product-development/templates/AGENTS.md.tmpl` - `skills/product-development/tests/init.bats` @@ -245,7 +245,7 @@ Static checks: - `references/source/product-constitution-guide.md` exists. - `references/source/product-constitution-guide.md` preserves the attached guide substantially as-is; headings and major sections from the source are still present and not condensed into a summary. - No stale language says the Constitution Grill remains future work. -- `references/phase-2-requirements.md` no longer presents hard-coded five principles as normative. +- `references/requirements.md` no longer presents hard-coded five principles as normative. - Foundation Gate wording stays consistent across `SKILL.md`, initialization reference, generated README, generated AGENTS, and requirements reference. - Source archive remains separate from operational reference. diff --git a/flake.nix b/flake.nix index d2f54b8..556bce4 100644 --- a/flake.nix +++ b/flake.nix @@ -24,6 +24,7 @@ default = pkgs.mkShell { packages = [ pkgs.bats + pkgs.jq pkgs.nodejs (pkgs.python313.withPackages (ps: [ ps.pyyaml ])) ]; diff --git a/plugins/delivery-engineering/.codex-plugin/plugin.json b/plugins/delivery-engineering/.codex-plugin/plugin.json index b4b4bba..9d24f07 100644 --- a/plugins/delivery-engineering/.codex-plugin/plugin.json +++ b/plugins/delivery-engineering/.codex-plugin/plugin.json @@ -14,7 +14,7 @@ "interface": { "displayName": "Delivery Engineering", "shortDescription": "Execute an approved plan through review-gated delivery to merge", - "longDescription": "Use Delivery Engineering to turn an approved implementation plan into merged, shipped, and coordinated work. It hosts the review-gated-implementation-loop skill: plan and execute a large or high-risk change with an independent reviewer gating each step.", + "longDescription": "Use Delivery Engineering to turn a handed-off change into merged, shipped, and coordinated work. It hosts the review-gated-implementation-loop skill: plan and execute a large or high-risk change with an independent reviewer gating each step.", "developerName": "Prometheas Labs", "category": "Developer Tools", "capabilities": [ diff --git a/plugins/delivery-engineering/README.md b/plugins/delivery-engineering/README.md index 100fd06..6727482 100644 --- a/plugins/delivery-engineering/README.md +++ b/plugins/delivery-engineering/README.md @@ -1,13 +1,14 @@ # delivery-engineering -Engineering delivery workflows: turning an **approved implementation plan** into +Engineering delivery workflows: turning a **handed-off change** into **merged, shipped, and coordinated** work. ## Scope This plugin owns the **execution half** of the software delivery lifecycle. It -begins where a plan is settled and ends when the work is merged, verified, and -its coordination state is recorded. It hosts a family of skills: +begins at the handoff, a ratified change from `product-development` or another +scoped work item, plans the work in the pull-request body, and ends when the +work is merged, verified, and its coordination state is recorded. It hosts a family of skills: - **`review-gated-implementation-loop`** — plan and execute a large or high-risk change with an independent reviewer gating each step. *(available)* @@ -20,20 +21,21 @@ its coordination state is recorded. It hosts a family of skills: This plugin does **not** decide *what* to build or *why*. Product definition — product constitution and vision, PRDs and TRDs, user stories, scenarios, -acceptance criteria, and implementation *planning* — belongs to the -[`product-development`](../product-development) plugin. +and acceptance criteria — belongs to the +[`product-development`](../product-development) plugin. Implementation +planning belongs here: the pull-request body is the plan. The two plugins meet at one hand-off: ```text product-development delivery-engineering - idea → constitution → vision → approved plan → implementation + idea → constitution → vision → plan in the PR body → implementation → PRD → TRD → stories → scenarios → review-gated delivery - → acceptance criteria → PLAN ─┐ → merge → coordinate → ship + → ratification → HANDOFF ─┐ → merge → coordinate → ship └──► (starts here) ``` -`product-development` ends at an approved implementation plan. +`product-development` ends at the handoff of a ratified change. `delivery-engineering` starts there. Also out of scope: diff --git a/plugins/product-development/.claude-plugin/plugin.json b/plugins/product-development/.claude-plugin/plugin.json index 745fc3d..c78cbf6 100644 --- a/plugins/product-development/.claude-plugin/plugin.json +++ b/plugins/product-development/.claude-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "product-development", - "version": "0.1.0", + "version": "0.2.0", "description": "Product development lifecycle workflows as portable agent skills.", "author": { "name": "Prometheas Labs" diff --git a/plugins/product-development/.codex-plugin/plugin.json b/plugins/product-development/.codex-plugin/plugin.json index 7ca80ad..1679c5d 100644 --- a/plugins/product-development/.codex-plugin/plugin.json +++ b/plugins/product-development/.codex-plugin/plugin.json @@ -1,6 +1,6 @@ { "name": "product-development", - "version": "0.1.0", + "version": "0.2.0", "description": "Product development lifecycle workflows as portable agent skills.", "author": { "name": "Prometheas Labs" diff --git a/plugins/product-development/README.md b/plugins/product-development/README.md index dfc687c..de3d11b 100644 --- a/plugins/product-development/README.md +++ b/plugins/product-development/README.md @@ -1,8 +1,9 @@ # product-development The Product Development methodology as a portable agent plugin. It guides -features through the product development lifecycle from idea to implementation -plan, producing artifacts that feed the next workflow. +features through the product development lifecycle from idea to the +implementation handoff, producing artifacts that feed the next workflow, and +keeps each feature's spec true as its changes ship. The canonical methodology lives in `skills/product-development/`. Marketplace manifests and adapter wrappers expose @@ -17,16 +18,53 @@ This plugin guides agents through product artifacts in a deliberate sequence, with human review gates between each workflow: ```text -Project Setup -> Foundation Stage -> Discovery and Design -> Requirements -> User Stories -> BDD Scenarios -> Implementation Planning - | | | | | - Foundation Gate Design Approval PRD/TRD Approval Story Approval Scenario Approval +Project Setup -> Foundation workflow -> Discovery and Design -> Requirements -> User Stories -> BDD Scenarios -> Promotion -> Handoff -> Implementation -> Canonization + | | | | | + Design Approval PRD/TRD Approval Story Approval Scenario Approval Ratification + + Foundation Gate ``` -Foundation Stage contains Product Constitution approval and the Product Vision -workflow. Foundation Gate blocks the first PRD until constitution is approved -and versioned, and vision is approved and versioned. Discovery and Design can -still happen before the gate passes. Each approval point pauses for review -before the agent proceeds. +The Foundation workflow contains Product Constitution approval and the Product +Vision workflow. Foundation Gate blocks drafting the first PRD until +constitution is approved and versioned, and vision is approved and versioned. +It does not block ideas or shaping: Discovery and Design can still happen +before the gate passes. Each approval point pauses for review before the agent +proceeds. + +Feature content moves through three stage directories under `docs/product/`. +`ideas/` holds early sketches with no requirements authority. `shaping/` holds +changes being worked out, including draft PRDs and TRDs. `features/` holds +ratified changes and shipped feature specs, which are the requirements. +Merging a change's promotion PR ratifies it and moves it into `features/`. +Code alone never admits a spec. + +Each feature has a feature bundle in `features/{feature}/`. Its feature spec +describes shipped behavior only. Every PRD and TRD describes a change, including +a feature's first version, and each change carries deltas: the spec units it +adds, modifies or removes, with base text for each one it modifies or removes. +An overlap check and a base check stop two changes to one feature from +silently overwriting each other. + +When the project's ship signal fires, such as a release reaching everyone, a +Shipped entry in the feature log records the evidence; the change is Shipped and +waits in `changes/` for canonization. Canonization accounts for each requirement +and scenario as shipped, changed or deferred, with the maintainer's approval for +any change in meaning, runs the base check, applies the deltas as reconciled +with that accounting, and archives the change. The change is then Canonized. +Deferred work becomes a new shaping item. + +A team that tracks changes on a board, such as GitHub Projects, gets one item +per change with a "Spec state" field. The repository stays the authority: the +agent reports where the board has drifted and corrects it only with the +maintainer's approval. + +When a change is ratified, the skill drafts its handoff to the implementation +workflow and sends it once no implementation-level open question remains. +Implementation belongs to that workflow, such as the +[`delivery-engineering`](../delivery-engineering) plugin, or the project's own. +The skill writes no implementation plan: execution plans stay out of Git. It +drafts GitHub writes, such as the implementation issue and comments for +downstream owners, and makes none without the maintainer's approval. ## Start A Product Workflow @@ -63,15 +101,21 @@ At each gate, you can: | Workflow | Artifact | Location | | --- | --- | --- | | Project Setup | Documentation structure | `docs/product/README.md`, `docs/product/AGENTS.md` | -| Foundation Stage | Constitution | `docs/product/constitution.md`, `docs/product/constitutions/constitution-vX.Y.Z.md` | -| Foundation Stage | Product vision | `docs/product/vision.md`, `docs/product/visions/vision-vX.Y.Z.md` | -| Discovery and Design | Design document | `docs/plans/YYYY-MM-DD--design.md` | -| Requirements | PRD | `docs/product/features/{feature}/PRD.md` | -| Requirements | TRD | `docs/product/features/{feature}/TRD.md` | -| User Stories | User stories | `docs/product/features/{feature}/stories/*.md` | -| BDD Scenarios | Platform scenarios | `docs/product/features/{feature}/scenarios/*.feature` | +| Foundation workflow | Constitution | `docs/product/constitution.md`, `docs/product/constitutions/constitution-vX.Y.Z.md` | +| Foundation workflow | Product vision | `docs/product/vision.md`, `docs/product/visions/vision-vX.Y.Z.md` | +| Foundation workflow | Vision companions, delivery plan, research notes | `docs/product/vision-{topic}.md`, `docs/product/roadmap.md`, `docs/product/research/YYYY-MM-DD-{topic}.md` | +| Discovery and Design | Shaping document | `docs/product/shaping/{feature}--{change}/` | +| Requirements | PRD | `docs/product/shaping/{feature}--{change}/PRD.md` | +| Requirements | TRD | `docs/product/shaping/{feature}--{change}/TRD.md` | +| Requirements | Deltas | `docs/product/shaping/{feature}--{change}/deltas/{facet}.delta.md` | +| User Stories | User stories | `docs/product/shaping/{feature}--{change}/stories/*.md` | +| BDD Scenarios | Platform scenarios | `docs/product/shaping/{feature}--{change}/scenarios/*.feature` | | BDD Scenarios | Surface scenarios | `apps/{surface}/docs/features/{feature}/scenarios/*.feature` | -| Implementation Planning | Implementation plan | `docs/plans/YYYY-MM-DD-.md` | +| Promotion | Ratified change | `docs/product/features/{feature}/changes/{change}/` | +| Handoff | Handoff for the implementation workflow | Not committed; filed as the implementation issue with the maintainer's approval | +| Ship Signal and Canonization | Shipped and Canonized log entries, feature spec, archived change | `docs/product/features/{feature}/` | +| Ship Signal and Canonization | Shaping item for deferred work | `docs/product/shaping/{feature}--{change}/` | +| Any workflow that adds, moves or retitles a document | Generated OKF directory listings (`scripts/okf-profile.py index`) | `docs/product/**/index.md` | Platform-level artifacts describe what the product does regardless of which app surface delivers it. Surface-specific artifacts capture behavior tied to a @@ -129,16 +173,24 @@ All TRDs must follow the vendor-agnostic facade pattern. ## Specification Evolution -Product specs are living artifacts: - -- PRDs and TRDs are updated in place with a changelog recording date, change, - and rationale. -- User stories progress through a lifecycle from Draft to Ready to In Progress - to Done to Archived. +Product specs evolve through ratified changes: + +- The feature spec describes shipped behavior in durable tense and changes only + when a shipped change is canonized into it. +- A change to requirements, stories or scenarios is drafted in `shaping/` and + ratified by a promotion PR, like a new feature. Only edits that don't change + meaning (typos, links, clarifications) go directly into ratified documents. +- A change's PRD and TRD are its dated record, so planning tense is fine in + them. They have no changelog: each feature's `log.md` records its history and + reasons, and `features/log.md` records feature splits, merges and drops. +- A change keeps its own stories and scenarios until canonization moves them to + the feature root. Each file is a unit in the change's deltas, so a deferred + one stays with the archived change. - BDD scenarios are living and self-verifying; when behavior changes, scenarios update and the test suite validates the spec. - Governance docs such as constitution and vision are never edited after approval; a new version supersedes the old one. -When incremental updates are insufficient, supersede with a new document instead -of editing beyond recognition. +A change that would replace most of a feature's spec units is a fundamental +change: its deltas replace them, or it is a feature split, merge or drop +recorded in the lineage log. diff --git a/plugins/product-development/agents/shared/spec-reviewer.md b/plugins/product-development/agents/shared/spec-reviewer.md index 7082110..ddd8961 100644 --- a/plugins/product-development/agents/shared/spec-reviewer.md +++ b/plugins/product-development/agents/shared/spec-reviewer.md @@ -7,6 +7,8 @@ Review the provided product-development spec or product artifact. Use `skills/product-development/SKILL.md` and files under `skills/product-development/` as the canonical methodology. Treat this file as a harness wrapper only. +For a promotion PR, use `skills/product-development/references/promotion-review.md` as the checklist and report findings in its format. + Bound your job to review: find missing decisions, unclear requirements, conflicting statements, weak acceptance criteria, and drift from the canonical skill guidance. Return findings ordered by severity, with concrete file or section references when available. Do not make edits by default. Do not rewrite methodology or duplicate lifecycle rules. diff --git a/plugins/product-development/gemini-extension.json b/plugins/product-development/gemini-extension.json index 643b234..6132a9c 100644 --- a/plugins/product-development/gemini-extension.json +++ b/plugins/product-development/gemini-extension.json @@ -1,5 +1,5 @@ { "name": "product-development", - "version": "0.1.0", + "version": "0.2.0", "description": "Product development lifecycle workflows as portable agent skills." } diff --git a/plugins/product-development/package.json b/plugins/product-development/package.json index 6e3b7e6..c206aaa 100644 --- a/plugins/product-development/package.json +++ b/plugins/product-development/package.json @@ -1,6 +1,6 @@ { "name": "product-development", - "version": "0.1.0", + "version": "0.2.0", "description": "Product development lifecycle workflows as portable agent skills.", "private": false, "keywords": [ diff --git a/plugins/product-development/plugin.json b/plugins/product-development/plugin.json index c4b045a..14705a0 100644 --- a/plugins/product-development/plugin.json +++ b/plugins/product-development/plugin.json @@ -1,6 +1,6 @@ { "name": "product-development", - "version": "0.1.0", + "version": "0.2.0", "description": "Product development lifecycle workflows as portable agent skills.", "author": { "name": "Prometheas Labs" diff --git a/plugins/product-development/skills/product-development/CONTEXT.md b/plugins/product-development/skills/product-development/CONTEXT.md new file mode 100644 index 0000000..8023517 --- /dev/null +++ b/plugins/product-development/skills/product-development/CONTEXT.md @@ -0,0 +1,173 @@ +# Product Development + +How a product's intent is written down, approved, changed and kept true as the product evolves, from foundation documents through feature specs. + +## Language + +### Foundation + +**Foundation documents**: +The approved, versioned constitution and vision that every feature must align with. +_Avoid_: Anchor docs + +**Foundation Gate**: +The check that approved, versioned foundation documents exist before a PRD is drafted. +_Avoid_: Foundation Stage + +**Alignment check**: +A PRD's assessment against the constitution's principles and the approved vision. + +**Amendment**: +A versioned change to a foundation document. + +### Stages and early work + +**Stage**: +A category of authority for product documents, shown by the directory a document sits in: `ideas/`, `shaping/` or `features/`. +_Avoid_: Phase, maturity + +**Idea**: +An early sketch that nobody is shaping yet. It has no requirements authority. +_Avoid_: Seedling, backlog item + +**Idea discovery**: +A scoped subagent search of ideas for any that bear on an upcoming design or plan. + +**Shaping document**: +The tentative design of a change while it is worked out. ADRs and contracts it links keep their own authority. +_Avoid_: Shaping spec, draft spec + +**Spike**: +A disposable prototype that answers a shaping question. Its code never admits a spec. + +**Decision ledger**: +An append-only record of the decisions an agent makes during an unattended spike, kept for the maintainer's review. When the spike ends, every entry is absorbed into a lasting document before the ledger is deleted. + +**Open question**: +An unchecked assumption or an undecided choice, recorded in the one document it concerns, together with what it blocks and how it will be resolved. +_Avoid_: TBD, unknown + +**Blocking level**: +What an open question holds back: `design` (ratification), `implementation` (handoff), `release` (shipping or a delivery-plan step) or `none yet`. + +**Delivery plan**: +The product's intended order of what ships, with the conditions each step must meet. It holds no tasks or owners. +_Avoid_: Implementation plan, release plan + +### Features + +**Feature**: +A product capability with a stable ID. +_Avoid_: Direction, epic + +**Feature bundle**: +The directory, inside the product's OKF bundle at `docs/product/`, that holds everything about one feature: its spec, changes, stories, scenarios and log. +_Avoid_: Feature folder + +**Feature spec**: +The current-state documents of a feature bundle, describing the feature's shipped behavior. +_Avoid_: Living spec, PRD + +**Feature overview**: +The document that opens a feature spec, summarizes the feature and links to its facet specs. Until the feature's first change is canonized, it is metadata-only: front matter, title and History, with no behavior claims, even after that change has shipped. +_Avoid_: Entry document, main spec + +**Facet spec**: +A current-state document that covers one face of a feature, such as one user type, workflow or contract. +_Avoid_: Seam document, spec fragment, spec slice + +**Spec unit**: +An independently changeable section of a feature spec with its own stable ID. Examples: `FR-12` invitation expiry, `NFR-03` invite acceptance latency, `MEM-02` membership status transitions, and a whole scenario file such as `accept-invitation.feature`. +_Avoid_: Requirement block + +**Feature tag**: +A code comment that names the feature a file or declaration implements, by stable ID. + +**Feature path convention**: +Placing files that cannot carry comments under a path segment named for their feature's ID. + +### Changes + +**Change**: +A bounded addition to or revision of a feature, including its first version, described by a PRD, a TRD and deltas. +_Avoid_: Amendment, change proposal, evolution + +**Change state**: +A change's position in its lifecycle: Idea, Shaping, In review, Ratified, Shipped, Canonized or Dropped. +_Avoid_: Status (that is OKF's readiness field) + +**Ratification**: +The maintainer's approval of a change, recorded by merging its promotion PR. +_Avoid_: Sign-off + +**Promotion PR**: +The pull request whose merge ratifies a change and admits it to its feature bundle. + +**Delta**: +An explicit set of spec units that a change adds, modifies or removes. +_Avoid_: Patch, diff + +**Base text**: +The content of a spec unit recorded when a delta modifies or removes it. + +**Overlap check**: +A check that finds concurrent changes targeting the same spec units, so the maintainer can sequence or combine them. + +**Base check**: +A check that finds drift between a delta's base text and the current feature spec, so the delta can be rebased before canonization. + +**Shipped**: +The change state reached when a change meets the project's definition of live. The change still sits in `changes//`; the project's ship signal, not the path, marks this state. It triggers canonization. +_Avoid_: Reconciled, delivered, implemented + +**Ship signal**: +The event a project names as making a change live, such as the implementation PR merging, a release, or a feature flag reaching everyone. It marks a change Shipped and triggers canonization. +_Avoid_: Release, launch, go-live (each project's word for the event varies; this names its role) + +**Canonization**: +Making a shipped change part of the feature spec: accounting for each requirement and scenario as shipped, changed or deferred, applying its deltas, archiving the change and logging the outcome. +_Avoid_: Fold, reconcile, assimilate, apply + +**Canonized**: +The change state of a change whose deltas are in the feature spec. The change sits in the change archive. + +**Dropped**: +The change state of a change withdrawn before it shipped, removed and logged in the lineage log with a reason. + +**Change archive**: +The record of a feature's canonized changes, kept as history. + +### Logs + +**Feature log**: +One feature's dated history and the reasons behind each change. +_Avoid_: Changelog, history section + +**Lineage log**: +The product-wide record of feature splits, merges and drops, dropped changes, and promotion PRs closed without merging, with reasons. + +### Delivery boundary + +**Handoff**: +What a ratified change gives the implementation workflow: the change, its stories and scenarios, the affected feature spec, the foundation documents, the project's ship signal and any open release-level questions. It is drafted at ratification and sent once no implementation-level question remains open. + +### Adoption + +**Modernization**: +Converting specs written with an earlier version of this skill into feature bundles, separating shipped behavior, approved unbuilt work and drafts. +_Avoid_: Migration, upgrade + +**Retrofit**: +Discovering a codebase's features from the maintainer's account and repo evidence, then seeding ideas and shaping documents. +_Avoid_: Onboarding, backfill + +**Feature inventory**: +The maintainer-approved list of features a retrofit produces, routing each one to modernization, shaping or ideas. It is discarded once its features are seeded. +_Avoid_: Feature map + +**Feature lens**: +One strategy for finding feature evidence in a codebase, such as the domain model, screens and flows, or commit history. +_Avoid_: Survey angle + +**Artifact retirement**: +Removing a legacy spec artifact, with the maintainer's approval, once its durable content lives elsewhere: in a feature spec for specs of shipped behavior, or in a shaping document, ADR or log for plans and design docs. diff --git a/plugins/product-development/skills/product-development/SKILL.md b/plugins/product-development/skills/product-development/SKILL.md index 278dbb5..9c26698 100644 --- a/plugins/product-development/skills/product-development/SKILL.md +++ b/plugins/product-development/skills/product-development/SKILL.md @@ -1,75 +1,132 @@ --- 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, plan implementation, 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 implementation planning." +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 -Guide features through the product development lifecycle from idea to implementation plan. Each workflow produces specific artifacts that feed into the next. Workflow transitions are gated by human review, with optional automated review passes. +Guide features through the product development lifecycle from idea to the implementation handoff, and keep each feature spec true once its changes ship. Implementation itself belongs to the implementation workflow, such as the `delivery-engineering` plugin. Each workflow produces specific artifacts that feed into the next. Workflow transitions are gated by human review, with optional automated review passes. + +The skill's glossary is [CONTEXT.md](CONTEXT.md). Use its terms exactly, in conversation and in the documents you write. A word listed under _Avoid_ must not be used as a name for that entry's concept; it stays correct when it names something else, such as the PRD or an implementation plan. ## Lifecycle Map ``` [Project Setup] ← one-time setup (scripts/init.sh) ↓ -Foundation Stage +Foundation workflow ├─ Product Constitution approval ├─ Product Vision workflow (Vision Grill) - ├─ additional product-anchor workflows (planned extension point) + ├─ further foundation document types (planned extension point) └─ Foundation Gate: approved, versioned constitution + approved, versioned vision before first PRD ↓ -Discovery and Design +Discovery and Design ← idea discovery first; design saved in shaping/ ↓ [human approves design] -Requirements +Requirements ← drafted in shaping/, after the Foundation Gate ├─ PRD [human approves before TRD] └─ TRD [human approves PRD + TRD] → optional review pass ↓ -User Stories +User Stories ← drafted in shaping/ ↓ [human approves stories] → optional review pass -BDD Scenarios +BDD Scenarios ← drafted in shaping/ ↓ [human approves scenarios] → optional review pass -Implementation Planning +Promotion ← overlap check; promotion PR moves the change to features/{feature}/changes/{change}/ + ↓ [maintainer merges = ratification] +Handoff ← drafted at ratification; sent once no implementation-level question is open + ↓ +Implementation ← delivery-engineering or the project's own workflow; no plans in Git + ↓ +Release Check ← release-level open-questions check, before the ship signal + ↓ [project's ship signal fires] → Shipped entry in the feature log +Canonization ← coverage and base checks; deltas applied to the feature spec; change archived ``` -Foundation Stage does not block brainstorming or design exploration. Foundation Gate blocks creation of the first PRD. Later PRDs must check constitution and vision alignment before proceeding. +The Foundation Gate blocks drafting a PRD, not ideas or shaping. The default order is still to establish the foundation documents first. Later PRDs must check constitution and vision alignment before proceeding. + +## Stages + +A stage is a category of authority for product documents, shown by the directory a document sits in. Read a document's authority from its path, never from a status field. + +| Stage | Holds | Agents treat it as | +|-------|-------|--------------------| +| `docs/product/ideas/` | Early sketches nobody is shaping yet | No requirements authority. Read an idea only when the task names it, or through idea discovery. | +| `docs/product/shaping/` | Changes being worked out: shaping documents and draft PRDs, TRDs, stories and scenarios | Tentative context for work on that feature. ADRs and contracts that a shaping document links keep their own authority. | +| `docs/product/features/` | Ratified changes and shipped feature specs | Requirements | + +Rules: + +- The maintainer moves an idea to `shaping/` when they start shaping it. +- The Foundation Gate blocks drafting a PRD, not ideas or shaping. +- A PRD is drafted in `shaping/`. Merging the change's promotion PR ratifies the change and moves it into `features/`. +- Code alone never admits a spec to `features/`. Behavior that exists only in code enters through `shaping/` or `ideas/`. +- Each stage directory has an `AGENTS.md` that says when agents read it and when they stay out. + +Before a design or plan, run idea discovery: a subagent reads `ideas/` and reports any idea that enables, conflicts with or overlaps the work. Spikes answer shaping questions and keep a decision ledger when run unattended. Consult `references/idea-discovery-and-spikes.md` for both. + +## Feature Bundles and Changes + +Each feature has a feature bundle, `docs/product/features/{feature}/`, inside the product's OKF bundle at `docs/product/`. It separates what the feature does now from the changes that got it there: + +- The **feature spec**, `{feature}-spec.md` (the feature overview) plus one facet spec per user type, workflow or contract, describes shipped behavior only, in durable tense. Only canonization changes its meaning. +- A **change** is one bounded addition to or revision of the feature, including its first version. Every PRD and TRD describes a change. The change's **deltas** list the spec units it adds, modifies or removes, with base text for each modified or removed unit. The change keeps its own stories and scenarios until it is canonized. +- The **feature log**, `log.md`, records the feature's history and reasons. The **lineage log**, `features/log.md`, records feature splits, merges and drops, dropped changes, and promotion PRs closed without merging. + +A change's state comes from its path plus two recorded signals: Idea, Shaping, In review (promotion PR open), Ratified (in `changes/{change}/`), Shipped (still in `changes/{change}/`, with a Shipped entry in the feature log), Canonized (in `changes/archive/`) or Dropped (deleted, with a lineage-log entry). + +Consult `references/feature-bundles.md` for the bundle layout, spec units, the OKF `status` mapping and both logs, and `references/changes-and-deltas.md` for the change and delta contract, the overlap and base checks, and worked examples. Consult `references/okf-profile.md` for the front matter every product document carries, the closed `type` list, the generated indexes and the profile checks; regenerate the indexes from the project root with `python3 "/scripts/okf-profile.py" index docs/product` whenever a document is added, moved or retitled, where `` is this skill's installed directory. While feature folders written with 0.1.0 await modernization, every index and check command runs with one `--pending` for each of them (`references/open-questions.md#while-modernization-is-in-progress`). + +When the project tracks changes on a board, such as GitHub Projects, consult `references/board-mapping.md`: one item per change, a "Spec state" field, moves on repository events, and the repository wins over the board. Every board write needs the maintainer's approval. ## Workflows ### Project Setup -**Trigger:** The project does not yet have a `docs/product/` directory, or the user asks to "initialize product docs" or "set up product documentation." +**Trigger:** The project does not yet have a `docs/product/` directory or is missing one of the scaffold files or the bundle root, `docs/product/index.md`, listed under Output, or the user asks to "initialize product docs" or "set up product documentation." -**Process:** Run the initialization script (`scripts/init.sh`) to scaffold the documentation structure. The script uses templates with placeholders, auto-detects project context (name, surfaces), and prompts the user for domain-specific values. Consult `references/initialization.md` for the full workflow. +**Process:** Run the initialization script (`"/scripts/init.sh" `) to scaffold the documentation structure, including the three stage directories. The script uses templates with placeholders, auto-detects project context (name, surfaces), and prompts the user for domain-specific values. Then generate the OKF indexes from the project root, `python3 "/scripts/okf-profile.py" index docs/product`, which writes the bundle root, `docs/product/index.md`; the script prints this step, since it needs PyYAML. Consult `references/initialization.md` for the full workflow. **Output:** - `docs/product/README.md` — documentation hierarchy and boundary rules - `docs/product/AGENTS.md` — agent guidance for organizing product docs -- `docs/product/features/` — empty directory ready for the first feature +- `docs/product/ideas/AGENTS.md`, `docs/product/shaping/AGENTS.md`, `docs/product/features/AGENTS.md` — the three stage directories, each with its agent guidance +- `docs/product/open-questions.md` — the register of product-wide open questions and the generated open-questions index +- `docs/product/index.md` — the OKF bundle root, with an `index.md` in every directory, generated by `okf-profile.py` + +**This workflow runs once per project.** Skip only when every scaffold file exists, `docs/product/README.md`, `docs/product/AGENTS.md`, `docs/product/ideas/AGENTS.md`, `docs/product/shaping/AGENTS.md`, `docs/product/features/AGENTS.md` and `docs/product/open-questions.md`, and so does the bundle root, `docs/product/index.md`. If a scaffold file is missing, for example after an interrupted run, re-run `"/scripts/init.sh" .` from the project root. It never overwrites, so it fills only the gaps. If only `docs/product/index.md` is missing, Setup stopped before index generation, for example because `python3` lacks PyYAML and `okf-profile.py` exited 2: resume there with a `python3` that has PyYAML (`references/initialization.md#post-initialization`). -**This workflow runs once per project.** Skip if `docs/product/README.md` already exists. +### Foundation workflow -### Foundation Stage +**Trigger:** Either of two entry points: -**Trigger:** `docs/product/constitution.md` or `docs/product/vision.md` is missing, the user asks to create or update product-anchor docs, or the agent is preparing to start the first feature PRD and must verify Foundation Gate before drafting. +- The user asks to create, update or approve foundation documents: the constitution or the vision. +- The agent is about to draft a PRD and the Foundation Gate has not passed: `docs/product/constitution.md` or `docs/product/vision.md` is missing, unapproved or unversioned. -**Process:** Establish product-anchor docs in this hierarchy: +A missing foundation document does not trigger this workflow during ideas, discovery, design or other shaping work. Raise it when PRD drafting is next. + +**Process:** Establish the foundation documents in this order: 1. Product Constitution workflow: create, ratify, or amend approved, versioned `docs/product/constitution.md`. Consult `references/product-constitution.md` for `grill-with-docs` dependency behavior, Constitution Grill workflow, versioning, amendment behavior, and constitution alignment checks. -2. Product Vision workflow: run the Vision Grill after Constitution approval. Consult `references/product-vision.md` for `grill-with-docs` dependency behavior, context/ADR coordination, and vision versioning. -3. Additional product-anchor workflows: planned extension point for product-anchor documents when approved. +2. Product Vision workflow: run the Vision Grill after Constitution approval. The vision is a six-part core; material that changes more often goes in companion documents linked from it, the delivery plan (`roadmap.md`), research notes (`research/`) and the open-questions register. Consult `references/product-vision.md` for `grill-with-docs` dependency behavior, the core and its companions, the Decided label, splitting an existing vision, context/ADR coordination, and vision versioning. +3. Further foundation document types: a planned extension point. The foundation documents are the constitution and the vision; another document type joins them only when the maintainer approves it, with its own workflow. 4. Foundation Gate: complete only when approved, versioned `docs/product/constitution.md` and approved, versioned `docs/product/vision.md` exist. **Output:** Approved, versioned `docs/product/constitution.md`; approved, versioned `docs/product/vision.md`; optional `CONTEXT-MAP.md`, `docs/product/CONTEXT.md`, and ADRs when approved and used. -**Foundation Gate:** Do not create the first PRD until the user approves `docs/product/constitution.md`, it has version metadata, and approved, versioned `docs/product/vision.md` exists. +**Foundation Gate:** Do not draft the first PRD until the user approves `docs/product/constitution.md`, it has version metadata, and approved, versioned `docs/product/vision.md` exists. The gate blocks PRD drafting only: ideas, discovery, design and other shaping work may proceed before it passes. ### Discovery and Design -**Trigger:** An idea, feature request, or problem statement arrives. +**Trigger:** An idea, feature request, or problem statement arrives, or the maintainer moves an idea to `shaping/`. + +**Process:** Run idea discovery first (`references/idea-discovery-and-spikes.md`) and bring its questions to the brainstorming session. Classify the work as a new feature, an incremental amendment, an evolution or migration, or a fundamental change (`references/changes-and-deltas.md`); work on an existing feature is a change to that feature, never a competing feature directory. Then invoke the `brainstorming` skill. It handles collaborative exploration, approach proposals, and design approval. When a shaping question needs a prototype, run a spike. + +Override the brainstorming skill's own hand-off. It saves its design under `docs/superpowers/specs/` and then invokes `writing-plans`. Here, save the approved design as the change's shaping document in `docs/product/shaping/{feature}--{change}/`, then return control to this skill. The shaping document includes the change's provenance record (`references/changes-and-deltas.md`, Provenance). A change to an existing feature names it in the shaping document's front matter: `x-amends: {feature}`. The override ends there: this skill never invokes `writing-plans` or plans implementation, which belongs to the implementation workflow. + +When the requirements are already clear and the Foundation Gate has passed, skip brainstorming: write them as the change's shaping document, provenance record included, and get the maintainer's approval of it as the design. -**Process:** Invoke the `brainstorming` skill. It handles collaborative exploration, approach proposals, and design approval. +An early idea that nobody is shaping yet goes to `docs/product/ideas/` instead, with no gate. -**Output:** Approved design document at `docs/plans/YYYY-MM-DD--design.md`. +**Output:** Approved design, saved as the change's shaping document in `docs/product/shaping/{feature}--{change}/`. **Gate:** Do not proceed to Requirements until the design is approved. @@ -79,13 +136,14 @@ Foundation Stage does not block brainstorming or design exploration. Foundation **Required inputs:** Approved design document, approved, versioned `docs/product/constitution.md`, and approved, versioned `docs/product/vision.md`. Missing, unapproved, or unversioned foundation documents block first-PRD requirements work. -**Process:** Create product and technical requirements documents. Consult `references/phase-2-requirements.md` for structure, conventions, constitution alignment, and vision alignment. +**Process:** Create the change's product and technical requirements documents and its deltas. The PRD and TRD describe this change, even when it is the feature's first version; for a feature that already exists, read its feature spec first. Consult `references/requirements.md` for structure, conventions, constitution alignment, and vision alignment, and `references/changes-and-deltas.md` for the delta format. **Gate:** The PRD defines *what*; the TRD defines *how*. Present the PRD for human approval before writing the TRD. This prevents wasted architectural work if the requirements shift. **Output:** -- `docs/product/features/{feature}/PRD.md` -- `docs/product/features/{feature}/TRD.md` +- `docs/product/shaping/{feature}--{change}/PRD.md` +- `docs/product/shaping/{feature}--{change}/TRD.md` +- `docs/product/shaping/{feature}--{change}/deltas/{facet}.delta.md`, one per feature spec document the change touches **Gate:** Both documents reviewed and approved before proceeding. Run configured review passes (see Configuration). @@ -95,9 +153,9 @@ Foundation Stage does not block brainstorming or design exploration. Foundation **Trigger:** PRD and TRD are reviewed and stable. -**Process:** Decompose PRD requirements into user-facing narratives. Consult `references/phase-3-user-stories.md` for format, sizing guidance, and acceptance criteria conventions. +**Process:** Decompose PRD requirements into user-facing narratives. Consult `references/user-stories.md` for format, sizing guidance, and acceptance criteria conventions. -**Output:** Story files at `docs/product/features/{feature}/stories/`. +**Output:** Story files at `docs/product/shaping/{feature}--{change}/stories/`. A revised story is listed in the change's deltas as a whole-file unit. **Gate:** Stories reviewed and approved. Run configured review passes. @@ -107,23 +165,95 @@ Foundation Stage does not block brainstorming or design exploration. Foundation **Trigger:** User stories have acceptance criteria defined. -**Process:** Express acceptance criteria as Gherkin scenarios. Consult `references/phase-4-scenarios.md` for the boundary rule, file placement, and writing conventions. +**Process:** Express acceptance criteria as Gherkin scenarios. Consult `references/bdd-scenarios.md` for the boundary rule, file placement, and writing conventions. **Output:** -- Platform-level scenarios: `docs/product/features/{feature}/scenarios/*.feature` -- Surface-specific scenarios: `apps/{surface}/docs/features/{feature}/scenarios/*.feature` +- Platform-level scenarios: `docs/product/shaping/{feature}--{change}/scenarios/*.feature`, each revised scenario file listed in the change's deltas as a whole-file unit +- Surface-specific scenarios: `apps/{surface}/docs/features/{feature}/scenarios/*.feature`, written now, before promotion **Gate:** Scenarios reviewed and approved. Run configured review passes. **Boundary rule:** If the Given/When/Then language is surface-neutral, the scenario is platform-level. If it references a specific interaction model (swipe, D-pad, gaze), it is surface-specific. -### Implementation Planning +### Promotion **Trigger:** Scenarios are reviewed and cover the acceptance criteria. -**Process:** Load the approved constitution and approved vision with the reviewed scenarios, then invoke the `writing-plans` skill. It creates a detailed, task-by-task implementation plan with TDD steps, file paths, and verification criteria. Stop before planning if the plan would violate `MUST NOT` language, weaken a constitutional principle, conflict with the approved vision, or exceed clear authority. +**Process:** Follow `references/ratification.md` for the ratification checks and the promotion PR body, and review the PR against the checklist in `references/promotion-review.md`, which the `spec-reviewer` agent uses. Run the overlap check (`references/changes-and-deltas.md`) and put its report in the promotion PR. Before the promotion PR opens, the approved change must be on the default branch in `docs/product/shaping/{feature}--{change}/`: if its approved documents are not there yet, land them first, in a PR of its own, opened with the maintainer's approval. The promotion PR then shows the move from `shaping/` to `features/` that board mapping detects, and closing it without merging leaves the change in `shaping/` (`references/board-mapping.md`). With the maintainer's approval, open a promotion PR that moves the change's approved documents from `docs/product/shaping/{feature}--{change}/` into `docs/product/features/{feature}/changes/{change}/`, sets their OKF `status` to `stable`, and adds a Ratified entry to the feature log. For a new feature, the PR also creates the feature bundle: a metadata-only feature overview that claims no behavior, `log.md` and `changes/`. The first canonization writes the complete overview and the facet specs (`references/feature-bundles.md`). The maintainer reviews it and orders or combines any overlapping changes. Run the overlap check again just before the PR merges. At both points, also run the design-level open-questions check (`references/open-questions.md`): no open `design` or `none yet` question may name the change unless the maintainer approved its deferral. Merging the promotion PR ratifies the change; the merge is the approval record. Code alone never admits a spec, so a change whose code has already shipped still goes through promotion. + +The promotion PR also lists each app-local scenario file under `apps/{surface}/docs/features/{feature}/scenarios/` that it adds or changes, so the maintainer ratifies surface-specific scenarios with the rest of the change. + +Check for collisions before moving anything: if the change is named `archive` (reserved for the change archive), `features/{feature}/changes/{change}/` already exists, the change name is already used in the change archive, or a new feature's bundle already exists, stop and ask the maintainer. Never overwrite a ratified document during promotion. + +**Output:** The ratified change in `docs/product/features/{feature}/changes/{change}/`. + +**Gate:** Do not start implementation until the promotion PR has merged. + +### Handoff + +**Trigger:** The change's promotion PR has merged. + +**Process:** Draft the handoff from the promotion PR's merge commit: the ratified change (its PRD, TRD and every delta, feature-qualified ones included), its stories and scenarios, every document a delta targets, the foundation documents, the project's ship signal and any open release-level questions. For a feature's first change, the change's deltas describe the spec to be. The ratified documents stay pinned to the merge commit; answers the maintainer approves later are linked at the commits that recorded them, and the release-level questions are listed as of the commit the handoff is sent from. Send it once no implementation-level question remains open: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level implementation` exits 0, run with `--pending` while feature folders written with 0.1.0 await modernization. If it lists questions, triage them with the maintainer (`references/open-question-triage.md`) and run it again. Filing the handoff as the implementation issue waits for the maintainer's approval. Consult `references/implementation-handoff.md` for its contents, the send condition and an example. The skill drafts the handoff and stops there; the implementation workflow, such as the `delivery-engineering` plugin, takes it from there. + +**Output:** The handoff, sent to the implementation workflow. + +**Gate:** Do not start implementation until the handoff has been sent. + +### Implementation + +**Trigger:** The handoff has been sent. -**Output:** Implementation plan at `docs/plans/YYYY-MM-DD-.md`. +**Process:** The skill does not plan or run implementation. The implementation workflow takes the sent handoff: the `delivery-engineering` plugin's review-gated implementation loop, or the project's own workflow. The handoff carries everything that workflow needs from this skill (`references/implementation-handoff.md`), and it passed the implementation-level open-questions check when it was sent. Before implementation starts, run idea discovery and give its report to the implementation workflow. + +Execution plans stay out of Git. `delivery-engineering` uses the PR body as the plan. Change-scoped design stays in the change's TRD, and ship order stays in the product's delivery plan (`roadmap.md`). Implementation findings stay with the implementation workflow; a product question it raises goes to the open-questions register (`references/open-questions.md`). + +If implementation would violate `MUST NOT` language, weaken a constitutional principle, conflict with the approved vision, or exceed clear authority, stop and raise it with the maintainer: a change of meaning is a revision of the ratified change (`references/changes-and-deltas.md`, Changing a ratified change). + +**Output:** None in this skill. The implementation workflow's output is the work that the ship signal makes live. + +### Release Check + +**Trigger:** Someone is about to fire the ship signal for a ratified change (merge the implementation PR, cut the release, or widen the feature flag to everyone, whichever the project names), or to execute a step in the delivery plan. + +**Process:** Whoever will fire the ship signal runs the release-level open-questions check (`references/open-questions.md`), `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release`: no open `design`, `implementation`, `release` or `none yet` question may name the change unless its deferral is approved. When merging the implementation PR is the ship signal, the implementation workflow runs this check before that merge. While feature folders written with 0.1.0 await modernization, the check runs with `--pending` and the maintainer triages their questions too (`references/open-questions.md#while-modernization-is-in-progress`). + +Release questions can also name a delivery-plan step, by path and anchor. Before executing a delivery-plan step, run the same check, with the same `--pending`, on the step: `python3 "/scripts/open-questions.py" blocking docs/product roadmap.md#broader-rollout --level release`. The step's check also lists the questions that block the whole delivery plan, scoped to `this document` in `roadmap.md`. When that step fires a change's ship signal, run both checks, the change's and the step's. + +**Gate:** Do not fire the ship signal until its checks pass, and do not execute a delivery-plan step until its check passes. + +### Ship Signal and Canonization + +**Trigger:** The project's ship signal fires for a ratified change: the event the project names as making a change live, such as the implementation PR merging, a release, or a feature flag reaching everyone. + +**Process:** Record a Shipped entry in the feature log with the signal and its evidence, and land it on the default branch before canonization starts; the change stays in `docs/product/features/{feature}/changes/{change}/` and is now Shipped. If the feature log already has a Shipped entry for the change, reuse it. Then canonize it, following `references/canonization.md`: + +1. **Coverage check:** account for each requirement and scenario as shipped, changed or deferred. A change in meaning needs the maintainer's approval; each deferred item becomes a shaping item. Reconcile the deltas with the accounting; the ratified deltas stay as they were. +2. **Base check:** rebase any delta whose base text has drifted, with the maintainer's confirmation of any change in meaning. +3. **Apply** the reconciled deltas, and move the story and scenario files they list to the feature root. +4. **Archive** the change to `changes/archive/YYYY-MM-DD-{change}/`. It is now Canonized. +5. **Log** a Canonized entry in the feature log. + +`references/changes-and-deltas.md` defines the delta contract the workflow consumes. + +**Output:** The Shipped entry on the default branch, then the canonization PR: the updated feature spec, stories and scenarios at the feature root; the archived change; shaping items for deferred work; the Canonized feature-log entry. + +**Gate:** Opening the canonization PR waits for the maintainer's approval. The maintainer confirms any change in meaning, any deferred item and any rebased delta before it merges. Run the base check again just before it merges. + +## Modernization + +**Trigger:** The project has specs written with version 0.1.0 of this skill: a feature folder with one PRD and one TRD edited in place, changelog tables, status fields, or committed implementation plans. + +**Process:** Follow `references/modernization.md`, one feature folder at a time, in one modernization PR each: archive the original PRD and TRD byte for byte, derive the feature spec from what shipped, have the maintainer rule on each mismatch, carry unbuilt requirements forward as a change in `shaping/`, convert the history, move plans out, and retire artifacts with the maintainer's approval. + +**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, 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. ## Gates and Review Passes @@ -140,12 +270,27 @@ At each gate: Review passes are optional automated checks that run at gates before human review. They are configured per-project or per-user (see Configuration). Examples: - **Constitution alignment check** — verify PRD satisfies all governance principles +- **Promotion review** — review the promotion PR against `references/promotion-review.md`, with the `spec-reviewer` agent where the harness has one - **Traceability audit** — verify every FR-* is covered by a story, every story by a scenario - **Code review agent** — run a review skill (e.g., `coderabbit:review`) against the artifacts - **Custom review prompt** — project-specific review instructions from `AGENTS.md` If no review passes are configured for a gate, the gate is human-only. +## Supporting Workflows + +These workflows run inside the lifecycle when their trigger arises. None of them moves a change to another stage. + +- **Open-question triage** (`references/open-question-triage.md`): a check lists open questions that hold a change, or the maintainer asks to triage. Works one question at a time and classifies each by blocking level. +- **Downstream comments** (`references/downstream-comments.md`): a decision affects work someone else owns later. The skill drafts the comments; posting waits for the maintainer's approval. +- **Tech decisions** (`references/tech-decisions.md`): a TRD needs a technology choice. The decision lands in the change's TRD, with an ADR when it is consequential. +- **Compliance research** (`references/compliance-research.md`): a requirement or decision depends on a law, regulation, standard or platform policy. Claims that land in a spec, TRD or ADR cite primary sources there. +- **Feature tags** (`references/feature-tags.md`): code is written or reviewed for a ratified change, a feature is renamed, split, merged or dropped, or a project sets up the check. Code names its feature in an `@feature ` tag or by a `features//` path; `python3 "/scripts/feature-tags.py" check` fails on any tag or path that names a missing feature. + +## GitHub Writes + +The skill drafts; the maintainer approves. Every write to GitHub waits for the maintainer's approval: opening a promotion PR, filing the implementation issue, posting downstream comments, moving board cards, and any other issue, PR or comment. Show the exact content first. An approval covers the writes it names and no others. The rule holds whichever workflow does the write, this skill or a GitHub helper workflow. The maintainer merges promotion PRs; an agent never does. + ## Configuration Configuration lives in two locations, with project-level overriding user-level: @@ -203,10 +348,15 @@ For each writing workflow, dispatch a sub-agent with only the inputs it needs: | Workflow | Sub-agent receives | Sub-agent returns | |----------|-------------------|-------------------| -| Requirements PRD | Design doc, constitution, vision, `references/phase-2-requirements.md`, example features | PRD written to disk | -| Requirements TRD | Approved PRD, constitution, vision, `references/phase-2-requirements.md`, example features | TRD written to disk | -| User Stories | Approved PRD, TRD, constitution, vision, `references/phase-3-user-stories.md` | Story files written to disk | -| BDD Scenarios | User stories, TRD, constitution, vision, `references/phase-4-scenarios.md` | `.feature` files written to disk | +| Requirements PRD | Shaping document, constitution, vision, `references/requirements.md`, the feature spec of the feature it amends, if any | PRD written to disk | +| Requirements TRD | Approved PRD, constitution, vision, `references/requirements.md`, the feature spec of the feature it amends, if any | TRD written to disk | +| Deltas | Approved PRD and TRD, the feature spec, `references/changes-and-deltas.md` | Delta files written to disk | +| 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 | The main context reviews sub-agent output with the human and iterates if needed. @@ -223,67 +373,113 @@ All product documentation follows a three-tier hierarchy. See `docs/product/READ | Tier | Location | Contains | |------|----------|----------| -| Platform | `docs/product/` | PRDs, TRDs, user stories, platform-level scenarios | +| Platform | `docs/product/` | Foundation documents and the `ideas/`, `shaping/` and `features/` stages: PRDs, TRDs, user stories, platform-level scenarios | | App | `apps/{surface}/docs/` | Surface-specific scenarios | | Code | `apps/{surface}/tests/` | Step definitions (test automation) | ## Workflow Selection -Not every feature starts at the beginning. Match the entry point to the current state: +Not every feature starts at the beginning. Match the entry point to the current state. Route by the gates already passed: a workflow starts only when its inputs are approved, and an unfinished artifact goes back to the workflow that produces it. | Starting point | Enter at | |---------------|----------| -| No `docs/product/` directory | Project Setup | -| Missing, unapproved, or unversioned constitution or vision before first PRD | Foundation Stage | +| No `docs/product/` directory, any scaffold file missing (`README.md`, `AGENTS.md`, a stage `AGENTS.md`, or `open-questions.md`), or no bundle root (`docs/product/index.md`) | Project Setup; with only the bundle root missing, resume at index generation | +| Missing, unapproved, or unversioned constitution or vision before first PRD | Foundation workflow | +| Early idea nobody is shaping yet | Record it in `ideas/` | | Vague idea, no clarity on approach | Discovery and Design | -| Clear requirements, needs documentation | Requirements after Foundation Gate | -| PRD exists, needs decomposition | User Stories | -| Stories exist, needs testable criteria | BDD Scenarios | -| Scenarios exist, needs implementation | Implementation Planning | - -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 Foundation Stage before Requirements. +| Clear requirements, needs documentation | Discovery and Design: record them as the change's shaping document and get it approved, skipping brainstorming once the Foundation Gate passes; then Requirements | +| PRD or TRD drafted, not yet approved | Requirements: finish its review and approval | +| PRD and TRD approved, no stories yet | User Stories | +| Stories drafted, not yet approved, or without acceptance criteria | User Stories: finish them | +| Stories approved, with acceptance criteria defined, no scenarios yet | BDD Scenarios | +| Scenarios drafted, not yet approved | BDD Scenarios: finish their review and approval | +| Discovery suggests the work may evolve an existing feature | Discovery and Design: classify the work first | +| Approved change in `shaping/` (PRD, TRD, stories and scenarios all approved), not yet ratified | Promotion | +| Ratified change in `features/{feature}/changes/`, handoff not sent | Handoff | +| Handoff sent, needs implementation | Implementation | +| A check lists open questions that hold a change | Open-question triage | +| A TRD needs a technology choice | Tech decisions | +| A requirement depends on a law, regulation or standard | Compliance research | +| About to fire the ship signal for a ratified change | Release Check | +| 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 | +| 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 the Foundation Gate passes, never the approved shaping document: Requirements starts from an approved design (`references/requirements.md`), so record them as the change's shaping document and get it approved first. 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. ## Skill Delegation -This skill orchestrates the lifecycle but delegates to specialized skills for bookend workflows: +This skill orchestrates the lifecycle but delegates the bookend workflows: - **Discovery and Design:** Delegate to `brainstorming` skill - **Requirements, User Stories, BDD Scenarios:** Follow the reference files in this skill -- **Implementation Planning:** Delegate to `writing-plans` skill +- **Implementation:** Hand off to `delivery-engineering` or the project's own workflow; this skill writes no implementation plan ## Specification Evolution -Product specifications are living artifacts. Different artifact types evolve at different rates. Consult `docs/METHODOLOGY.md` for the full methodology. Summary: +Product specifications are living artifacts, and each kind changes in its own way. Consult `docs/METHODOLOGY.md` for the full methodology. Summary: | Artifact | Strategy | |----------|----------| | Constitution, Vision | Immutable + supersede (semver) | -| PRD, TRD | Living document with changelog | -| User Stories | Living — add, complete, archive | -| Platform Scenarios | Living + self-verifying | -| Surface Scenarios | Living + self-verifying | +| Vision companion documents | Current state; each change approved by the maintainer, consistent with the core | +| Research notes | Dated; superseded by a newer note, never edited in place | +| Idea, shaping document | Draft; authority comes from the stage directory | +| Change: PRD, TRD, deltas, its stories and scenarios | Dated record of one change; archived at canonization | +| Feature spec, feature-root stories and scenarios | Current state; changed only by canonization | +| Platform and surface scenarios | Self-verifying | +| Feature log, lineage log | Append-only history | -When updating an existing spec, append to its changelog with date, change, and rationale. When changes are so extensive the document is unrecognizable from its original form, supersede with a new document instead. +A change to requirements, stories or scenarios is drafted in `shaping/{feature}--{change}/` and ratified by a promotion PR, like a new feature. Only edits that don't change meaning (typos, links, clarifications) go directly into ratified documents. Change events and their reasons go in the feature log, never in spec prose. A fundamental change replaces most of a feature's spec units through its deltas, or is a lineage event recorded in the lineage log. ## Reference Files -Detailed guidance for each workflow lives in reference files to keep context targeted. The `phase-*` filenames are legacy compatibility paths; load them by the workflow names below: +Detailed guidance for each workflow lives in reference files to keep context targeted. Each file is named for its workflow: - **`references/initialization.md`** — Project initialization workflow, placeholders, post-init steps - **`references/product-constitution.md`** — Product Constitution workflow, Foundation Gate, Constitution Grill, versioning, amendment behavior, and alignment checks -- **`references/product-vision.md`** — Product Vision workflow, Foundation Gate, Vision Grill, versioning, and context/ADR coordination -- **`references/phase-2-requirements.md`** — PRD and TRD structure, conventions, constitution and vision checks -- **`references/phase-3-user-stories.md`** — Story format, acceptance criteria, sizing -- **`references/phase-4-scenarios.md`** — Gherkin conventions, boundary rule, file placement -- **`docs/METHODOLOGY.md`** — Specification evolution strategies, changelog conventions, supersession rules +- **`references/product-vision.md`** — Product Vision workflow, Foundation Gate, Vision Grill, the core vision and its companion documents, the Decided label, market-context research notes, splitting an existing vision, versioning, and context/ADR coordination +- **`references/idea-discovery-and-spikes.md`** — Idea discovery before a design or plan, spikes, and the decision ledger +- **`references/feature-bundles.md`** — Feature bundle layout, feature spec and spec units, OKF `status` mapping, feature log and lineage log +- **`references/changes-and-deltas.md`** — The change and delta contract, change states, overlap and base checks, worked examples +- **`references/board-mapping.md`** — Mapping change states to a project board: where each state comes from, the closed-PR and repository-wins rules, one item per change, spec states only +- **`references/board-mapping-github-projects.md`** — GitHub Projects setup, built-in workflows to keep off Spec state, event moves, drift correction with `gh`, walkthrough +- **`references/okf-profile.md`** — The OKF v0.3 profile of `docs/product/`: front matter, closed types and open tags, status by path, generated indexes, profile checks and the upstream validator +- **`references/requirements.md`** — PRD and TRD structure, conventions, constitution and vision checks +- **`references/open-questions.md`** — Open questions: blocking levels and their check points, resolution methods, IDs and anchors, deferral, homes and the generated index +- **`references/ratification.md`** — Ratification checks: preparing the promotion PR, the checks again before the merge, and what follows it +- **`references/promotion-review.md`** — The promotion-review checklist the `spec-reviewer` agent uses +- **`references/open-question-triage.md`** — Working through open questions one at a time by blocking level, with recorded deferrals +- **`references/implementation-handoff.md`** — The handoff: its contents, when it is drafted and sent, and an example for a feature's first change +- **`references/feature-tags.md`** — Feature tags: `@feature` comments in code, the feature path convention for files that can't carry comments, the check and its CI setup +- **`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 +- **`references/user-stories.md`** — Story format, acceptance criteria, sizing +- **`references/bdd-scenarios.md`** — Gherkin conventions, boundary rule, file placement +- **`docs/METHODOLOGY.md`** — Specification evolution strategies, the change model, feature log conventions Load `references/source/product-constitution-guide.md` only through `references/product-constitution.md` when exact source detail is needed. Load `references/source/vision-document-guide.md` only through `references/product-vision.md` when exact source detail is needed. ## Scripts +The scripts ship with the installed skill; `scripts/init.sh` does not copy them into the project. Run each one from the project root by its installed path, such as `python3 "/scripts/open-questions.py" check docs/product`, where `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. Bundle paths such as `docs/product` resolve from the project root. + - **`scripts/init.sh`** — Project initialization script. Scaffolds `docs/product/` from templates with placeholder substitution. Supports interactive prompts, CLI arguments, and `--dry-run`. +- **`scripts/open-questions.py`** — Generates the open-questions index in `docs/product/open-questions.md`, checks it in CI, and lists the open questions that hold a change at a check point. `--pending` names each feature folder still in the 0.1.0 layout while it awaits modernization, as the profile check does: the rows of tables still in the 0.1.0 format are skipped, and valid rows there still count. See `references/open-questions.md`. +- **`scripts/feature-tags.py`** — Checks that every `@feature` tag and feature path segment in code names a feature in `docs/product/features/`. See `references/feature-tags.md`. +- **`scripts/okf-profile.py`** — OKF profile tooling. `index` regenerates every `index.md` in `docs/product/`, keeping the root front matter; `index --check` reports stale indexes; `check` runs the profile checks, skipping the originals that modernization archives without front matter; `--pending` makes `index` and `check` skip each feature folder still in the 0.1.0 layout while it awaits modernization, and check everything else. Needs PyYAML. ## Templates - **`templates/README.md.tmpl`** — Documentation hierarchy template - **`templates/AGENTS.md.tmpl`** — Agent guidance template +- **`templates/ideas/AGENTS.md.tmpl`**, **`templates/shaping/AGENTS.md.tmpl`**, **`templates/features/AGENTS.md.tmpl`** — Stage guidance: each stage's authority, and when agents read it or stay out +- **`templates/open-questions.md.tmpl`** — The product-wide open-questions register with its index markers +- **`templates/documents/`** — Document templates the agent copies: feature spec overview and facet, delta, feature log and lineage log, and the core vision (`vision.md.tmpl`) diff --git a/plugins/product-development/skills/product-development/docs/METHODOLOGY.md b/plugins/product-development/skills/product-development/docs/METHODOLOGY.md index 9a0998c..ee71509 100644 --- a/plugins/product-development/skills/product-development/docs/METHODOLOGY.md +++ b/plugins/product-development/skills/product-development/docs/METHODOLOGY.md @@ -4,7 +4,59 @@ Product specifications are living artifacts that evolve alongside the product. D ## Core Principle -**Traceability over format.** Whether a specification is updated in place or superseded by a new document, the requirement is that any current specification can be traced back to the decision that created it. Git history provides this for living documents. Explicit supersession headers provide this for immutable documents. +**Traceability over format.** Whether a specification is updated in place or superseded by a new document, the requirement is that any current specification can be traced back to the decision that created it. Git history and the change archive provide this for feature specs and changes. Explicit supersession headers provide this for immutable documents. + +## Stages Carry Authority + +A product document's authority comes from the stage directory it sits in, not from a status field. A status field drifts once code ships unless someone remembers to update it; a path moves in the same pull request as the work. The decision is recorded in ADR 0001 (stage directories carry authority). + +| Stage | Holds | Authority | +|-------|-------|-----------| +| `docs/product/ideas/` | Early sketches nobody is shaping yet | None. Agents read an idea only when the task names it, or through idea discovery. | +| `docs/product/shaping/` | Changes being worked out: shaping documents and draft PRDs, TRDs, stories and scenarios | Tentative context for work on that feature. ADRs and contracts that a shaping document links keep their own authority. | +| `docs/product/features/` | Ratified changes and shipped feature specs | Requirements | + +### Promotion rule + +- The maintainer moves an idea to `shaping/` when they start shaping it. +- The Foundation Gate blocks drafting a PRD, not ideas or shaping. +- A PRD is drafted in `shaping/`. Merging the change's promotion PR ratifies the change and moves it into `features/`. The merge is the approval record. +- Code alone never admits a spec to `features/`. Behavior found only in code enters through `ideas/` or `shaping/` and is promoted like any other change. +- A spike's code never admits a spec either. Its decision ledger lives with the spike, never in `docs/product/`, and its entries move into lasting documents when the spike ends. + +The evolution strategies below apply once a document has the authority of its stage: foundation documents once approved, changes once ratified into `features/`, and feature specs always. Ideas and shaping documents are drafts and change freely. + +## The Change Model + +A feature lives in its own feature bundle, `docs/product/features/{feature}/`, inside the product's OKF bundle at `docs/product/`. The bundle separates what the feature does now from the changes that got it there. ADR 0002 (deltas with base text, canonized at ship) and ADR 0003 (product documents form one OKF bundle) record the decisions. `references/feature-bundles.md` and `references/changes-and-deltas.md` hold the details. + +- The **feature spec**, a feature overview plus facet specs, describes shipped behavior only, in durable tense. +- A **change** is one bounded addition to or revision of a feature, including its first version. Every PRD and TRD describes a change. Its **deltas** list the spec units it adds, modifies or removes; each modified or removed unit records its base text. +- A **spec unit** is an independently changeable section of the feature spec with a stable ID, such as `FR-12` invitation expiry or `MEM-02` membership status transitions, or a whole scenario file. +- **Canonization** makes a shipped change part of the feature spec: it accounts for each requirement and scenario as shipped, changed or deferred, applies the deltas as reconciled with that accounting, moves the story and scenario files the reconciled deltas list to the feature root, archives the change, and logs the outcome. Every story and scenario file a change adds or revises is a whole-file unit in its deltas, so a deferred one never reaches the feature root. +- The **feature log** records each feature's dated history and reasons. The **lineage log** records feature splits, merges and drops, dropped changes, and promotion PRs closed without merging. + +### Lifecycle of a change + +1. **Shaping.** The change is drafted in `shaping/{feature}--{change}/`. The shaping document and the PRD hold the change's provenance: affected consumers, compatibility constraints, who decided what and when, evidence with the claim each source supports, rejected alternatives, and non-goals and boundaries for the delivery team (`references/changes-and-deltas.md`, Provenance). A change to an existing feature names it with `x-amends: {feature}`; the ratified feature spec stays in force while the change is worked out. +2. **Ratification.** The maintainer merges the promotion PR, after the overlap check. The change moves to `features/{feature}/changes/{change}/`. The merge is the approval record. +3. **Implementation and Shipped.** The handoff gives the ratified change to the implementation workflow, `delivery-engineering` or the project's own; this skill writes no implementation plan. Each project names its ship signal, the event that makes a change live. When it fires, a Shipped entry in the feature log records the evidence, so the state survives a restart. The change stays in `changes/{change}/`. +4. **Canonization.** After the base check, the deltas are applied to the feature spec, the story and scenario files the reconciled deltas list move to the feature root, the change moves to `changes/archive/YYYY-MM-DD-{change}/` with its ratified deltas' content intact and its documents' `status` set to `deprecated`, and a feature-log entry records the outcome. Deferred requirements become shaping items. The change is now Canonized. `references/canonization.md` holds the workflow step by step: a coverage check that accounts for each requirement and scenario as shipped, changed or deferred, with the maintainer's approval for any change in meaning; the base check; applying the reconciled deltas; archiving the change; and the Canonized log entry. + +A change withdrawn before it ships is Dropped: its directory is deleted and the lineage log records why. + +### Execution plans stay out of Git + +Execution plans stay out of Git. They describe how one piece of work gets done and go stale once it merges, so they are not product documents and have no OKF type. `delivery-engineering` uses the PR body as the plan. What outlives the work has a home of its own: change-scoped design in the change's TRD, ship order and conditions in the product's delivery plan, decisions in an ADR or the feature log, and product questions in the open-questions register. + +### Parallel changes + +Two changes to one feature can be in flight together. Two checks keep the second from silently overwriting the first: + +- The **overlap check**, when a promotion PR is prepared and again just before it merges, finds other in-flight changes that touch the same spec units or add a unit with the same ID. The maintainer orders or combines them. +- The **base check**, at canonization and again just before the canonization PR merges, compares each recorded base text with the latest feature spec. If the spec has drifted, the delta is rebased first, and the maintainer confirms any change in meaning. + +`references/changes-and-deltas.md` walks through two parallel changes, and the skill's test fixture runs them. ## Evolution Strategies @@ -25,24 +77,21 @@ The document is never modified after approval. When the specification must chang **Use for:** Governance documents where changes are rare, consequential, and require deliberate review. A quiet edit to the constitution undermines its authority. -### Living Document +### Change Record -The document is updated in place. A changelog section at the bottom records significant changes with date, description, and rationale. +A change's PRD, TRD, deltas, stories and scenarios are the dated record of one bounded change. They are written before the change ships, so planning tense is correct in the PRD and TRD. They are not re-tensed after it ships: canonization moves the change to the change archive, where the same text reads as history. -**Mechanism:** Edit the document directly. Append to the changelog. Git history provides the full diff. +**Mechanism:** Draft in `shaping/{feature}--{change}/`, ratify by a promotion PR, canonize at ship, archive. A later revision of the feature is a new change, not an edit to an earlier one. -```markdown -## Changelog +**Use for:** PRDs, TRDs, deltas, and the stories and scenarios a change adds or revises. -| Date | Change | Rationale | -|------|--------|-----------| -| 2026-03-15 | Added `session_paused` event | User research showed pause frequency is a key engagement signal | -| 2026-03-01 | Initial version | — | -``` +### Current State, Canonized at Ship -**Use for:** Specifications that evolve incrementally. Adding a new analytics event, refining acceptance criteria, updating a dependency version. +The document describes what the product does now, in durable tense, and changes only when a shipped change is canonized into it. -**When to supersede instead:** If the changes are so extensive that the document is no longer recognizable from its original form — a major pivot, a complete rearchitecture, or a fundamental change in approach — create a new document and supersede the old one rather than editing it beyond recognition. +**Mechanism:** Canonization applies a change's deltas unit by unit, after the base check. Change events go in the feature log, never in the document. Edits that don't change meaning (typos, links, clarifications) may go in directly. + +**Use for:** The feature spec, and the stories and scenarios at the feature root. ### Living + Self-Verifying @@ -58,46 +107,52 @@ The specification is tied to automated tests. When behavior changes, the specifi |----------|----------|----------|-----------| | Constitution | Immutable + supersede (semver) | `docs/product/` | Governance changes are rare and consequential | | Vision | Immutable + supersede (semver) | `docs/product/` | Strategic direction changes are deliberate | -| PRD | Living document with changelog | `docs/product/features/{feature}/` | Requirements evolve incrementally | -| TRD | Living document with changelog | `docs/product/features/{feature}/` | Architecture tracks requirements | -| User Stories | Living — add, complete, archive | `docs/product/features/{feature}/stories/` | Stories are transient work items | -| Platform Scenarios | Living + self-verifying | `docs/product/features/{feature}/scenarios/` | Executable behavioral contracts | +| Vision companion documents | Current state, maintainer-approved | `docs/product/vision-{topic}.md` | Change more often than the core; must agree with it | +| Research notes | Dated, superseded by a newer note | `docs/product/research/` | Evidence is a record of what was known when | +| Idea | Draft | `docs/product/ideas/` | No requirements authority; moves to `shaping/` when shaping starts | +| Shaping document | Draft | `docs/product/shaping/{feature}--{change}/` | Tentative design; moves with its change on promotion, or is absorbed into the PRD | +| PRD, TRD, deltas | Change record | `shaping/{feature}--{change}/`, then `features/{feature}/changes/{change}/`, then `changes/archive/` | One change, written before it ships | +| Feature spec | Current state, canonized at ship | `docs/product/features/{feature}/` | Shipped behavior only | +| User Stories | Change record, then current state | The change's `stories/`, then the feature root's `stories/` at canonization | Unshipped stories never sit beside shipped ones | +| Platform Scenarios | Living + self-verifying | The change's `scenarios/`, then the feature root's `scenarios/` at canonization | Executable behavioral contracts | | Surface Scenarios | Living + self-verifying | `apps/{surface}/docs/features/{feature}/scenarios/` | Surface-specific executable contracts | +| Open questions | Removed when answered; index generated | Each document's Open Questions table; product-wide ones in `docs/product/open-questions.md` | The answer moves into the spec, an ADR or the feature log, so it has one home | +| Feature log, lineage log | Append-only | `features/{feature}/log.md`, `features/log.md` | History and reasons | -## User Story Lifecycle +## Feature Log Conventions -Stories have a status field that tracks their progress: +The feature log replaces the changelog tables PRDs and TRDs used to end with. Each feature's `log.md` holds dated entries, oldest first, for each change's ratification, ship signal and canonization, and for decisions no change record holds. Entries follow the log format in [feature-bundles.md](../references/feature-bundles.md#feature-log): a `## YYYY-MM-DD` date heading, then one list item for each event, with its details nested inside it. -- **Draft** — story is being written, acceptance criteria may be incomplete -- **Ready** — story is approved and ready for scenario writing or implementation -- **In Progress** — story is being implemented -- **Done** — story is implemented, scenarios pass -- **Archived** — story has been superseded or is no longer relevant +- Record the date, the change, the reason and links +- Link records that outlive canonization: the promotion PR for Ratified, the ship evidence for Shipped, the archive path for Canonized. `changes/{change}/` is deleted when the change is archived +- The reason matters more than the description: git diff shows *what* changed, but not *why* +- Change events ("replaces X", "added Y") go here, never in spec prose +- Consequential decisions also get an ADR, linked from the entry +- Minor corrections (typos, formatting) do not need entries -Done and archived stories remain in the `stories/` directory for traceability. If the directory becomes noisy, completed stories may be moved to `stories/archive/`. +The lineage log, `features/log.md`, records events that span features: splits, merges and drops, dropped changes, and promotion PRs closed without merging. A bundle or change that is removed is deleted, not left as a stub; its lineage entry links the last commit that had it. -## Changelog Conventions +## Classifying a Change -For living documents (PRDs, TRDs), the changelog section is the last section in the document. +A change to requirements, stories or scenarios is drafted in `shaping/{feature}--{change}/` and ratified by a promotion PR, like a new feature. Only edits that don't change meaning (typos, links, clarifications) go directly into ratified documents. -- Record the date, a brief description of the change, and the rationale -- The rationale matters more than the description — git diff shows *what* changed, but not *why* -- The initial version entry has no rationale (it's self-evident) -- Minor corrections (typos, formatting) do not need changelog entries -- Changes to requirements, architecture, or acceptance criteria always get entries +When discovery finds that proposed work may touch an existing feature, classify it before shaping: -## When to Supersede vs. Update +| Classification | Path | +|----------------|------| +| Independent new feature | A change in `shaping/` that creates a new feature bundle when ratified | +| Incremental amendment | A small change, with deltas against the existing feature spec | +| Evolution or migration | A change in `shaping/` that names its target feature with `x-amends: {feature}`. The ratified feature spec stays in force while the change is worked out. | +| Fundamental change | A change whose deltas replace most spec units, or a lineage event (split, merge or drop) recorded in the lineage log | -Update in place when: -- Adding a new requirement or event to an existing feature -- Refining acceptance criteria based on implementation learnings -- Updating dependency versions or technical details -- Correcting errors discovered during implementation +Work on an existing feature is a change to that feature's bundle, so the feature keeps one lineage. Discovery is not approval: nothing changes the feature spec until a change is ratified and ships. -Supersede with a new document when: +A fundamental change is the right path when: - Replacing the underlying technology (e.g., migrating from PostHog to another vendor) - Fundamentally changing the privacy or consent model -- Rearchitecting a feature to the point where the original PRD/TRD is unrecognizable -- Changing governance principles (constitution, vision) +- Rearchitecting a feature to the point where most of its spec units would be rewritten +- Splitting one feature into several, or merging several into one + +The threshold is judgment-based: if someone reading the deltas would be confused by the volume of changes relative to the feature's current spec, treat it as a fundamental change and say so in the PRD. -The threshold is judgment-based: if someone reading the document would be confused by the volume of changes relative to the original intent, it's time for a new version. +Constitution and vision changes follow Immutable + Supersede instead. diff --git a/plugins/product-development/skills/product-development/references/phase-4-scenarios.md b/plugins/product-development/skills/product-development/references/bdd-scenarios.md similarity index 51% rename from plugins/product-development/skills/product-development/references/phase-4-scenarios.md rename to plugins/product-development/skills/product-development/references/bdd-scenarios.md index 8952c03..20b807e 100644 --- a/plugins/product-development/skills/product-development/references/phase-4-scenarios.md +++ b/plugins/product-development/skills/product-development/references/bdd-scenarios.md @@ -1,21 +1,24 @@ # BDD Scenarios -This file keeps its `phase-4-scenarios.md` name as a legacy compatibility path. The public workflow name is BDD Scenarios. - Scenarios are **living + self-verifying** artifacts (see `docs/METHODOLOGY.md`). They are tied to automated tests via step definitions. When behavior changes, the scenario is updated and the test suite validates that the specification matches reality. A failing scenario means the spec and the implementation have diverged. ## Inputs -- User stories at `docs/product/features/{feature}/stories/` -- TRD at `docs/product/features/{feature}/TRD.md` (for technical context on what is feasible) +- User stories at `docs/product/shaping/{feature}--{change}/stories/` while the change is drafted +- TRD at `docs/product/shaping/{feature}--{change}/TRD.md` (for technical context on what is feasible) +- For an existing feature, also read its feature spec and the scenarios of shipped behavior in `docs/product/features/{feature}/scenarios/` - Approved, versioned product constitution at `docs/product/constitution.md` - Approved, versioned product vision at `docs/product/vision.md` ## Output Locations **Platform-level scenarios** (surface-neutral behavioral contracts): +Platform-level scenarios are drafted with their change in `shaping/` and move with it into `docs/product/features/{feature}/changes/{change}/scenarios/` when the promotion PR merges. They stay in the change until it is canonized, which moves them to `docs/product/features/{feature}/scenarios/` at the feature root. The feature root holds only scenarios of shipped behavior. + +To revise a shipped scenario file, put the new version in the change's `scenarios/` under the same name and list the file in the change's deltas as a modified whole-file unit, with the shipped file as base text. A scenario file is one spec unit, so the overlap and base checks catch two changes that revise it at once. See `references/changes-and-deltas.md`. + ``` -docs/product/features/{feature}/scenarios/ +docs/product/shaping/{feature}--{change}/scenarios/ ├── {story-or-behavior-name}.feature └── ... ``` @@ -27,6 +30,8 @@ apps/{surface}/docs/features/{feature}/scenarios/ └── ... ``` +Write surface-specific scenarios with the change, before promotion. The change lists each app-local scenario file it adds or changes in its deltas, with the file's base text when it existed before the change, and the promotion PR lists them too. If canonization defers one, the canonization PR restores it from that base text, or deletes it when the change added it and there is no base to restore. + **Step definitions** (test automation, always app-local): ``` apps/{surface}/tests/features/{feature}/steps/ @@ -38,11 +43,11 @@ apps/{surface}/tests/features/{feature}/steps/ A scenario belongs at **platform level** if its Given/When/Then language holds true regardless of surface. The words should not reference any specific input mechanism, UI widget, or device capability. -> "Given the user has not consented to analytics, When an unhandled error occurs, Then the error report contains no persistent identifier" +> "Given an invitee has accepted an invitation, When the organizer moves the event, Then the event shows the new time in the invitee's calendar" A scenario belongs at **app level** if its language references a surface-specific interaction model. -> "Given I am on the BreathWork session screen, When I swipe down during an active round, Then haptic feedback fires and the session pauses" +> "Given I am on the day view for Monday, When I swipe left, Then the day view shows Tuesday" **When in doubt:** Write it at platform level. Move to app level only when the scenario cannot be expressed without surface-specific language. @@ -51,9 +56,9 @@ A scenario belongs at **app level** if its language references a surface-specifi ### File naming Use lowercase kebab-case matching the behavior being tested: -- `consent-opted-out-error-reporting.feature` -- `session-completion-tracking.feature` -- `swipe-pause-haptics.feature` (surface-specific) +- `invitation-acceptance.feature` +- `event-reschedule-sync.feature` +- `day-view-swipe-navigation.feature` (surface-specific) ### Feature block @@ -73,8 +78,8 @@ Feature: {Feature name from PRD} ### Writing guidelines - **One behavior per scenario.** A scenario tests one thing. If there are multiple Then clauses, consider whether they are really separate behaviors. -- **Use domain language, not implementation language.** "the user consents to analytics" not "setAnalyticsConsent(true) is called." -- **Avoid UI details in platform scenarios.** "the user enables analytics" not "the user taps the Enable button." UI details belong in surface-specific scenarios. +- **Use domain language, not implementation language.** "the invitee accepts the invitation" not "acceptInvitation(eventId) is called." +- **Avoid UI details in platform scenarios.** "the invitee accepts the invitation" not "the invitee taps the Accept button." UI details belong in surface-specific scenarios. - **Acceptance criteria map to scenarios.** Each acceptance criterion from a user story should have at least one corresponding scenario. - **Tag surface-specific scenarios.** Use `@mobile`, `@tv`, `@web` tags at the Feature or Scenario level for surface-specific files. - **Preserve foundation constraints.** Add scenario coverage for constitutional behaviors when relevant, and do not weaken `MUST` or `MUST NOT` language. @@ -83,37 +88,35 @@ Feature: {Feature name from PRD} ### Example: Platform-level scenario ```gherkin -Feature: Consent-tiered error reporting - Error reports are always sent but detail varies by consent state. - - Scenario: Error report for opted-out user contains no identifier - Given the user has not consented to analytics - When an unhandled error occurs - Then an error report is sent to the error tracking service - And the report contains a stack trace - And the report contains no persistent user identifier - - Scenario: Error report for opted-in user includes anonymous ID - Given the user has consented to analytics - When an unhandled error occurs - Then an error report is sent to the error tracking service - And the report contains a stack trace - And the report contains the user's anonymous identifier +Feature: Invitation responses + An invitee's response decides whether the event joins their calendar. + + Scenario: Accepting an invitation adds the event to the invitee's calendar + Given an organizer has invited me to an event + When I accept the invitation + Then the event appears in my calendar + And the organizer sees my response as accepted + + Scenario: Declining an invitation leaves the invitee's calendar unchanged + Given an organizer has invited me to an event + When I decline the invitation + Then the event does not appear in my calendar + And the organizer sees my response as declined ``` ### Example: Surface-specific scenario ```gherkin @mobile -Feature: Session pause via gesture - Mobile users can pause an active session with a swipe gesture. - - Scenario: Swipe down pauses active breathing round - Given I am on the BreathWork session screen - And a breathing round is active - When I swipe down - Then the session pauses - And haptic feedback fires +Feature: Day view swipe navigation + Phone users move between days with a swipe gesture. + + Scenario: Swipe left shows the next day + Given I am on the day view for Monday + And Tuesday has two events + When I swipe left + Then the day view shows Tuesday + And Tuesday's two events are listed ``` ## Traceability @@ -129,7 +132,9 @@ This makes it possible to audit which stories have scenario coverage and which d ## Quality Criteria -Scenarios are ready for Implementation Planning when: +Scenarios are ready for Promotion when the criteria below hold. Implementation starts only after the promotion PR merges and the handoff is sent. + +Criteria: - Every user story acceptance criterion has at least one corresponding scenario - Platform-level and surface-specific scenarios are filed in the correct locations - Scenarios use domain language, not implementation language diff --git a/plugins/product-development/skills/product-development/references/board-mapping-github-projects.md b/plugins/product-development/skills/product-development/references/board-mapping-github-projects.md new file mode 100644 index 0000000..fb29062 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/board-mapping-github-projects.md @@ -0,0 +1,463 @@ +# Board Mapping: GitHub Projects + +Load this reference with [board-mapping.md](board-mapping.md) when the project's board is a GitHub project. The model, the closed-PR rule and the repository-wins rule are in that file; this one says how to apply them with GitHub Projects and the `gh` CLI. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +Every `gh project` command below that writes to the board runs only after the maintainer approves that write. Read-only commands (`gh project view`, `field-list` and `item-list`, `gh issue view`, `gh pr view` and the `gh api` reads below) need no approval. + +## Setup + +`gh` needs the `project` scope. Check with `gh auth status`; if the scope is missing, tell the maintainer that the next command opens a browser authorization for GitHub Projects access, then run: + +```sh +gh auth refresh -s project +``` + +Name the project, its owner and the repository once per session. `OWNER` is the organization or user that owns the project; use `@me` for a project you own. `REPO` is the repository whose `docs/product/` holds the changes. Every `gh pr` command and REST call below names it, with `--repo "$REPO"` or `repos/$REPO/`, so it reads that repository whichever directory the shell is in. + +```sh +OWNER= +PROJECT= # for a new board, set below +REPO=/ +SINGLE_REPO_BOARD=no # yes only once the maintainer confirms; see draft items below +``` + +For a new board, create the project, keep its number in `PROJECT`, and link it to the repository. For an existing board, skip to the field. Pass the bare repository name to `--repo`: `gh` looks it up under the project's owner. With `OWNER=@me`, a full `OWNER/REPO` fails `gh`'s check that both name the same owner, because `@me` is not a login. + +```sh +PROJECT=$(gh project create --owner "$OWNER" --title " changes" --format json --jq .number) +gh project link "$PROJECT" --owner "$OWNER" --repo +``` + +Add the "Spec state" field, a single-select field whose options are the seven change states in order: + +```sh +gh project field-create "$PROJECT" --owner "$OWNER" --name "Spec state" \ + --data-type SINGLE_SELECT \ + --single-select-options "Idea,Shaping,In review,Ratified,Shipped,Canonized,Dropped" +``` + +Before adding any item, turn off automation. On this project, turn off every workflow in [Built-in workflows](#built-in-workflows), Sync with issue status included. Then check every project that holds the change's issue, not only this one: an issue can sit on several projects, and a workflow on any of them can close it. List the projects that hold an issue: + +```sh +gh issue view --repo "$REPO" --json projectItems --jq '.projectItems[].title' +``` + +The listing shows only the projects the `gh` token can read. A project the token can't see, such as one owned by another organization, is left out, so an empty listing does not prove the issue is on no other project. Unless the maintainer confirms that the token can read every project that could hold the issue, ask the maintainer to confirm which projects hold it. + +Then ask the maintainer to confirm that Auto-close issue, Sync with issue status and Auto-add sub-issues to project are off on each project that holds the issue, and on each project that holds its parent issue, if it has one: Auto-add sub-issues to project adds an issue to a project through its parent. Add no item until every check passes. + +Add one item per change, titled with the change's identity. Track the change with an issue, or with a draft item when it has no issue. Use a draft item only on a board dedicated to one repository: a draft item has no repository, so on a board shared by several, two repositories' changes with the same identity can't be told apart. Set `SINGLE_REPO_BOARD=yes` only after the maintainer confirms that the board holds this repository's changes and no other's. Until then, the helpers below match no draft item, and stop when a draft item carries the change's identity. + +```sh +# An issue that tracks the change +gh project item-add "$PROJECT" --owner "$OWNER" --url https://github.com///issues/ + +# A draft item +gh project item-create "$PROJECT" --owner "$OWNER" \ + --title "shared-calendars/invite-expiry" --body "Change: docs/product/shaping/shared-calendars--invite-expiry/" +``` + +Never add a promotion PR to the board. + +These helpers list the board, look up the IDs that `gh project item-edit` takes, find promotion PRs and check them for closing references. They were checked against `gh` 2.100. In `gh project item-list --format json`, each field's value sits under a key made from the field's name with only its first letter lowercased, so the "Spec state" field exports as `spec state` (a field named "Spec State" would export as `spec State`). The helpers need bash: they use here-strings and `$'…'` quoting, which `sh` and Dash can't parse. + +```bash +PROJECT_ID=$(gh project view "$PROJECT" --owner "$OWNER" --format json --jq .id) +FIELD_ID=$(gh project field-list "$PROJECT" --owner "$OWNER" --format json \ + --jq '.fields[] | select(.name == "Spec state") | .id') + +# Every helper exits non-zero, and says why, when a read fails or comes back +# incomplete. Treat that as "not checked": stop and report, and never act on +# what it printed. + +# board_items: one line per item: item ID, content type, repository, number, +# title, Spec state. Stops if the listing holds fewer items than the board. +board_items() { + gh project item-list "$PROJECT" --owner "$OWNER" --limit 1000 --format json --jq ' + if (.items | length) < .totalCount + then error("board_items: listed \(.items | length) of \(.totalCount) items") + else .items[] | [.id, .content.type, .content.repository, .content.number, + .content.title, (."spec state" // "none")] | @tsv + end' +} + +# item_id /: the ID of the one item whose title is that +# identity or starts with it and a space: an issue in $REPO, with the +# repository name compared case-insensitively, or a draft item when +# SINGLE_REPO_BOARD=yes. Fails unless exactly one matches, and fails when a +# draft item matches on a board not confirmed as single-repository. +item_id() { + local items rows ids + items=$(board_items) || return 1 + rows=$(printf '%s\n' "$items" | awk -F'\t' -v want="$1" -v repo="$REPO" ' + (($2 == "Issue" && tolower($3) == tolower(repo)) || $2 == "DraftIssue") && + ($5 == want || index($5, want " ") == 1) { print $2, $1 }') + if [ "$SINGLE_REPO_BOARD" != yes ] && grep -q '^DraftIssue ' <<< "$rows"; then + echo "item_id $1: draft item matches, but the board is not confirmed as $REPO's alone:" \ + $(awk '$1 == "DraftIssue" { print $2 }' <<< "$rows") >&2 + return 1 + fi + ids=$(awk '{ print $2 }' <<< "$rows") + if [ "$(printf '%s' "$ids" | grep -c .)" -ne 1 ]; then + echo "item_id $1: want one issue in $REPO or draft item, found:" ${ids:-none} >&2 + return 1 + fi + printf '%s\n' "$ids" +} + +# set_spec_state / : set the change's one item to that +# state. Writes nothing unless the item and the state's option are both found. +set_spec_state() { + local item option + item=$(item_id "$1") || return 1 + option=$(gh project field-list "$PROJECT" --owner "$OWNER" --format json \ + --jq ".fields[] | select(.name == \"Spec state\") | .options[] | select(.name == \"$2\") | .id") || return 1 + if [ -z "$option" ]; then + echo "set_spec_state: Spec state has no option named $2" >&2 + return 1 + fi + if [ -z "$PROJECT_ID" ] || [ -z "$FIELD_ID" ]; then + echo "set_spec_state: PROJECT_ID or FIELD_ID is empty; look them up again" >&2 + return 1 + fi + gh project item-edit --id "$item" --project-id "$PROJECT_ID" \ + --field-id "$FIELD_ID" --single-select-option-id "$option" +} + +# promotion_change : the change a pull request promotes, as +# {feature}/{change}. A file counts when it leaves shaping/{feature}--{change}/ +# (renamed away or removed) and one arrives in features/{feature}/changes/{change}/ +# (renamed in or added), for the same feature and change. Exits non-zero when +# it reads fewer files than the pull request changed. +promotion_change() { + local total moves got + total=$(gh api "repos/$REPO/pulls/$1" --jq .changed_files) || return 1 + # One "file" line per file read, then one line per move out of shaping or into changes. + moves=$(gh api --paginate "repos/$REPO/pulls/$1/files" --jq '.[] + | "file", + (select(.status == "renamed" or .status == "removed") + | (.previous_filename // .filename) + | capture("^docs/product/shaping/(?[^/]+)/") | "from \(.dir)"), + (select(.status == "renamed" or .status == "added") + | .filename | select(startswith("docs/product/features/") and (contains("/changes/archive/") | not)) + | capture("^docs/product/features/(?[^/]+)/changes/(?[^/]+)/") + | "to \(.f)--\(.c) \(.f)/\(.c)")') || return 1 + got=$(grep -cx 'file' <<< "$moves") + if [ "$got" -ne "$total" ]; then + echo "promotion_change $1: read $got of $total files; check the rest by hand" >&2 + return 1 + fi + printf '%s\n' "$moves" | + awk '$1 == "from" { from[$2] = 1 } $1 == "to" { to[$2] = $3 } + END { for (dir in to) if (dir in from) print to[dir] }' | sort +} + +# closing_refs : everything that would close an issue when the pull +# request merges: closing keywords in its title, body or commit messages, and the +# issues GitHub links to close (keywords and Development-sidebar links). +# Prints nothing when the pull request uses plain references only. Exits +# non-zero when a read fails or misses commits: the PR is then not cleared. +closing_refs() { + local closers total commits got + closers='def closers: [scan("(?i)\\b(?:close[sd]?|fix(?:e[sd])?|resolve[sd]?):?\\s+(?:https://github\\.com/[\\w.-]+/[\\w.-]+/issues/|(?:[\\w.-]+/[\\w.-]+)?#)[0-9]+")] | .[];' + total=$(gh api "repos/$REPO/pulls/$1" --jq .commits) || return 1 + # One bare SHA line per commit read, then one line per closing keyword in it. + commits=$(gh api --paginate "repos/$REPO/pulls/$1/commits" --jq "$closers"' + .[] | .sha[0:7] as $sha | $sha, (.commit.message | closers | "commit \($sha): \(.)")') || return 1 + got=$(grep -cv '^commit ' <<< "$commits") + if [ "$got" -ne "$total" ]; then + echo "closing_refs $1: read $got of $total commits; check the rest by hand" >&2 + return 1 + fi + gh pr view "$1" --repo "$REPO" --json title,body,closingIssuesReferences --jq "$closers"' + ((.title, .body) | closers | "title or body: \(.)"), + (.closingIssuesReferences[] | "closes on merge: \(.url)")' || return 1 + grep '^commit ' <<< "$commits" || true +} + +# promotion_prs: each open promotion PR and the change it promotes, tab-separated +promotion_prs() { + local prs pr changes + prs=$(gh api --paginate "repos/$REPO/pulls?state=open&per_page=100" \ + --jq '.[].number') || return 1 + while read -r pr; do + [ -n "$pr" ] || continue + changes=$(promotion_change "$pr") || return 1 + [ -z "$changes" ] || printf '%s\n' "$changes" | awk -v pr="$pr" '{ print pr "\t" $0 }' + done <<< "$prs" +} + +# promotion_pr_closers: each closing reference in an open promotion PR, one per +# line, prefixed with the PR and the change it promotes. Prints nothing when +# every promotion PR is cleared. +promotion_pr_closers() { + local rows pr change refs + rows=$(promotion_prs) || return 1 + while IFS=$'\t' read -r pr change; do + [ -n "$pr" ] || continue + refs=$(closing_refs "$pr") || return 1 + [ -z "$refs" ] || printf '%s\n' "$refs" | awk -v p="Promotion PR #$pr ($change): " '{ print p $0 }' + done <<< "$rows" +} +``` + +`item_id` looks only at issues in `$REPO`, comparing repository names case-insensitively as GitHub does, and at draft items once `SINGLE_REPO_BOARD=yes`. A pull request on the board never matches, even one titled with the change's identity, and neither does another repository's issue with the same title. Propose each write with the item's repository and number, as `board_items` prints them, such as `example-org/calendar#210`, so the maintainer approves the right item. When it finds no item or more than one, `set_spec_state` stops before writing. Report that as drift: no item means the change has none; more than one means duplicates, which the maintainer resolves before any write. + +## Built-in workflows + +GitHub Projects' built-in workflows write only the **Status** field. Spec state is a separate field, so no built-in workflow can set it. Never hold spec states in **Status**, and never rename **Status** to "Spec state": the workflows would then write spec states on events that don't define them, such as marking a change done when a pull request merges. + +Writing only **Status** does not make them safe. Each one still changes a change's item without the maintainer's approval: it sets the item's **Status**, adds or archives the item, or closes the change's issue. Every board write needs approval. Turn off every built-in workflow and sync that can change a change's item, on the project that holds the changes, before adding any item ([Setup](#setup)). GitHub's defaults change over time, so check each one in the project's Workflows settings rather than trusting a default: + +| Workflow | What it changes | Set to | +|----------|-----------------|--------| +| Item added to project | Sets **Status** on each item added | Off | +| Item reopened | Sets **Status** when a change's issue reopens | Off | +| Item closed | Sets **Status** when a change's issue closes, such as at canonization | Off | +| Pull request merged | Sets **Status** on pull request items, which never belong on this board | Off | +| Pull request linked to issue | Sets **Status** on the change's issue item when a pull request links the issue | Off | +| Code changes requested | Sets **Status** on pull request items | Off | +| Code review approved | Sets **Status** on pull request items | Off | +| Auto-close issue | Closes an issue when its item's **Status** reaches the trigger value, so moving a card closes the change's issue | Off | +| Auto-add to project | Adds matching issues and pull requests to the board | Off | +| Auto-add sub-issues to project | Adds an issue's sub-issues to the board when the issue is on it, so a change's issue can arrive through its parent | Off | +| Auto-archive items | Archives matching items | Off | +| Sync with issue status | Keeps an issue's status and its items' **Status** in step: closing the issue moves its card, and moving a card to a matching option can close or reopen the issue | Off | + +Sync with issue status sits under Workflows, in the Statuses group, or in the **Status** field's settings. + +GitHub can't exempt single items from these workflows: only Auto-add and Auto-archive take filters, and a filter still lets a matching change's item through. If the implementation workflow needs them, isolate it: give changes a project of their own with every workflow off, and run the delivery workflows on another project. A change's issue may also sit on that other project, but there Auto-close issue or Sync with issue status would close the issue when its card moves. Turn both off on every project that holds a change's issue, or keep the issue off that project. GitHub Actions and other automation must not write Spec state, or add, archive or close a change's item, either. + +## Event moves + +Each move follows [Board moves](board-mapping.md#board-moves). The evidence is what the agent checks before proposing the move: + +| Event | Evidence | Spec state | +|-------|----------|-----------| +| The maintainer asks to track an idea | The idea in `docs/product/ideas/` on the default branch | Idea | +| The idea moves to shaping | `docs/product/shaping/{feature}--{change}/` on the default branch | Shaping | +| The promotion PR opens or reopens | `gh pr view --repo "$REPO" --json state` says `OPEN`, and `closing_refs ` prints nothing | In review | +| The promotion PR closes without merging | `gh pr view --repo "$REPO" --json state` says `CLOSED`; the change is still in `shaping/` | Shaping | +| The promotion PR merges | `gh pr view --repo "$REPO" --json state` says `MERGED`; the change is in `features/{feature}/changes/{change}/` | Ratified | +| The Shipped entry lands | A `Shipped: {change}` entry in `features/{feature}/log.md` on the default branch | Shipped | +| The canonization PR merges | The change is in `features/{feature}/changes/archive/YYYY-MM-DD-{change}/` | Canonized | +| The drop lands | The change's directory is gone, and `features/log.md` has its `Dropped change` entry | Dropped | +| A promotion PR closes, and the change is dropped | The shaping directory is gone, and `features/log.md` has both the `Promotion PR closed without merging` entry, outcome Dropped, and the `Dropped change` entry | Dropped | + +A promotion PR must not close the change's issue when it merges ([One item per change](board-mapping.md#one-item-per-change)). GitHub closes an issue on merge for a closing keyword in the PR body, for a closing keyword in a commit message that lands on the default branch, and for an issue linked in the PR's Development sidebar. `closing_refs ` reports all three. It reads the commits from the REST API, page by page, and stops if it read fewer than the pull request holds (the endpoint lists at most 250). Run it when the promotion PR opens or reopens, and run `closing_refs` again just before the maintainer merges, since commits and links can change in between. If `closing_refs` exits non-zero, the PR is not cleared, even when it printed nothing: report the failed read and propose no move. If it prints anything, ask the maintainer to fix it before merging: change the keyword to a plain reference in the body, reword the commit, or remove the issue from the Development sidebar. A squash merge writes a new commit message, edited in the merge dialog; it must hold no closing keyword either. + +Then propose the write, and on approval run, for example: + +```sh +set_spec_state shared-calendars/invite-expiry "Ratified" +``` + +## Correcting drift + +Run a drift check when the maintainer asks, before a planning or review session, or whenever an item's Spec state looks wrong. + +1. List the board: + + ```sh + board_items + ``` + + If it exits non-zero, the board was not read in full: stop and report. Drift found in a partial listing would be wrong. + +2. Derive each change's state from the repository: paths under `docs/product/ideas/`, `shaping/` and each feature's `changes/` and `changes/archive/`, the Shipped entries in each feature log, and the lineage log. List the open promotion PRs and the change each promotes: + + ```sh + promotion_prs + ``` + + `gh pr list --json files` gives one path per renamed file, so it can't show a move from `shaping/` to `changes/`. `promotion_change` reads the pull request's files from the REST API instead (at `repos/$REPO/`, the repository named in [Setup](#setup), not whichever one the current directory belongs to), where a renamed file carries both `previous_filename` and `filename`, and counts a pull request as a promotion only when files leave `shaping/{feature}--{change}/` and arrive in `features/{feature}/changes/{change}/` for the same change. Those files leave `shaping/` because a promotion PR opens only once the change is in `shaping/` on the default branch ([ratification.md](ratification.md#1-prepare-the-promotion-pr)); a pull request that adds a change straight to `features/` shows no such move and is not detected. It stops if it read fewer files than the pull request's `changed_files`, since the files endpoint lists at most 3,000. + + Check that no promotion PR would close an issue: + + ```sh + promotion_pr_closers + ``` + + Each line names the promotion PR, the change, and the closing reference; each `closes on merge` line gives the URL of the issue that would close. That issue may not be the one tracking the change: a closing reference can name any issue. A promotion PR must close none, so report every line as in [Event moves](#event-moves), naming the issue it would close. If `promotion_pr_closers` exits non-zero, a read failed: report which, and treat the PRs as not cleared. + +3. Compare. Drift is any of: an item whose Spec state differs from the repository's state; a change with no item; an item that matches no change; a change with two items; a pull request on the board as a change's item. + +4. Report each drift as a table (item with its repository and number, board value, repository value, evidence) and propose one write per row. Run no `gh project` write until the maintainer approves. Then apply the approved rows only: + + ```sh + set_spec_state shared-calendars/decline-with-note "Ratified" + ``` + + To take a pull request off the board, after approval, delete its item; `board_items` prints the item ID: + + ```sh + gh project item-delete "$PROJECT" --owner "$OWNER" --id + ``` + +5. List the board again and confirm each corrected item now matches the repository. + +## Walkthrough + +The example product is a shared calendar. Its board, project 7 owned by `example-org`, holds one item per change, all from the repository `example-org/calendar` (`OWNER=example-org`, `PROJECT=7`, `REPO=example-org/calendar`). The walkthrough follows the change `shared-calendars/invite-expiry`, tracked by issue #210 (invitation expiry), from idea to canonization, then a dropped change and a drift check. Before it starts, the board reads: + +| Item | Content | Spec state | +|------|---------|-----------| +| `shared-calendars/decline-with-note` | Issue #198 (decline with a note) | Ratified | +| `shared-calendars/recurring-invitations` | Issue #201 (recurring invitations) | Ratified | + +Each step names the evidence, the move the agent proposes, and the command it runs once the maintainer approves. + +### Idea + +The maintainer records `docs/product/ideas/invite-expiry.md` and asks to track it. The agent opens issue #210 titled `invite-expiry` with the maintainer's approval. Before adding it, the agent lists the projects that hold #210: + +```sh +gh issue view 210 --repo example-org/calendar --json projectItems --jq '.projectItems[].title' +``` + +It prints nothing. The token can't read every project that could hold #210, so the empty listing proves nothing on its own: the agent asks, and the maintainer confirms that #210 is on no other project and has no parent issue. Every built-in workflow and Sync with issue status are already off on project 7, so the agent proposes adding the issue to the board at Idea: + +```sh +gh project item-add 7 --owner example-org --url https://github.com/example-org/calendar/issues/210 +set_spec_state invite-expiry "Idea" +``` + +### Shaping + +The maintainer moves the idea to `docs/product/shaping/shared-calendars--invite-expiry/`, and that commit lands on the default branch. The item becomes a change: the agent proposes retitling issue #210 to `shared-calendars/invite-expiry` and moving it to Shaping. + +```sh +gh issue edit 210 --title "shared-calendars/invite-expiry" +set_spec_state shared-calendars/invite-expiry "Shaping" +``` + +### In review + +The promotion PR #214 (promote invite-expiry) opens. Its body and its commit say `Refs #210`, with no closing keyword. The agent checks the evidence: + +```sh +gh pr view 214 --repo "$REPO" --json state --jq .state +closing_refs 214 +``` + +The first prints `OPEN`; `closing_refs` prints nothing. The agent proposes In review, and once the maintainer approves: + +```sh +set_spec_state shared-calendars/invite-expiry "In review" +``` + +### Promotion PR closed without merging + +The maintainer closes the promotion PR, #214, without merging: the expiry window needs more work. The change is still in `shaping/`, so the agent proposes Shaping, and on approval runs: + +```sh +set_spec_state shared-calendars/invite-expiry "Shaping" +``` + +The next commit to the default branch that touches `docs/product/` adds to `features/log.md`: + +```markdown +## 2026-11-03 + +- **Promotion PR closed without merging:** shared-calendars/invite-expiry + - Reason: The expiry window was undecided; organizers asked for a per-calendar setting. + - PR: #214 (promotion PR for invitation expiry) + - Outcome: Returned to shaping +``` + +### In review again + +The maintainer reworks the change on the promotion PR's branch, adding a per-calendar expiry window, and reopens the original promotion PR: + +```sh +gh pr reopen 214 --repo "$REPO" +``` + +The agent checks that #214 is open again and still closes nothing: + +```sh +gh pr view 214 --repo "$REPO" --json state --jq .state +``` + +```text +OPEN +``` + +```sh +closing_refs 214 +``` + +`closing_refs` prints nothing. The agent proposes moving the item back to In review, and once the maintainer approves: + +```sh +set_spec_state shared-calendars/invite-expiry "In review" +``` + +### Ratified + +Just before the merge, the agent runs `closing_refs 214` once more, and it prints nothing. Then #214 merges, and the change is in `features/shared-calendars/changes/invite-expiry/`. The agent proposes Ratified. Issue #210 stays open because #214 does not close it. On approval: + +```sh +set_spec_state shared-calendars/invite-expiry "Ratified" +``` + +### Shipped + +The project's ship signal is a release reaching all users. Release 2.4.0 does, with the implementation from PR #231 (build invitation expiry). Nothing moves yet: the repository still says Ratified. PR #236 (record invite-expiry shipped) adds the Shipped entry to `features/shared-calendars/log.md`: + +```markdown +## 2026-11-24 + +- **Shipped:** invite-expiry + - Change: invite-expiry + - Ship signal: Release 2.4.0 reached all users. + - Evidence: https://github.com/example-org/calendar/releases/tag/v2.4.0 +``` + +Once #236 merges, the agent proposes Shipped, citing the entry, and once the maintainer approves: + +```sh +set_spec_state shared-calendars/invite-expiry "Shipped" +``` + +Canonization is now due. + +### Canonized + +The canonization PR #240 (canonize invite-expiry) merges. The change is in `features/shared-calendars/changes/archive/2026-12-01-invite-expiry/`, and the feature log has its Canonized entry. The agent proposes Canonized, and closing issue #210, now that the change is done: + +```sh +set_spec_state shared-calendars/invite-expiry "Canonized" +gh issue close 210 --reason completed +``` + +### Dropped + +The maintainer withdraws `shared-calendars/recurring-invitations` while it is Ratified. PR #244 (drop recurring-invitations) deletes `features/shared-calendars/changes/recurring-invitations/` and adds its `Dropped change` entry to `features/log.md`. Once #244 merges, the agent proposes Dropped and closing issue #201 as not planned: + +```sh +set_spec_state shared-calendars/recurring-invitations "Dropped" +gh issue close 201 --reason "not planned" +``` + +### Drift + +A teammate drags `shared-calendars/decline-with-note` to Shipped after its implementation PR merges. The drift check finds no Shipped entry for `decline-with-note` in the feature log, so the repository says Ratified. The agent reports: + +| Item | Board | Repository | Evidence | +|------|-------|------------|----------| +| `shared-calendars/decline-with-note` (`example-org/calendar#198`) | Shipped | Ratified | `features/shared-calendars/changes/decline-with-note/`; no `Shipped: decline-with-note` entry in `features/shared-calendars/log.md` | + +It proposes setting the item back to Ratified, and asks whether the project's ship signal has fired. If it has, recording the Shipped entry is repository work, through the Ship Signal and Canonization workflow; the item moves to Shipped once that entry lands. The maintainer approves the correction: + +```sh +set_spec_state shared-calendars/decline-with-note "Ratified" +``` + +The board now reads: + +| Item | Content | Spec state | +|------|---------|-----------| +| `shared-calendars/decline-with-note` | Issue #198 (decline with a note) | Ratified | +| `shared-calendars/recurring-invitations` | Issue #201 (recurring invitations) | Dropped | +| `shared-calendars/invite-expiry` | Issue #210 (invitation expiry) | Canonized | diff --git a/plugins/product-development/skills/product-development/references/board-mapping.md b/plugins/product-development/skills/product-development/references/board-mapping.md new file mode 100644 index 0000000..466064c --- /dev/null +++ b/plugins/product-development/skills/product-development/references/board-mapping.md @@ -0,0 +1,79 @@ +# Board Mapping + +Load this reference when a project tracks its changes on a board, such as GitHub Projects, Jira or Linear, and you add a change to the board, move its item, or check the board against the repository. It maps change states to a board in terms no service owns. A per-service reference says how to apply it on one service. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +## The model + +The board shows each change's change state. The states, and where each one comes from, are defined in [changes-and-deltas.md](changes-and-deltas.md#change-states); this table repeats them without the OKF column: + +| State | Where the change sits | Signal | +|-------|----------------------|--------| +| Idea | `ideas/` | — | +| Shaping | `shaping/{feature}--{change}/` | — | +| In review | `shaping/{feature}--{change}/` | Its promotion PR is open | +| Ratified | `features/{feature}/changes/{change}/` | Its promotion PR merged | +| Shipped | `features/{feature}/changes/{change}/` | A feature-log entry records the ship signal | +| Canonized | `features/{feature}/changes/archive/YYYY-MM-DD-{change}/` | — | +| Dropped | Deleted | A lineage-log entry records the drop and its reason | + +An Idea is a document in `ideas/`, not yet a change. When the maintainer moves it to `shaping/`, it becomes a change, and its board item follows it. + +Ratified and Shipped share a path: the feature log tells them apart. In review is read from the forge, not the tree. Read paths and log entries from the default branch. A move that sits on an unmerged branch has not happened yet. + +## Board moves + +An item moves when the repository or the forge records the event, never before: + +| Event | Spec state | +|-------|-----------| +| The maintainer asks to track an idea in `ideas/` | Idea | +| The idea, moved to `shaping/{feature}--{change}/`, lands on the default branch | Shaping | +| The change's promotion PR opens, or a closed one reopens | In review | +| The promotion PR closes without merging | Shaping | +| The promotion PR merges | Ratified | +| The feature log's Shipped entry for the change lands on the default branch | Shipped | +| The canonization PR merges, archiving the change to `changes/archive/` | Canonized | +| The PR that deletes the change and adds its Dropped change entry to the lineage log merges | Dropped | + +The ship signal alone does not move an item. When the signal fires, record the Shipped entry first (the Ship Signal and Canonization workflow in `SKILL.md`); the item moves once that entry is on the default branch. Until then, the repository says Ratified. + +A Shipped change cannot be dropped, so no item moves from Shipped to Dropped. + +## Closed promotion PRs + +A promotion PR closed without merging returns the change to Shaping: its documents are still in `shaping/{feature}--{change}/`, because a promotion PR opens only once the change is in `shaping/` on the default branch ([ratification.md](ratification.md#1-prepare-the-promotion-pr)). The lineage log, `features/log.md`, gets a "Promotion PR closed without merging" entry saying why. A closed PR can't carry its own entry, so the next commit to the default branch that touches `docs/product/` adds it ([feature-bundles.md](feature-bundles.md#lineage-log)). + +If the maintainer drops the change instead, the lineage log gets both entries: the "Promotion PR closed without merging" entry, with the outcome Dropped, and a "Dropped change" entry with the drop's reason and the state when dropped ([feature-bundles.md](feature-bundles.md#lineage-log)). The PR that adds the Dropped change entry also deletes the shaping directory. The item moves to Dropped only once the PR that deletes the shaping directory and adds the Dropped change entry merges; until then it stays at Shaping. + +## The repository wins + +The repository is the authority: paths, the promotion PR's state, and the feature-log entry that records the ship signal. The board is a view of it, never a source. When the board disagrees, the repository wins: + +1. Derive each change's state from the repository, as in [The model](#the-model). +2. Compare it with each item's Spec state. Also look for changes with no item, items that match no change, and changes with more than one item. +3. Report each drift to the maintainer: the item, the board's value, the repository's value and the evidence (a path, a PR or a log entry). +4. Correct the board once the maintainer approves, for each item or for a listed batch. + +Never change the repository to match the board. A board value never moves a file, opens, merges or closes a PR, or writes a log entry. If the repository itself looks wrong, such as a change that shipped with no Shipped entry, raise it with the maintainer as repository work, not board work. + +Every board write needs the maintainer's approval: adding an item, setting or correcting its Spec state, retitling, archiving or deleting it. Propose each write with its evidence, then wait. No sync bot or automation moves an item on its own. + +## One item per change + +Each change has one board item, an issue or a draft item, never its promotion PR. The canonization PR and the implementation PRs aren't the change's item either. + +- **Title.** The item's title starts with the change's identity, `{feature}/{change}` ([changes-and-deltas.md](changes-and-deltas.md#naming)), such as `shared-calendars/invite-expiry`, so a drift check can match items to changes. An idea's item starts with the idea's ID; when the idea becomes a change, the item is retitled. +- **Field.** A single-select field, "Spec state", holds the state. Its options are the seven states, in the order of [The model](#the-model). +- **Linking PRs.** A promotion PR links the change's issue with plain references, such as `Refs #`, in the PR body and in every commit message, never a closing keyword (`Closes`, `Fixes`, `Resolves`), and with no closing link set on the forge, such as GitHub's Development sidebar. A merged promotion PR means Ratified, not done: closing the issue at ratification would tell the board the work is finished. Check this before the promotion PR merges: when it opens or reopens, and again just before the merge, since commits and links can change in between. A squash merge's commit message counts too. The issue stays open until the change is Canonized or Dropped. + +## Spec states only + +This mapping covers spec states. Delivery states, such as in progress, in code review or blocked, are out of scope: they belong to the implementation workflow. The two can share a board as separate fields: Spec state for the change, and the implementation workflow's own field for its work. Neither field is derived from the other. A delivery event moves Spec state only through the repository: an implementation PR merging moves the item to Shipped only if the project names that merge as its ship signal, and only once the Shipped entry is recorded. + +## Per-service references + +| Service | Reference | +|---------|-----------| +| GitHub Projects | [board-mapping-github-projects.md](board-mapping-github-projects.md) | + +For a service with no reference here, apply the model directly: one item per change, a single-select field named "Spec state" with the seven options, no service automation that writes it, moves on the events in [Board moves](#board-moves), and drift corrected after the maintainer approves. diff --git a/plugins/product-development/skills/product-development/references/canonization.md b/plugins/product-development/skills/product-development/references/canonization.md new file mode 100644 index 0000000..7d0f613 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/canonization.md @@ -0,0 +1,179 @@ +# Canonization + +Load this reference when a ratified change's ship signal fires, or when a Shipped change is due for canonization. It is the workflow that keeps a feature spec true once its changes ship: recording the ship signal, then five steps that make the shipped change part of the feature spec. The change and delta contract it consumes, including the delta format, base text, the base check rules and deferred files, is in [changes-and-deltas.md](changes-and-deltas.md); the bundle layout and log format are in [feature-bundles.md](feature-bundles.md). Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +This is a workflow, not a stage. The change stays in `features/{feature}/changes/{change}/` from ratification until step 4 archives it. + +Implementation is not part of it. The handoff ([implementation-handoff.md](implementation-handoff.md)) gives the ratified change to the implementation workflow, `delivery-engineering` or the project's own, and that workflow owns everything from planning to merge, including the file and test evidence for each requirement. Canonization starts when the ship signal fires. + +## The ship signal + +Each project names its ship signal: the event that makes a change live, such as the implementation PR merging, a release, or a feature flag reaching everyone. Before it fires, whoever fires it runs the Release Check (`SKILL.md`, Release Check). + +When it fires, record a Shipped entry in the feature log, `features/{feature}/log.md`, with the signal and a link to its evidence. The entry is how a reader tells a Shipped change from a Ratified one, since both sit in `changes/{change}/`, so the state survives a restart: an agent that picks the work up later reads the log, not a chat. Land it on the default branch when the signal fires, before canonization starts, in a commit or PR of its own, with the maintainer's approval, as for any write to GitHub. Until it lands, the repository and the board still record the change as Ratified ([board-mapping.md](board-mapping.md)). If the feature log already has a Shipped entry for the change, reuse it: canonization resumed after a restart never records the signal twice. + +```markdown +## 2027-03-01 + +- **Shipped:** working-hours + - Change: working-hours + - Ship signal: release 4.4 reached all users. + - Evidence: [release 4.4](https://example.com/releases/4.4), which includes implementation PR #148 +``` + +Link evidence that outlives canonization: a release, a merged implementation PR, a flag change record. Once the entry lands, the change is Shipped, and canonization is due. Several Shipped changes to one feature are canonized one at a time. Changes the overlap check reported are canonized in the order the maintainer recorded for them at the overlap check, in the later change's promotion PR ([changes-and-deltas.md](changes-and-deltas.md#overlap-check)); other changes, in ship order. Check the recorded order as soon as either of the overlapping changes ships. If a change ships while a change ordered before it is still Ratified, ask the maintainer before canonizing the one that shipped. If the recorded order otherwise conflicts with the order the changes actually shipped, for example when both ship in one release or the rollout order changed, ask the maintainer which order to use before canonizing either. Record the answer in the canonization PR's body. + +## The five steps + +Canonization starts once the Shipped entry is on the default branch. The agent drafts each step and the maintainer decides. Work on a branch for the canonization PR; nothing is applied to the default branch until that PR merges. + +### 1. Coverage check + +Account for each item in the change as shipped, changed or deferred: + +- each spec unit in its deltas: the `ADDED`, `MODIFIED` and `REMOVED` entries; +- each story file; +- each scenario in each scenario file, with its own outcome. The scenarios' outcomes decide the file's entry: if every scenario in the file is deferred, the reconciled deltas drop its entry and the file stays in the archived change ([changes-and-deltas.md](changes-and-deltas.md#deferred-stories-and-scenarios)). Otherwise the file is still applied as one whole-file unit, its entry carrying only the shipped scenarios, as the text they reconcile to; +- each `DOCUMENT` entry; +- each app-local scenario file the deltas list. + +Base the accounting on the evidence the Shipped entry links and on what the implementation workflow reports. Cite that evidence; don't redo the implementation workflow's own checks. Propose the accounting to the maintainer as a table: + +```markdown +| Item | Outcome | Evidence or reason | +|------|---------|--------------------| +| FR-03 | changed | Ships as outside working hours, not as busy (implementation PR #148) | +| FR-04 | deferred | Not in release 4.4 | +``` + +- **Shipped:** the item went live as ratified. +- **Changed:** it went live with a different meaning. A change in meaning needs the maintainer's approval of the text that shipped. An edit that keeps the meaning, such as clearer wording, is not a change. +- **Deferred:** it did not go live. Each deferred item becomes a shaping item: a shaping document in `shaping/{feature}--{change}/`, with `x-amends: {feature}`, that starts from copies of the deferred text and files and links the archived change. Name the new change for what it delivers. It is shaped, ratified and canonized like any other change; nothing in it is ratified yet. A deferred spec unit keeps its ID in the archive as provenance, and IDs are never reused ([feature-bundles.md](feature-bundles.md#spec-units)): when the follow-up change's delta is drafted, it assigns the next free ID to a deferred addition. A deferred modification or removal keeps targeting the existing unit's ID: a deferred revision to `FR-02` still modifies `FR-02`. + +Then write the reconciled deltas, the deltas to be applied: deferred units are left out, and changed units carry the approved text. A story or scenario file that is partly shipped, or a whole-file unit that changed in meaning or was rebased, carries its reconciled text in its entry, so canonization writes that text at the feature root instead of moving the ratified file; it, an app-local file and a `DOCUMENT` entry are reconciled as [changes-and-deltas.md](changes-and-deltas.md#deferred-stories-and-scenarios) describes. The ratified deltas stay as they were, for the archive. The reconciled deltas are working copies: the canonization PR shows their effect on the feature spec, its body holds the accounting, and the Canonized log entry records the outcome. + +### 2. Base check + +Run the base check ([changes-and-deltas.md](changes-and-deltas.md#base-check)) on the reconciled deltas against the current feature spec. Each modified or removed spec unit must still match the base text the delta recorded. + +If the feature spec has drifted, usually because another change was canonized after this one was ratified, the delta is rebased first, and the maintainer confirms any change in meaning. Write the rebase into the reconciled deltas only: the rebased entry records the unit as it now stands as its base text, and the change's edit on top of it as its new text. A rebased story or scenario file does the same, with the whole file as both. An `ADDED` ID that is now taken is renumbered. + +Run it again against the latest feature spec on the default branch just before the canonization PR merges. If a change was canonized in the meantime, rebase again. + +### 3. Apply the reconciled deltas + +Apply the reconciled deltas to the feature spec, and move the story and scenario files the reconciled deltas list to the feature root. A whole-file unit whose reconciled entry carries text, because it was split, changed or rebased, is written from that text at the feature root, and the change's own file stays with the change; a deferred file stays with the change. App-local scenario files are restored or rewritten as the contract says; they don't move. + +Check the result before going on: + +- The feature spec and the feature-root stories and scenarios describe only what shipped, in durable tense ([feature-bundles.md](feature-bundles.md#durable-tense)). +- Each unit ID appears once across the feature's spec documents. +- Every relative link in text the deltas wrote resolves. +- A feature-root scenario that now fails means the implementation and the spec have diverged. Raise it with the maintainer before the PR merges. + +A lineage change may empty another feature's bundle; [feature-bundles.md](feature-bundles.md#no-stub-bundles) says when that bundle is deleted and when canonization is refused. + +### 4. Archive the change + +Move what is left of the change to `changes/archive/YYYY-MM-DD-{change}/`, dated the day of canonization. The ratified deltas keep their payloads: every `Text:`, `New text:` and base text stays as ratified, never the reconciled or rebased text, so the archive shows what the maintainer approved. Deferred story and scenario files stay in the archive, where the shaping item's copies came from. In the archived documents, set OKF `status` from `stable` to `deprecated`, and change no wording. + +The move breaks relative links in both directions, so the same PR updates them; a rebased link changes its path, never its label or the text around it: + +- **Links into the change** from the rest of the bundle, including the back-links in the target rows of approved deferrals, whose `Deferred from` link points at a question row in the change. +- **Links out of the archived change**, which gain one directory level, including the **Deferred to** links of its deferred rows, which must still reach their open target rows ([open-questions.md](open-questions.md#deferral)). + +The open-questions worked example walks both links through this move ([open-questions.md](open-questions.md#worked-example), step 3). + +The change is now Canonized. From the project root, regenerate the indexes, then check them, so a link the move broke or a stale index fails here instead of on the default branch: + +```bash +python3 "/scripts/open-questions.py" index --pending {unconverted} docs/product +python3 "/scripts/okf-profile.py" index --pending {unconverted} docs/product +python3 "/scripts/open-questions.py" check --pending {unconverted} docs/product +python3 "/scripts/okf-profile.py" check --pending {unconverted} docs/product +``` + +`--pending {unconverted}` stands for one `--pending` for each feature folder written with 0.1.0 that awaits modernization, so no command fails on such a folder or writes an index into it ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). With no such folder, drop it. + +The open-questions index drops the archived change's rows, since the change archive is history, and keeps their open target rows. The generator refuses to run while any question link does not resolve. + +### 5. Write the feature-log entry + +Append a Canonized entry to the feature log in the [log format](feature-bundles.md#feature-log). Link the archive, which outlives canonization, and record: + +- **Outcome:** what was applied: the units added, modified and removed, and the files moved to the feature root; +- **Changed in meaning:** each changed item, what shipped instead, why, and the maintainer's approval; +- **Deferred:** each deferred item and the shaping item it went to; +- **Rebased:** each rebased unit, what it had drifted from, and the maintainer's confirmation; +- **Links:** the canonization PR. + +Write "Nothing deferred." in the outcome when nothing was, and leave out a field that has nothing to record. A lineage event, such as a merge that deletes a bundle, also gets a lineage-log entry. + +## The canonization PR + +One PR canonizes one change. It holds the applied deltas, the moved files, the archived change with its rebased links, the links into it, the shaping items for deferrals, the Canonized log entry and the regenerated OKF and open-questions indexes. Its body holds the coverage table, the base-check result with any rebased unit, and the list of shaping items. + +Opening it waits for the maintainer's approval, like every write to GitHub (`SKILL.md`, GitHub Writes). The maintainer confirms any change in meaning, any deferred item and any rebased delta before it merges, and the base check runs again just before the merge. When the project tracks changes on a board, the merge moves the change's item to Canonized ([board-mapping.md](board-mapping.md)). + +## Worked example + +The `availability` feature of a shared-calendar product lets members see when others are free. Its `free-busy.md` facet spec has `FR-01 Free/busy sharing` and `FR-02 Busy blocks`. Two changes were ratified close together: + +- **`tentative-events`** modifies `FR-02` so a tentative event shows as a tentative block. +- **`working-hours`** adds `FR-03 Working hours` ("Others see the time outside those hours as busy"), adds `FR-04 Working hours across time zones`, modifies `FR-02` to show the start and end of the member's working day, and adds `stories/US-002-set-working-hours.md`, `stories/US-003-working-hours-while-travelling.md` and `scenarios/working-hours.feature`. The scenario file has two scenarios: time outside working hours shows as busy, and working hours follow a time-zone change. + +The overlap check at `working-hours`' promotion PR reported `FR-02`, and the maintainer ordered `tentative-events` first. `tentative-events` shipped and was canonized on 2027-02-01, so `FR-02` now ends with "A tentative event shows as a tentative block." + +**The ship signal.** Release 4.4 reaches all users. A commit to the default branch adds the Shipped entry shown in [The ship signal](#the-ship-signal) to the feature log, linking the release, which includes implementation PR #148. `working-hours` is Shipped and stays in `changes/working-hours/`. + +**1. Coverage check.** Implementation PR #148 and the release notes show what went live. The agent proposes, and the maintainer decides: + +| Item | Outcome | Evidence or reason | +|------|---------|--------------------| +| FR-02 | shipped | Release 4.4 | +| FR-03 | changed | Time outside working hours shows as outside working hours, apart from busy blocks. Shown as busy, a member looked booked every evening. | +| `scenarios/working-hours.feature`: Time outside working hours shows as busy | changed | Ships with FR-03's approved meaning | +| `stories/US-002-set-working-hours.md` | shipped | Release 4.4 | +| FR-04 | deferred | Not in release 4.4 | +| `stories/US-003-working-hours-while-travelling.md` | deferred | Not in release 4.4 | +| `scenarios/working-hours.feature`: Working hours follow a time-zone change | deferred | Not in release 4.4 | + +The maintainer approves the new meaning of `FR-03` and of the first scenario. The reconciled delta carries the approved `FR-03`: + +```markdown +### FR-03 Working hours + +A member sets the hours of their working day. Others see the time outside those hours as outside working hours, shown apart from busy blocks. +``` + +The file is partly shipped, so its entry for `scenarios/working-hours.feature`, still one whole-file unit, carries `Text:` with the first scenario only, rewritten to the approved meaning. `FR-04`, `US-003` and the time-zone scenario are left out, and they start the shaping item `shaping/availability--travel-time-zones/`: a shaping document with `x-amends: availability` that quotes `FR-04` and the time-zone scenario, a copy of `US-003`, and a link to the archived change. `FR-04` stays with the archived change as provenance; the follow-up's delta will add the requirement as `FR-05`, the next free ID. + +**2. Base check.** It fails on `FR-02`: the recorded base text lacks the sentence `tentative-events` added. Applying the delta as ratified would drop that sentence. The reconciled delta is rebased: + +```markdown +### FR-02 Busy blocks + +Others see a member's busy times as blocks, without event details, and the start and end of the member's working day. A tentative event shows as a tentative block. +``` + +The maintainer confirms the meaning is unchanged: both edits stand. The base check passes on the reconciled deltas. + +**3. Apply.** `free-busy.md` gains `FR-03` as approved and the rebased `FR-02`. `US-002` moves to `stories/`, and `scenarios/working-hours.feature` is written with its shipped scenario only. Nothing about time zones reaches the feature spec or the feature root. + +**4. Archive.** The change moves to `changes/archive/2027-03-08-working-hours/`. Its delta is the ratified one, `FR-03` still reading "as busy" and `FR-04` still listed, with `status: deprecated`. `US-003` and the two-scenario `scenarios/working-hours.feature` stay in the archive. `working-hours` is Canonized. + +**5. Log.** The canonization PR, #152, appends: + +```markdown +## 2027-03-08 + +- **Canonized:** working-hours + - Change: [working-hours](changes/archive/2027-03-08-working-hours/) + - Outcome: Added FR-03, `stories/US-002-set-working-hours.md` and the first scenario of `scenarios/working-hours.feature`; modified FR-02. + - Changed in meaning: FR-03 and the first scenario of `scenarios/working-hours.feature`. Time outside working hours shows as outside working hours, apart from busy blocks, instead of as busy: shown as busy, a member looked booked every evening. The maintainer approved the change in the canonization PR. + - Deferred: FR-04, `stories/US-003-working-hours-while-travelling.md` and the time-zone scenario of `scenarios/working-hours.feature`, which release 4.4 did not include. They start the shaping item `shaping/availability--travel-time-zones/`. + - Rebased: FR-02 had drifted since ratification, when tentative-events added "A tentative event shows as a tentative block." The rebased FR-02 keeps that sentence and adds the working day. The maintainer confirmed the meaning is unchanged. + - Links: canonization PR #152 +``` + +The skill's test fixture, `tests/fixtures/canonization/`, runs this example. diff --git a/plugins/product-development/skills/product-development/references/changes-and-deltas.md b/plugins/product-development/skills/product-development/references/changes-and-deltas.md new file mode 100644 index 0000000..44cf4c5 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/changes-and-deltas.md @@ -0,0 +1,326 @@ +# Changes and Deltas + +Load this reference when you shape, promote, check or canonize a change to a feature. It defines the change and delta contract: what a change holds, the delta format, spec-unit IDs and base text, the change states, and the overlap and base checks. Where a feature's documents live is in [feature-bundles.md](feature-bundles.md). Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +## What a change is + +A change is one bounded addition to or revision of a feature, including the feature's first version. Every PRD and TRD describes a change: + +- The **PRD** says what the change does and why. +- The **TRD** says how the change will be built. +- The **deltas** list the spec units the change adds, modifies or removes in the feature spec. +- The change's own **stories** and **scenarios** describe the behavior it adds or revises. + +A change record is dated history: it describes work that has not shipped when it is written, and reads as the record of that work afterwards. Planning tense is correct in its PRD and TRD. Delta text is the exception: canonization applies it to the feature spec word for word, so it is written in the feature spec's durable tense (see [feature-bundles.md](feature-bundles.md#durable-tense)). + +### Classifying the work + +Before shaping, classify what discovery found. Each class is a change, or a lineage event carried by a change: + +| Classification | Path | +|----------------|------| +| Independent new feature | A change in `shaping/` that creates a new feature bundle when ratified | +| Incremental amendment | A small change, with deltas against the existing feature spec | +| Evolution or migration | A change in `shaping/` whose shaping document names its target feature with `x-amends: {feature}`. The ratified feature spec stays in force while the change is worked out. | +| Fundamental change | A change whose deltas replace most of the feature's spec units, or a lineage event (split, merge or drop) recorded in the lineage log `features/log.md` | + +There is no competing feature directory for work on an existing feature. Work that evolves a feature is a change to that feature's bundle, so the feature keeps one lineage. Creating a new feature beside an existing one, or splitting one, is a decision the maintainer makes through the promotion PR. + +### Provenance + +The shaping document records why the change is being made and on what evidence, and the PRD carries that record forward, so the reasons outlive canonization. Fill in each row; write "none" rather than leave one out. + +| Record | What it holds | +|--------|---------------| +| Current artifacts | The feature spec units, contracts and package or API surfaces the change touches, and the implementation constraints it works within | +| Affected consumers | Upstream and downstream owners, surfaces and integrations the change affects, and the follow-up each one needs | +| Compatibility constraints | Public, package, API and data compatibility the change must keep, its migration effect, and who owns any migration work | +| Decisions | Each stakeholder decision: who decided what, and when, the reason, and the assumptions still unresolved | +| Evidence | Internal evidence (issues, reviews, tests, incidents, consumer requirements) and external sources, each with a direct link and the claim each source supports | +| Rejected alternatives | Each alternative considered and why it lost, including keeping the current boundary and creating an independent feature | +| Non-goals and boundaries | For the active delivery team: the scope, refactors and adjacent clean-up the change excludes, and the boundaries its implementation must not cross | + +Discovery is not approval: the record informs the maintainer's decision, and the promotion PR is where it is made. + +## Change states + +A change's state comes from its path, plus two recorded signals: + +| State | Where the change sits | Signal | OKF `status` | +|-------|----------------------|--------|--------------| +| Idea | `ideas/` | — | `draft` | +| Shaping | `shaping/{feature}--{change}/` | — | `draft` | +| In review | `shaping/{feature}--{change}/` | Its promotion PR is open | `draft` | +| Ratified | `features/{feature}/changes/{change}/` | Its promotion PR merged | `stable` | +| Shipped | `features/{feature}/changes/{change}/` | A feature-log entry records the ship signal | `stable` | +| Canonized | `features/{feature}/changes/archive/YYYY-MM-DD-{change}/` | — | `deprecated` | +| Dropped | Deleted | A lineage-log entry records the drop and its reason | — | + +Ratified and Shipped share a path. Read the feature log to tell them apart: a Shipped change has a Shipped entry. In review is read from the forge, not the tree. + +A Shipped change cannot be dropped. Its behavior is live, so withdrawing it is a new change whose deltas remove that behavior, canonized like any other. + +## Naming + +- `{change}` is lowercase kebab-case and names what the change does: `invite-expiry`, `decline-with-note`. A feature's first version is a change like any other; name it for what it delivers. +- `archive` is reserved: `features/{feature}/changes/archive/` holds the change archive, so a change named `archive` would be promoted into it. No change takes that name; promotion refuses it ([ratification.md](ratification.md#1-prepare-the-promotion-pr)). +- A change name is unique within its feature, including the change archive. Two features may each have a change of the same name, so a change is identified by its feature and name, written `{feature}/{change}`, such as `calendar-links/link-expiry`. Checks, reports and logs that span more than one feature name changes this way. +- While shaped, a change lives in `shaping/{feature}--{change}/`, one directory per change. `{feature}` is the feature it creates or amends. A shaping directory never holds more than one change. +- A change to an existing feature names it in its shaping document's front matter, `x-amends: {feature}`. A change that creates a feature has no `x-amends`. + +## Change directory + +``` +shaping/{feature}--{change}/ while shaped and in review + {change}.md shaping document (type: shaping) + PRD.md type: prd + TRD.md type: trd + deltas/{facet}.delta.md type: delta + deltas/{feature-id}/{facet}.delta.md type: delta, against another feature + stories/US--.md type: story + scenarios/*.feature + {feature-id}/stories/, {feature-id}/scenarios/ + files the change adds to another feature + +features/{feature}/changes/{change}/ once ratified, until canonized + (the same files) +``` + +The promotion PR moves the PRD, TRD, deltas, stories and scenarios from the shaping directory to `features/{feature}/changes/{change}/`, sets their `status` to `stable`, adds a Ratified entry to the feature log in the [log format](feature-bundles.md#feature-log), and deletes the shaping directory. The shaping document either moves with the change or is absorbed into the PRD; the PRD keeps the provenance record either way. For a new feature, the promotion PR also creates the feature bundle: a metadata-only feature overview that claims no behavior (see [feature-bundles.md](feature-bundles.md#feature-bundle-layout)), `log.md` and `changes/`. A split into a new feature initializes the receiving bundle the same way (see [feature-bundles.md](feature-bundles.md#no-stub-bundles)). + +## Deltas + +A delta lists the spec units a change adds, modifies or removes in one feature spec document. Write one delta per document the change touches: + +- `deltas/{facet}.delta.md` targets the facet spec `{facet}.md`. +- `deltas/{feature}-spec.delta.md` targets the feature overview. A change that alters the overview outside its units, such as completing a metadata-only overview or adding a Facets row for a new facet, rewrites the whole document with a `DOCUMENT` entry holding `Base text:` and `New text:`. +- A delta that writes a new facet spec targets a document that does not exist yet. It opens with a `DOCUMENT` entry whose `Text:` holds the facet's front matter (`type`, `title`, `description`, `status`, `tags`), title and summary; canonization writes the facet from that entry and the delta's added units. Units for a missing document without a `DOCUMENT` entry are refused. +- `deltas/{feature-id}/{facet}.delta.md` targets `features/{feature-id}/{facet}.md`, a document in another feature. Every delta that touches a feature other than the change's own uses this feature-qualified target, as a merge or split does. Without the qualifier, `deltas/sharing.delta.md` could not tell the change's own `sharing.md` from another feature's. A qualified delta's heading is `# Delta: {feature-id}/{facet}.md`, and its whole-file unit paths are relative to that feature's root. A story or scenario file it adds sits in the change under `{feature-id}/stories/` or `{feature-id}/scenarios/`. +- No delta targets a reserved `index.md` or `log.md`: canonization refuses `index.delta.md` and `log.delta.md`, qualified or not. + +Checks and reports name a unit in another feature with its feature, such as `calendar-links/FR-01`, and a change in another feature the same way, such as `calendar-links/link-expiry`. + +List each story and scenario file the change adds or revises in the delta of the facet whose behavior it covers. Template: `templates/documents/delta.md.tmpl`. + +### Format + +A delta has up to three unit sections, `## ADDED`, `## MODIFIED` and `## REMOVED`, with one `###` entry per spec unit, and may open with a `## DOCUMENT` section for the whole document and end with a `## App-local scenario files` section. An entry's heading is the unit's ID, or the path of a whole-file unit relative to the feature root. Unit text sits in a fenced block (`~~~markdown`, or `~~~gherkin` for a scenario file) exactly as it reads, or will read, in the feature spec, heading included. + +Fences follow CommonMark. The outer fence is a run of three or more tildes (or backticks), and the payload ends at the first line that holds only a run of the same character at least as long. When the unit itself contains a fenced block, make the outer fence longer than every fence inside it: wrap a unit that contains `~~~` in `~~~~markdown` and `~~~~`. A line of text after a payload's closing fence means an inner fence closed it early; the delta is refused. + +`Section:` names the heading of the section an added unit joins, and it must name exactly one heading in the target document. When two sections share a title, such as a `Requirements` section under both `Members` and `Guests`, give the heading path instead: `Section: Guests > Requirements`. An anchor that matches more than one heading is refused at the base check, and nothing is applied. A plain title that matches no heading starts a new `##` section at the end of the document. + +| Section | Entry holds | +|---------|-------------| +| `ADDED` | `Section:` the heading, or heading path, of the feature spec section the unit joins, then `Text:` and the unit. A whole-file unit holds nothing more: its content is the file in the change's `stories/` or `scenarios/`. A reconciled entry for a changed or split file carries `Text:` with the file as canonization writes it at the feature root (see [Deferred stories and scenarios](#deferred-stories-and-scenarios)). | +| `MODIFIED` | `Base text:` and the unit as it stood when the delta was written, then `New text:` and the unit as the change leaves it. A whole-file unit holds only the base text; the new version is the file in the change. A reconciled entry for a changed, rebased or split file adds `New text:` with the file as canonization writes it at the feature root, and a rebased one also records the feature-root file as it now stands as its `Base text:`. | +| `REMOVED` | `Base text:` and the unit as it stood when the delta was written. | +| `App-local scenario files` | One entry per app-local scenario file, headed by its path from the repository root: `Base text:` with the file before the change for a revised file, nothing for an added one (see [App-local scenario files](#app-local-scenario-files)). | +| `DOCUMENT` | No `###` entry. `Text:` and the front matter, title and summary of a document the delta writes; or `Base text:` and `New text:` with the whole document, before and after, for a rewrite. A rewrite holds no other entries. | + +```markdown +--- +type: delta +title: Invitations delta for invite-expiry +description: Spec units the invite-expiry change adds and modifies in the invitations facet. +status: stable +--- + +# Delta: invitations.md + +## ADDED + +### FR-12 + +Section: Requirements + +Text: + +~~~markdown +### FR-12 Invitation expiry + +An invitation that has no response 14 days after it was sent expires. The organizer is told when an invitation expires. +~~~ + +### scenarios/invitation-expiry.feature + +### stories/US-007-invitation-expiry.md + +## MODIFIED + +### FR-03 + +Base text: + +~~~markdown +### FR-03 Invitation responses + +An invitee can accept or decline an invitation. An accepted invitation adds the event to the invitee's calendar. +~~~ + +New text: + +~~~markdown +### FR-03 Invitation responses + +An invitee can accept or decline an invitation. An accepted invitation adds the event to the invitee's calendar. An expired invitation cannot be accepted. +~~~ +``` + +Rules: + +- Name every unit the change touches. A unit missing from the deltas is not changed by canonization. +- Copy base text from the current feature spec when the delta is written, without editing it. Base text is the record the base check compares against. +- A new unit takes the next free number for its prefix (see [feature-bundles.md](feature-bundles.md#spec-units)). The PRD uses the same IDs for the requirements it adds or revises, so each PRD requirement traces to the unit it becomes. +- Write `Text:` and `New text:` in durable tense. Words such as "will", "now", "no longer" or "new" do not belong in delta text, because they would land in the feature spec. +- Every story and scenario file the change adds or revises is a whole-file unit with its own entry: `ADDED` for a file new to the feature root, `MODIFIED` for a revised one. The overlap and base checks cover it, and canonization moves only the files the reconciled deltas list, so each file follows the coverage accounting. A change that holds a file its deltas don't list cannot be canonized. + +### Moving a unit + +A unit that moves to another facet, or to another feature, is a `REMOVED` entry, with base text, in the delta of the document it leaves, and an `ADDED` entry in the delta of the document it joins. + +- **Between facets of one feature**, the unit keeps its ID: the base check accepts an `ADDED` ID that the same change removes from the same feature. +- **Into another feature**, the unit keeps its ID when the receiving feature has not used it, checked against its feature spec, its change archive and its changes in flight. Otherwise it takes the next free ID there; the PRD maps the old ID to the new one, and the lineage-log entry records the mapping. + +The overlap check reads the pair as the change's own move. It reports the unit only when another change touches it too, and then says the change `moves` it. + +### App-local scenario files + +Surface-specific scenarios stay with their app, under `apps/{surface}/docs/features/{feature}/scenarios/`, and are written before promotion. The change lists each app-local scenario file it adds or changes in a `## App-local scenario files` section of the relevant delta, one `###` entry per file, headed by its path from the repository root. An entry for a file the change revises holds `Base text:` with the file as it stood before the change; an entry for a file the change adds holds nothing more. At promotion, the recorded base text equals the file as it stood immediately before the promotion PR merged, at the merge commit's first parent (`git show ^1:`), and a file the change adds is absent there. When another change revised the file after the base text was recorded, the promotion PR rebases the base text before it merges. These entries are not whole-file units: the promotion PR edits the files in place, so canonization does not move them. Read an app-local scenario as it stood at the promotion PR's merge commit, resolved from the PR (`git show :`), because a later change may already be editing the working copy. The overlap check compares these paths too. + +Canonization accounts for each app-local file as it does for the change's other scenario files: + +- **Shipped:** the reconciled delta keeps the file's entry as listed, and the file stays as the promotion PR left it. +- **Deferred:** the reconciled delta drops the entry, and the canonization PR restores it from the recorded base text, or deletes a file the change added. +- **Partly shipped:** the reconciled entry carries `New text:` with the base text plus the shipped scenarios, and the canonization PR writes that text. + +Before it restores or rewrites a file, canonization compares it with the file at the promotion PR's merge commit; if another change has edited it since, canonization refuses and the maintainer reconciles the file. Likewise, canonization refuses a deferral whose recorded base text differs from the file at the merge commit's first parent, or that deletes a file present there: putting back a stale base would undo another change's revision. The shaping item a deferral creates starts from the file at the promotion PR's merge commit. + +Dropping a Ratified change undoes its app-local edits in the drop PR, since the promotion PR made them on the default branch. For each app-local scenario file the ratified deltas list, the drop PR restores each revised file from its recorded base text and deletes each file the change added, under the same guards as a deferral: the file must still read as the promotion PR's merge commit left it, and the recorded base text must equal the file at the merge commit's first parent. If another change has edited the file since, restoring the base would undo that edit, so the drop PR refuses that file and the maintainer reconciles it, removing only the dropped change's edits and keeping the later ones. A change dropped before its promotion PR merged made no app-local edits on the default branch. + +## A change's stories and scenarios + +A change carries its own stories and scenarios until it is canonized. The feature root keeps only stories and scenarios of shipped behavior, so an expectation that has not shipped never sits beside shipped ones, and anyone reading `scenarios/` at the feature root reads only what the product does. + +Worked example. The `shared-calendars` feature root has `stories/US-001-respond-to-invitation.md` and `scenarios/invitation-responses.feature`. The change `invite-expiry` adds a story and a scenario, and the change `decline-with-note` adds a story and revises the existing scenario file: + +``` +features/shared-calendars/ + stories/US-001-respond-to-invitation.md shipped + scenarios/invitation-responses.feature shipped + changes/invite-expiry/ + stories/US-007-invitation-expiry.md added by the change + scenarios/invitation-expiry.feature added by the change + changes/decline-with-note/ + stories/US-008-decline-with-note.md added by the change + scenarios/invitation-responses.feature the change's revised version +``` + +`decline-with-note`'s delta lists `scenarios/invitation-responses.feature` under `MODIFIED`, with the shipped file as its base text. Until `decline-with-note` is canonized, the shipped version stays at the feature root. At canonization the revised file replaces the shipped one and the added story moves to the feature root, because the reconciled deltas list each of them. The archived change keeps its PRD, TRD and deltas, and any story or scenario file the accounting deferred. + +### Deferred stories and scenarios + +Canonization's accounting decides each story and scenario file, as it decides each requirement: + +- **Shipped:** the reconciled delta keeps the file's entry as listed, and canonization moves the change's file to the feature root. +- **Changed:** the reconciled entry carries the approved file as its text, `Text:` for an added file or `New text:` for a revised one, and canonization writes that text at the feature root. The change's own file, with the ratified expectation, stays in the archived change. Moving it would publish the expectation that did not ship. +- **Rebased:** a revised file whose feature-root version drifted since the delta was written, usually because another change canonized an edit to it, fails the base check. Its reconciled entry is rebased like a spec unit, with the maintainer confirming any change in meaning: `Base text:` holds the file as it now stands at the feature root, and `New text:` holds the change's revision applied on top of it, which canonization writes at the feature root. The change's own file stays in the archived change. +- **Deferred:** the reconciled delta drops the file's entry. The file stays in the archived change, and the shaping item the deferral creates starts from a copy of it. A deferred file never reaches the feature root. +- **Partly shipped:** a file that holds both shipped and deferred scenarios is split. The reconciled entry carries the shipped scenarios as its text, `Text:` for an added file or `New text:` for a revised one, and canonization writes that text at the feature root. The change's own file, with the deferred scenarios, stays in the archived change for the shaping item. A story whose acceptance criteria shipped only in part is split the same way. A split file that also changed or was rebased carries a single text with all of it. +- **App-local scenario files:** the promotion PR edited them in place, so a deferral restores the file from its recorded base text (see [App-local scenario files](#app-local-scenario-files)). +- **`DOCUMENT` entries:** their text is reconciled like a changed unit, with the maintainer's approval. A description, summary or Facets row that describes deferred behavior is rewritten to describe only what shipped, and links to deferred facet specs, stories or scenarios are removed. A facet spec whose units are all deferred is not written: its delta is left out of the reconciled deltas and stays in the archived change. Canonization resolves every relative link in `DOCUMENT` text, including `./` forms, against the bundle as it will be after canonization, and refuses a link that does not resolve. The rule covers reference-style links: each link reference definition's target resolves the same way. A link to an existing document the change leaves alone resolves; a link to a deferred facet spec, story or scenario, to a file the change removes, or to an app-local scenario file the deferral deletes, does not. The first-version fixture, `tests/fixtures/first-version/`, defers a whole facet this way. + +## Overlap check + +The overlap check finds concurrent changes that target the same spec units, so the maintainer can sequence or combine them before either is ratified. + +**When:** when a change's promotion PR is prepared, and again just before it merges. + +**Compare** the change's deltas against every other change that has not been canonized and touches a feature the deltas touch. For each such feature, that is its ratified and shipped changes in `features/{feature}/changes/`, its changes in `shaping/{feature}--*/`, its open promotion PRs, and any change to another feature whose feature-qualified deltas target it. Compare units by feature and ID: `FR-01` in `shared-calendars` and `FR-01` in `calendar-links` are two units. Compare changes by feature and name: `calendar-links/link-expiry` and `shared-calendars/link-expiry` are two changes. Report every unit that: + +- another change also modifies or removes; +- another change adds with the same ID, even when the two units mean different things; +- is added with an ID the receiving feature's spec or change archive already uses; +- is a whole-file unit, or an app-local scenario path, that another change also touches. + +**Report** to the maintainer in the promotion PR: + +```markdown +| Unit | This change | Other change | Other change's state | +|------|-------------|--------------|----------------------| +| FR-03 | modifies | invite-expiry modifies | Ratified | +| FR-12 | adds "Decline notes" | invite-expiry adds "Invitation expiry" | Ratified | +``` + +The design-level open-questions check runs at the same two points: no open `design` or `none yet` question may name the change unless its deferral is approved ([open-questions.md](open-questions.md)). + +**Resolve:** the maintainer either orders the changes, so the later one is rebased at its canonization, or combines them into one change. Two changes adding the same ID always end with one of them renumbered before its promotion PR merges. When no overlap is found, the promotion PR says so in one line. + +## Base check + +The base check finds drift between a delta's base text and the current feature spec, so the delta can be rebased before canonization overwrites anything. + +**When:** at canonization, before the deltas are applied, and again just before the canonization PR merges, against the latest feature spec on the default branch. + +**Check** each delta entry against the feature it targets: the change's own feature, or the feature a feature-qualified delta names. + +- `MODIFIED` and `REMOVED` unit: the recorded base text matches the unit in the feature spec, ignoring trailing whitespace. +- `MODIFIED` and `REMOVED` whole-file unit: the base text matches the file at the feature root. +- `DOCUMENT` entry: a document the delta writes does not exist yet; a rewritten document matches its base text. +- `ADDED` unit: no unit in the target feature's spec has its ID, unless the same change removes that ID from that feature ([a move](#moving-a-unit)), and its `Section:` anchor names at most one heading in the target document. `ADDED` whole-file unit: no file exists at its path at the feature root. +- Unit IDs are unique per feature after the change: with every delta applied, each ID appears once across the feature's spec documents. Two entries that add the same free ID, in different facets or the same one, are refused; a move leaves exactly one copy. + +**Rebase** when a unit has drifted: write the change's edit again on top of the unit as it now stands, so the result keeps both the other change's edits and this one's. The maintainer confirms any change in meaning. The canonization applies the rebased text; the archive keeps the deltas as they were ratified, and the Canonized log entry records the rebase. An `ADDED` ID that is now taken is renumbered, with the PRD's references to it. + +## Worked example: two parallel changes + +The `shared-calendars` feature has an `invitations.md` facet spec with three units: + +```markdown +### FR-03 Invitation responses + +An invitee can accept or decline an invitation. An accepted invitation adds the event to the invitee's calendar. + +### FR-04 Invitation delivery + +An invitation is delivered to the invitee by email and in the app. + +### FR-05 Response visibility + +The organizer sees each invitee's response. +``` + +Two changes are shaped at the same time: + +- **`invite-expiry`** adds `FR-12 Invitation expiry` and modifies `FR-03` to add "An expired invitation cannot be accepted." +- **`decline-with-note`** adds `FR-12 Decline notes`, modifies `FR-03` to let an invitee add a note when declining, and modifies `FR-05` so the organizer sees any decline note. + +**1. Overlap check, `invite-expiry`'s promotion PR.** `decline-with-note` is still in `shaping/`. The check reports `FR-03` (both modify) and `FR-12` (both add). The maintainer rules: `invite-expiry` goes first, and `decline-with-note` renumbers its unit. `invite-expiry`'s promotion PR merges; it is Ratified. + +**2. Overlap check, `decline-with-note`'s promotion PR.** Its delta now adds `FR-13 Decline notes`. The check still reports `FR-03`, already ordered by the maintainer; the PR records the ordering and merges. Both changes are Ratified, and both deltas record the same base text for `FR-03`: the sentence pair above. + +**3. Canonize `invite-expiry`.** It ships first. Its base check passes: `FR-03` still matches its base text and `FR-12` is free. Canonization adds `FR-12`, rewrites `FR-03`, moves its story and scenario to the feature root and archives the change as `changes/archive/2026-12-01-invite-expiry/`. + +**4. Canonize `decline-with-note`.** Its base check fails on `FR-03`: the feature spec now ends with "An expired invitation cannot be accepted.", which the recorded base text lacks. Applying the delta as ratified would silently drop `invite-expiry`'s sentence. The delta is rebased instead: + +```markdown +### FR-03 Invitation responses + +An invitee can accept or decline an invitation, and can add a note when declining. An accepted invitation adds the event to the invitee's calendar. An expired invitation cannot be accepted. +``` + +The maintainer confirms the meaning is unchanged: both edits stand. The base check passes on the rebased delta, canonization applies it, and `FR-03` keeps the first change's edit along with the second's. The archive `changes/archive/2026-12-15-decline-with-note/` keeps the delta as ratified, and the Canonized log entry records the rebase. + +The skill's test fixture, `tests/fixtures/two-canonizations/`, runs exactly these two canonizations. + +## Shipping and canonization + +Each project names its **ship signal**, the event that makes a change live: a merge to the default branch, a release, a feature flag reaching everyone. Before it fires, whoever fires it runs the release-level open-questions check ([open-questions.md](open-questions.md)); when merging the implementation PR is the ship signal, the implementation workflow runs it before that merge. When it fires, a Shipped entry in the feature log records the evidence. The change stays in `changes/{change}/`; it is now Shipped, and canonization is due. + +**Canonization** makes the shipped change part of the feature spec. It accounts for each requirement, scenario and `DOCUMENT` entry in the change as shipped, changed or deferred, runs the base check, applies the deltas as reconciled with that accounting, moves the story and scenario files the reconciled deltas list to the feature root, archives the change to `changes/archive/YYYY-MM-DD-{change}/` dated the day of canonization, and writes a Canonized entry in the feature log. Deferred units, including deferred story and scenario files, are left out of the spec and become shaping items; changed units carry the text the maintainer approved. The archive keeps the content of the ratified deltas as approved; canonization changes only their OKF `status`, from `stable` to `deprecated`, as it does for every document in the archived change. + +The canonization workflow, step by step with a worked example, is in [canonization.md](canonization.md). This reference defines the contract it consumes. + +## Changing a ratified change + +A ratified change records an approval, so a change in its meaning needs one too. Draft the revision in `shaping/{feature}--{change}/` and, with the maintainer's approval, open a promotion PR for it. Its destination, `changes/{change}/`, already exists, so promotion stops and the maintainer decides how the revision lands. Edits that don't change meaning (typos, links, clarifications) may go in directly. diff --git a/plugins/product-development/skills/product-development/references/compliance-research.md b/plugins/product-development/skills/product-development/references/compliance-research.md new file mode 100644 index 0000000..7b41559 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/compliance-research.md @@ -0,0 +1,36 @@ +# Compliance Research + +Load this reference when a requirement, decision or open question depends on a law, regulation, standard, certification scheme, platform policy or security framework. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +## Research charter + +Before researching, write a short charter and show it to the maintainer, who may add or exclude context: + +- **Question:** what must be known, in one sentence. +- **Scope:** the jurisdictions, standards, versions and platforms in play. +- **Sources:** where to look first. +- **Constraints and non-goals:** what the research does not cover, such as giving legal advice. + +Run the research in a subagent where the harness supports it, such as the `product-researcher` agent. + +## Sources + +Use primary sources: the text of the law or regulation, the standard as its body publishes it, a regulator's own guidance, the platform's published policy. Secondary sources, such as articles or vendor summaries, may point to a primary source but never stand in for one; label any claim that rests on one alone. + +Cite each source with a direct link, the section or clause, and its version or the date it was read. + +## Where citations go + +Claims that land in a spec, TRD or ADR cite primary sources there, in the document itself. That holds for a delta whose text will enter the feature spec. Exploratory notes can carry their citations in a research note (type `research-note`) or in the PR. + +## Route the findings + +Separate what this change must do from what belongs elsewhere: + +- **This change:** a requirement in the PRD, a decision in the TRD ([tech-decisions.md](tech-decisions.md)) or a delta. +- **Not yet known:** an open question with a blocking level and resolution `research` or `maintainer decision` ([open-question-triage.md](open-question-triage.md)). +- **Later or downstream work:** a deferral to a shaping item or delivery-plan step, or a comment drafted for the downstream owner ([downstream-comments.md](downstream-comments.md)). + +## No overclaims + +Never claim certification, compliance or legal sufficiency. Write what the product does and which clause it addresses: "Invitation emails include an unsubscribe link, as [clause] requires", not "the product is compliant with [law]". A claim of certification or legal sufficiency needs the maintainer's separate approval, on the evidence of whoever the project relies on for that judgment, and records that approval where the claim is made. diff --git a/plugins/product-development/skills/product-development/references/downstream-comments.md b/plugins/product-development/skills/product-development/references/downstream-comments.md new file mode 100644 index 0000000..0ae209c --- /dev/null +++ b/plugins/product-development/skills/product-development/references/downstream-comments.md @@ -0,0 +1,38 @@ +# Downstream Comments + +Load this reference when a decision in a change affects work that someone else owns later: an issue in this or another repository, another team's integration, or a consumer the change's provenance names. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +The skill drafts comments for downstream owners. Posting waits for the maintainer's approval. + +## Find who is affected + +Look in: + +- the **Affected consumers** row of the change's provenance record ([changes-and-deltas.md](changes-and-deltas.md#provenance)); +- the ruling on an open question during triage ([open-question-triage.md](open-question-triage.md)), especially a deferral to work owned outside `docs/product/`; +- dependency tables and links to issues in the PRD and TRD; +- the overlap report, when the ordering the maintainer chose delays another owner's change. + +A downstream target inside `docs/product/`, such as a shaping document or a step in the delivery plan, gets an open-question row with a deferral instead of a comment ([open-questions.md](open-questions.md#deferral)). Comments are for owners outside the bundle. + +## Draft each comment + +One comment per target. Each comment: + +- says what was decided, in one or two sentences; +- links its source: the document and anchor at a commit, or the PR or review where the maintainer decided, so the reader can check it; +- cites the primary source for any claim about a law, standard or external technology ([compliance-research.md](compliance-research.md)); +- says what the owner must revisit, in an explicit sentence: "Revisit []() when resolving this issue."; +- separates what this change settles from what it leaves to the owner. + +```markdown +The `shared-calendars/invite-expiry` change expires an invitation that has no response 14 days after it was sent, and an expired invitation cannot be accepted ([PRD, FR-12](https://github.com/example/shared-calendars/blob/4f2a9c1/docs/product/features/shared-calendars/changes/invite-expiry/PRD.md)). + +Revisit [invite-expiry FR-12](https://github.com/example/shared-calendars/blob/4f2a9c1/docs/product/features/shared-calendars/changes/invite-expiry/PRD.md) when resolving this issue: calendar sync must not import an expired invitation as pending. How sync shows the expiry date is yours to decide. +``` + +## Approval + +Show the maintainer every draft, with its target. Post only the comments the maintainer approves, as approved. One approval covers the comments it names, no others. Posting can go to whatever GitHub helper workflow the project uses, after the approval. + +Once the maintainer approves a comment and it is posted, link it from the change's provenance record if it records a decision the bundle needs. When the comment is where the maintainer approved a deferral, it can also go in that row's dated **Approval** cell, as `YYYY-MM-DD, [comment]()`. An active deferral's **Deferred to** links the target's row in the bundle, never a comment: a deferral to work outside `docs/product/` still names a target row inside it, such as a step in the delivery plan, and the validator refuses anything else ([open-questions.md](open-questions.md#deferral)). Once the target is answered, its row goes. A row kept as history in the change archive keeps the original destination as plain text and links the answer's home ([open-questions.md](open-questions.md#homes)). diff --git a/plugins/product-development/skills/product-development/references/feature-bundles.md b/plugins/product-development/skills/product-development/references/feature-bundles.md new file mode 100644 index 0000000..e6bd8ef --- /dev/null +++ b/plugins/product-development/skills/product-development/references/feature-bundles.md @@ -0,0 +1,179 @@ +# Feature Bundles + +Load this reference when you create, read or change anything under `docs/product/features/`: a feature spec, a change waiting to ship, the feature log or the lineage log. How changes are drafted, checked and canonized is in [changes-and-deltas.md](changes-and-deltas.md). Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +## The product bundle + +`docs/product/` is one Open Knowledge Format (OKF) v0.3 bundle. `docs/product/index.md` is the bundle root and declares `okf_version: "0.3"`. Every directory has a generated `index.md`; below the root these are plain listings without front matter. `index.md` and `log.md` are reserved names at every level, and neither carries front matter below the root. ADR 0003 (product documents form one OKF bundle) records the decision. The skill's OKF profile, [okf-profile.md](okf-profile.md), covers front matter, the generated indexes and the profile checks. + +Every product document carries front matter with `type`, `title`, `description` and `status`, and may carry `tags`. `README.md` and `AGENTS.md` have no `type`, so they are not OKF concepts and keep their roles. `.feature` files are assets. + +`type` comes from a closed list: `constitution`, `vision`, `research-note`, `idea`, `shaping`, `feature-spec-overview`, `feature-spec-facet`, `prd`, `trd`, `delta`, `story`, `delivery-plan`, `open-questions`. What a facet spec covers goes in open `tags`, for example `workflow`, `contract`, `policy`, `data`, `integration`, `permissions`, `entitlement`, `notification`, `screen`, `quality` or `user-type`. + +`status` follows from the path. The path is the authority (ADR 0001, stage directories carry authority); `status` mirrors it for OKF consumers, and the two must agree. + +| Path | OKF `status` | +|------|--------------| +| `ideas/`, `shaping/` | `draft` | +| `features/{feature}/changes/{change}/` (ratified or shipped change) | `stable` | +| Feature spec, and stories at the feature root | `stable` | +| `features/{feature}/changes/archive/` | `deprecated` | + +Moving a document between these paths changes its `status` in the same pull request. + +## Feature bundle layout + +Each feature has one feature bundle, named for the feature's ID in lowercase kebab-case: + +``` +docs/product/features/ + index.md OKF listing, generated + log.md lineage log: splits, merges, drops, dropped changes, closed promotion PRs + {feature}/ + index.md OKF listing, generated + log.md feature log: dated history and reasons + {feature}-spec.md feature overview + {facet}.md facet specs: one user type, workflow or contract each + stories/ stories for shipped behavior + scenarios/*.feature scenarios for shipped behavior + changes/{change}/ a ratified change waiting to ship, or shipped and waiting for canonization + PRD.md + TRD.md + deltas/{facet}.delta.md + stories/ stories the change adds or revises + scenarios/*.feature scenarios the change adds or revises + changes/archive/YYYY-MM-DD-{change}/ + a canonized change, kept as history +``` + +The feature root holds shipped behavior only. Everything about a change that has not been canonized stays in its `changes/{change}/` directory, including its stories and scenarios, so an expectation that hasn't shipped never sits beside shipped ones. + +A feature bundle exists from the day its first change is ratified. Until that change is canonized, the bundle holds a metadata-only feature overview, the log and the change, and no facet specs. That holds while the change is Ratified and after it ships: behavior reaches the feature spec only through canonization, so between the ship signal and canonization a shipped first version is read from its change directory and its Shipped log entry. + +- **At ratification**, the promotion PR writes a metadata-only feature overview: front matter with `type: feature-spec-overview`, a `title`, a `description` that names the feature's subject without claiming any behavior, and the `status` the path mapping gives the feature spec, `stable`; then the title and the History section. It has no summary, no facet table and no links to facets, stories or scenarios, which don't exist yet. +- **At the first canonization**, canonization writes the complete shipped overview and each new facet spec from the reconciled deltas. A delta that writes a facet spec opens with a `## DOCUMENT` entry holding the facet's front matter, title and summary, and its added units follow. The overview's delta rewrites the metadata-only overview with the complete one: its summary, a Facets row linking each facet with its spec-unit prefixes, and the stories and scenarios links. When part of the first version is deferred, the `DOCUMENT` text is reconciled too, so the overview and facet summaries describe only what shipped and link nothing deferred. See [changes-and-deltas.md](changes-and-deltas.md#deferred-stories-and-scenarios). + +A later change that adds a facet does the same: its facet delta writes the facet, and its overview delta adds the facet's row. + +## Feature spec + +The feature spec is the feature overview plus its facet specs. It describes the feature's shipped behavior and nothing else. + +- **Feature overview**, `{feature}-spec.md`, type `feature-spec-overview`. It summarizes what the feature is for, lists its facet specs with the spec-unit prefixes each one uses, and holds the feature's metadata in its front matter. Template: `templates/documents/feature-spec-overview.md.tmpl`. +- **Facet spec**, `{facet}.md`, type `feature-spec-facet`. It covers one face of the feature, such as one user type, one workflow or one contract. Its subject goes in `tags`. Template: `templates/documents/feature-spec-facet.md.tmpl`. + +### Durable tense + +Write the feature spec so that it stays true for as long as the behavior it describes: + +- Present tense, describing what the feature does. "An invitation expires 14 days after it was sent", not "Invitations will expire". +- No change events. Words like "now", "no longer", "replaces", "new" or "formerly" describe a change; put the change in the feature log. +- No plans. No file lists, no dependencies to add or remove, no "to be built", no conditions on a future approval. A dependency or footprint map, where a project wants one, belongs in engineering documentation outside `docs/product/`. + +Only canonization changes the meaning of a feature spec. Edits that don't change meaning (typos, links, clarifications) may go in directly. + +### Spec units + +A spec unit is an independently changeable section of a feature spec with a stable ID. Deltas add, modify and remove whole units, so the unit is the smallest thing two changes can collide on. + +- A unit is a heading whose text starts with the unit's ID, then a space and a short name: `### FR-12 Invitation expiry`. The unit runs to the next heading at the same level or higher. Headings inside a unit sit at a deeper level. A heading inside a fenced code block is text: it neither starts nor ends a unit, and a `Section:` anchor never names it. +- An ID is an uppercase prefix, a hyphen and a number: `FR-12`, `NFR-03`, `MEM-02`. `FR` and `NFR` are for functional and non-functional requirements. A facet may declare its own prefix, such as `MEM` for membership rules; the feature overview lists each facet's prefixes. +- IDs are unique within the feature and never reused, even after the unit is removed. A new unit takes the next free number for its prefix, checked against the feature spec, the change archive and the changes in flight. +- A unit keeps its ID when it moves between facet specs of the same feature. A unit that moves to another feature keeps its ID when the receiving feature has not used it, and otherwise takes the next free ID there. See [Moving a unit](changes-and-deltas.md#moving-a-unit). +- A scenario file at the feature root is a spec unit as a whole file, named by its path, such as `scenarios/invitation-responses.feature`. A story file a change revises is treated the same way, as a whole-file unit named by its path. + +### Stories and scenarios at the feature root + +`stories/` and `scenarios/` at the feature root hold the stories and platform-level scenarios of shipped behavior. Canonization moves here the story and scenario files a change's reconciled deltas list; a deferred file stays with the archived change. Scenarios at the feature root describe shipped behavior, so a failing one means the implementation and the spec have diverged. + +Surface-specific scenarios stay with their app, under `apps/{surface}/docs/features/{feature}/scenarios/`. A change lists the app-local scenario files it adds or changes (see [changes-and-deltas.md](changes-and-deltas.md#app-local-scenario-files)). + +## Feature log + +Each feature bundle has a `log.md`, the feature log: the feature's dated history and the reasons behind each change. It replaces the changelog tables that PRDs and TRDs used to end with. As an OKF reserved file it has no front matter. Template: `templates/documents/feature-log.md.tmpl`. + +Entries are append-only and in date order, oldest first. They sit under date headings in the `## YYYY-MM-DD` form, which OKF v0.3 requires of every `log.md`; entries from the same day share one date heading. OKF v0.3 makes a log a flat list of entries, so an entry has no heading of its own. Each entry is one list item: the event in bold, then what it applies to, with the change, the reason and links nested inside it: + +```markdown +## 2026-12-01 + +- **Canonized:** invite-expiry + - Change: [invite-expiry](changes/archive/2026-12-01-invite-expiry/) + - Reason: Invitees left invitations unanswered for weeks, so organizers could not plan. + - Outcome: Added FR-12 and `scenarios/invitation-expiry.feature`; modified FR-03. Nothing deferred. + - Links: canonization PR #123 +``` + +Write an entry for each of these events: + +| Event | Written by | Records | +|-------|-----------|---------| +| Ratified | The promotion PR | The change, why it is being made, and a link to the promotion PR | +| Shipped | The commit or PR that records the ship signal | The ship signal and a link to its evidence, such as a release, a merged implementation PR or a flag reaching everyone | +| Canonized | The canonization PR | A link to the archived change, what was applied, what changed in meaning with the maintainer's approval, what was deferred and where it went, any rebased delta | +| Decision | Whoever records it | A decision about the feature that no change record holds, such as a spike finding | + +Link each entry to something that outlives canonization. `changes/{change}/` is deleted when the change is archived, so a Ratified entry links the promotion PR, a Shipped entry links its evidence, and the Canonized entry links the archive path. A Ratified entry links the promotion PR only: the PR writes the entry, so it can't hold its own merge commit. Resolve the merge commit from the PR when you need it. + +A Shipped entry is how a reader tells a Shipped change from a Ratified one: both sit in `changes/{change}/` (ADR 0001). A decision that is hard to reverse, surprising and the result of a real trade-off also gets an ADR; the log entry links it. + +Change events go in the log, never in the feature spec. + +## Lineage log + +`docs/product/features/log.md` is the lineage log: the product-wide record of events that a single feature log can't hold. Template: `templates/documents/lineage-log.md.tmpl`. Its entries use the feature log's format: a `## YYYY-MM-DD` date heading, then one list item for each event. Write an entry, with a reason, for each: + +- **Feature split**: one feature becomes two or more. +- **Feature merge**: two or more features become one. +- **Feature drop**: a feature is withdrawn. +- **Dropped change**: a change is withdrawn before it ships, from `shaping/` or from `changes/`. A Shipped change cannot be dropped: withdrawing shipped behavior is a new change that removes it, shaped, ratified and canonized like any other. When the change was Ratified, the drop PR also restores the app-local scenario files its promotion PR revised and deletes the ones it added, with the guards in [changes-and-deltas.md](changes-and-deltas.md#app-local-scenario-files), and the entry lists each under Restored or Removed. +- **Promotion PR closed without merging**: the change returns to `shaping/` or is dropped; say which. + +A closed PR can't carry its own entry, so add it in the next commit to the default branch that touches `docs/product/`. + +### No stub bundles + +A bundle that no longer describes a feature is deleted, not left behind as a stub that points elsewhere. The same holds for a dropped change's directory. The lineage-log entry keeps the history: it names what was removed, why, where its spec units went, and links the last commit that had it, so `git show :` recovers the content. + +A split or merge is shaped and ratified like any other change. The change belongs to one feature, usually the receiving one. Its deltas remove the moving units from the source feature and add them to the receiving one; each delta against a feature other than the change's own uses a feature-qualified target, `deltas/{feature-id}/{facet}.delta.md` (see [changes-and-deltas.md](changes-and-deltas.md#deltas)). The overlap and base checks run against every feature the deltas touch. If a moved unit's ID is already taken in the receiving feature, the unit takes the next free ID there, and the lineage entry maps each old ID to its new one. When canonization leaves a source bundle with no spec units and no stories or scenarios, delete the bundle in the same PR. Canonization that would delete a bundle is refused while that bundle holds any other change in `changes/`, Ratified or Shipped: deleting the bundle would delete that change too. It is refused as well while an uncanonized change in any other feature has feature-qualified deltas that target the bundle: those deltas would have no bundle to apply to. Each such change is first canonized, moved to the receiving feature (or, for a change in another feature, its deltas retargeted there), or dropped with a lineage-log entry; then the lineage change is canonized. A Shipped change in that bundle is canonized or moved, never dropped. + +When a change's feature-qualified deltas target a feature that does not exist yet, its promotion PR initializes that bundle like a first version, as a split into a new feature does: a metadata-only feature overview, and a log with a Ratified entry naming the owning change, such as `Ratified: shared-calendars/split-calendar-links`. The change itself belongs to the source feature, and the source's own Ratified entry records the split. The promotion PR also adds a Feature split entry to the lineage log, linking the promotion PR, because the new bundle appears with it. The change's deltas for the new feature write its facet specs and complete its overview, as a first version's deltas do. Canonization refuses a feature-qualified delta whose receiving bundle has no overview or log. The skill's test fixture, `tests/fixtures/feature-split/`, runs a split like this one. + +Withdrawing a ratified split follows the no-stub rule. Dropping the owning change also deletes a receiving bundle its promotion PR created, when that bundle holds no other change and no shipped content (spec units, stories or scenarios). The Dropped change entry names the deleted bundle under Removed, with the last commit that had it. A receiving bundle that holds another change stays. + +### Worked example: a merge + +The product has two features, `shared-calendars` and `calendar-links`. Calendar links turn out to be one more way to share a calendar, so the maintainer merges them. The change `absorb-calendar-links`, shaped in `shaping/shared-calendars--absorb-calendar-links/`, carries two deltas: + +- `deltas/sharing.delta.md` adds the units from `calendar-links` to the `sharing.md` facet of `shared-calendars`. `calendar-links` used `FR-01` and `FR-02`, which `shared-calendars` already has, so they arrive as `FR-14` and `FR-15`, the next free numbers once `decline-with-note` has taken `FR-13`. +- `deltas/calendar-links/sharing.delta.md`, a feature-qualified delta, removes every unit `calendar-links/sharing.md` had, with base text. Both features have a `sharing.md` facet, so the qualifier is what says which one each delta targets. + +The overlap check for the promotion PR compares these deltas with the changes in flight for both features. A `calendar-links` change that modifies its own `FR-01` overlaps with the merge, which removes it; a `shared-calendars` change that modifies `FR-01` there does not. + +When the change is canonized, the canonization PR deletes `features/calendar-links/` and adds to the lineage log: + +```markdown +## 2027-01-20 + +- **Feature merge:** calendar-links into shared-calendars + - Reason: A calendar link is one way to share a calendar; two features split one concept. + - Change: [absorb-calendar-links](shared-calendars/changes/archive/2027-01-20-absorb-calendar-links/) + - Units: calendar-links FR-01 → shared-calendars FR-14; FR-02 → FR-15 + - Removed: `features/calendar-links/`, last present in commit 4f2a9c1 +``` + +No `calendar-links` directory remains. Its history is in this entry, in the archived change and in Git. The skill's test fixture, `tests/fixtures/feature-merge/`, runs a merge like this one. + +### Worked example: a dropped change + +The change `recurring-invitations` was ratified, then the maintainer withdrew it before it shipped. Its promotion PR had revised the app-local scenario file `apps/web/docs/features/shared-calendars/scenarios/invitation-list.feature`, and no change has edited it since. The PR that drops it deletes `features/shared-calendars/changes/recurring-invitations/`, restores that file from the base text its delta recorded, and adds: + +```markdown +## 2027-02-03 + +- **Dropped change:** shared-calendars/recurring-invitations + - Reason: Usage showed organizers re-invite per event; the series model added cost without demand. + - State when dropped: Ratified + - Removed: `features/shared-calendars/changes/recurring-invitations/`, last present in commit 9b07e3d + - Restored: `apps/web/docs/features/shared-calendars/scenarios/invitation-list.feature`, to its text before the promotion PR +``` diff --git a/plugins/product-development/skills/product-development/references/feature-tags.md b/plugins/product-development/skills/product-development/references/feature-tags.md new file mode 100644 index 0000000..976743a --- /dev/null +++ b/plugins/product-development/skills/product-development/references/feature-tags.md @@ -0,0 +1,164 @@ +# Feature Tags + +Load this reference when you write or review code for a ratified change, when a feature is renamed, split, merged or dropped, or when you set up the feature-tag check in a project. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +The link from code to the feature it implements lives in the code. A feature tag names the feature in a documentation comment. Files that can't carry comments follow the feature path convention instead. A check fails whenever a tag or path names a feature that has no feature bundle, so the links can't go stale silently. + +An agent changing a module reads its tags to find the feature spec that governs it, and canonization uses them to find the code that belongs to a change's feature. + +## Tags in code + +A tag is `@feature `, where `` is the name of a feature bundle directory, `docs/product/features//`. Put it in the language's documentation comment, at file level or on the declaration it covers. A file can carry more than one tag, one feature ID per tag. + +```ts +/** + * Sends invitation reminders. + * @feature workspace-invitations + */ +export function sendReminders() {} +``` + +```python +"""Calendar sharing. + +@feature shared-calendars +""" +``` + +```rust +//! Calendar sync between invitations and calendars. +//! @feature workspace-invitations +//! @feature shared-calendars +``` + +```sh +#!/usr/bin/env bash +# Sends the weekly digest. +# @feature weekly-digest +``` + +The check recognizes these forms: + +| Form | Files | +| --- | --- | +| `/** … */` block comments | JavaScript, TypeScript, Java, Kotlin, Swift, Scala, Groovy, C, C++, Objective-C, C#, Go, PHP, Dart, Rust | +| `///` and `//!` doc comments | Rust, Swift | +| Docstrings of modules, classes and functions | Python (`.py`, `.pyi`) | +| `#` comments, on their own line or after code outside quotes | Shell scripts (`.sh`, `.bash`, `.zsh`, `.ksh`, or any other file except Markdown with a `sh`, `bash`, `zsh`, `ksh` or `dash` shebang), YAML (`.yml`, `.yaml`) | + +`@feature` anywhere else is not a tag, and the check ignores it: in a string literal, a YAML block scalar, a shell heredoc, an ordinary comment such as `//`, `/* */` or a Python `#` comment, or a file of any other kind, Markdown included. A tag written in one of these places is never checked, so it can go stale: use a recognized form. The scan is lexical, not a full parser for each language, so keep tags in plain doc comments. + +## Known limits + +The scan knows each language's common string forms: single- and double-quoted strings, backtick strings in JavaScript, TypeScript and Go, triple-quoted strings, Rust strings and raw strings across lines, shell and YAML quoted strings across lines, YAML block scalars and shell heredocs. Some rarer forms are read as code, so a doc-comment-shaped line inside one counts as a tag: + +- C++ raw strings, `R"(…)"`; +- C# verbatim and raw strings, `@"…"` and `"""…"""`; +- PHP heredocs and nowdocs; +- a backtick inside a JavaScript or TypeScript regular-expression literal (for example `/`/`), which is read as opening a template string; +- a YAML trailing comment indented less than its block scalar's content but more than its header, which is read as scalar content. + +A false tag that names a missing feature fails the check, which names its line. Move the text out of the literal, or exclude the directory if it is not source. + +## Path convention + +Assets, strict JSON and some configuration files can't hold comments. They map by path: a file under a `features//` directory inside a scanned source root belongs to that feature, at any depth. + +```text +src/assets/features/shared-calendars/palette.json → shared-calendars +apps/web/features/workspace-invitations/icons/invite.svg → workspace-invitations +src/features/index.json → unmapped: no feature directory +``` + +Every file under such a directory is checked, whatever its type. A path with more than one `features//` segment names each of those features. Only the part of the path inside the source root counts: scanning `src/features/generated/assets` as a root maps nothing, because its `features/` directory sits above the root. + +## Source roots and exclusions + +The project names its source roots, such as `src`, `lib`, `apps` or `packages`. The check scans only those. It always skips: + +- `docs/product/`, the product bundle, which holds documents rather than code, and the bundle `--product` names when it is another one; +- every directory whose name starts with a dot, such as `.git` or `.github`. + +Pass any other directory to skip as an exclusion: test fixtures, generated or vendored code such as `node_modules`, and a framework's own `features` directory, such as Cucumber's, whose subdirectories are not feature IDs. Name such a directory exactly, so the exclusion doesn't hide path-mapped files elsewhere. An exclusion is a directory path relative to the project root. Shell wildcards match within one path segment, so `packages/*/test/fixtures` skips the fixtures of every package. The check warns about an exclusion that matched no directory, since that is usually a typo. + +These rules apply to each source root and the directories above it, too. A root inside a skipped directory, such as `docs/product/features` or `src/.generated`, is skipped whole, and the check says so on stderr. + +Tests need no tags: scenarios map them to features. A test directory can stay outside the source roots. + +## Unmapped files + +A file with no tag that sits outside any `features//` directory is unmapped. That is allowed: the check never requires a file to be tagged. + +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 in a [retrofit](retrofit.md), and tagging can follow once those features are ratified. + +## What stays out of the feature bundle + +The mapping lives in the code. Feature `index.md` files list documents and bundle assets but never implementation code, as the [OKF profile](okf-profile.md) requires. They never carry generated lists of code files, and nothing under `docs/product/` lists the code that implements a feature. + +## The check + +Run it from the project root, naming the source roots: + +```bash +python3 "/scripts/feature-tags.py" check src apps --exclude src/test/fixtures --exclude apps/web/test/fixtures +``` + +`` is this skill's installed directory. `--product ` points the check at a product bundle other than `docs/product`; both are skipped. + +It reports each tag or path whose feature has no directory under `docs/product/features/`, and each tag with no valid feature ID (lowercase kebab-case): + +```text +src/reminders.ts:3: @feature workspace-invites: docs/product/features/workspace-invites/ does not exist +src/assets/features/weekly-digest/schedule.json: path names features/weekly-digest/, but docs/product/features/weekly-digest/ does not exist +2 feature-tag problems (14 tags and 6 paths checked) +``` + +Exit 0 means every tag and path names an existing feature. Exit 1 lists the problems, including a source file that could not be read and a Python file that could not be parsed. Binary files are skipped, not reported. Exit 2 is a usage problem, such as a source root that doesn't exist. + +The check fails only when a referenced feature ID disappears: when a feature is renamed, merged into another or dropped, it fails until the code is updated. A split that keeps the old ID passes, so reviewers confirm that code moved to the new feature carries the new ID. Update the tags and paths in the same pull request that changes the feature bundle, so the check passes when it merges. + +## Running the check in CI + +Run the check on every pull request. The script needs Python 3.9 or later and nothing outside the standard library. Either copy it into the repository, or check out this plugin's repository at a pinned commit, as in this GitHub Actions workflow, `.github/workflows/feature-tags.yml`: + +```yaml +name: Feature tags + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +jobs: + feature-tags: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + with: + persist-credentials: false + - uses: actions/checkout@v5 + with: + repository: Prometheas-Labs/agent-plugins + ref: # the skill version the project uses + path: .product-development + persist-credentials: false + - name: Check feature tags + env: + SKILL_DIR: .product-development/plugins/product-development/skills/product-development + run: | + python3 "$SKILL_DIR/scripts/feature-tags.py" check src apps \ + --exclude src/test/fixtures --exclude apps/web/test/fixtures +``` + +Set `ref` to a full 40-character commit SHA of this repository, from a commit that contains `scripts/feature-tags.py`. A branch or tag can move, a short SHA is ambiguous, and an older commit lacks the script. The second checkout lands in a dot-directory, so a scan of `.` skips it. Replace the roots and exclusions with the project's own. + +## Tagging new code + +New code for a change links to the change's feature: by an `@feature` tag in a doc comment or, for a file that can't hold a comment, such as an image or strict JSON, by the path convention. Code that implements a feature-qualified delta, one that targets another feature ([changes-and-deltas.md](changes-and-deltas.md#deltas)), links to that feature instead. The handoff states this instruction ([implementation-handoff.md](implementation-handoff.md)). + +The check validates only that each referenced feature ID exists. It can't tell whether new code is linked at all, or linked to the right feature. Reviewers verify the intended mapping against the handoff. diff --git a/plugins/product-development/skills/product-development/references/idea-discovery-and-spikes.md b/plugins/product-development/skills/product-development/references/idea-discovery-and-spikes.md new file mode 100644 index 0000000..a7eb06b --- /dev/null +++ b/plugins/product-development/skills/product-development/references/idea-discovery-and-spikes.md @@ -0,0 +1,81 @@ +# Idea Discovery and Spikes + +Load this reference before a design or plan (idea discovery) or when a shaping question needs a prototype to answer it (spikes). Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +## Idea discovery + +Ideas have no requirements authority, and agents do not read `docs/product/ideas/` for general context. Idea discovery is the exception: a scoped subagent search for ideas that bear on upcoming work. The main context pays for idea content only when an idea is relevant. + +### When to run + +- Before Discovery and Design produces a design. +- Before implementation starts, so the implementation workflow plans with any idea that bears on the change. + +Skip it when `docs/product/ideas/` holds no ideas. + +### How to run + +Dispatch one subagent. Give it: + +- a short summary of the work: the feature, the problem, and the scope of the design or plan +- the path `docs/product/ideas/` +- the report format below + +The subagent reads every idea and reports only the ones that bear on the work. The main context does not open idea files itself unless the report names one and the maintainer wants to discuss it. + +### Report format + +```markdown +| Idea | Relation | Why it matters | Ask the maintainer | +|------|----------|----------------|--------------------| +| `ideas/shared-calendar-reminders.md` | enables | Reminders reuse the invitation's event time | Ship reminders with invitations, or later? | +| `ideas/public-calendars.md` | conflicts | Public calendars assume no invitation step | Do public calendars skip invitations? | +``` + +Relation is one of `enables`, `conflicts` or `overlaps`. When no idea bears on the work, the report says so in one line. + +### Using the report + +- Put each question to the maintainer before the design or plan is approved. +- An idea that enables or overlaps the work stays an idea. Only the maintainer moves an idea to `shaping/`; do not fold it into the design on your own. +- The maintainer settles each conflict: change the design, revise or drop the idea, or note the conflict in the shaping document for later. + +## Spikes + +A spike is a disposable prototype that answers a shaping question. + +- Name the question before you start. The spike answers that question and nothing more. +- Keep spike code out of the product's main line: use a throwaway branch or a scratch directory, and delete the code once the question is answered. +- Spike code never admits a spec. Working code is evidence for the shaping document, not a requirement, and nothing reaches `features/` because a spike ran. +- Record the answer in the shaping document that asked the question. + +### Decision ledger + +When an agent runs a spike unattended, it keeps a decision ledger: an append-only record of the decisions it made, for the maintainer to review. + +- The ledger lives with the spike, for example `DECISIONS.md` at the spike's root, never in `docs/product/`. +- Append only. Never edit or delete an entry while the spike runs. To correct an entry, add a new one that names it. +- Record every decision the maintainer would have been asked about if present. + +Entry format: + +```markdown +## D-003 2026-11-29: Store invitations per calendar, not per user + +- Question: How does an invitee see pending invitations across calendars? +- Decision: Keep pending invitations on the calendar and query them by invitee. +- Alternatives: A per-user inbox copied on send. +- Reason: One source of truth; revoking an invitation needs no fan-out. +- Reversible: Yes. An inbox can be added later as a projection. +``` + +When the spike ends, the maintainer reviews the ledger and every recorded decision moves to one of four destinations: + +| The entry is | It moves to | +|--------------|-------------| +| Part of the change's tentative design | The shaping document | +| Hard to reverse, surprising, and the result of a real trade-off | An ADR | +| History or reasoning about a ratified feature | That feature's log | +| A new possibility outside the spike's question | An idea in `ideas/` | + +No entry is dropped. A decision the maintainer rejects or reverses still lands, recorded with its reason, usually in the shaping document. Delete the ledger only after every entry has landed in one of these destinations. diff --git a/plugins/product-development/skills/product-development/references/implementation-handoff.md b/plugins/product-development/skills/product-development/references/implementation-handoff.md new file mode 100644 index 0000000..e7f5d58 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/implementation-handoff.md @@ -0,0 +1,193 @@ +# Implementation Handoff + +Load this reference when a change's promotion PR merges, or when you check whether its handoff can be sent. It defines what the handoff gives the implementation workflow, when it is drafted and when it is sent. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +The handoff is drafted at ratification and sent once no implementation-level question remains open. It is the boundary between this skill and implementation: nothing before it implies that implementation may start. + +## Contents + +The handoff gives the implementation workflow: + +- **the ratified change:** its PRD, TRD and deltas, in `docs/product/features/{feature}/changes/{change}/`. That is every delta in the change, including the feature-qualified ones under `deltas/{target-feature}/` for each other feature it touches ([changes-and-deltas.md](changes-and-deltas.md#deltas)); +- **its stories and scenarios:** one link per whole-file entry in the change's deltas, feature-qualified ones included, and the app-local scenario files the promotion PR listed. An added or revised file's payload is in the change: under `stories/` and `scenarios/` for the change's own feature, and under `{target-feature}/stories/` and `{target-feature}/scenarios/` for another feature. A file the change removes has no payload in the change; link it at the root of the feature it leaves, `features/{feature}/` or `features/{target-feature}/`, and mark it removed. Check that each path exists at the promotion PR's merge commit, `git cat-file -e :`, before you list it; +- **the affected feature spec:** every document a delta targets, and the overview of each feature a delta touches. A `DOCUMENT` entry that writes a new facet spec targets a document that does not exist yet, so the handoff names the delta instead. A `DOCUMENT` entry that rewrites an existing document, such as the feature overview, links the document as it stands at the merge commit and names the delta that rewrites it. For a feature's first change, which has no shipped spec yet, the change's deltas describe the spec to be: their `DOCUMENT` entries and added units; +- **answers since ratification:** each answer the maintainer approved after the merge, with the question it answers; +- **the foundation documents:** the approved constitution and vision, with their versions; +- **the project's ship signal, and any open release-level questions,** with the release checks that must pass before the signal fires: the change's, and the step's when a delivery-plan step fires it. + +It also carries the provenance record's non-goals and boundaries from the PRD, so the implementation workflow knows what to leave alone. + +It carries the tagging instruction too: new code for the change links to the change's feature, by an `@feature` tag or, for a file that can't hold a comment, such as an asset, by the path convention; code for a feature-qualified delta links to the target feature ([feature-tags.md](feature-tags.md#tagging-new-code)). The feature-tag check validates only that referenced feature IDs exist; reviewers verify the intended mapping against the handoff. + +The handoff links the documents rather than copying them. The ratified documents stay pinned to the promotion PR's merge commit: that is what the maintainer ratified, and a later change may already be editing the working copy. Resolve an app-local scenario file the same way, `git show :`. + +An answer approved after the merge is linked separately, with the question it answers. Link the question at a commit where its row exists: the merge commit if the row was there at ratification, otherwise the commit that added it. Link the answer at the commit that recorded it. Such an answer leaves the ratified design as it was: an implementation-level question is one the design holds either way. Its answer is recorded in a PR of its own, which the maintainer approves ([open-question-triage.md](open-question-triage.md)), in the one home the register's home rule ([open-questions.md](open-questions.md#homes)) gives it: the PRD, TRD or delta of the change that settles it, or an ADR or a Decision entry in the feature log when no change record holds it. A change of meaning is a revision of the ratified change: it is drafted in `shaping/` and ratified again ([changes-and-deltas.md](changes-and-deltas.md#changing-a-ratified-change)), and the handoff waits for it. + +The open release-level questions are listed and linked as of the commit the handoff is sent from, not the merge commit, because questions are added and answered after ratification. The list tells the implementation workflow what still holds the ship decision. Whoever fires the ship signal runs the release check on the current tree, not on the list. + +## When it is drafted + +Draft the handoff when the promotion PR merges, from the merge commit. The draft is not a product document: it has no OKF type and it repeats what the ratified documents hold, so it is not committed under `docs/product/`. Show it to the maintainer. + +## When it is sent + +Send the handoff once no implementation-level question remains open. Run the implementation-level check just before sending, since questions can be added after the draft was written: + +```bash +python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level implementation +``` + +Run it from the project root. `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. The handoff's own commands use the same form, so whoever fires the ship signal runs the script from the installed skill. + +Exit 0 means it can be sent. The check fails on any open `design`, `implementation` or `none yet` question that names the change without an approved deferral ([open-questions.md](open-questions.md#blocking-level)). On exit 1, work through the listed questions with the maintainer ([open-question-triage.md](open-question-triage.md)), then run the check again. While feature folders written with 0.1.0 await modernization, the check runs with `--pending` and the maintainer triages their questions too ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). + +Before sending, add the answers approved since the draft. Then list the open release-level questions in the handoff, from the check run on the commit the handoff is sent from, and record that commit; when a delivery-plan step fires the ship signal, list the step's check too ([The ship signal and the release check](#the-ship-signal-and-the-release-check)). They don't hold the handoff; they hold the ship decision: + +```bash +python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release +``` + +Sending means giving the handoff to the implementation workflow, for example by filing it as the implementation issue. Filing the implementation issue, posting downstream comments and moving board cards each need the maintainer's approval, whichever workflow does them (`SKILL.md`, GitHub Writes). + +## The ship signal and the release check + +The handoff names the project's ship signal: the event that makes the change live, such as the implementation PR merging, a release, or a feature flag reaching everyone. Whoever fires the ship signal runs the release check first: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release` must exit 0 (`SKILL.md`, Release Check). If merging the implementation PR is itself the ship signal, the implementation workflow runs it before that merge. When a delivery-plan step fires the ship signal, the handoff carries both checks, the change's and the step's, `python3 "/scripts/open-questions.py" blocking docs/product roadmap.md# --level release`, with the step taken from the ship signal it names; both must exit 0. While feature folders written with 0.1.0 await modernization, each check runs with `--pending` and the maintainer triages their questions too, reading their 0.1.0 question tables by hand ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). The handoff carries that note, since the implementation workflow may fire the signal. + +When the signal fires, a Shipped entry in the feature log records it with its evidence, and canonization follows ([canonization.md](canonization.md)). + +## Where the skill stops + +The skill drafts the handoff and stops there. It does not prescribe how implementation runs, and execution plans stay out of Git. The `delivery-engineering` plugin, or whatever workflow the project uses, takes it from there, scoped to the implementation PR. That workflow may hand back a reviewed PR for a human to merge. That is a different handoff, and it is the implementation workflow's own. + +Promotion review checks design authority, delta validity and overlap ([promotion-review.md](promotion-review.md)). Implementation review checks the code against the handoff. + +## Template + +List one line per file. `{target-feature}` stands for each other feature a feature-qualified delta touches; leave those lines out when there is none. + +````markdown +# Handoff: {feature}/{change} + + + +Ratified by promotion PR #, merge commit ``. Read the ratified documents below at that commit; later answers are linked at their own commits. + +## The ratified change + +- PRD: `docs/product/features/{feature}/changes/{change}/PRD.md` +- TRD: `docs/product/features/{feature}/changes/{change}/TRD.md` +- Deltas: `docs/product/features/{feature}/changes/{change}/deltas/.delta.md`, one per document in the change's own feature +- Deltas against other features: `docs/product/features/{feature}/changes/{change}/deltas/{target-feature}/.delta.md`, one per document + +## Stories and scenarios + +- `docs/product/features/{feature}/changes/{change}/stories/.md` +- `docs/product/features/{feature}/changes/{change}/scenarios/.feature` +- `docs/product/features/{feature}/changes/{change}/{target-feature}/stories/.md` +- `docs/product/features/{feature}/changes/{change}/{target-feature}/scenarios/.feature` +- Removed: `docs/product/features/{feature}//` or `docs/product/features/{target-feature}//`, one per `REMOVED` whole-file entry, or "none" +- App-local: `apps/{surface}/docs/features/{feature}/scenarios/.feature`, or "none" + +## Affected feature spec + +- `docs/product/features/{feature}/{feature}-spec.md` +- `docs/product/features/{feature}/.md`, for each `deltas/.delta.md` +- `docs/product/features/{target-feature}/{target-feature}-spec.md` +- `docs/product/features/{target-feature}/.md`, for each `deltas/{target-feature}/.delta.md` +- For a new facet spec a `DOCUMENT` entry writes: "not yet written; see ``" +- For an existing document a `DOCUMENT` entry rewrites: its path, then "rewritten by ``" + +## Answers since ratification + +- : answered in at ``, PR #; or "none" + +## Foundation documents + +- Constitution v: `docs/product/constitution.md` +- Vision v: `docs/product/vision.md` + +## Boundaries + + + +## Feature tags + +New code for this change carries `@feature {feature}`, or sits under `features/{feature}/` when the file can't hold a comment; code for a delta against another feature names `{target-feature}` the same way. The feature-tag check validates only that referenced feature IDs exist; reviewers verify this mapping. See the skill's `references/feature-tags.md`. + +## Ship signal + + Before firing it, run `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level release`; it must exit 0. If merging the implementation PR is the ship signal, run it before that merge. + +, the step the signal executes.> This signal executes the delivery-plan step `roadmap.md#`, so run both checks: the change's, above, and the step's, `python3 "/scripts/open-questions.py" blocking docs/product roadmap.md# --level release`. Both must exit 0. + + Run each check with one `--pending` for each feature folder written with 0.1.0 still awaiting modernization: . The checks skip their 0.1.0 rows, so the maintainer reads the 0.1.0 question tables in those folders by hand: before sending, to list any open release question that applies below, and again before firing, to triage any question that might hold the change or the step. See the skill's `references/open-questions.md#while-modernization-is-in-progress`. + +Open release-level questions, as of ``, the commit this handoff was sent from<, from both checks when a step fires the signal><, and from the 0.1.0 question tables the maintainer reviewed by hand in the folders still awaiting modernization>: + +- + +When the signal fires, record it, with its evidence, in a Shipped entry in `docs/product/features/{feature}/log.md`. +```` + +## Example: a feature's first change + +The `shared-calendars` feature has no shipped spec yet. Its first change, `event-invitations`, was ratified by promotion PR #87, merge commit `4f2a9c1`, so its feature overview is metadata-only and the change's deltas describe the spec to be. The draft, written when the PR merged, waits on one implementation-level question: TRD OQ-1, whether the in-app inbox polls for invitations or the server pushes them. Either way the ratified design holds. A spike answers it: the server pushes them. With the maintainer's approval, PR #91 writes the answer into the TRD's Inbox delivery section and removes the row; it merges as `9b1e07d`. The ratified documents stay pinned to `4f2a9c1`, and the answer is linked at `9b1e07d`. The implementation-level check then exits 0 on `9b1e07d`, and with the maintainer's approval the handoff is filed as the implementation issue: + +````markdown +# Handoff: shared-calendars/event-invitations + +An organizer invites people to an event and sees each response: the first version of shared calendars. + +Ratified by promotion PR #87, merge commit `4f2a9c1`. Read the ratified documents below at that commit; later answers are linked at their own commits. + +## The ratified change + +- PRD: `docs/product/features/shared-calendars/changes/event-invitations/PRD.md` +- TRD: `docs/product/features/shared-calendars/changes/event-invitations/TRD.md` +- Deltas: `docs/product/features/shared-calendars/changes/event-invitations/deltas/shared-calendars-spec.delta.md` and `docs/product/features/shared-calendars/changes/event-invitations/deltas/invitations.delta.md` +- Deltas against other features: none + +## Stories and scenarios + +- `docs/product/features/shared-calendars/changes/event-invitations/stories/US-001-respond-to-invitation.md` +- `docs/product/features/shared-calendars/changes/event-invitations/scenarios/invitation-responses.feature` +- Removed: none +- App-local: none + +## Affected feature spec + +This is the feature's first change, so there is no shipped spec yet. + +- `docs/product/features/shared-calendars/shared-calendars-spec.md`: metadata-only; rewritten by `docs/product/features/shared-calendars/changes/event-invitations/deltas/shared-calendars-spec.delta.md`, whose `DOCUMENT` entry completes it. +- `invitations.md`: not yet written; see `docs/product/features/shared-calendars/changes/event-invitations/deltas/invitations.delta.md`. Its `DOCUMENT` entry and added units, FR-01 and FR-02, write the invitations facet spec. + +## Answers since ratification + +- TRD OQ-1, `docs/product/features/shared-calendars/changes/event-invitations/TRD.md#oq-1` at `4f2a9c1`, poll or push: answered in the TRD's Inbox delivery section at `9b1e07d`, PR #91. The server pushes new invitations. + +## Foundation documents + +- Constitution v1.0.0: `docs/product/constitution.md` +- Vision v1.0.0: `docs/product/vision.md` + +## Boundaries + +Reminders are not part of this change. + +## Feature tags + +New code for this change carries `@feature shared-calendars`, or sits under `features/shared-calendars/` when the file can't hold a comment. The feature-tag check validates only that referenced feature IDs exist; reviewers verify this mapping. + +## Ship signal + +Release 3.0 reaching all users. Before widening the release to everyone, run `python3 "/scripts/open-questions.py" blocking docs/product shared-calendars/event-invitations --level release`; it must exit 0. + +Open release-level questions, as of `9b1e07d`, the commit this handoff was sent from: + +- `docs/product/features/shared-calendars/changes/event-invitations/PRD.md#oq-1`: Does release 3.0 wait until invitation emails are translated into every supported language? +- `docs/product/open-questions.md#oq-1`: Must invitation emails meet each region's rules for sender addresses before they go out? + +When the signal fires, record it, with its evidence, in a Shipped entry in `docs/product/features/shared-calendars/log.md`. +```` + +The skill's test fixture, `tests/fixtures/handoff/`, holds the bundle as the promotion PR left it, and `tests/lifecycle-review-handoff.bats` runs the send condition on it. diff --git a/plugins/product-development/skills/product-development/references/initialization.md b/plugins/product-development/skills/product-development/references/initialization.md index 8819506..8293335 100644 --- a/plugins/product-development/skills/product-development/references/initialization.md +++ b/plugins/product-development/skills/product-development/references/initialization.md @@ -2,7 +2,7 @@ ## Purpose -Set up the `docs/product/` directory structure for a project that will use the product development lifecycle. This is a one-time step that creates the documentation hierarchy, agent guidance, and feature directory. +Set up the `docs/product/` directory structure for a project that will use the product development lifecycle. This is a one-time step that creates the documentation hierarchy, agent guidance, and the three stage directories. ## What gets created @@ -10,13 +10,16 @@ Set up the `docs/product/` directory structure for a project that will use the p |------|---------| | `docs/product/README.md` | Documentation hierarchy, artifact flow, boundary rule, directory structure | | `docs/product/AGENTS.md` | Agent guidance for organizing product documentation | -| `docs/product/features/` | Empty directory, ready for the first feature | +| `docs/product/ideas/AGENTS.md` | `ideas/` stage: early sketches with no requirements authority | +| `docs/product/shaping/AGENTS.md` | `shaping/` stage: changes being worked out, including draft PRDs and TRDs | +| `docs/product/features/AGENTS.md` | `features/` stage: ratified changes and shipped feature specs | +| `docs/product/open-questions.md` | Product-wide open questions and the generated index of every open or deferred question (`references/open-questions.md`) | -Files that already exist are skipped — the script never overwrites. +Each stage directory gets its own `AGENTS.md` that says when agents read the stage and when they stay out. Files that already exist are skipped — the script never overwrites. If any scaffold file is missing, for example after an interrupted run, run the script again: it creates only the missing files. A stage directory that already exists keeps its content and gains an `AGENTS.md` only if it has none. ## Running the script -The initialization script lives at `scripts/init.sh` relative to this skill's root directory. +The initialization script lives at `/scripts/init.sh`, where `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. It takes the project root as its argument. It copies no scripts into the project: the other scripts also run from the installed skill, with the project root as the working directory. ### Via agent orchestration @@ -26,17 +29,17 @@ The initialization script lives at `scripts/init.sh` relative to this skill's ro 4. Run the script with the collected values: ```bash -scripts/init.sh /path/to/project \ +"/scripts/init.sh" /path/to/project \ --project-name "MyProject" \ --surfaces "mobile,web" \ - --platform-scenario-example "Error reports contain no PII." \ - --surface-scenario-example "Swiping down pauses the session." + --platform-scenario-example "Every invitee sees the event's current time." \ + --surface-scenario-example "Swiping left shows the next day." ``` ### Via standalone execution ```bash -./scripts/init.sh /path/to/project +"/scripts/init.sh" /path/to/project ``` The script prompts interactively for any values not provided as arguments. @@ -44,7 +47,7 @@ The script prompts interactively for any values not provided as arguments. ### Non-interactive mode ```bash -./scripts/init.sh /path/to/project --non-interactive +"/scripts/init.sh" /path/to/project --non-interactive ``` Uses auto-detected and default values without prompting. @@ -56,10 +59,10 @@ Uses auto-detected and default values without prompting. | `{{PROJECT_NAME}}` | `package.json` name field, then directory name | Directory name | | `{{SURFACES}}` | Subdirectories under `apps/` | `mobile` | | `{{SURFACE_LIST_PROSE}}` | Derived from surfaces (e.g., "mobile, web, or tv") | — | -| `{{PLATFORM_SCENARIO_EXAMPLE}}` | Ask user | "Error reports for non-consented users contain no persistent identifier." | -| `{{SURFACE_SCENARIO_EXAMPLE}}` | Ask user | "Swiping down during a breathing round triggers haptic feedback." | +| `{{PLATFORM_SCENARIO_EXAMPLE}}` | Ask user | "An accepted invitation adds the event to the invitee's calendar." | +| `{{SURFACE_SCENARIO_EXAMPLE}}` | Ask user | "Swiping left on the day view shows the next day." | | `{{SURFACE_SCENARIO_EXAMPLE_FULL}}` | Same as above (full sentence) | — | -| `{{EXAMPLE_FEATURES_LINE}}` | Auto-detected from existing `docs/product/features/` subdirs | Empty (omitted) | +| `{{EXAMPLE_FEATURES_LINE}}` | Auto-detected from existing `docs/product/features/` subdirectories | Empty (omitted) | ### What to ask the user @@ -74,15 +77,26 @@ If the user doesn't have examples yet, the defaults are reasonable placeholders After running the script: -1. Review the generated files and adjust wording if needed -2. Run the Product Constitution workflow before the Product Vision workflow -3. Create and approve versioned `docs/product/constitution.md` through the Constitution Grill (use the immutable + supersede evolution strategy) -4. Run the Product Vision workflow before the first PRD -5. Create approved, versioned `docs/product/vision.md` through the Vision Grill (use the immutable + supersede evolution strategy) -6. Proceed to the first PRD only after the Foundation Gate passes +1. Generate the OKF indexes from the project root, both after agent orchestration and after standalone execution. They include the bundle root, `docs/product/index.md`, which declares `okf_version: "0.3"`; without it the profile check fails ([okf-profile.md](okf-profile.md#indexes)). The script prints this step instead of running it, because `okf-profile.py` needs PyYAML and, on a rerun over feature folders written with 0.1.0, must name them with `--pending` ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)): + + ```bash + python3 "/scripts/okf-profile.py" index docs/product + python3 "/scripts/okf-profile.py" check docs/product + ``` + + On a project upgrading from 0.1.0, run only `index` here. Its constitution and vision have no front matter until the modernization guide's setup adds it, and its feature folders are still in the 0.1.0 layout, so the check fails until then. After that step, regenerate the indexes and then run the check, both with one `--pending` for each feature folder not yet converted; the front matter moves the constitution and vision into the root index, so the earlier index is stale ([modernization.md](modernization.md#how-it-runs)). + + Run them with a `python3` that has PyYAML: the project's dev shell if it provides one, a virtual environment with PyYAML installed, or `nix-shell -p 'python3.withPackages (ps: [ ps.pyyaml ])'`. Without PyYAML, `okf-profile.py` exits 2 and writes nothing. Setup is unfinished until `docs/product/index.md` exists, even with every scaffold file in place; Workflow Selection resumes it at this step. + +2. Review the generated files and adjust wording if needed +3. Run the Product Constitution workflow before the Product Vision workflow +4. Create and approve versioned `docs/product/constitution.md` through the Constitution Grill (use the immutable + supersede evolution strategy) +5. Run the Product Vision workflow before the first PRD +6. Create approved, versioned `docs/product/vision.md` through the Vision Grill (use the immutable + supersede evolution strategy) +7. Draft the first PRD, in `docs/product/shaping/`, only after the Foundation Gate passes When running the Constitution Grill or Vision Grill, prefer `grill-with-docs` if it is installed. If it is missing, notify the user up front, recommend installing it for doc-aware interrogation, and continue with the built-in fallback only if the user declines installation or asks to proceed. The constitution is not generated by the initialization script because governance principles require human approval. The vision is not scaffolded because it requires project-specific interrogation through the Vision Grill. These documents are the foundation that all PRDs reference, so they should be written deliberately rather than scaffolded. -Discovery and design exploration may happen before the Foundation Gate, but the first Requirements PRD cannot start until `docs/product/constitution.md` is approved with version metadata and approved, versioned `docs/product/vision.md` exists. +The Foundation Gate blocks drafting a PRD, not ideas or shaping. Ideas, discovery and design exploration may happen before it passes, but the first Requirements PRD cannot start until `docs/product/constitution.md` is approved with version metadata and approved, versioned `docs/product/vision.md` exists. diff --git a/plugins/product-development/skills/product-development/references/modernization.md b/plugins/product-development/skills/product-development/references/modernization.md new file mode 100644 index 0000000..8e26648 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/modernization.md @@ -0,0 +1,181 @@ +# Modernization + +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 [retrofit.md](retrofit.md). + +## How it runs + +Convert one feature folder at a time, in one pull request per folder, the modernization PR. The agent drafts each step and the maintainer decides: the maintainer rules on every mismatch between the documents and the code, and approves every retirement. Nothing is converted automatically. Opening the modernization PR waits for the maintainer's approval, like every write to GitHub (`SKILL.md`, GitHub Writes), and the maintainer merges it. + +Until the last folder is converted, the folders still in the 0.1.0 layout fail the profile checks, because their documents have no front matter, and the open-questions checks, because their question tables use the 0.1.0 columns. Each modernization PR therefore regenerates indexes and runs the checks with one `--pending` for each feature folder still in the 0.1.0 layout other than the one it converts; `--pending {unconverted}` in the commands below stands for that list. The commands skip only the feature folders they name and check everything else, the features converted earlier included. The gates run the same way meanwhile ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). After the last conversion nothing is pending, and the whole bundle is checked ([Finishing the modernization PR](#finishing-the-modernization-pr)). + +Before step 1: + +- **Set up the bundle.** If `docs/product/` lacks the 0.2.0 scaffold, run `"/scripts/init.sh" .` from the project root; it never overwrites. The constitution and vision gain front matter as [okf-profile.md](okf-profile.md#front-matter) describes; a 0.1.0 vision is split as [product-vision.md](product-vision.md#splitting-an-existing-vision) describes, in its own PR. +- **Reconcile `docs/product/AGENTS.md` and `docs/product/README.md`.** 0.1.0 installed both, so `scripts/init.sh` skips them, and it never overwrites them: their 0.1.0 instructions still send a new PRD to the feature folder and say to edit PRDs and TRDs in place with a changelog. Rewrite each from the current template, `templates/AGENTS.md.tmpl` and `templates/README.md.tmpl`, keeping the project's own guidance, such as conventions or notes added after setup. Do this in the first modernization PR, or in a PR of its own before it. +- **Gather the folder's material:** its `PRD.md`, `TRD.md`, `stories/` and `scenarios/`; surface-specific scenarios under `apps/{surface}/docs/features/{feature}/scenarios/`; plans and design documents under `docs/plans/` that concern the feature; decision ledgers from spikes; engineering notes; and the code, its tests and release history, which show what shipped. +- **Account for each requirement** in the original documents, with evidence from the code, tests or releases: shipped as written, shipped but different from the documents (a mismatch, step 3), or never shipped (step 4). Ask the maintainer where the evidence is thin. The accounting goes in the modernization PR's body. + +If nothing in the folder shipped, it stays unconverted: leave it as it is, named with `--pending` in every check, until the maintainer rules where its originals are preserved. There is no feature spec to derive and no bundle to archive into, because a feature bundle exists only from its first ratified change ([feature-bundles.md](feature-bundles.md#feature-bundle-layout)), so step 1's archive and step 4's `x-amends` and archive links have nothing to point at. Nothing retires or rewrites its originals: they are kept byte for byte, like every folder's. Once the maintainer has ruled, the folder's requirements go through shaping as the feature's first change ([changes-and-deltas.md](changes-and-deltas.md#naming)): a shaping document with no `x-amends`, and deltas with no existing spec as their base, each writing its facet spec from a `DOCUMENT` entry ([changes-and-deltas.md](changes-and-deltas.md#deltas)). Until then the whole-bundle check cannot pass, so the PR body lists the folder as an open decision. + +## The seven steps + +### 1. Archive the originals + +The original PRD and TRD move byte for byte to `features/{feature}/changes/archive/YYYY-MM-DD-initial/`, where they serve as the feature's first change. The date is the original documents' created date, from the PRD's `**Created:**` header. 0.1.0 did not require that header; without it, use the date of the changelog's initial row, the one that records the initial version, else the date of the commit that created the PRD: `git log --diff-filter=A --follow --format=%as -- docs/product/features/{feature}/PRD.md | tail -1`. Move them with `git mv` and change nothing in them: their status fields, changelog tables and wording stay as written, as the record of what was approved under 0.1.0. + +They get no OKF front matter, so under OKF v0.3 they are not concepts, and the profile's `type` and `status` checks skip them. The profile skips only these two files: a `PRD.md` or `TRD.md` with no front matter directly in a dated `-initial` archive that has no `deltas/`, when the feature log's Modernized entry links that archive. It checks anything else there as usual, and a PRD in a canonized change's archive too ([okf-profile.md](okf-profile.md#files-in-the-bundle)). The archive's generated `index.md` lists them as archived originals, and a feature-log entry records the move: the Modernized entry (step 5). + +Confirm each archived file is unchanged by comparing it with the original at the modernization PR's base: `git show :docs/product/features/{feature}/PRD.md | cmp - `. + +### 2. Derive the feature spec from what shipped + +Write the spec overview and facet specs from the code and the original documents, covering shipped behavior only. The code says what shipped; the original documents give the intent, the words and the IDs. Use the templates in `templates/documents/` and write in durable tense ([feature-bundles.md](feature-bundles.md#durable-tense)). The overview is complete from the start, not metadata-only, because its behavior has shipped. Start `log.md` from `templates/documents/feature-log.md.tmpl`. + +Each spec unit gets a stable ID. Keep the original document's ID for each requirement you carry into the spec, so `FR-1` in the archived PRD is `FR-1` in the facet spec. A unit with no original ID takes the next free number for its prefix, checked against the archived originals too: an ID they use is never reused ([feature-bundles.md](feature-bundles.md#spec-units)). + +Stories and scenarios move to the feature root with what shipped, and no more. A story gains front matter (`type: story`, `status: stable`) and loses its 0.1.0 `**Status:**` line. Each mismatch ruling applies to stories and scenarios as it does to the spec unit (step 3), so no story or scenario at the feature root asserts behavior that never shipped, such as a lead time the code doesn't use. A story or scenario file that shipped in full and agrees with the code moves unchanged, apart from a story's front matter and status line. + +A story or scenario file that shipped only in part is split, as canonization splits one ([changes-and-deltas.md](changes-and-deltas.md#deferred-stories-and-scenarios)): the feature root gets the shipped scenarios, or the story with its shipped acceptance criteria, and the change in step 4 gets the file at the same path with the deferred scenarios or deferred acceptance criteria added back. A file in which nothing shipped goes to that change whole. + +Surface-specific scenarios keep their app path, `apps/{surface}/docs/features/{feature}/scenarios/`. The rulings apply to them too, and deferred scenarios leave the file, which keeps only what shipped. The change accounts for each such file in its delta's `## App-local scenario files` section, with the file as the modernization PR leaves it as base text ([changes-and-deltas.md](changes-and-deltas.md#app-local-scenario-files)), and its shaping document quotes the deferred scenarios, so its promotion PR writes them back. + +Behavior in the code that no original document describes is not part of this conversion: code alone never admits a spec, so it enters through `shaping/` or `ideas/` (`SKILL.md`, Stages). + +### 3. Rule on each mismatch + +Wherever the spec and the code disagree, the maintainer decides which is right. Present each mismatch with what the original document says, what the code does, and the evidence for each. A ruling covers every statement of the behavior: the spec unit, and every story and scenario that asserts it. + +- **The code is right:** the feature spec, stories and scenarios state what the code does. +- **The document is right:** the code never shipped the intended behavior. The feature spec, stories and scenarios still state what shipped, and the intended behavior is unbuilt work: step 4 carries it as a modification of that spec unit and of each story and scenario file that asserts it. + +Each ruling becomes a feature-log entry, a Decision entry with the mismatch, the ruling, its reason and who ruled. A consequential one also becomes an ADR: a decision that is hard to reverse, surprising and the result of a real trade-off ([tech-decisions.md](tech-decisions.md)). ADRs live outside `docs/product/`, and the log entry links the ADR. + +### 4. Carry the unbuilt work forward + +Requirements that never shipped become one change in `shaping/`, with deltas against the new spec: `shaping/{feature}--{change}/`, named for what the change delivers. Its shaping document carries `x-amends: {feature}`, quotes each carried-forward requirement as written, links the archived originals and holds the provenance record ([changes-and-deltas.md](changes-and-deltas.md#provenance)). A carried-forward requirement keeps its original ID in the archive as provenance; the change's delta adds it with the next free ID, as canonization does for a deferred addition ([canonization.md](canonization.md#1-coverage-check)). A ruling that the document was right becomes a `MODIFIED` entry, with the shipped unit as its base text. + +List every story and scenario file the change carries in its delta, as the delta contract requires ([changes-and-deltas.md](changes-and-deltas.md#format)): `MODIFIED`, with the feature-root file as base text, for a file split in step 2 or revised by a ruling that the document was right; `ADDED` for a file that is not at the feature root. Each sits in the change's `stories/` or `scenarios/` at its feature-root path, so canonization moves it there once it ships. + +Approval under 0.1.0 doesn't carry over: the change reaches `features/{feature}/changes/` only through its own promotion PR, after its PRD, TRD, stories and scenarios are drafted and approved like any other change. A 0.1.0 PRD still marked as a draft, never approved, is handled the same way. + +Live open questions in the original documents move to the shaping document they now concern, or to the register, `docs/product/open-questions.md` ([open-questions.md](open-questions.md)), with a blocking level and a resolution method. Each takes the next number in its new home and names the original it came from. Rebase every inbound link to a moved question, such as a story's `../PRD.md#oq-1`, to the question's new home, then regenerate the open-questions index, with the same `--pending` as the profile check: + +```bash +python3 "/scripts/open-questions.py" index --pending {unconverted} docs/product +``` + +Never name the folder being converted, or one converted earlier, with `--pending`: both scripts refuse a folder that is not in the 0.1.0 layout. The script doesn't validate the question tables of the pending folders, since they hold 0.1.0 tables, but a valid row there counts, indexed and seen by `blocking`. Rows in tables still in the 0.1.0 format are skipped, so the maintainer reads those tables directly before accepting a gate pass ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). Every other table is validated, so an error in a feature converted earlier still fails the command. It checks question links everywhere except between pending folders: links into them, and their links out to the rest of the bundle. + +`open-questions.py` doesn't follow the question links inside the archived originals, the PRD and TRD that the profile checks skip, identified the same way. They are history, and history never blocks a live check: a link in them that breaks once they are archived, such as a relative link to a question in another folder, never fails a check, and you don't edit them to fix it. A live document's link into the archive is checked like any other. + +### 5. Convert the history + +Changelog rows become `log.md` entries, one entry for each row of each changelog table, under the row's date. The feature log runs oldest first, while 0.1.0 changelogs ran newest first, so reverse the order. Each entry names the row's change, the document whose changelog held it, linked in the archive, and its rationale as the reason; leave the reason out when the rationale was blank or a dash: + +```markdown +## 2026-05-11 + +- **Recorded in 0.1.0:** Added FR-3: no reminders for declined events + - Document: PRD changelog, [archived](changes/archive/2026-04-20-initial/PRD.md) + - Reason: Members who declined an event were still reminded, and some turned reminders off altogether. +``` + +Decision-ledger files become ADRs, for consequential decisions, or feature-log entries, for the rest. Each ledger then retires under step 7. + +Market and positioning details go to research notes in `docs/product/research/`, as [product-vision.md](product-vision.md#market-context-research-note) describes: segments, competitors, survey results, positioning claims. Name each note for when its evidence was gathered and record in it where the detail came from. The archived originals keep the detail as written; the feature spec and the shaping document don't repeat it. + +Finish the log with a Modernized entry, dated the day of the modernization PR. It records the move to the archive, linking it, what the feature spec covers, the change that carries the unbuilt work, where each live open question moved, the research notes written, each retired artifact with where its content went and the maintainer's approval, and the modernization PR. Put each mismatch ruling's Decision entry under the same date, before it. + +### 6. Move plans out + +Committed implementation plans leave the repository. Anything durable in them goes to the feature spec, an ADR or the log first: a decision and its reason, a finding that explains shipped behavior, or why a requirement waits. Task lists, file lists and step-by-step instructions are not durable; Git history keeps them. Design documents under `docs/plans/` go the same way, their durable content to the shaping document, an ADR or the log. From here on, execution plans stay out of Git (`SKILL.md`, Implementation). + +### 7. Retire artifacts with approval + +The maintainer approves each retirement. A document describing shipped behavior retires only once its content is in the feature spec. A plan or design document retires once its content is in a shaping document, an ADR or the log. Retiring an artifact deletes it in the modernization PR; Git keeps its content. List each retirement in the PR body for the maintainer to approve, and record it in the Modernized entry. The archived originals are not retired: they are the feature's first change. + +Engineering references found along the way, such as architecture contracts, vendor notes and implementation notes, stay outside `docs/product/`. Move them to the project's engineering documentation if they sit inside it; a spec or TRD links them as external links. + +## Finishing the modernization PR + +Regenerate the indexes and check the conversion from the project root: the profile check, the pinned upstream validator, downloaded as [okf-profile.md](okf-profile.md#checks) shows, and the open-questions check ([open-questions.md](open-questions.md)): + +```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 +``` + +The commands skip only the pending folders and name each one they skip. They check `features/{feature}/`, the features converted earlier and everything outside the feature directories, such as `shaping/`, `research/` and the files directly in `features/`, in full. Index generation skips the same folders, so it writes no `index.md` into a folder not yet converted, which is left byte for byte as it was; the index of `features/` still lists it. Folders not yet converted still fail the checks run without `--pending`, the profile check on their missing front matter and the open-questions check on their 0.1.0 tables, so a modernization PR does not run them that way while any remain. The validator passes with them: it only warns that a file without front matter is not a concept. + +After the last conversion, run the whole-bundle commands, with nothing left pending: index generation, the profile check and the open-questions check without `--pending`, and the validator again. From then on CI runs the checks on the whole bundle. + +```bash +python3 "/scripts/okf-profile.py" index docs/product +python3 "/scripts/okf-profile.py" check docs/product +python3 /tmp/okf-validate.py docs/product +python3 "/scripts/open-questions.py" check docs/product +``` + +Before asking the maintainer to merge, confirm: + +- the original PRD and TRD sit in the archive, byte-identical; +- the feature spec covers only shipped behavior, and each story and scenario at the feature root states only what shipped, with the rulings applied; +- each requirement that never shipped is in the change in `shaping/`, and each story and scenario file it carries is listed in its delta; +- each live open question has moved, and every link to it resolves; +- each market detail is in a research note; +- the log carries every changelog row and every mismatch ruling; +- no plan remains; +- every concept's OKF `type` and `status` match its path, and the profile and open-questions checks pass with the remaining 0.1.0 folders pending, or the whole-bundle checks after the last conversion. + +The PR body holds the accounting, each mismatch with the maintainer's ruling, and each retirement with the maintainer's approval. When the project tracks changes on a board, the change carried forward gets an item in Shaping after the modernization PR merges, which puts its shaping directory on the default branch, and only once the maintainer approves the board write ([board-mapping.md](board-mapping.md#board-moves); `SKILL.md`, GitHub Writes). + +## Worked example + +The `event-reminders` feature of a shared-calendar product reminds members before events on a calendar they share. Under 0.1.0 its folder holds a PRD and a TRD, both `**Status:** Implemented` and created 2026-04-20, each with a two-row changelog; story `US-001`; and `scenarios/event-reminders.feature`. `docs/plans/2026-04-22-event-reminders.md` is the committed implementation plan. `docs/product/AGENTS.md` and `README.md` are as 0.1.0 installed them, with the project's own conventions added; setup rewrites them from the current templates and keeps those conventions. A second 0.1.0 folder, `features/calendar-sharing/`, waits for its own modernization PR; this PR's checks name it with `--pending`, and its PRD has no `**Created:**` header, so its archive will take the date of its changelog's initial row, 2026-03-02. The event-reminders PRD lists four requirements: + +| ID | Requirement | What the code does | +|----|-------------|--------------------| +| FR-1 | A push notification before each event | Shipped | +| FR-2 | The reminder arrives 30 minutes before the event starts | Sends it 10 minutes before | +| FR-3 | No reminder for a declined event | Shipped | +| FR-4 | SMS for members without the app | Never shipped | + +Its Problem section also cites a March 2026 survey and says competing shared-calendar apps remind only the event's creator. + +**1. Archive.** The PRD and TRD move unchanged to `features/event-reminders/changes/archive/2026-04-20-initial/`. + +**2. Derive.** `event-reminders-spec.md` and the facet spec `reminders.md` state FR-1, FR-2 and FR-3, with their original IDs. `US-001` and `scenarios/event-reminders.feature` both assert the 30-minute lead time, and both hold an SMS item that never shipped: an unchecked acceptance criterion and a scenario. They reach the feature root with the FR-2 ruling applied and the SMS items split off to the change in step 4. Nothing about SMS reaches the feature spec. + +**3. Rule.** FR-2 is a mismatch. The plan records a usability test in which five of six testers had forgotten a reminder that arrived 30 minutes ahead. The maintainer rules the code right, and FR-2 reads "The reminder arrives 10 minutes before the event starts." The ruling applies to `US-001`'s criterion and the lead-time scenario, which state 10 minutes and 13:50. The ruling is a Decision entry; it is not consequential, so no ADR. + +**4. Carry forward.** FR-4 starts `shaping/event-reminders--sms-reminders/`: a shaping document that quotes FR-4 and the PRD's privacy note, a draft delta that adds the requirement as FR-5, since FR-4 stays with the archive, and the split `US-001` and scenario file, each with its SMS item added back and listed in the delta as a `MODIFIED` whole-file unit. The PRD's open question on SMS consent, OQ-1, moves to the shaping document's Open Questions table, and the link to it from `US-001`'s SMS criterion is rebased from `../PRD.md#oq-1` to `../sms-reminders.md#oq-1`. The TRD's link to the question, `PRD.md#oq-1`, still resolves in the archive. `calendar-sharing`'s PRD keeps its 0.1.0 Open Questions table; the open-questions commands skip it, named with `--pending`. The change is not ratified; it needs its own promotion PR. + +**5. Convert.** The four changelog rows become four Recorded in 0.1.0 entries under 2026-04-20 and 2026-05-11. The survey and the competitor detail go to `research/2026-03-16-reminder-survey.md`. + +**6. Move plans out.** The plan's lead-time finding is already the ruling's reason, and its note that the SMS provider contract was never signed goes to the shaping document. + +**7. Retire.** The maintainer approves retiring the plan, and the modernization PR, #160, deletes it. The log ends: + +```markdown +## 2026-12-02 + +- **Decision:** FR-2 reminder lead time + - Mismatch: The original PRD says the reminder arrives 30 minutes before the event starts; the shipped code sends it 10 minutes before. + - Ruling: The code is right. FR-2, `US-001` and the lead-time scenario state the 10-minute lead time. + - Reason: In a usability test on 2026-04-28, five of six testers had forgotten a reminder that arrived 30 minutes ahead by the time the event started. + - Ruled by: the maintainer, in modernization PR #160 +- **Modernized:** event-reminders + - Archive: [2026-04-20-initial](changes/archive/2026-04-20-initial/), the original PRD and TRD, byte for byte and without front matter + - Feature spec: FR-1, FR-2 and FR-3 in `reminders.md`, derived from the shipped code and the original documents; `stories/US-001-get-reminded.md` and `scenarios/event-reminders.feature` at the feature root, with the FR-2 ruling applied and without the SMS criterion and scenario + - Carried forward: FR-4, SMS reminders, never shipped, with the SMS criterion of `US-001` and the SMS scenario. It starts the change `shaping/event-reminders--sms-reminders/`; its approval under 0.1.0 does not carry over. + - Open questions: the PRD's OQ-1, on SMS consent, moved to the shaping document as its OQ-1; the link from `US-001` was rebased + - Research: the March 2026 survey and the comparison with competing apps went to `research/2026-03-16-reminder-survey.md` + - Retired: `docs/plans/2026-04-22-event-reminders.md`, once its lead-time finding was in the FR-2 decision and its SMS note in the shaping document. The maintainer approved the retirement in modernization PR #160. + - Links: modernization PR #160 +``` + +The skill's test fixture, `tests/fixtures/modernization/`, holds this example before and after, and `tests/modernization.bats` checks the result. diff --git a/plugins/product-development/skills/product-development/references/okf-profile.md b/plugins/product-development/skills/product-development/references/okf-profile.md new file mode 100644 index 0000000..6409b44 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/okf-profile.md @@ -0,0 +1,154 @@ +# OKF Profile + +Load this reference when you create, move or check a document under `docs/product/`, regenerate its indexes, or run the profile checks. It is the skill's profile of Open Knowledge Format (OKF) v0.3: the rules `docs/product/` follows on top of OKF itself. ADR 0003 (product documents form one OKF bundle) records the decision. Where feature documents live is in [feature-bundles.md](feature-bundles.md). Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +## The bundle + +`docs/product/` is one OKF v0.3 bundle, and `docs/product/index.md` is its root. The root `index.md` is the only file in the bundle whose front matter describes the bundle: + +```yaml +--- +okf_version: "0.3" +title: Shared calendars product documents +description: Foundation documents, ideas, shaping and feature specs for a shared-calendar product. +--- +``` + +`okf_version: "0.3"` is required, as a quoted string. `title`, `description`, `license` and `x-` keys are optional. The index generator keeps this front matter byte for byte and regenerates the body below it, so prose for readers goes in `README.md`, not in the root index. + +ADRs, engineering references and test code stay outside `docs/product/`. Links to them are external links, which OKF consumers accept even when broken. + +## Files in the bundle + +| File | Role | Front matter | +|------|------|--------------| +| `index.md` | Generated directory listing, in every directory | Root only | +| `log.md` | Feature log in a feature bundle, lineage log in `features/`; reserved at every level | None | +| `README.md`, `AGENTS.md`, `CONTEXT.md` | Guidance for readers and agents, and the product glossary. Never concepts, whatever their front matter says | None; never a `type` | +| Any other `.md` file | A product document: an OKF concept | Required | +| An archived original: only `PRD.md` and `TRD.md`, with no front matter, directly in `features/{feature}/changes/archive/YYYY-MM-DD-initial/`, when that archive has no `deltas/` and the feature's `log.md` has a Modernized entry that links it | The PRD and TRD written with 0.1.0, archived byte for byte by [modernization](modernization.md). Not a concept; the profile checks skip it and the index lists it under Other files. Any other file there, and a PRD in a canonized change's archive, is checked as usual | None | +| `.feature` files and other non-Markdown files | Assets; a link or a delta may name them | None | +| Implementation code, such as `.ts`, `.js`, `.py`, `.rs`, `.go`, `.swift`, `.kt`, `.java` or `.sh` files | Not allowed. Code lives outside the bundle. It may link to its feature with an optional `@feature` tag or the path convention ([feature-tags.md](feature-tags.md)); an untagged codebase is supported | — | +| Names that start with `.` | Not part of the bundle | — | + +A symbolic link that resolves outside `docs/product/` is not part of the bundle either: OKF consumers do not follow one out of the bundle. The index generator neither reads nor lists it, and the profile check reports it. An `index.md` is always a regular file; the generator writes nothing while any `index.md` is a symbolic link. The bundle root is never a symbolic link either: the script refuses a bundle path that is one, or a relative bundle path with a symbolic link among its directories, and exits 2. It does not check the directories above an absolute bundle path. + +A `log.md` is a flat list of entries grouped under `## YYYY-MM-DD` date headings, the form OKF v0.3 requires. Each entry is one list item; its details nest inside it. See [feature-bundles.md](feature-bundles.md#feature-log). + +## Front matter + +Every product document opens with front matter: + +```yaml +--- +type: feature-spec-facet +title: Invitations +description: How people are invited to a shared calendar and how they respond. +status: stable +tags: +- workflow +--- +``` + +- `type`: one value from the closed list below. Lowercase kebab-case. +- `title`: the document's name. +- `description`: one sentence about what the document covers. The index lists it beside the title. +- `status`: the OKF readiness the document's path gives it. See [Status](#status). +- `tags`: optional, a YAML list. What a facet spec covers, or `companion` on a vision companion. +- Keys of the skill's own use the `x-` prefix, such as `x-amends: {feature}` on a shaping document that amends an existing feature. + +Quote a value that contains `: `, such as `title: "PRD: invite-expiry"`, or it does not parse as YAML. + +Front matter is read as YAML 1.2 with the core schema, as OKF v0.3 requires. Only `true` and `false` (in any of their core-schema spellings) are booleans, and there are no dates: `title: On` and `title: 2026-12-01` are strings. A plain `2026`, `1.5` or `null` is still a number or a null, so quote a title that looks like one. + +Spec units carry stable IDs in the body, such as `FR-12`, not in front matter, so a unit keeps its identity when files move. Typed relationships between documents wait for upstream OKF; until then documents link to each other with ordinary links. + +## Types + +The `type` list is closed. A document whose type is not on it fails the profile checks. + +| Type | Document | Where it lives | +|------|----------|----------------| +| `constitution` | The product constitution | `constitution.md`; approved versions in `constitutions/` | +| `vision` | The product vision, and its companion documents | `vision.md`; approved versions in `visions/`; companions linked from the vision | +| `research-note` | Evidence, such as market context | `research/` | +| `idea` | An idea | `ideas/` | +| `shaping` | A shaping document | `shaping/{feature}--{change}/{change}.md` | +| `feature-spec-overview` | A feature overview | `features/{feature}/{feature}-spec.md` | +| `feature-spec-facet` | A facet spec | `features/{feature}/{facet}.md` | +| `prd` | A change's PRD | `PRD.md` in a change directory | +| `trd` | A change's TRD | `TRD.md` in a change directory | +| `delta` | A delta | `deltas/{facet}.delta.md` in a change directory | +| `story` | A user story | `stories/` in a change directory or at the feature root | +| `delivery-plan` | The delivery plan | `roadmap.md` | +| `open-questions` | The open-questions register | `open-questions.md` | + +A vision companion uses type `vision` with the tag `companion`, so the closed list stays as it is. Any `vision` document other than `vision.md` and its approved versions in `visions/` must carry that tag. + +## Tags + +Tags are open: each product names its facets in its own words. A starter set for facet specs: `workflow`, `contract`, `policy`, `data`, `integration`, `permissions`, `entitlement`, `notification`, `screen`, `quality`, `user-type`. + +## Status + +OKF `status` mirrors the path; the path is the authority (ADR 0001, stage directories carry authority). For the stage directories, use the tables in [feature-bundles.md](feature-bundles.md#the-product-bundle) and [changes-and-deltas.md](changes-and-deltas.md#change-states). The rest of the bundle follows the same rule: archives are `deprecated`, everything current outside `ideas/` and `shaping/` is `stable`. + +| Path | OKF `status` | +|------|--------------| +| `constitution.md`, `vision.md`, vision companions, `roadmap.md`, `open-questions.md`, `research/` | `stable` | +| `constitutions/`, `visions/` (approved versions kept as history) | `deprecated` | + +The profile check applies the rule as: `draft` under `ideas/` and `shaping/`; `deprecated` under `features/{feature}/changes/archive/`, `constitutions/` and `visions/`; `stable` everywhere else. Moving a document between these paths changes its `status` in the same pull request. + +The constitution's `Status: Approved` line is its own approval metadata, written in the body. It is separate from OKF `status`. + +## Indexes + +Every directory in the bundle has a generated `index.md`; an empty directory's index has one empty heading and lists nothing. Regenerate them from the project root with: + +```bash +python3 "/scripts/okf-profile.py" index docs/product +``` + +`` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. The script path resolves from there; the bundle path, `docs/product`, resolves from the project root. While feature folders written with 0.1.0 await modernization, add one `--pending` for each, so the generator writes no index into them ([Checks](#checks), [While modernization is in progress](open-questions.md#while-modernization-is-in-progress)). + +Run it in every pull request that adds, moves, renames or removes a document, or changes a title or description, and commit the result. Don't edit an index by hand; the freshness check fails on any difference. + +Each index has up to three sections: + +- **Documents**: each concept, as its title linked to the file, then its description. +- **Directories**: each subdirectory, with a description from its lead document (the overview of a feature, the shaping document of a shaping directory, the PRD of a change) or, for the standard directories, a fixed one. +- **Other files**: `log.md`, `README.md`, `AGENTS.md`, `CONTEXT.md` and assets. A `.feature` file is described by its `Feature:` line. + +The generator escapes Markdown punctuation in link labels, so a title such as `Handling ] in input`, `Q&A` or `~~draft~~` reads as written, and percent-encodes file names in link destinations. + +When the bundle has no root `index.md`, the generator writes one that declares `okf_version: "0.3"`. When a directory empties, its index stays, with one empty `# Documents` heading, because OKF v0.3 gives every index body at least one headed section; remove the directory to remove its index. + +## Checks + +Two checks run on the bundle, and they stay separate: + +- **Profile checks**, this skill's rules: `python3 "/scripts/okf-profile.py" check docs/product`, run from the project root. They check that the root declares `okf_version: "0.3"`; that every Markdown file other than the reserved files, `README.md`, `AGENTS.md`, `CONTEXT.md` and archived originals has a `type`, and that it is on the closed list; that `README.md`, `AGENTS.md` and `CONTEXT.md` carry no `type`; that `title`, `description` and `status` are present; that `status` matches the path; that `tags` is a list and a vision companion carries `companion`; that no symbolic link resolves outside the bundle; that no implementation code file sits in the bundle; and that every index is a fresh, regular file. +- **OKF conformance**, generic OKF v0.3: the upstream validator, [`skills/okf-generate/scripts/validate.py`](https://github.com/open-knowledge-format/open-knowledge-format/blob/527e81aff55992be21507e97004286789126f88c/skills/okf-generate/scripts/validate.py), pinned to commit `527e81aff55992be21507e97004286789126f88c`. It checks that front matter parses as YAML and that `index.md` and `log.md` follow their reserved formats. It needs PyYAML. + +```bash +curl -fsSLo /tmp/okf-validate.py \ + https://raw.githubusercontent.com/open-knowledge-format/open-knowledge-format/527e81aff55992be21507e97004286789126f88c/skills/okf-generate/scripts/validate.py +python3 /tmp/okf-validate.py docs/product +``` + +The validator warns that `README.md`, `AGENTS.md` and `CONTEXT.md` are not concepts; that is expected. A bundle can pass the upstream validator and still fail the profile: a document with `type: roadmap` is conformant OKF but is not on the closed list. Run both in CI, and treat a profile failure or a validator error as a failed build. + +While a project is being modernized, the feature folders written with 0.1.0 that are not yet converted fail the profile checks. `python3 "/scripts/okf-profile.py" check --pending {unconverted} docs/product`, with one `--pending` for each feature folder still in the 0.1.0 layout, skips only those folders, naming each one it skips, and checks everything else in full: the root, the files directly in `features/`, the feature being converted and every feature converted earlier. `index --pending {unconverted} docs/product`, and `index --check --pending {unconverted}`, skip the same folders, so regenerating the indexes writes nothing into a folder not yet converted; `features/index.md` still lists it. The script refuses a `--pending` that names a folder not in the 0.1.0 layout: one with a feature spec overview, `{feature}-spec.md`, or a `changes/` directory, one with no `PRD.md`, or one whose `PRD.md` or `TRD.md` has front matter. `scripts/open-questions.py` takes the same `--pending` ([open-questions.md](open-questions.md#while-modernization-is-in-progress)). The scoped commands are for the transition only: after the last conversion, the whole-bundle profile check and the validator run in CI ([modernization.md](modernization.md#finishing-the-modernization-pr)). + +Both scripts exit 0 on success and 1 on a failure; the profile script exits 2 on a usage problem, such as a bundle path that is or passes through a symbolic link, or a `--pending` that names no feature folder in the 0.1.0 layout. Both need PyYAML. The profile script reads front matter as YAML 1.2 core, so a `null` value counts as missing and a quoted comma stays inside its tag. + +## Consumers + +- **Direct agent navigation.** An agent reads `docs/product/index.md`, follows the listings to the documents its task needs, and reads `type`, `description` and `status` before opening a file. +- **The upstream validator**, pinned as above. The skill's own fixture, `tests/fixtures/okf-profile/`, passes both the validator and the profile checks. +- This repository's `okf-bundle` skill targets OKF v0.2. It becomes a third consumer once #43 (okf-bundle v0.3 upgrade) lands. + +## Rollback + +To leave the profile, remove the front matter from the product documents and delete the generated `index.md` files. Directory layout and document content stay as they are. Moving a project from this skill's 0.1.0 layout into the bundle is modernization: see [modernization.md](modernization.md). diff --git a/plugins/product-development/skills/product-development/references/open-question-triage.md b/plugins/product-development/skills/product-development/references/open-question-triage.md new file mode 100644 index 0000000..dcdcb36 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/open-question-triage.md @@ -0,0 +1,61 @@ +# Open-Question Triage + +Load this reference when the maintainer works through open questions: when a check lists questions that hold a change, before a promotion PR is prepared or a handoff is sent, or when the maintainer asks to triage. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +[open-questions.md](open-questions.md) owns the register and the levels: the table, blocking levels, resolution methods, IDs, deferral records and homes. This reference owns the triage workflow that applies them. + +## The loop + +The loop takes one question at a time. Never batch decisions: each question gets its own explanation, recommendation and ruling before the next one starts. The maintainer can stop at any point; questions not yet reached stay as they are. + +### 1. Enumerate + +List the questions to triage. While feature folders written with 0.1.0 await modernization, every command here runs with one `--pending` for each of them, as the check that started the loop did ([While modernization is in progress](open-questions.md#while-modernization-is-in-progress)): + +- For a check point, the questions that hold the change there: `python3 "/scripts/open-questions.py" blocking docs/product {feature}/{change} --level `. +- For a wider pass, the generated index in `docs/product/open-questions.md`. + +Run the script from the project root. `` is the directory that holds this skill's `SKILL.md`, wherever the plugin is installed. + +Order them `none yet` first, since each must be classified before the change's next check, then `design`, `implementation` and `release`. + +### 2. Explain + +In two or three sentences: what the question asks, which document holds it, and what depends on the answer. + +### 3. Classify + +Recommend a blocking level, with the reason: + +| Blocking level | Choose it when the question | +|----------------|-----------------------------| +| `design` | blocks ratification: its answer changes the requirements, deltas or scope the maintainer ratifies | +| `implementation` | blocks the handoff: the design holds either way, but implementation cannot start without the answer | +| `release` | blocks the ship decision, or a step in the delivery plan: the change can be built, but not shipped, without it | +| `none yet` | blocks nothing yet; classify it before the change's next check | + +Recommend a resolution method as well: `research`, `spike`, `maintainer decision` or `measurement after shipping`. A question answered by measurement after shipping can't block the ship decision it measures ([open-questions.md](open-questions.md#resolution-method)). + +### 4. Recommend an action + +Recommend one, concisely, with the reason: + +- **Answer it now.** The maintainer decides, or the research or spike has already been done. +- **Keep it open** at the recommended level and method. +- **Defer it** to a shaping item, a later change or a step in the delivery plan. + +### 5. The maintainer rules + +Apply only what the maintainer approves. + +- **Answered:** write the answer in its one home, the PRD, TRD or delta of the change that settles it. An ADR or a Decision entry in the feature log is the home only when no change record holds it. Then remove the row and apply the register's cleanup in the same PR ([open-questions.md](open-questions.md#homes)): a deferred question is answered at its target, at the end of its chain, and every row deferred to it, directly or through other rows, goes too, so no row is left deferred to a removed row. A linked row in the change archive stays as history; rewrite its **Deferred to** cell to keep the original destination as plain text and link the answer's home. A choice of technology follows [tech-decisions.md](tech-decisions.md); a claim about a law, regulation or standard follows [compliance-research.md](compliance-research.md). An answer that changes the meaning of a ratified document is a revision of the change, drafted in `shaping/` ([changes-and-deltas.md](changes-and-deltas.md#changing-a-ratified-change)). +- **Kept open:** set its **Blocking level** and **Resolution** cells. +- **Deferred:** a deferral is recorded, needs maintainer approval, and names where the question went. Fill **Deferred to** with a link to the target's row and **Approval** with the date and where the maintainer approved it. Create the target row with its back-link, creating the target document if it doesn't exist yet ([open-questions.md](open-questions.md#deferral)). An approved deferral satisfies the current check. + +### 6. Tell downstream owners + +When the ruling affects work that someone else owns later, such as another feature's change or an issue in another repository, draft a comment for that owner ([downstream-comments.md](downstream-comments.md)). A target inside `docs/product/` gets a deferral row instead. + +### 7. Regenerate and continue + +Regenerate the index in the same PR, `python3 "/scripts/open-questions.py" index docs/product`, with the same `--pending` as the check, then take the next question. When the list is done, run the check that started the loop again. diff --git a/plugins/product-development/skills/product-development/references/open-questions.md b/plugins/product-development/skills/product-development/references/open-questions.md new file mode 100644 index 0000000..e5aa2e0 --- /dev/null +++ b/plugins/product-development/skills/product-development/references/open-questions.md @@ -0,0 +1,164 @@ +# Open Questions + +Load this reference when you record, defer, answer or check an open question in any product document, or regenerate the open-questions index. Terms follow the skill's glossary, [CONTEXT.md](../CONTEXT.md). + +An open question is an unchecked assumption or an undecided choice. It is recorded in the one document it concerns, together with what it blocks and how it will be answered. A question that should stop ratification must look different from one that can wait until after launch, so every question carries a blocking level. + +## What each question records + +### Blocking level + +What the question holds back, and when that is checked: + +| Blocking level | Blocks | Checked | +|----------------|--------|---------| +| `design` | Ratification of the change | When the promotion PR is prepared, and again just before it merges | +| `implementation` | Sending the handoff | Before the handoff is sent | +| `release` | The ship decision, or a step in the delivery plan | Before the ship signal fires, by whoever fires it. When merging the implementation PR is the ship signal, the implementation workflow checks before that merge. A step in the delivery plan is checked before the step is executed. | +| `none yet` | Nothing yet | Must be classified before the change's next check | + +A check passes when no open question that names its target sits at the checked level or an earlier one, and none is `none yet`. A design-level question that is still open at the handoff fails that check too: the change was ratified with it settled or deferred, so an open one means it was added later and needs a decision before work goes on. An approved deferral satisfies the check. + +The checks themselves, and how the maintainer works through the questions they find, belong to the ratification and handoff workflows. This reference defines what they check. + +### Resolution method + +How the question gets answered: + +- `research`: reading, interviews or analysis. +- `spike`: a disposable prototype (`references/idea-discovery-and-spikes.md`). +- `maintainer decision`: the maintainer chooses. +- `measurement after shipping`: data gathered once the change is live. + +A question answered by measurement after shipping can't block that same ship decision. It is classified as `none yet`, or as `release` for a later step in the delivery plan. As a `release` question it names only delivery-plan steps, by path and anchor outside any change's documents, never a change, so a product-wide one can't hold the ship it measures. + +### What it applies to + +Each question names what it blocks, in its Blocks cell: + +- `this change`, for a question in a change's own documents (its shaping document, PRD or TRD). It means the change the document belongs to, `{feature}/{change}`, so the meaning survives the move from `shaping/` to `features/` at promotion. +- `this document`, for a document's own questions, such as a question in the delivery plan or a vision companion. Research notes and foundation snapshots are never edited, so they hold no live questions: a question about a research note's evidence goes in the register, or in the change it concerns. The vision has no Open Questions section; questions about the product's direction go in the register. A question scoped to one of a change's documents, by `this document` or by the document's path, also holds that change's checks. +- A change by name, `{feature}/{change}`, or a step in the delivery plan by path and anchor, such as `roadmap.md#invitation-extension`. Separate several targets with commas. + +A question that blocks a whole document, by `this document` or by the document's path without an anchor, blocks every step in it: the check on `roadmap.md#broader-rollout` lists the delivery plan's own `this document` questions as well as the questions that name that step. + +A document target, a path ending in `.md` or a path and anchor, written plainly or as a link, must resolve: to its file and to the heading or HTML anchor it names. A step's anchor is its heading's anchor as GitHub generates it, so `## Broader rollout` is `#broader-rollout`. Renaming a heading that a Blocks cell names, or moving its document, updates those Blocks cells in the same PR. Otherwise the block would silently clear, so every command refuses to run while a target does not resolve, and `blocking` refuses a target that names a missing document or step. + +A product-wide release question blocks only the targets it names. A question about regional sender rules for expiry notices that names `shared-calendars/invite-expiry` holds that change's ship decision and no other. + +## Identity + +Each question has an ID that is unique within its document, for example `OQ-3`, and its table row starts with an HTML anchor, ``, because a table row creates no link target on its own. Elsewhere it is referred to as `#oq-3`, as a link. A new question takes the next never-issued number in its document. Answered questions leave the table, so check the document's Git history for the highest number ever issued (`git log --follow -p -- `, which follows it across committed moves), not just the rows that remain. If the document was moved but the move is not yet committed, also check the history of its prior path. Numbers are not reused, so an old link never points at a different question. + +When a document moves, links to its questions are updated like any other link in the bundle. The index generator refuses to run while any link to a question anchor does not resolve, which catches the ones that weren't. + +## The table + +Every document with open questions holds them in one table under an `## Open Questions` heading, with exactly these columns: + +```markdown +## Open Questions + +| ID | Question | Blocking level | Blocks | Resolution | Deferred to | Approval | +|----|----------|----------------|--------|------------|-------------|----------| +| OQ-1 | Is 14 days the right expiry period for every calendar? | design | this change | maintainer decision | — | — | +``` + +- **Blocking level** and **Resolution** take the values above. +- **Deferred to** and **Approval** stay `—` until the question is deferred. +- A document with no open questions keeps the heading and the header row, or drops the section. +- A table under an `## Open Questions` heading, a table whose first columns are `ID` and `Question`, or a table with a row carrying a question ID is an open-questions table, and its header must match these columns exactly, so a typo such as `Blocking Level` is refused instead of hiding the table's questions. +- A table counts with or without its outer pipes, as GitHub renders it either way. It ends where GitHub ends it: at a blank line, or at a line that starts a blockquote, heading, list item or code fence. + +The PRD and TRD templates in `references/requirements.md` use this table. + +## Deferral + +Deferring a question means recording it, getting maintainer approval, and naming the target: a shaping item, a later change, or a step in the delivery plan. The question's row records the target in **Deferred to**, as a link to the target's row (`[