diff --git a/pi/core/skills/intent-driven-development/SKILL.md b/pi/core/skills/intent-driven-development/SKILL.md index a5f032899..eb9decfe4 100644 --- a/pi/core/skills/intent-driven-development/SKILL.md +++ b/pi/core/skills/intent-driven-development/SKILL.md @@ -58,6 +58,66 @@ blocking decisions on session invalidation strategy, and explicit rollback AC. Skill reviews it for missing scope boundaries, unverifiable requirements ("the system shall be fast"), and silent assumptions, then returns corrected or supplemental criteria without restarting discovery. +### Existing-Issue Handoff Example + +When continuing an existing issue, reconcile its original +description with later comments and verified evidence before +preparing a handoff. Do not assume the issue body is current. + +**Synthetic issue:** + +- Phase A: Blocked, awaiting database approval. +- Phase B: Not started, awaiting the API contract. + +A later comment reports that Phase A passed its approval check, +with a review record and a successful test result. The agent +checks that both pieces of evidence apply to Phase A. +Phase B still requires API contract approval. + +Verified progress must be supported by checked evidence, +not merely by a completion claim. + +**Reconciled issue state (draft; not published without authorization):** + +- Phase A: Completed, supported by the verified approval + review record and successful test result. +- Phase B: Pending, awaiting API contract approval. +- Next action: Review and approve the API contract. +- Prerequisite: Obtain the contract and its designated reviewer. +- Acceptance check: Confirm approval is recorded in a + traceable review record. + +This is a proposed issue update, not an authorized edit. +Publish it only with authorization, then read back the +published description to verify its contents. + +**Unverified claim variant:** + +If the later comment only says "Phase A is done" without +verifiable evidence, keep Phase A's completion uncertain. +Record the missing evidence rather than treating the claim +as an accepted result. Do not silently erase the original +blocker or assert that Phase A remains blocked without +checking its current status. + +**Captured versus accepted variant:** + +For a task involving three fictional data categories, +preserve all requested categories in the handoff: + +| Category | Verified state | Missing prerequisite/evidence | Next action | Acceptance check | +| --- | --- | --- | --- | --- | +| A | Records captured but not accepted | Acceptance review and validation results missing | Validate records against agreed criteria | Required checks pass and acceptance is recorded | +| B | Source not established; unknown total | Authoritative source and coverage evidence missing | Identify an authoritative source and establish coverage | Source and record scope are verified | +| C | Limited subset returned zero records | Subset coverage and broader scope are unknown | Determine subset coverage and whether broader data exists | Coverage is verified; global absence is not inferred from the subset | + +Do not equate successful data capture with accepted work. +Keep unsupported counts and unverified completion claims +explicitly unknown. + +For each incomplete category, identify its next action, +missing prerequisite or evidence, and acceptance check. + ## Operating Rules 1. Inspect the available repository, documentation, issue, design, and test context before @@ -358,3 +418,21 @@ Before returning the brief, check: When another planning or implementation workflow is available, pass the acceptance brief or criterion IDs to it. When no dedicated workflow exists, provide the brief directly as the implementation reference. Do not assume any named skill or tool is installed. + +For an existing issue, read the issue body and relevant later +comments before preparing the handoff. Reconcile reported +progress against verifiable evidence, distinguishing completed +work, unverified claims, captured-but-unaccepted data, and +remaining blockers. Mark inaccessible or insufficient evidence +as unknown rather than assuming completion. + +State the next action, prerequisite or missing evidence, and +acceptance check for each remaining phase. Preserve the original +scope unless an authorized change explicitly revises it. + +Only modify the issue description when authorized. After an +authorized edit, perform a read-back of the published description +and verify that the completed work, outstanding blockers, and +acceptance criteria are represented accurately. If verification +fails, report the mismatch rather than claiming a successful +handoff. diff --git a/skills/intent-driven-development/SKILL.md b/skills/intent-driven-development/SKILL.md index a5f032899..eb9decfe4 100644 --- a/skills/intent-driven-development/SKILL.md +++ b/skills/intent-driven-development/SKILL.md @@ -58,6 +58,66 @@ blocking decisions on session invalidation strategy, and explicit rollback AC. Skill reviews it for missing scope boundaries, unverifiable requirements ("the system shall be fast"), and silent assumptions, then returns corrected or supplemental criteria without restarting discovery. +### Existing-Issue Handoff Example + +When continuing an existing issue, reconcile its original +description with later comments and verified evidence before +preparing a handoff. Do not assume the issue body is current. + +**Synthetic issue:** + +- Phase A: Blocked, awaiting database approval. +- Phase B: Not started, awaiting the API contract. + +A later comment reports that Phase A passed its approval check, +with a review record and a successful test result. The agent +checks that both pieces of evidence apply to Phase A. +Phase B still requires API contract approval. + +Verified progress must be supported by checked evidence, +not merely by a completion claim. + +**Reconciled issue state (draft; not published without authorization):** + +- Phase A: Completed, supported by the verified approval + review record and successful test result. +- Phase B: Pending, awaiting API contract approval. +- Next action: Review and approve the API contract. +- Prerequisite: Obtain the contract and its designated reviewer. +- Acceptance check: Confirm approval is recorded in a + traceable review record. + +This is a proposed issue update, not an authorized edit. +Publish it only with authorization, then read back the +published description to verify its contents. + +**Unverified claim variant:** + +If the later comment only says "Phase A is done" without +verifiable evidence, keep Phase A's completion uncertain. +Record the missing evidence rather than treating the claim +as an accepted result. Do not silently erase the original +blocker or assert that Phase A remains blocked without +checking its current status. + +**Captured versus accepted variant:** + +For a task involving three fictional data categories, +preserve all requested categories in the handoff: + +| Category | Verified state | Missing prerequisite/evidence | Next action | Acceptance check | +| --- | --- | --- | --- | --- | +| A | Records captured but not accepted | Acceptance review and validation results missing | Validate records against agreed criteria | Required checks pass and acceptance is recorded | +| B | Source not established; unknown total | Authoritative source and coverage evidence missing | Identify an authoritative source and establish coverage | Source and record scope are verified | +| C | Limited subset returned zero records | Subset coverage and broader scope are unknown | Determine subset coverage and whether broader data exists | Coverage is verified; global absence is not inferred from the subset | + +Do not equate successful data capture with accepted work. +Keep unsupported counts and unverified completion claims +explicitly unknown. + +For each incomplete category, identify its next action, +missing prerequisite or evidence, and acceptance check. + ## Operating Rules 1. Inspect the available repository, documentation, issue, design, and test context before @@ -358,3 +418,21 @@ Before returning the brief, check: When another planning or implementation workflow is available, pass the acceptance brief or criterion IDs to it. When no dedicated workflow exists, provide the brief directly as the implementation reference. Do not assume any named skill or tool is installed. + +For an existing issue, read the issue body and relevant later +comments before preparing the handoff. Reconcile reported +progress against verifiable evidence, distinguishing completed +work, unverified claims, captured-but-unaccepted data, and +remaining blockers. Mark inaccessible or insufficient evidence +as unknown rather than assuming completion. + +State the next action, prerequisite or missing evidence, and +acceptance check for each remaining phase. Preserve the original +scope unless an authorized change explicitly revises it. + +Only modify the issue description when authorized. After an +authorized edit, perform a read-back of the published description +and verify that the completed work, outstanding blockers, and +acceptance criteria are represented accurately. If verification +fails, report the mismatch rather than claiming a successful +handoff. diff --git a/tests/skills/intent-driven-development.test.js b/tests/skills/intent-driven-development.test.js new file mode 100644 index 000000000..952a58728 --- /dev/null +++ b/tests/skills/intent-driven-development.test.js @@ -0,0 +1,144 @@ + +'use strict'; + +const test = require('node:test'); +const assert = require('node:assert/strict'); +const fs = require('node:fs'); +const path = require('node:path'); + +const root = path.resolve(__dirname, '../..'); + +const skill = fs.readFileSync( + path.join(root, 'skills/intent-driven-development/SKILL.md'), + 'utf8' +); + +const handoffExample = + skill.split('### Existing-Issue Handoff Example')[1] + ?.split('\n## ')[0] || ''; + +test('documents verified progress across issue updates', () => { + assert.match(handoffExample, /Verified progress/i); + assert.match(handoffExample, /Phase A/i); + assert.match(handoffExample, /Phase B/i); + assert.match(handoffExample, /evidence/i); + assert.match(handoffExample, /acceptance check/i); +}); + +test('distinguishes unverified completion claims', () => { + assert.match(handoffExample, /Unverified claim/i); + assert.match(handoffExample, /uncertain/i); +}); + +test('distinguishes captured data from accepted work', () => { + assert.match(handoffExample, /Captured versus accepted/i); + assert.match(handoffExample, /unknown total/i); + assert.match(handoffExample, /limited subset/i); +}); + +test('requires read-back after authorized issue edits', () => { + const handoff = skill.split('## Handoff')[1] || ''; + assert.match(handoff, /read-back/i); + assert.match(handoff, /authorized/i); +}); + + +test('preserves authorization and original scope', () => { + const handoff = skill.split('## Handoff')[1] || ''; + + assert.match( + handoff, + /Preserve the original\s+scope unless an authorized change/i + ); + + assert.match( + handoff, + /Only modify the issue description when authorized/i + ); + + assert.match( + handoff, + /If verification\s+fails,\s+report the mismatch/i + ); +}); + + +// Contract checks for the synthetic handoff scenarios. +// These verify documented rules, not real agent behavior. + +function categoryRow(category) { + const line = handoffExample.split('\n').find( + line => new RegExp(`^\\|\\s*${category}\\s*\\|`).test(line) + ); + + assert.ok(line, `Missing category ${category}`); + + const cells = line.split('|').slice(1, -1).map( + cell => cell.trim() + ); + + assert.equal(cells.length, 5, `Category ${category} needs five fields`); + return cells; +} + +test('provides a reconciled issue description as an unpublished draft', () => { + const draft = handoffExample + .split('**Reconciled issue state')[1] + ?.split('**Unverified claim variant:**')[0] || ''; + + assert.ok(draft, 'Missing reconciled issue state'); + assert.match(draft, /draft|proposed/i); + assert.match(draft, /not published|authorization/i); + assert.match(draft, /Phase A:\s*Completed/i); + assert.match(draft, /review/i); + assert.match(draft, /test/i); + assert.match(draft, /Phase B:\s*(Pending|Still pending)/i); + assert.match(draft, /API contract/i); + assert.match(draft, /Next action:/i); + assert.match(draft, /Prerequisite:/i); + assert.match(draft, /Acceptance check:/i); +}); + +test('category table explicitly tracks missing prerequisites', () => { + const header = handoffExample.split('\n').find( + line => line.trim().startsWith('| Category |') + ); + + assert.ok(header, 'Missing category table'); + const columns = header.split('|').slice(1, -1).map( + cell => cell.trim() + ); + + assert.deepEqual(columns, [ + 'Category', + 'Verified state', + 'Missing prerequisite/evidence', + 'Next action', + 'Acceptance check', + ]); +}); + +test('category A distinguishes captured from accepted records', () => { + const row = categoryRow('A'); + assert.match(row[1], /captured.*not accepted/i); + assert.match(row[2], /acceptance|validation|review/i); + assert.match(row[3], /validate|review/i); + assert.match(row[4], /checks pass|accepted|acceptance.*recorded/i); +}); + +test('category B preserves unknown source and unknown total', () => { + const row = categoryRow('B'); + assert.match(row[1], /source not established/i); + assert.match(row[1], /unknown total/i); + assert.match(row[2], /authoritative source|source.*coverage/i); + assert.match(row[3], /identify|establish/i); + assert.match(row[4], /verified|confirmed/i); +}); + +test('category C does not infer global absence from a subset', () => { + const row = categoryRow('C'); + assert.match(row[1], /limited subset.*zero records/i); + assert.match(row[2], /subset|coverage|scope/i); + assert.match(row[3], /determine|verify|establish/i); + assert.match(row[4], /global absence.*not inferred|not.*global absence/i); +});