prizmkit 1.1.145 → 1.1.147

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ If you believe the task is better suited for a different workflow, you MUST:
35
35
 
36
36
  **Your ONLY writable outputs are:**
37
37
  1. `.prizmkit/plans/project-brief.md` (`.prizmkit/plans/` — accumulated project context brief)
38
- 2. `.prizmkit/plans/project-brief.draft.md` — draft only when user exits before completion
38
+ 2. `.prizmkit/plans/project-brief.draft.md` — working source during planning and saved draft when the user exits before completion
39
39
  3. Project conventions and architecture decisions appended to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` (with user consent)
40
40
  4. Infrastructure configuration (database conventions, deployment config, **cloud services**) appended to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` `### Infrastructure` section
41
41
  5. `.prizmkit/rules/<layer>-rules.md` — per-layer development rules generated by Rules Configuration
@@ -56,6 +56,49 @@ If you believe the task is better suited for a different workflow, you MUST:
56
56
  4. **NEVER generate `feature-list.json`** — that is exclusively `feature-planner`'s responsibility
57
57
  5. Return the completed planning context to the caller. Direct implementation and planned pipeline execution are separate next steps; this planner is not an execution intermediary
58
58
 
59
+ ## Durable App Context Contract (Hard Rule)
60
+
61
+ Every new or changed project brief line, convention, infrastructure decision, architecture decision, and rule must be understandable by a fresh AI session that has never seen the planning conversation. Durable app context records the actual selected product or technical decision, not the answer token used in chat.
62
+
63
+ ### Conversational Context Normalization
64
+
65
+ - Never persist standalone option labels such as `A`, `B`, `C`, `方案A`, or `方案B`.
66
+ - Expand each selected option into complete meaning and preserve its source inline: `Selected decision: <complete meaning> (original response: "<exact response>")`.
67
+ - Resolve `上面`, `这个`, `按推荐走`, `同前`, `继续这样`, `用刚才的方案`, `same as above`, or `go with your recommendation` only when there is one provable antecedent. If multiple antecedents are plausible, ask the user for clarification; never guess.
68
+ - Exclude conversational authorization such as `所有问题都按你的推荐处理` when it only controls planning behavior and does not constrain the product or implementation.
69
+ - Do not present rejected alternatives as active decisions. Include one only when it defines a necessary non-goal or compatibility boundary.
70
+ - Preserve detailed user requirements at matching detail; normalization must not simplify away substantive product, infrastructure, architecture, or development rules.
71
+
72
+ ### Reference Material Handling
73
+
74
+ - Every retained file path, URL, screenshot, diagram, log, issue, PRD, or document reference must be purpose-tagged: say why it matters and what a downstream AI should inspect. This applies to paths and URLs in all app-planning artifacts.
75
+ - Good: `docs/architecture.md §Authentication — inspect identity-provider ownership and session boundaries`; Bad: `docs/architecture.md` alone.
76
+ - For large materials, record title/location and purpose, preserve only task-relevant exact excerpts, and move confirmed product or technical decisions into the durable app-planning artifact.
77
+ - Embed complete large materials only when future sessions cannot access the source and all content is genuinely required.
78
+
79
+ ### Good and Bad Normalization Examples
80
+
81
+ - Bad: `[ ] 使用方案B`, `按推荐走`, `use option A`, `same as above`, or `go with your recommendation`.
82
+ - Good: `[ ] Authentication uses organization-scoped OAuth with server-side sessions (original response: "方案B")`.
83
+ - Good: `Deployment target: managed container service with PostgreSQL in the same region (original response: "use option A")`.
84
+ - Bad: storing `所有问题都按你的推荐处理` as a project convention; it is conversational authorization.
85
+ - Bad: attaching an entire infrastructure proposal while recording only `follow this`. Good: retain a purpose-tagged proposal section and task-relevant exact excerpts, then name the actual network, database, and deployment decisions.
86
+
87
+ ## Pre-Generation Headless Context Completeness Gate
88
+
89
+ Before any final app-planning writer runs, review every new or changed brief line, convention, infrastructure decision, architecture decision, and rule as if the reviewer has never seen the planning conversation. Preserve unchanged historical content; do not bulk-rewrite it. From the proposed artifact alone, answer:
90
+
91
+ 1. What exact product outcome or technical decision does this line record?
92
+ 2. What exists today and what desired state or constraint applies?
93
+ 3. Which approach was selected, expressed by meaning rather than an option label?
94
+ 4. What constraints and non-goals must downstream work preserve?
95
+ 5. Why is each reference material relevant, and what should be inspected?
96
+ 6. How will downstream planning or implementation know the decision has been honored?
97
+ 7. Does any phrase require an unseen earlier question, recommendation, or option list?
98
+ 8. Do quoted source materials agree with the final task decision?
99
+
100
+ Return `NEEDS_FIXES` whenever any answer is unavailable or ambiguous. Ask the user for clarification rather than guessing, update the draft/source representation, and rerun the gate before writing final artifacts. This pre-generation gate is separate from the Local Generated-Plan Review, which repeats the same simulation after final writes.
101
+
59
102
  ## When to Use
60
103
 
61
104
  The skill `description` lists the trigger phrases. Beyond those, use this section to disambiguate from `feature-planner` and other workflows.
@@ -85,18 +128,18 @@ Do NOT use this skill when:
85
128
 
86
129
  → Read `${SKILL_DIR}/references/project-conventions-discovery.md` for the full AI-driven discovery procedure (Analyze → Reason → Present via AskUserQuestion).
87
130
 
88
- Save answers to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` under `### Project Conventions` section (format: one bullet per convention)
131
+ Run the Pre-Generation Headless Context Completeness Gate on each proposed convention, then save passing answers to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` under `### Project Conventions` section (format: one bullet per convention)
89
132
  → Output format will naturally vary per project — that is the intended behavior
90
133
 
91
134
  **Infrastructure Convention Discovery (Database + Deployment)**
92
135
 
93
136
  After project conventions are captured, check the project instruction file for `### Infrastructure` section status. Read `${SKILL_DIR}/references/infrastructure-convention-discovery.md` for the full database (6 topics — table naming, field naming, migrations, primary keys, indexes, environment separation), deployment (4 topics — target refinement, existing infrastructure, AI-assisted deploy, env var management), and cloud services (2-round AskUserQuestion) inquiry procedures. Follow the inquiry flow there — use `AskUserQuestion` for each batch. Each question MUST include a "Skip — decide later" option.
94
137
 
95
- After inquiry, update the `### Infrastructure` section in the project instruction file with all collected information (see reference file for full output format). Items still marked "Skip — decide later" remain as `<!-- [topic]: deferred -->` for `prizmkit-deploy` to pick up later.
138
+ After inquiry, run the Pre-Generation Headless Context Completeness Gate on every proposed infrastructure decision, then update the `### Infrastructure` section in the project instruction file with passing content (see reference file for full output format). Items still marked "Skip — decide later" remain as `<!-- [topic]: deferred -->` for `prizmkit-deploy` to pick up later.
96
139
 
97
140
  4. **Project brief accumulation** — throughout all interactive phases:
98
141
  → Read `${SKILL_DIR}/references/project-brief-guide.md` for template and rules
99
- → Update after each meaningful user response containing business intent, constraints, or design decisions
142
+ → Update the in-memory or `.prizmkit/plans/project-brief.draft.md` source after each meaningful user response containing business intent, constraints, or design decisions; do not write the final `.prizmkit/plans/project-brief.md` until the Pre-Generation Headless Context Completeness Gate passes
100
143
 
101
144
  ## Rules Configuration (after Infrastructure)
102
145
 
@@ -104,7 +147,7 @@ After Infrastructure configuration is complete (CP-AP-1.5), check whether the pr
104
147
 
105
148
  Rules are optional. If the user skips, AI uses general best practices freely — no reminders, no blocking.
106
149
 
107
- → Read `${SKILL_DIR}/references/rules-configuration.md` for the full procedure: layer detection, configuration mode selection, interactive Q&A per layer, template rendering, and root.prizm RULES pointer update.
150
+ → Read `${SKILL_DIR}/references/rules-configuration.md` for the full procedure: layer detection, configuration mode selection, interactive Q&A per layer, template rendering, and root.prizm RULES pointer update. Before rendering final rule files or updating the pointer, run the Pre-Generation Headless Context Completeness Gate on every proposed new or changed rule.
108
151
 
109
152
  ### After rules configuration
110
153
 
@@ -179,9 +222,9 @@ Route by answer:
179
222
  - **Generate project context only** → Enter **Quick Context Mode** (brownfield only):
180
223
  - Run Project State Detection → if greenfield, redirect to produce mode
181
224
  - Proactively scan the project (same as brownfield behavior)
182
- - Generate project-brief.md from inferred context
225
+ - Generate the proposed project brief in memory or `.prizmkit/plans/project-brief.draft.md` from inferred context
183
226
  - Skip extensive brainstorming and constraint phases
184
- - Present brief for user confirmation → write → run CP-AP-6 Generated App-Plan Review Gate → completion summary
227
+ - Run the Pre-Generation Headless Context Completeness Gate → Present brief for user confirmation → write → run CP-AP-6 Generated App-Plan Review Gate → completion summary
185
228
 
186
229
  Session goal tracking: Track the intent (`produce`, `explore`, or `quick_context`) throughout the session. If `explore`, always re-prompt before ending.
187
230
 
@@ -224,7 +267,7 @@ Execute the planning workflow in conversation mode with mandatory checkpoints:
224
267
  2.2 **Frontend design check** (for frontend projects) — scan for existing UI/UX design docs. If none found, use `AskUserQuestion`:
225
268
  - Question: "No UI/UX design docs found. Would you like to establish design direction?"
226
269
  - Options: "Establish design direction now (Recommended)", "Skip for now", "I have external designs"
227
- 3. Capture architecture decisions and finalize project brief
270
+ 3. Capture architecture decisions, run the Pre-Generation Headless Context Completeness Gate on every proposed new or changed app-planning line, and finalize project brief only after the gate passes
228
271
  4. Present completion summary with artifacts produced and possible next steps
229
272
 
230
273
  ### Checkpoints (Mandatory Gates)
@@ -239,20 +282,21 @@ Checkpoints catch cascading errors early — skipping one means the next phase b
239
282
  | **CP-AP-1.6** | Rules Configured | For each detected layer (from config.json or self-detection), rules file exists in `.prizmkit/rules/` or user explicitly skipped. `root.prizm` `RULES:` pointer up-to-date. | 2 |
240
283
  | **CP-AP-2** | Vision Summary | Goal/users/differentiators confirmed by user. For brownfield: existing purpose confirmed or refined. | 1-2 |
241
284
  | **CP-AP-3** | Frontend Design Evaluated | For frontend projects: checked for existing UI/UX design system; user was asked if missing. **Auto-pass** for backend-only or non-UI projects. | 2 |
242
- | **CP-AP-4** | Project Brief Accumulated | `.prizmkit/plans/project-brief.md` exists at `.prizmkit/plans/` with at least 3 ideas listed. For brownfield: already-implemented items marked `[x]` count toward this total. | 3 |
243
- | **CP-AP-5** | Planning Complete | All project-level context captured: conventions, infrastructure config, tech stack, architecture decisions, project brief finalized | 4 |
244
- | **CP-AP-6** | Local Plan Review Passed | Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, directly reviewed current-session final app-planning artifacts, applied accepted fixes through source/writer paths, and rechecked changed sections | 4 |
285
+ | **CP-AP-4** | Project Brief Accumulated | The in-memory brief or `.prizmkit/plans/project-brief.draft.md` contains at least 3 ideas. For brownfield: already-implemented items marked `[x]` count toward this total. The final brief is not written before CP-AP-5.5. | 3 |
286
+ | **CP-AP-5** | Planning Complete | All project-level context captured: conventions, infrastructure config, tech stack, architecture decisions, project brief drafted | 4 |
287
+ | **CP-AP-5.5** | Fresh-Session Context Passed | Every new or changed brief line, convention, infrastructure decision, architecture decision, and rule passes the Pre-Generation Headless Context Completeness Gate before its final writer runs | 4 |
288
+ | **CP-AP-6** | Local Plan Review Passed | Local generated-plan review loaded `${SKILL_DIR}/references/generated-plan-review.md`, directly reviewed current-session final app-planning artifacts, repeated fresh-session simulation, applied accepted fixes through source/writer paths, and rechecked changed sections | 4 |
245
289
 
246
290
  ## Generated App-Plan Review Gate
247
291
 
248
292
  User requirement preserved verbatim: `Add generated-plan review in app-planner also .`
249
293
 
250
- Run this gate before any final handoff whenever the current `app-planner` session wrote or rewrote final app-level planning content. In full produce mode this runs after CP-AP-5; in Quick Context Mode it runs after the confirmed `.prizmkit/plans/project-brief.md` write; in conventions, infrastructure, architecture-decision, or rules-only final-write flows it runs after those writes and before the completion summary. This gate reviews generated planning artifacts directly, not implementation diffs.
294
+ Run this gate before any final handoff whenever the current `app-planner` session wrote or rewrote final app-level planning content. In full produce mode this runs after CP-AP-5.5 and the passing content's final writes; in Quick Context Mode it runs after the confirmed `.prizmkit/plans/project-brief.md` write; in conventions, infrastructure, architecture-decision, or rules-only final-write flows it runs after those writes and before the completion summary. This gate reviews generated planning artifacts directly, not implementation diffs.
251
295
 
252
296
  1. **Load the local reference**: read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the source of truth for app-planner generated content review.
253
297
  2. **Read actual planning artifacts directly**: inspect current-session final outputs such as `.prizmkit/plans/project-brief.md`, selected `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` sections, `.prizmkit/rules/<layer>-rules.md`, and `.prizmkit/prizm-docs/root.prizm` `RULES:` pointer line. Do not rely on `git status`, `git diff`, or `git diff --cached`, because `.prizmkit` planning artifacts are often gitignored or untracked.
254
298
  3. **Scope to new/changed app-planning content**: compare against pre-session snapshots or in-memory drafts when available. Preserve unchanged historical brief items, instruction-file sections, rules files, and Prizm doc content. For explore-only sessions, draft-save exits, or flows with no new final planning content, report: `Local generated-plan review: not applicable — no new final planning content written.`
255
- 4. **Run the local checklist** from the reference: project brief completeness, consistency of conventions/infrastructure/architecture decisions, rules pointer consistency, user-provided wording preservation, app-planner writable-boundary compliance, and downstream `feature-planner` readiness to produce `.prizmkit/plans/feature-list.json` without guessing.
299
+ 4. **Run the local checklist and fresh-session simulation** from the reference: project brief completeness, consistency of conventions/infrastructure/architecture decisions, rules pointer consistency, normalization of selected decisions, purpose-tagged references, app-planner writable-boundary compliance, and downstream `feature-planner` readiness to produce `.prizmkit/plans/feature-list.json` without guessing or seeing the original conversation.
256
300
  5. **Apply accepted fixes through the source/writer path**: project brief fixes go through the draft/checklist source, instruction-file section fixes go through the selected platform instruction file section source with user confirmation when changing approved wording, rules fixes re-render from rules configuration answers/templates when available, and `root.prizm` fixes are limited to the `RULES:` pointer line.
257
301
  6. **Recheck changed sections directly** after every accepted fix batch.
258
302
  7. **Report CP-AP-6** in the completion summary: include local generated-plan review verdict, reviewed app-planning artifacts/sections, accepted fixes (or "none"), and final writer/validation result.
@@ -262,13 +306,13 @@ Run this gate before any final handoff whenever the current `app-planner` sessio
262
306
  After Phase 2, if framework-shaping architecture decisions emerged during planning (tech stack, communication patterns, data model strategies — not individual feature details), read `${SKILL_DIR}/references/architecture-decisions.md` and follow the capture flow. Most sessions will NOT produce architecture decisions — only capture when genuinely impactful.
263
307
 
264
308
  **How it works**:
265
- 1. If decisions are captured → append to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` under `### Architecture Decisions` section
309
+ 1. If decisions are captured → run the Pre-Generation Headless Context Completeness Gate on each decision, then append passing decisions to `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` under `### Architecture Decisions` section
266
310
  2. Downstream skills (feature-planner, prizmkit-plan, etc.) read `AGENTS.md` / `CLAUDE.md` / `CODEBUDDY.md` as standard context, so they automatically receive these decisions
267
311
  3. Do NOT write architecture decision content directly to `.prizmkit/prizm-docs/root.prizm` — that file is maintained by `prizmkit-prizm-docs` and `prizmkit-retrospective`. (The `RULES:` pointer line is managed by Rules Configuration, not by this section.) If the project needs `.prizmkit/prizm-docs/`, recommend the user run `prizmkit-prizm-docs` init after planning.
268
312
 
269
313
  ## Project Brief Accumulation
270
314
 
271
- During interactive planning, maintain a `.prizmkit/plans/project-brief.md` at `.prizmkit/plans/` as a simple checklist of product ideas.
315
+ During interactive planning, maintain the proposed brief in memory or `.prizmkit/plans/project-brief.draft.md` as a simple checklist of product ideas. After the Pre-Generation Headless Context Completeness Gate passes, write the final `.prizmkit/plans/project-brief.md` through the project brief writer path.
272
316
 
273
317
  → Read `${SKILL_DIR}/references/project-brief-guide.md` for full format and rules.
274
318
 
@@ -44,17 +44,44 @@ For every reviewed app-planning artifact or section, check:
44
44
  - Consistency among conventions, infrastructure, architecture decisions, and project brief content
45
45
  - Infrastructure completeness or explicit deferral for database, deployment, and cloud services topics when those flows ran
46
46
  - Rules pointer consistency: generated `.prizmkit/rules/<layer>-rules.md` files are referenced by the `root.prizm` `RULES:` line when rules were configured
47
- - User-provided wording preservation in project brief ideas, conventions, infrastructure notes, architecture decisions, and rules
47
+ - User-provided wording preservation and detail preservation at matching detail after conversational normalization in project brief ideas, conventions, infrastructure notes, architecture decisions, and rules
48
+ - Every selected product or technical decision is expressed by complete meaning rather than `A`, `B`, `C`, `方案A`, `方案B`, or another unseen option label; whenever the selection originated as shorthand, the original response is preserved inline for traceability
49
+ - Purpose-tagged paths and URLs, screenshots, diagrams, logs, issues, PRDs, and documents; large materials retain title/location, purpose, and task-relevant exact excerpts rather than full-content injection
50
+ - Conversational authorization is excluded when it controls planning but does not constrain implementation; rejected alternatives appear only as necessary non-goals
48
51
  - Downstream readiness: `feature-planner` has enough context to produce `.prizmkit/plans/feature-list.json` without guessing core app purpose, stack, constraints, or implementation conventions
49
52
  - No implementation/scaffolding actions are introduced by the app plan; outputs stay within app-planner's writable boundary
50
53
 
54
+ ## Headless Context Completeness Gate
55
+
56
+ Repeat the pre-generation simulation for every reviewed new or changed app-planning line or section as if the reviewer has never seen the planning conversation. From the artifact alone, answer:
57
+
58
+ 1. What exact product outcome or technical decision does this content record?
59
+ 2. What exists today and what desired state or constraint applies?
60
+ 3. Which approach was selected, expressed by meaning rather than an option label?
61
+ 4. What constraints and non-goals must downstream work preserve?
62
+ 5. Why is each reference material relevant?
63
+ 6. How will downstream planning or implementation know the decision was honored?
64
+ 7. Does any phrase require an unseen earlier question, recommendation, or option list?
65
+ 8. Do quoted source materials agree with the final task decision?
66
+
67
+ Return `NEEDS_FIXES` if any answer is missing, ambiguous, or dependent on shorthand such as `方案B`, `按推荐走`, `use option A`, `same as above`, or `go with your recommendation`. Accept an expanded decision only when it states complete meaning with inline traceability such as `(original response: "方案B")`. Ask the user for clarification when there is not one provable antecedent. Exclude `所有问题都按你的推荐处理` and equivalent conversational authorization unless a concrete implementation constraint was separately confirmed.
68
+
69
+ Apply this stricter gate prospectively to new or changed content and preserve unchanged historical app-planning content.
70
+
71
+ ### Good and Bad Review Examples
72
+
73
+ - Bad: `[ ] 使用方案B`; Good: `[ ] Authentication uses organization-scoped OAuth with server-side sessions (original response: "方案B")`.
74
+ - Bad: a bare architecture URL; Good: `Architecture RFC §5 — inspect identity ownership and session boundaries`, plus only task-relevant exact excerpts.
75
+ - Bad: a rejected serverless alternative listed as an active infrastructure decision; Good: include it only as a non-goal when preserving the selected container deployment boundary requires that fact.
76
+
51
77
  ## Fix Loop
52
78
 
53
79
  1. Present findings with artifact path, section name, severity, evidence, and suggested source change.
54
80
  2. Accept only findings that improve planner correctness, consistency, user wording preservation, or downstream feature-planner readiness.
55
81
  3. Apply accepted fixes to the source representation first: brief draft/checklist, instruction-file section source, rules answer/template source, or `root.prizm` `RULES:` pointer source.
56
82
  4. Regenerate or rewrite final artifacts through the same writer path used by app-planner. Do not hand-patch final artifacts as a shortcut when a draft/source representation exists.
57
- 5. Re-read the changed final artifacts directly and re-run the local review only for changed sections.
83
+ 5. Re-read the changed final artifacts directly and repeat the Headless Context Completeness Gate only for changed sections.
84
+ 6. Do not report `PASS` until every required fresh-session answer is available and each changed artifact passes its final writer/validation check.
58
85
 
59
86
  ## Report Format
60
87
 
@@ -28,8 +28,16 @@
28
28
  - Change `[ ]` to `[x]`
29
29
  - Append `->` followed by the **key file or directory paths** that implement it
30
30
  - List the most important 1-3 paths only (entry point, core module, or directory) — not every touched file
31
- - Example: `[x] User authentication with OAuth -> src/auth/, src/middleware/auth.ts`
32
- - This lets future AI sessions instantly locate the implementation without re-scanning
31
+ - Purpose-tag every retained path so a fresh session knows what to inspect
32
+ - Good: `[x] User authentication uses organization-scoped OAuth with server-side sessions -> src/auth/ inspect provider/session ownership; src/middleware/auth.ts — inspect request authorization`
33
+ - Bad: `[x] User authentication -> src/auth/, src/middleware/auth.ts` because neither the selected behavior nor path purpose is clear
34
+ - This lets future AI sessions locate the implementation without guessing or broad rescanning
35
+ 7. **Complete decision meaning**: Every line names the actual product or technical decision. Never write only `A`, `B`, `C`, `方案A`, `方案B`, `按推荐走`, `use option A`, `same as above`, or `go with your recommendation`.
36
+ 8. **Traceability**: Whenever a selection originated as shorthand, expand it into meaning and retain the original response inline: `[ ] Authentication uses organization-scoped OAuth with server-side sessions (original response: "方案B")`.
37
+ 9. **Ambiguous references**: Resolve shorthand only with one provable antecedent. Otherwise ask the user for clarification; never guess.
38
+ 10. **Conversational authorization**: Exclude statements such as `所有问题都按你的推荐处理` when they control planning behavior but do not constrain the product or implementation.
39
+ 11. **References**: Require purpose-tagged paths and URLs, documents, screenshots, diagrams, and logs. For large materials, retain title/location, purpose, and task-relevant exact excerpts; move confirmed decisions into the brief instead of embedding complete large materials.
40
+ 12. **Alternatives**: Do not present rejected alternatives as active brief items; include them only as necessary non-goals.
33
41
 
34
42
  ## Brownfield Init
35
43
 
@@ -76,7 +84,18 @@ If the user gives short/vague answers, don't accept them — rephrase and ask ag
76
84
 
77
85
  ### Generate & Confirm
78
86
  Once all criteria are met:
79
- 1. Generate brief in checklist format (see Format section above)
80
- 2. Present to user with: "Here's what I captured anything to add, remove, or change?"
81
- 3. Apply edits and write to `.prizmkit/plans/project-brief.md`
87
+ 1. Generate the proposed brief in checklist format (see Format section above).
88
+ 2. Run the app-planner Pre-Generation Headless Context Completeness Gate on every new or changed line as if the reviewer has never seen the planning conversation. Confirm the actual outcome/current state/desired state, selected meaning, constraints/non-goals, reference relevance, downstream completion signal, absence of unseen conversational dependencies, and that quoted source materials agree with the final task decision.
89
+ 3. Return `NEEDS_FIXES` for any unanswered question, update the draft/source line, and repeat until all changed lines pass. Preserve unchanged historical brief items.
90
+ 4. Present to user with: "Here's what I captured — anything to add, remove, or change?"
91
+ 5. Apply edits, rerun the gate for modified lines, and write `.prizmkit/plans/project-brief.md` only after `PASS`.
92
+
93
+ ### Good and Bad Brief Examples
94
+
95
+ - Bad: `[ ] 使用方案B`.
96
+ - Good: `[ ] Authentication uses organization-scoped OAuth with server-side sessions (original response: "方案B")`.
97
+ - Bad: `[ ] same as above` when several prior decisions exist.
98
+ - Good: ask the user which decision applies, then record its complete meaning.
99
+ - Bad: `[ ] Follow https://example.test/platform-rfc`.
100
+ - Good: `[ ] Deployment uses a managed container service with regional PostgreSQL; Platform RFC §3 — inspect region and failover constraints`.
82
101
 
@@ -40,29 +40,43 @@ After planning is complete, you MUST:
40
40
  4. NEVER auto-execute the pipeline, launcher, composite workflow, or any fix step
41
41
  5. Return the validated bug list to the caller; only `bugfix-pipeline-launcher` prepares the runtime command
42
42
 
43
- ## User-Provided Content Priority (Hard Rule)
44
-
45
- When the user provides detailed specifications, rules, or implementation requirements:
46
-
47
- 1. **Verbatim preservation**: The user's exact wording MUST be preserved in `description` and `acceptance_criteria` fields. Do NOT paraphrase, summarize, abstract, or simplify.
48
- 2. **No autonomous simplification**: A 200-word user specification must NOT become a 30-word description. Match the detail level of the user's input.
49
- 3. **Clarify, don't assume**: If any user-provided rule is ambiguous or potentially conflicts with another, ASK the user to clarify. No limit on clarification rounds. Do NOT proceed with unresolved ambiguities.
50
- 4. **Task-scoped `user_context`**: In single-bug planning, write the relevant user-provided materials into that bug's `user_context`. In multi-bug planning, multi-bug `user_context` must contain only the user text, file references, logs, and reproduction details relevant to that specific bug.
51
- - Preserve the matching user wording verbatim, but scope it to the item it belongs to.
52
- - Do NOT copy the full multi-bug request into every bug.
53
- - Ensure there are no unrelated sibling bug descriptions, stack traces, logs, reproduction steps, expected/actual behavior notes, or supplementary materials in a bug's `user_context`.
54
- - Shared global context may be copied to every item only when it is explicitly applicable to all generated items.
55
- - If a log, stack trace, screenshot, reproduction path, or file reference applies to only one bug, attach it only to that matching bug.
56
- - If applicability is unclear, ask the user to map the material to the correct bug before generating the final list.
57
- 5. **`user_context` format**:
58
- - Bug-specific supplementary content or rules store as-is (verbatim text) on the matching bug only
59
- - Bug-specific file references store as path string, e.g. `src/auth/login.ts:42-78` or `src/utils/validate.ts focus on validateEmail function`
60
- - Truly shared global constraints or environment context → repeat only when they apply to every generated bug
43
+ ## Fresh-Session Task Contract (Hard Rule)
44
+
45
+ Every new or changed bug is an executable contract for a fresh AI session that has never seen the planning conversation. Do not add new JSON fields, context objects, schema versions, or pipeline runtime structures. Use the existing fields correctly:
46
+
47
+ 1. **Self-contained contract**: The bug's `description` and `acceptance_criteria`, read together, MUST define the objective, current state and actual behavior, desired state and expected behavior, selected scope and decisions, severity rationale, constraints, non-goals, relevant integrations, edge cases, reproduction conditions, verification decisions, and completion evidence. Because no separate rationale field is added, include the durable severity rationale in `description`. Preserve user requirements at matching detail.
48
+ 2. **Supplementary evidence only**: `user_context` is supplementary evidence only. Logs, stack traces, screenshots, and source excerpts may support diagnosis, but they MUST NOT expand, replace, or contradict the contract. If `user_context` were removed, a fresh bug-fix session must still know what fails, where and when it fails, what correct behavior means, which scope was selected, and how to verify the fix.
49
+ 3. **Severity and verification are durable decisions**: Write the complete severity rationale, selected scope, environment, reproduction path, verification type, and verification decisions by meaning. Never store only an option label or conversational answer.
50
+ 4. **Clarify, do not guess**: Ask the user for clarification whenever expected behavior, root-cause scope, material applicability, or a relative reference has multiple plausible meanings.
51
+ 5. **Bug isolation**: Each bug contract and its supplementary evidence contain only material relevant to that bug. Repeat shared environment or constraints only when explicitly global.
52
+
53
+ ### Conversational Context Normalization
54
+
55
+ - Never persist standalone option labels such as `A`, `B`, `C`, `方案A`, or `方案B` as execution context.
56
+ - Expand a selected option into complete meaning with inline traceability: `Selected decision: <complete meaning> (original response: "<exact response>")`.
57
+ - Resolve `上面`, `这个`, `按推荐走`, `同前`, `继续这样`, `用刚才的方案`, `same as above`, or `go with your recommendation` only when there is one provable antecedent. Otherwise ask the user for clarification; never guess.
58
+ - Exclude conversational authorization such as `所有问题都按你的推荐处理` when it controls planning behavior but does not constrain the fix.
59
+ - Do not present rejected root-cause or fix alternatives as active instructions; preserve one only when it defines a necessary non-goal.
60
+
61
+ ### Reference Material Handling
62
+
63
+ - Every retained file path, URL, screenshot, log, stack trace, or document reference must be purpose-tagged: state why it is relevant and what the execution AI should inspect. This applies to paths and URLs in structured evidence and `user_context`.
64
+ - Good: `logs/api-500.log lines 220-248 — inspect the empty-password request, exception, and correlation ID`; Bad: `logs/api-500.log` alone.
65
+ - For large materials, record title/location and purpose, preserve only task-relevant exact excerpts, and move confirmed expected behavior, selected scope, severity rationale, and verification decisions into `description` and `acceptance_criteria`.
66
+ - Embed complete large materials only when the execution session cannot access the source and all content is genuinely required.
67
+
68
+ ### Good and Bad Normalization Examples
69
+
70
+ - Bad: `方案B`, `按推荐走`, `use option A`, `same as above`, or `go with your recommendation` stored as selected fix scope.
71
+ - Good: `Selected decision: reject empty passwords in request validation with HTTP 400 and do not enter credential verification (original response: "方案B")`.
72
+ - Good: `Selected decision: reproduce against the API integration test and retain UI verification as a regression check (original response: "use option A")`.
73
+ - Bad: storing `所有问题都按你的推荐处理` as a bug constraint; it is conversational authorization.
74
+ - Bad: attaching a complete production log while saying only `fix this`. Good: retain the relevant exception excerpt and purpose-tagged log location, then state actual behavior, expected behavior, scope, and verification in the task contract.
61
75
 
62
76
  **Multi-bug isolation example:**
63
77
  - User request includes: `Bug A: login crashes when password is empty`, `Bug B: CSV export loses Chinese characters`, and `Shared: production uses Node 20`.
64
- - The login bug `user_context` includes `Bug A: login crashes when password is empty` and the shared Node 20 environment; it MUST NOT include `Bug B: CSV export loses Chinese characters`.
65
- - The CSV bug `user_context` includes `Bug B: CSV export loses Chinese characters` and the shared Node 20 environment; it MUST NOT include `Bug A: login crashes when password is empty`.
78
+ - The login bug contract fully defines its expected/actual behavior and includes only matching evidence plus the shared Node 20 environment; it MUST NOT include the CSV report.
79
+ - The CSV bug contract fully defines encoding expectations and includes only matching evidence plus the shared Node 20 environment; it MUST NOT include the login report.
66
80
 
67
81
  ## When to Use
68
82
 
@@ -180,7 +194,7 @@ Gather project metadata from the project's own configuration and documentation
180
194
  >
181
195
  > If none, we'll proceed with bug collection."
182
196
 
183
- If the user provides materials, read/fetch them all before proceeding to Phase 2. For web links, use web fetch to retrieve and analyze the content. For images, read and analyze them visually. This context significantly improves bug diagnosis accuracy and description quality.
197
+ If the user provides materials, require or infer only when unambiguous a bug-specific purpose for each material; otherwise ask what the execution AI should inspect. Read/fetch the relevant material before Phase 2. For web links, retrieve the relevant content; for images, analyze the relevant visual evidence. Preserve purpose-tagged locations and task-relevant exact excerpts, but do not inject complete large materials merely for verbatim preservation.
184
198
 
185
199
  Output: `project_name`, `project_description`, `global_context` fields populated.
186
200
 
@@ -205,7 +219,7 @@ When parsing user input, auto-detect the format and read `${SKILL_DIR}/reference
205
219
  - Acceptance criteria (auto-suggest based on description, user can edit)
206
220
  - Model override (optional; if specified, overrides $MODEL env var for this bug fix)
207
221
 
208
- **Per-bug clarification** — if the bug's root cause, reproduction steps, expected behavior, or scope is unclear from the provided information, ask focused questions one at a time (cite the unclear point, give a recommended answer with rationale) until the bug is fully understood. Do not finalize a bug entry with ambiguous details. No limit on the number of questions per bug.
222
+ **Per-bug clarification** — if the bug's root cause, reproduction steps, current/actual behavior, desired/expected behavior, selected scope, severity rationale, verification decisions, non-goals, integration impact, edge cases, or evidence purpose is unclear, ask focused questions one at a time (cite the unclear point, give a recommended answer with rationale) until the bug is fully understood. Do not finalize shorthand that requires an unseen question, recommendation, or option list. No limit on the number of questions per bug.
209
223
 
210
224
  **Per-bug confirmation (mandatory)** — after extracting and clarifying each bug, present a structured summary using the template in `${SKILL_DIR}/assets/bug-confirmation-template.md`, then ask the three confirmation questions defined there.
211
225
 
@@ -245,11 +259,22 @@ Only finalize the bug entry after user confirms all three points.
245
259
 
246
260
  **Gate → CP-BP-3**: Severity/priority assigned, duplicates resolved.
247
261
 
248
- ### Phase 4: Pre-Generation Completeness Review
262
+ ### Phase 4: Pre-Generation Headless Context Completeness Gate
263
+
264
+ Before generating `.prizmkit/plans/bug-fix-list.json`, review every new or changed bug as if the reviewer has never seen the planning conversation. Preserve unchanged historical bugs; do not bulk-rewrite them. First remove `user_context` from the review view and answer from `description` plus `acceptance_criteria` alone:
249
265
 
250
- Before generating `.prizmkit/plans/bug-fix-list.json`, perform a holistic scan across all collected bugs. The bugfix pipeline runs autonomously — any ambiguity left here becomes a wrong assumption later.
266
+ 1. What exact problem or outcome is this task responsible for?
267
+ 2. What exists today, including actual behavior, and what must change to the expected behavior?
268
+ 3. Which fix scope and verification approach were selected, expressed by meaning rather than an option label?
269
+ 4. What constraints and non-goals must be preserved?
270
+ 5. Why is each reference material relevant, and what should be inspected?
271
+ 6. How can completion be verified?
272
+ 7. Does any phrase require an unseen earlier question, recommendation, or option list?
273
+ 8. Do quoted source materials agree with the final task decision?
251
274
 
252
- **Step 1 Description adequacy scan (Headless Execution Readiness)**: The bugfix pipeline runs each bug through an autonomous AI session with NO human interaction. Every description must be unambiguous enough for headless execution. For each bug, check:
275
+ Return `NEEDS_FIXES` whenever any answer is missing, ambiguous, or available only in supplementary evidence. Ask the user for clarification rather than guessing when a reference does not have one provable antecedent.
276
+
277
+ **Step 1 — Description adequacy scan (Headless Execution Readiness)**: The bugfix pipeline runs each bug through an autonomous AI session with NO human interaction. Every task contract must be unambiguous enough for headless execution. For each bug, check:
253
278
  - Description clearly states **expected** vs **actual** behavior (not just "X doesn't work")
254
279
  - Reproduction path is specific enough for the pipeline AI to locate the relevant code
255
280
  - If the bug involves user interaction, the trigger action is described (not just the symptom)
@@ -258,7 +283,7 @@ Before generating `.prizmkit/plans/bug-fix-list.json`, perform a holistic scan a
258
283
  - Bad: "Login is broken" — too vague, AI will search the entire codebase
259
284
  - Good: "Login form at /login returns 500 when password field is empty. Expected: validation error 400. Root cause likely in src/api/auth.ts POST /api/auth/login handler — missing null check on password field."
260
285
 
261
- **Step 2 — Acceptance criteria specificity check**: For each bug, verify each acceptance criterion passes the "pipeline autonomy test" — could an AI session, without asking a human, determine whether this criterion is met? Flag criteria that are subjective ("works correctly"), lack measurable conditions ("performs better"), or don't specify the verification method.
286
+ **Step 2 — Acceptance criteria specificity check**: For each bug, verify each acceptance criterion passes the "pipeline autonomy test" — could an AI session, without asking a human, determine whether this criterion is met? Flag criteria that are subjective ("works correctly"), lack measurable conditions ("performs better"), omit expected behavior, or leave reproduction and verification decisions only in `user_context`.
262
287
 
263
288
  **Step 3 — Cross-bug analysis**: Check for:
264
289
  - **Root cause overlap**: Multiple bugs in the same module may share a root cause — flag for user to confirm whether they should be merged or kept separate
@@ -269,11 +294,11 @@ Before generating `.prizmkit/plans/bug-fix-list.json`, perform a holistic scan a
269
294
 
270
295
  For any items that need attention, ask targeted questions to fill gaps. Iterate until the user confirms all bugs are adequately described. Present the prompt:
271
296
 
272
- > "Above is the completeness review. Items needing more detail address them now, or proceed and refine later?"
297
+ > "Above is the completeness review. Every `NEEDS_FIXES` item must be clarified before generation. Which flagged item should we address first?"
273
298
 
274
- Only proceed to Phase 5 after user confirms.
299
+ For every `NEEDS_FIXES` result, update the draft/source bug contract, rerun the artifact-alone questions, and continue until all new or changed bugs return `PASS`. Only proceed to Phase 5 after user confirms.
275
300
 
276
- **Gate → CP-BP-4**: All bugs pass headless execution readiness check.
301
+ **Gate → CP-BP-4**: All new or changed bugs pass the Headless Context Completeness Gate without relying on conversation history or `user_context`.
277
302
 
278
303
  ### Phase 5: Generate & Validate
279
304
 
@@ -295,7 +320,7 @@ Only proceed to Phase 5 after user confirms.
295
320
 
296
321
  Run this gate after `.prizmkit/plans/bug-fix-list.json` passes generation and validation, and before the final handoff. It applies whenever this session added or changed final bug entries. For validate-only, summary-only, or draft-save flows with no final content change, report that the gate is not applicable.
297
322
 
298
- Read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the single source of truth. Review the actual draft and final artifacts directly because `.prizmkit` files may be gitignored. Keep the review planning-only, apply accepted findings to the draft/source representation, regenerate the final JSON, and require validation to pass again before reporting the review result.
323
+ Read `${SKILL_DIR}/references/generated-plan-review.md` and follow it as the single source of truth. Review the actual draft and final artifacts directly because `.prizmkit` files may be gitignored. Repeat the Headless Context Completeness Gate for every reviewed new or changed bug. Keep the review planning-only, apply accepted findings to the draft/source representation, regenerate the final JSON, rerun validation, and repeat local review until it returns `PASS` before reporting the result.
299
324
 
300
325
  #### Success Output
301
326
 
@@ -341,12 +366,13 @@ Batch-parse error logs with minimal interaction: parse automatically, then requi
341
366
  - verification_type: default to `automated`
342
367
  - acceptance_criteria: auto-generate "Error no longer occurs in [scenario]"
343
368
  4. Write draft to `.prizmkit/plans/bug-fix-list.draft.json` for user review
344
- 5. Ask: "Review and confirm? You can edit individual entries."
345
- 6. After user confirms, call the generate script:
369
+ 5. Run the Phase 4 Headless Context Completeness Gate on every parsed bug. Ask targeted clarification for missing expected behavior, selected scope, severity rationale, or verification decisions; update the draft until all entries pass.
370
+ 6. Ask: "Review and confirm? You can edit individual entries."
371
+ 7. After user confirms, call the generate script:
346
372
  ```bash
347
373
  python3 ${SKILL_DIR}/scripts/validate-bug-list.py generate --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json
348
374
  ```
349
- 7. If validation passes, run the mandatory Local Generated-Plan Review Gate before summarizing or recommending `bugfix-pipeline-launcher`.
375
+ 8. If validation passes, run the mandatory Local Generated-Plan Review Gate before summarizing or recommending `bugfix-pipeline-launcher`.
350
376
 
351
377
  ## Operation: From Tests
352
378
 
@@ -359,12 +385,13 @@ Batch-parse failed test output:
359
385
  3. Auto-populate `failed_test_path`, `error_message`
360
386
  4. Set verification_type to `automated` (test already exists)
361
387
  5. Write draft to `.prizmkit/plans/bug-fix-list.draft.json`
362
- 6. Present parsed failed-test bug entries for confirmation; allow edits, merges, or removals
363
- 7. After user confirms, call the generate script:
388
+ 6. Run the Phase 4 Headless Context Completeness Gate on every parsed failed-test bug; ensure the failing test evidence agrees with the final expected behavior and selected fix scope.
389
+ 7. Present parsed failed-test bug entries for confirmation; allow edits, merges, or removals
390
+ 8. After user confirms, call the generate script:
364
391
  ```bash
365
392
  python3 ${SKILL_DIR}/scripts/validate-bug-list.py generate --input .prizmkit/plans/bug-fix-list.draft.json --output .prizmkit/plans/bug-fix-list.json
366
393
  ```
367
- 7. If validation passes, run the mandatory Local Generated-Plan Review Gate before summarizing or recommending `bugfix-pipeline-launcher`.
394
+ 9. If validation passes, run the mandatory Local Generated-Plan Review Gate before summarizing or recommending `bugfix-pipeline-launcher`.
368
395
 
369
396
  ## Operation: Validate
370
397
 
@@ -31,13 +31,38 @@ For every reviewed bug entry, check:
31
31
 
32
32
  - Schema compatibility with `dev-pipeline-bug-fix-list-v1` and `.prizmkit/dev-pipeline/templates/bug-fix-list-schema.json`
33
33
  - Dependency/DAG consistency, duplicate handling, and root-cause overlap
34
- - Description completeness: expected vs actual behavior, reproduction path, code-location hints, affected environment, and headless execution readiness
34
+ - Description completeness: objective, current/actual behavior, desired/expected behavior, selected scope, reproduction path, code-location hints, affected environment, relevant integrations, constraints, non-goals, edge cases, verification decisions, completion evidence, and headless execution readiness
35
35
  - Acceptance criteria specificity and measurable verification method
36
- - User-provided wording preservation in `description`, `acceptance_criteria`, and `user_context`
36
+ - User-provided detail preservation at matching detail after conversational normalization
37
+ - `user_context` is supplementary evidence only: it does not expand, replace, or contradict the bug contract; if `user_context` were removed, execution and verification remain unambiguous
37
38
  - Task-scoped `user_context` isolation: no unrelated sibling bug descriptions, logs, stack traces, reproduction steps, expected/actual behavior notes, or supplementary materials; shared context appears on multiple bugs only when explicitly global
39
+ - Purpose-tagged paths and URLs, screenshots, logs, stack traces, and documents; large materials retain title/location, purpose, and task-relevant exact excerpts rather than full-content injection
38
40
  - Severity/priority calibration: every reviewed bug has a short severity rationale and priority rationale, the preserved severity-to-priority mapping is followed, and high priority is not used without core outage, data loss/integrity, security/auth, timeout/crash, or no-workaround indicators
39
41
  - Browser interaction and verification fields for UI-reproducible bugs when applicable
40
42
 
43
+ ## Headless Context Completeness Gate
44
+
45
+ Repeat the pre-generation simulation for every reviewed new or changed bug as if the reviewer has never seen the planning conversation. From the artifact alone, answer:
46
+
47
+ 1. What exact problem or outcome is this task responsible for?
48
+ 2. What exists today and what must change from actual to expected behavior?
49
+ 3. Which fix scope and verification approach were selected, expressed by meaning rather than an option label?
50
+ 4. What constraints and non-goals must be preserved?
51
+ 5. Why is each reference material relevant?
52
+ 6. How can completion be verified?
53
+ 7. Does any phrase require an unseen earlier question, recommendation, or option list?
54
+ 8. Do quoted source materials agree with the final task decision?
55
+
56
+ Return `NEEDS_FIXES` if any answer is missing, ambiguous, available only in `user_context`, or dependent on shorthand such as `方案B`, `按推荐走`, `use option A`, `same as above`, or `go with your recommendation`. Accept an expanded decision only when it states complete meaning with inline traceability such as `(original response: "方案B")`. Exclude conversational authorization that does not constrain implementation. Ask the user for clarification when there is not one provable antecedent.
57
+
58
+ Do not add new JSON fields, context objects, schema versions, or pipeline runtime structures. Apply this stricter gate prospectively to new or changed entries and preserve unchanged historical bugs.
59
+
60
+ ### Good and Bad Review Examples
61
+
62
+ - Bad: `按推荐走` as severity or verification scope; Good: `Selected decision: classify as medium because export is incorrect but a JSON workaround exists; verify with the existing Unicode export test (original response: "按推荐走")`.
63
+ - Bad: a bare log path; Good: `logs/export.log lines 90-118 — inspect encoding selection and the emitted response header` plus only task-relevant exact excerpts.
64
+ - Bad: `所有问题都按你的推荐处理` as a fix constraint; Good: omit it as conversational authorization unless a concrete decision was separately confirmed.
65
+
41
66
  ## Fix Loop
42
67
 
43
68
  1. Present findings with IDs, severity, evidence, and suggested draft/source changes.
@@ -50,7 +75,8 @@ python3 ${SKILL_DIR}/scripts/validate-bug-list.py generate --input .prizmkit/pla
50
75
  ```
51
76
 
52
77
  5. Re-run validation/generation until valid. Do not hand-patch `.prizmkit/plans/bug-fix-list.json` as the source of truth.
53
- 6. Repeat the local review only for entries changed by accepted fixes.
78
+ 6. Repeat the local review and Headless Context Completeness Gate only for entries changed by accepted fixes.
79
+ 7. Do not report `PASS` until every required fresh-session answer is available and final validation passes after regeneration.
54
80
 
55
81
  ## Report Format
56
82