@openprd/cli 0.1.0

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.
Files changed (154) hide show
  1. package/.openprd/README.md +82 -0
  2. package/.openprd/benchmarks/evidence/milvus-io-ai-code-review-gets-better-when-models-debate-claude-vs-gemini-vs-code.md +14 -0
  3. package/.openprd/benchmarks/evidence/nolanlawson-com-using-ai-to-write-better-code-more-slowly.md +14 -0
  4. package/.openprd/benchmarks/index.md +37 -0
  5. package/.openprd/benchmarks/sources.yaml +56 -0
  6. package/.openprd/config.yaml +50 -0
  7. package/.openprd/discovery/config.json +21 -0
  8. package/.openprd/engagements/active/flows.md +30 -0
  9. package/.openprd/engagements/active/handoff.md +9 -0
  10. package/.openprd/engagements/active/intake.md +15 -0
  11. package/.openprd/engagements/active/prd.md +161 -0
  12. package/.openprd/engagements/active/review.html +61 -0
  13. package/.openprd/engagements/active/roles.md +21 -0
  14. package/.openprd/engagements/work-units/wu-20260524015648-6d33ded7.json +23 -0
  15. package/.openprd/exports/.gitkeep +0 -0
  16. package/.openprd/knowledge/index.json +7 -0
  17. package/.openprd/quality/config.json +229 -0
  18. package/.openprd/reviews/v0001.html +1256 -0
  19. package/.openprd/schema/diagram-architecture.schema.yaml +49 -0
  20. package/.openprd/schema/diagram-product-flow.schema.yaml +52 -0
  21. package/.openprd/schema/prd.schema.yaml +121 -0
  22. package/.openprd/sessions/.gitkeep +0 -0
  23. package/.openprd/standards/config.json +88 -0
  24. package/.openprd/standards/file-manual-template.md +28 -0
  25. package/.openprd/standards/folder-readme-template.md +28 -0
  26. package/.openprd/state/.gitkeep +0 -0
  27. package/.openprd/state/changes.json +12 -0
  28. package/.openprd/state/current.json +169 -0
  29. package/.openprd/state/version-index.json +15 -0
  30. package/.openprd/state/versions/.gitkeep +0 -0
  31. package/.openprd/state/versions/v0001.json +121 -0
  32. package/.openprd/state/versions/v0001.md +161 -0
  33. package/.openprd/templates/agent/intake.md +6 -0
  34. package/.openprd/templates/agent/prd.md +21 -0
  35. package/.openprd/templates/b2b/intake.md +6 -0
  36. package/.openprd/templates/b2b/prd.md +24 -0
  37. package/.openprd/templates/base/intake.md +18 -0
  38. package/.openprd/templates/base/prd.md +67 -0
  39. package/.openprd/templates/company/README.md +10 -0
  40. package/.openprd/templates/consumer/intake.md +6 -0
  41. package/.openprd/templates/consumer/prd.md +19 -0
  42. package/.openprd/templates/diagram/architecture.contract.json +53 -0
  43. package/.openprd/templates/diagram/product-flow.contract.json +76 -0
  44. package/.openprd/templates/industry/README.md +16 -0
  45. package/.openprd/templates/manifest.yaml +27 -0
  46. package/.openprd/templates/project/README.md +14 -0
  47. package/.openprd/templates/session/README.md +14 -0
  48. package/AGENTS.md +44 -0
  49. package/CONTRIBUTING.md +30 -0
  50. package/LICENSE +21 -0
  51. package/README.md +727 -0
  52. package/README_CN.md +583 -0
  53. package/SECURITY.md +23 -0
  54. package/bin/openprd.js +5 -0
  55. package/docs/assets/openprd-capability-overview-en.png +0 -0
  56. package/docs/assets/openprd-capability-overview-zh.png +0 -0
  57. package/docs/assets/openprd-learning-html.png +0 -0
  58. package/docs/assets/openprd-quality-html.png +0 -0
  59. package/docs/assets/openprd-review-html.png +0 -0
  60. package/docs/assets/openprd-scenario-overview.png +0 -0
  61. package/docs/assets/openprd-scenario-overview.svg +114 -0
  62. package/docs/assets/openprd-self-evolving-mechanisms-en.png +0 -0
  63. package/docs/assets/openprd-self-evolving-mechanisms-zh.png +0 -0
  64. package/docs/assets/openprd-visual-compare-case-study-en.png +0 -0
  65. package/docs/assets/openprd-visual-compare-case-study-zh.png +0 -0
  66. package/package.json +59 -0
  67. package/scripts/openprd-dev-check.mjs +5 -0
  68. package/scripts/openprd-review-presentation.mjs +82 -0
  69. package/skills/openprd-benchmark-router/SKILL.md +92 -0
  70. package/skills/openprd-benchmark-router/agents/openai.yaml +4 -0
  71. package/skills/openprd-benchmark-router/references/benchmark-sources.md +74 -0
  72. package/skills/openprd-benchmark-router/references/evaluation-lenses.md +66 -0
  73. package/skills/openprd-benchmark-router/references/source-policy.md +35 -0
  74. package/skills/openprd-diagram-review/SKILL.md +91 -0
  75. package/skills/openprd-diagram-review/agents/openai.yaml +4 -0
  76. package/skills/openprd-diagram-review/examples/architecture-zh.md +8 -0
  77. package/skills/openprd-diagram-review/examples/product-flow-zh.md +7 -0
  78. package/skills/openprd-diagram-review/references/cocoon-patterns.md +17 -0
  79. package/skills/openprd-diagram-review/references/diagram-contracts.md +126 -0
  80. package/skills/openprd-diagram-review/references/review-checklist.md +10 -0
  81. package/skills/openprd-discovery-loop/SKILL.md +196 -0
  82. package/skills/openprd-discovery-loop/agents/openai.yaml +3 -0
  83. package/skills/openprd-harness/SKILL.md +179 -0
  84. package/skills/openprd-harness/agents/openai.yaml +4 -0
  85. package/skills/openprd-harness/examples/full-workflow-zh.md +9 -0
  86. package/skills/openprd-harness/references/command-map.md +71 -0
  87. package/skills/openprd-harness/references/examples.md +26 -0
  88. package/skills/openprd-harness/references/usage-guide.md +335 -0
  89. package/skills/openprd-harness/references/workflow-gates.md +51 -0
  90. package/skills/openprd-learning-review/SKILL.md +75 -0
  91. package/skills/openprd-learning-review/agents/openai.yaml +4 -0
  92. package/skills/openprd-learning-review/references/content-contract.md +125 -0
  93. package/skills/openprd-learning-review/references/ebook-reader.md +46 -0
  94. package/skills/openprd-learning-review/references/evidence-manifest.md +55 -0
  95. package/skills/openprd-learning-review/references/genre-library.md +43 -0
  96. package/skills/openprd-learning-review/references/prompt-engineering.md +71 -0
  97. package/skills/openprd-learning-review/references/quality-rubric.md +28 -0
  98. package/skills/openprd-learning-review/references/retrieval-worked-example.md +40 -0
  99. package/skills/openprd-learning-review/references/style-packs/xianxia-cultivation.prompt.md +67 -0
  100. package/skills/openprd-quality/SKILL.md +101 -0
  101. package/skills/openprd-requirement-intake/SKILL.md +76 -0
  102. package/skills/openprd-requirement-intake/agents/openai.yaml +4 -0
  103. package/skills/openprd-requirement-intake/references/prd-template-lenses.md +105 -0
  104. package/skills/openprd-requirement-intake/references/routing-rubric.md +64 -0
  105. package/skills/openprd-router/SKILL.md +40 -0
  106. package/skills/openprd-shared/SKILL.md +142 -0
  107. package/skills/openprd-shared/agents/openai.yaml +4 -0
  108. package/skills/openprd-shared/references/language-and-review.md +50 -0
  109. package/skills/openprd-shared/references/operating-rules.md +65 -0
  110. package/skills/openprd-shared/references/skill-architecture.md +70 -0
  111. package/skills/openprd-standards/SKILL.md +79 -0
  112. package/skills/openprd-standards/agents/openai.yaml +4 -0
  113. package/src/agent-integration.js +1717 -0
  114. package/src/benchmark.js +873 -0
  115. package/src/cli/args.js +460 -0
  116. package/src/cli/print.js +1423 -0
  117. package/src/codex-hook-runner-template.mjs +2422 -0
  118. package/src/dev-standards.js +372 -0
  119. package/src/diagram-core.js +1047 -0
  120. package/src/diagram-workspace.js +262 -0
  121. package/src/discovery.js +709 -0
  122. package/src/fleet.js +531 -0
  123. package/src/fs-utils.js +83 -0
  124. package/src/growth.js +545 -0
  125. package/src/html-artifacts.js +3803 -0
  126. package/src/knowledge.js +668 -0
  127. package/src/language-policy.js +142 -0
  128. package/src/learning-review.js +1655 -0
  129. package/src/loop.js +1290 -0
  130. package/src/openprd.js +1136 -0
  131. package/src/openspec/change-lifecycle.js +359 -0
  132. package/src/openspec/change-validate.js +248 -0
  133. package/src/openspec/constants.js +12 -0
  134. package/src/openspec/execute.js +300 -0
  135. package/src/openspec/generate.js +692 -0
  136. package/src/openspec/paths.js +111 -0
  137. package/src/openspec/tasks.js +352 -0
  138. package/src/prd-core.js +656 -0
  139. package/src/quality-html-artifact.js +1414 -0
  140. package/src/quality-learning.js +658 -0
  141. package/src/quality.js +1262 -0
  142. package/src/review-presentation.js +240 -0
  143. package/src/run-harness.js +1470 -0
  144. package/src/self-update.js +329 -0
  145. package/src/session-binding.js +140 -0
  146. package/src/source-inventory.js +224 -0
  147. package/src/standards.js +914 -0
  148. package/src/time.js +33 -0
  149. package/src/visual-compare.js +216 -0
  150. package/src/work-unit-migration.js +232 -0
  151. package/src/work-unit.js +88 -0
  152. package/src/workspace-core.js +1706 -0
  153. package/src/workspace-registry.js +162 -0
  154. package/src/workspace-workflow.js +1797 -0
@@ -0,0 +1,55 @@
1
+ # Evidence Manifest
2
+
3
+ The manifest is the provenance layer. It tells future readers what is evidence, what is inference, and what still needs verification.
4
+
5
+ ## Source Shape
6
+
7
+ Each source should include:
8
+
9
+ - `id`
10
+ - `title`
11
+ - `type`
12
+ - `groups`
13
+ - `path`
14
+ - `relativePath`
15
+ - `summary`
16
+ - `excerpt`
17
+ - `digest`
18
+ - `note`
19
+
20
+ ## Claim Shape
21
+
22
+ Each claim should include:
23
+
24
+ - `id`
25
+ - `statement`
26
+ - `sourceIds`
27
+ - `confidence`
28
+ - `kind`
29
+
30
+ ## Gap Shape
31
+
32
+ Each gap should include:
33
+
34
+ - `id`
35
+ - `description`
36
+ - `severity`
37
+
38
+ ## Rules
39
+
40
+ - Never write a claim without source ids.
41
+ - Never hide inference inside a factual statement.
42
+ - Keep the digest stable so later packages can compare evidence lines.
43
+ - Prefer short excerpts that are enough to orient the reader, not full-file dumps.
44
+ - If a source is missing, record the gap instead of pretending the source exists.
45
+
46
+ ## Suggested Source Priorities
47
+
48
+ 1. `current-state`
49
+ 2. `task-graph`
50
+ 3. `verification`
51
+ 4. `latest-loop-report`
52
+ 5. `active-prd` and other active engagement docs
53
+ 6. `docs/basic/*`
54
+ 7. version snapshots
55
+
@@ -0,0 +1,43 @@
1
+ # Genre Reference Library
2
+
3
+ This library gives the outer voice and chapter shape. Detailed writing behavior belongs to style prompt packs.
4
+
5
+ ## Registry
6
+
7
+ | id | label | Use When | Voice | Chapter Labels |
8
+ |---|---|---|---|---|
9
+ | `internet-product` | 互联网产品 | Default for code, CLI, workflow, and product systems | 清晰、务实、讲路径、讲状态、讲证据 | 问题地图 / 系统结构 / 证据链 / 工作示例 / 下一步动作 |
10
+ | `scientific` | 严肃科研 | When the user wants rigor, verification, or research framing | 严谨、可验证、重证据、重边界 | 研究问题 / 方法框架 / 证据链 / 复现实验 / 结论回收 |
11
+ | `fairy-tale` | 童话故事 | When the user wants gentle, memorable teaching prose | 温暖、清楚、带一点故事感 | 故事开头 / 旅程地图 / 线索与证据 / 角色示例 / 回家路上 |
12
+ | `web-novel` | 网文小说 | When the user wants stronger rhythm and chapter pacing | 节奏更强、推进更快、强调冲突和转折 | 开卷入局 / 结构铺陈 / 证据反转 / 范例拆招 / 收束留白 |
13
+ | `xianxia` | 仙侠修真 | When the user wants a cultivation-style metaphor | 带一点修炼感,但仍然要稳住事实和证据 | 筑基 / 观想 / 破境 / 传功 / 归元 |
14
+
15
+ ## Prompt Pack Rule
16
+
17
+ Each genre can own multiple substyle prompt packs. For example:
18
+
19
+ - `xianxia.cultivation`: 修行札记
20
+ - `xianxia.sect-intrigue`: 宗门权谋,planned
21
+ - `xianxia.artifact-refining`: 炼器法门,planned
22
+
23
+ The CLI can select a substyle with `--style <id>`. If omitted, the genre default is used.
24
+
25
+ ## Extension Rules
26
+
27
+ - Prefer one stable registry entry per genre.
28
+ - New genres should define:
29
+ - `id`
30
+ - `label`
31
+ - `voice`
32
+ - `chapterLabels`
33
+ - `opening`
34
+ - `closing`
35
+ - Keep the chapter labels human-readable and easy to scan.
36
+ - Never let the genre layer or style prompt pack overwrite evidence semantics.
37
+
38
+ ## Selection Hints
39
+
40
+ - Use `internet-product` when the topic is a codebase, CLI, workflow, or project execution path.
41
+ - Use `scientific` when the user wants conceptual rigor or repeatability.
42
+ - Use `fairy-tale` when the user wants the material to feel gentle and easier to remember.
43
+ - Use `web-novel` or `xianxia` when the user explicitly asks for a more stylized narrative shell.
@@ -0,0 +1,71 @@
1
+ # Style Prompt Engineering
2
+
3
+ The learning review generator uses prompt packs to move from neutral facts to styled reading content.
4
+
5
+ ## Principle
6
+
7
+ Facts do not move. Style moves around them.
8
+
9
+ The Agent must preserve:
10
+
11
+ - `schema`
12
+ - `packageId`
13
+ - `sourceScope`
14
+ - evidence ids
15
+ - file paths
16
+ - digests
17
+ - command names
18
+ - OpenPrd terms
19
+
20
+ The Agent may rewrite:
21
+
22
+ - title
23
+ - subtitle
24
+ - outline labels
25
+ - chapter titles
26
+ - chapter summaries
27
+ - chapter `visualExplainer`
28
+ - paragraphs
29
+ - retrieval prompts
30
+ - worked-example framing
31
+
32
+ ## Prompt Pack Shape
33
+
34
+ Each style pack should define:
35
+
36
+ - `id`
37
+ - `label`
38
+ - `concept`
39
+ - `titlePatterns`
40
+ - `outlineArc`
41
+ - `imageryBank`
42
+ - `sentenceRhythm`
43
+ - `taboo`
44
+ - `systemPrompt`
45
+ - `titlePrompt`
46
+ - `outlinePrompt`
47
+ - `chapterPrompt`
48
+ - `proseRewritePrompt`
49
+ - `evidenceBindingPrompt`
50
+ - `qualityReviewPrompt`
51
+
52
+ ## Agent-In-The-Loop Steps
53
+
54
+ 1. Read `evidence-manifest.json`.
55
+ 2. Read the neutral `learning-content.json`.
56
+ 3. Load the selected prompt pack by `genre.style`.
57
+ 4. Use `titlePrompt` to create a book-like title and subtitle.
58
+ 5. Use `outlinePrompt` to build a three-level outline at most, but keep retrieval questions in the body rather than the outline.
59
+ 6. Use `chapterPrompt` and `proseRewritePrompt` to migrate each chapter into the style, and create `visualExplainer` cards when they help non-technical readers.
60
+ 7. Use `evidenceBindingPrompt` to preserve every source anchor.
61
+ 8. Use `qualityReviewPrompt` to check style fit and fact drift.
62
+ 9. Render `reader.html` only after the quality checks pass.
63
+
64
+ ## Quality Bar
65
+
66
+ - The result should feel like a readable book, not a decorated report.
67
+ - The outline should support scanning before reading.
68
+ - The style should be visible in title, outline, rhythm, and paragraph movement.
69
+ - If visual explainers are used, they should reduce understanding cost instead of restating the chapter mechanically.
70
+ - Every important claim should still point back to evidence.
71
+ - Evidence should be available but should not dominate the reading surface.
@@ -0,0 +1,28 @@
1
+ # Quality Rubric
2
+
3
+ Use this rubric to decide whether a learning package is good enough to ship.
4
+
5
+ ## Must Pass
6
+
7
+ - Every claim points to one or more source ids.
8
+ - The package has a stable archive path under `.openprd/learning/archive/`.
9
+ - The reader opens and navigates by chapter.
10
+ - The package includes retrieval blocks and worked examples.
11
+ - Retrieval questions stay in the body, not as separate TOC leaf items.
12
+ - The content contract is versioned.
13
+ - If a `visualExplainer` is present, it must stay faithful to evidence and must not invent unsupported screenshots, states, or outcomes.
14
+
15
+ ## Should Pass
16
+
17
+ - The genre choice matches the user's request.
18
+ - The opening paragraph explains why the package exists.
19
+ - The chapters are easy to scan.
20
+ - Product-facing or non-technical packages use `visualExplainer` blocks when they meaningfully reduce comprehension cost.
21
+ - Chapter-level source anchors help the reader jump back to sources without crowding the page.
22
+ - The next-actions section says how to reuse the pattern.
23
+
24
+ ## Stop Conditions
25
+
26
+ - If the manifest has too many gaps, stop and gather more evidence.
27
+ - If the topic is too broad, narrow it before generating prose.
28
+ - If the user wants a different genre, switch the reference library first and regenerate.
@@ -0,0 +1,40 @@
1
+ # Retrieval and Worked Example Blocks
2
+
3
+ These blocks turn the package into something the reader can actively recall, not just passively consume.
4
+
5
+ ## Retrieval Block
6
+
7
+ Use a retrieval block when you want the reader to remember a mechanism without looking at the answer immediately.
8
+
9
+ Recommended shape:
10
+
11
+ - prompt
12
+ - hint
13
+ - answer
14
+
15
+ ## Worked Example
16
+
17
+ Use a worked example when you want to show how the abstract rule applies to a real OpenPrd scenario.
18
+
19
+ Recommended shape:
20
+
21
+ - title
22
+ - scenario
23
+ - steps
24
+ - principle
25
+
26
+ ## Rules
27
+
28
+ - Make the prompt answerable from the content in the package.
29
+ - Keep the answer short enough to compare mentally.
30
+ - The worked example should show a before/after or input/output shape.
31
+ - Prefer examples that reuse actual OpenPrd files, commands, or archive paths.
32
+ - Retrieval and worked examples should appear in every major chapter when possible.
33
+
34
+ ## Good Patterns
35
+
36
+ - "If you only remember one directory, which one is it?"
37
+ - "What should be cited as evidence and what should be marked as inference?"
38
+ - "What is the smallest change needed to add a new genre?"
39
+ - "How do you archive the package and reopen it later?"
40
+
@@ -0,0 +1,67 @@
1
+ # Xianxia Cultivation Prompt Pack
2
+
3
+ ## Identity
4
+
5
+ - `genre`: `xianxia`
6
+ - `style`: `cultivation`
7
+ - `label`: 修行札记
8
+ - `concept`: 把项目学习写成一次可回溯的修行:证据是灵根,结构是经脉,实践是破境。
9
+
10
+ ## System Prompt
11
+
12
+ 你是 OpenPrd 复盘学习书的风格迁移 Agent。
13
+
14
+ 你的任务不是虚构故事,而是把中性的学习内容转写成仙侠修行札记。
15
+
16
+ 事实层必须完全来自 learning-content 和 evidence-manifest;风格层只能改变表达、结构节奏和意象。
17
+
18
+ ## Title Prompt
19
+
20
+ 输入:topic、genre、substyle、evidence summary。
21
+
22
+ 输出:一个像书名的标题和一个短副题。
23
+
24
+ 要求:标题可带“札记/小卷/归藏/心法”等书籍意象,但必须保留 topic 的核心名词。
25
+
26
+ ## Outline Prompt
27
+
28
+ 输入:章节目标、证据类别、读者学习路径。
29
+
30
+ 输出:最多三层目录。
31
+
32
+ 第 1 层是卷/章,第 2 层是本章心法、检索练习、工作示例、证据锚点。
33
+ 不要把 R1/R2 这种具体练习题放进目录;它们只留在正文中。
34
+
35
+ ## Chapter Prompt
36
+
37
+ 输入:semanticTitle、summary、paragraphs、retrievalBlocks、workedExamples。
38
+
39
+ 输出:保持同一事实顺序的风格化章节。
40
+
41
+ 要求:每章先用修行意象开场,再把意象落回文件、状态、验证或任务路径。
42
+
43
+ ## Prose Rewrite Prompt
44
+
45
+ 把“做了什么/为什么/如何验证”改写成“立基/观脉/破境/传功/归元”的阅读路径。
46
+
47
+ 每段至少保留一个明确事实锚点,例如 `.openprd/`、docs/basic、loop finish、reader.html、evidence manifest。
48
+
49
+ 不要改写文件名、命令名、schema、packageId 和 source id。
50
+
51
+ ## Evidence Binding Prompt
52
+
53
+ 每个关键判断必须保留 evidenceIds。
54
+
55
+ 如果句子是综合推断,使用“由这些证据合参可知”一类表达,而不是绝对断言。
56
+
57
+ 风格词只能包装证据,不能替代证据。
58
+
59
+ ## Quality Review Prompt
60
+
61
+ 检查 1:标题、大纲、章节是否像修行札记,而不是普通项目报告。
62
+
63
+ 检查 2:是否仍能从每章回到 evidenceIds。
64
+
65
+ 检查 3:是否有玄幻词盖过事实、命令、路径、验证结果。
66
+
67
+ 检查 4:目录是否可读,最多三层,适合展开/收起。
@@ -0,0 +1,101 @@
1
+ ---
2
+ name: openprd-quality
3
+ description: 评估 OpenPrd 的可观测性、业务成本与滥用护栏、评估执行环境覆盖、性能基线、极端场景,以及 HTML 质量评估报告和项目级经验 Skill。
4
+ ---
5
+
6
+ # OpenPrd Quality
7
+
8
+ ## 何时使用
9
+
10
+ 当实现就绪、日志、链路追踪、业务成本、免费额度、滥用防护、评估执行环境、冒烟测试、性能阈值、压力数据、HTML 质量评估报告或项目级经验 Skill 在范围内时,使用这份 skill。
11
+
12
+ 典型触发词:
13
+
14
+ - 日志、链路追踪、中心化日志、排查证据、报错回溯
15
+ - 免费用户、额度、限流、AI 调用、第三方 API、成本、预算、报警、止损、滥用
16
+ - eval、评估体系、冒烟测试、功能覆盖、异常流程、逆向流程
17
+ - CPU、内存、加载时间、接口耗时、压力测试、极端数据
18
+ - 质量评估报告、HTML 审查产物、质量门禁
19
+ - 界面效果图、实现截图、视觉对比、复刻对标、阶段性视觉评审
20
+ - 复盘后沉淀经验 Skill,避免同类问题反复出现
21
+
22
+ ## 核心命令
23
+
24
+ - 初始化质量状态:
25
+ - `openprd quality <path> --init`
26
+ - 生成评审产物:
27
+ - `openprd quality <path> --verify`
28
+ - 先生成待确认经验草案:
29
+ - `openprd quality <path> --learn --review --from .openprd/harness/turn-state.json`
30
+ - 生成界面视觉对比图:
31
+ - `openprd visual-compare <path> --reference <效果图> --actual <实现截图>`
32
+ - 基于已审查报告生成或刷新项目级经验:
33
+ - `openprd quality <path> --learn --from <candidate-dir|report-id-or-json>`
34
+ - 审查执行中发现的配置、规则候选或 user-local 偏好:
35
+ - `openprd grow <path> --review`
36
+
37
+ ## 质量审查契约
38
+
39
+ 每次阶段性实现都应先判断 EVO 场景,再按场景要求审查。基础场景至少要覆盖冒烟和任务/功能覆盖;涉及 UI、桌面端、后端、成本、安全、性能、极端数据、发布交付时,再叠加对应门禁。
40
+
41
+ 脚本、依赖或 fixture “存在”只能说明项目具备能力,不能说明本次已经执行。质量报告必须区分:
42
+
43
+ - `pass`:当前场景必需门禁已经满足,且有本次执行证据或明确项目证据
44
+ - `needs-evidence`:能力可能存在,但缺本次执行证据
45
+ - `needs-attention`:能力、配置、任务或护栏本身缺失
46
+ - `advisory`:当前场景不阻断,但发布或风险进入范围时必须补齐
47
+
48
+ 每次阶段性实现都应从六层审查:
49
+
50
+ - 质量契约:这项任务承诺覆盖什么
51
+ - 可观测性:前端、后端、agent 工具、异步任务和错误路径能否通过共享 trace/request/task/error id 串起来
52
+ - 业务成本与滥用护栏:免费、试用、消耗型资源、AI 调用、第三方 API、下载、存储等路径是否有额度、负向验证、监控、报警和止损
53
+ - 评估执行环境:冒烟测试、功能覆盖、正常性能和极端数据场景是否存在并持续维护
54
+ - 视觉评审证据:涉及界面视觉实现且已有参考效果图时,确认 `.openprd/harness/visual-reviews/` 下存在本次 `openprd visual-compare` 输出的 JPG,并且 Agent 已基于合成图复核差异
55
+ - HTML 质量评估报告:`.openprd/quality/reports/` 下的人类审查产物是否存在,且足以支持就绪判断
56
+ - 知识 Skill:已验证修复是否应该先生成 `.openprd/knowledge/candidates/` 和 `.openprd/knowledge/drafts/` 下的草案,再 promote 为 `.openprd/knowledge/skills/` 下可复用的项目经验
57
+ - 自我成长:配置缺口、文件识别、命令习惯或用户偏好优先沉淀为 `.openprd/growth` 候选,经用户确认后固化;不要把个人偏好混进项目共享质量经验
58
+
59
+ ## 可观测性规则
60
+
61
+ - 优先使用中心化 logs / traces / errors / metrics,而不是零散本地日志。
62
+ - 跨层诊断必须具备关联字段:`trace_id`、`span_id`、`request_id`、`task_id`、`user_session_id`、`error_id`。
63
+ - secrets、token、凭证、个人信息和大体积 payload 必须做脱敏。
64
+ - 每次代码变更都要自查是否需要新增结构化日志或查询示例。
65
+
66
+ ## 业务护栏规则
67
+
68
+ - 只要需求涉及免费用户、试用、额度、AI 调用、第三方 API、生成、存储、下载或其他消耗型成本,就必须明确成本来源和用户级限制。
69
+ - 必须覆盖额度绕过、重复请求、并发请求、越权身份、异常恢复等负向场景。
70
+ - 必须有用量、成本、调用量或异常行为监控信号,以及可执行的报警阈值。
71
+ - 必须说明异常后如何关闭、降级、暂停或熔断高成本路径,并明确处理负责人或交接动作。
72
+
73
+ ## 评估执行环境规则
74
+
75
+ - 如果项目还没有冒烟测试体系,先补最小可用的 smoke 路径;如果已有 smoke,也必须留下本次运行证据。
76
+ - 把任务列表映射到主流程、异常流程、逆向/负向流程和边界条件。
77
+ - 持续维护项目级和功能级性能基线;只有性能敏感、批量、发布交付或用户明确要求时,正常性能门禁才应阻断。
78
+ - 持续维护能覆盖当前功能面的极端 fixture 或压力数据;只有极端数据、并发压力、批量处理、发布交付或用户明确要求时,极端压力门禁才应阻断。
79
+ - Agent 自动收紧基线可以做,但放宽阈值必须有用户明确要求。
80
+
81
+ ## 就绪判断规则
82
+
83
+ - `openprd quality <path> --verify` 生成 advisory 报告时,仍要认真阅读 HTML,不得只看命令退出结果。
84
+ - `openprd run <path> --verify` 中只要质量报告 `productionReady=false`,就不能宣称整体就绪。
85
+ - UI 任务有参考图但缺少 visual-compare 输出时,不要宣称视觉实现完成;如果对比图仍有明显偏差,先返工而不是把差异留给用户发现。
86
+ - 最终回复必须列出未通过的必需 EVO 门禁;如果某门禁被判定不适用,要说明它是当前场景可选或已有明确豁免。
87
+
88
+ ## 经验 Skill 规则
89
+
90
+ 只有当问题具备重复性、高影响、难以重新发现,或明显由 Agent 误判导致时,才生成项目级 Skill。
91
+
92
+ 每个经验 Skill 至少应包含:
93
+
94
+ - 触发条件
95
+ - 先看什么
96
+ - 根因模式
97
+ - 修复策略
98
+ - 验证证据
99
+ - 预防要求
100
+
101
+ 不要把一次性噪声沉淀成 Skill;知识层应该保持锋利,下一次拿来就有用。
@@ -0,0 +1,76 @@
1
+ ---
2
+ name: openprd-requirement-intake
3
+ description: OpenPrd 需求入口与 PRD 分流 skill。用于用户提出产品需求、功能变更、bugfix、流程调整、跨对话续做、OpenPrd/PRD 生成、review/change/tasks 前置判断时,先按语义判断 L0 小修、L1 中等改动或 L2 需要 PRD 的需求,并选择 base、consumer、b2b 或 agent PRD 模板 lens。
4
+ ---
5
+
6
+ # OpenPrd Requirement Intake
7
+
8
+ ## 作用
9
+
10
+ 这份 skill 只做需求入口分流,不负责实现代码。
11
+
12
+ - 判断当前用户输入属于 L0、L1 还是 L2
13
+ - 决定下一步是直接澄清、mini-plan,还是正式 PRD
14
+ - 为 L2 选择 `base`、`consumer`、`b2b` 或 `agent` PRD lens
15
+ - 把用户当前需求和历史 active change 分开,避免“继续任务”吞掉新范围
16
+ - 给 `$openprd-harness` 输出下一步行动合同
17
+
18
+ ## 分流原则
19
+
20
+ 不要按关键词判断。按影响面、未知数、决策成本和验证成本判断。
21
+
22
+ - L0:单点、低风险、可逆、验收清楚。可以直接处理并事后说明。
23
+ - L1:目标明确但影响多个文件、状态或用户可见行为。先给对话内 mini-plan,再执行。
24
+ - L2:新产品、模块、流程、权限、计费、账号、AI/第三方、云服务、数据迁移、跨系统、长期工作流,或目标/验收/影响面不清。先走 PRD。
25
+
26
+ 如果同一句话同时包含“继续旧任务”和“新增范围”,先判断新增范围是否超出旧 PRD。超出时必须回到需求入口,更新 PRD/change/tasks,不能把“继续”当作实现授权。
27
+
28
+ ## 工作流
29
+
30
+ 1. 读取 `.openprd/` 状态和 `openprd run . --context`,但把它当作建议。
31
+ 2. 用 `references/routing-rubric.md` 判断 L0/L1/L2。
32
+ 3. 如果是 L2,读取 `references/prd-template-lenses.md` 选择 PRD lens。
33
+ 4. 输出一个短的 Intake Decision:
34
+ - 等级:L0 / L1 / L2
35
+ - 理由:影响面、未知数、风险、验证成本
36
+ - 当前需求是否覆盖历史 active change
37
+ - 推荐下一步
38
+ - L2 时的 PRD lens:base / consumer / b2b / agent
39
+ 5. 把执行交回 `$openprd-harness`。
40
+
41
+ ## 输出合同
42
+
43
+ ### L0
44
+
45
+ - 直接处理或问 1 个必要问题。
46
+ - 不生成 PRD。
47
+ - 完成后说明变更和验证。
48
+
49
+ ### L1
50
+
51
+ - 给 3-5 行 mini-plan。
52
+ - 明确范围内、范围外和验证方式。
53
+ - 用户已明确要求执行时可继续实现。
54
+ - 不生成正式 PRD,除非 mini-plan 暴露出新的决策缺口。
55
+
56
+ ### L2
57
+
58
+ - 先运行或建议 `openprd clarify .`。
59
+ - 用对话内摘要确认目标、用户/角色、范围、非目标、验收、开放问题。
60
+ - 使用 `openprd capture . --field ...` 写回确认事实。
61
+ - 选择并记录产品类型:`openprd classify . <consumer|b2b|agent>`;无法判断时保持 `base`。
62
+ - 再进入 `openprd synthesize .`、review artifact、change 和 tasks。
63
+
64
+ ## PRD Lens
65
+
66
+ - `base`:通用产品或工程需求,强调问题、目标、范围、流程、需求矩阵、验收和风险。
67
+ - `consumer`:面向个人用户或 C 端体验,强调用户旅程、首次成功、激活、留存、情绪价值和增长指标。
68
+ - `b2b`:面向企业、团队、后台、SaaS 或组织流程,强调买方/使用者/管理员/运营者、权限矩阵、审批审计、集成依赖、SLA 和上线支持。
69
+ - `agent`:面向 AI Agent、harness、skill、自动化或人机协作工作流,强调 Human-Agent contract、自主边界、工具边界、状态模型、失败恢复和评估计划。
70
+
71
+ 模板 lens 应融入正文结构,不要作为 PRD 末尾的字段附录。比如 B2B 的角色、权限和审批应该贯穿用户、流程、需求矩阵和验收标准;Agent 的自主边界应该贯穿范围、风险、任务和验证。
72
+
73
+ ## 何时读取参考
74
+
75
+ - 分流有争议、用户输入很长、或涉及“继续旧任务 + 新范围”时,读 `references/routing-rubric.md`。
76
+ - 需要写 PRD、选择产品类型、或用户反馈 PRD 结构奇怪时,读 `references/prd-template-lenses.md`。
@@ -0,0 +1,4 @@
1
+ interface:
2
+ display_name: "OpenPrd Requirement Intake"
3
+ short_description: "Route requirements into clarify, mini-plan, or PRD"
4
+ default_prompt: "Use $openprd-requirement-intake to classify a user request as L0, L1, or L2 and choose the right PRD path."
@@ -0,0 +1,105 @@
1
+ # PRD Template Lenses
2
+
3
+ ## 共同骨架
4
+
5
+ 所有 L2 PRD 都先回答这些问题:
6
+
7
+ 1. 为什么做:背景、问题、证据、为什么现在
8
+ 2. 给谁做:用户、角色、相关方
9
+ 3. 做到什么程度:目标、成功指标、验收标准
10
+ 4. 做什么和不做什么:范围、非目标、边界情况
11
+ 5. 用户怎么走:主流程、失败路径、恢复路径
12
+ 6. 需求怎么验收:需求矩阵、优先级、验收标准、测试/验证
13
+ 7. 有什么风险:依赖、约束、成本、滥用、开放问题
14
+ 8. 如何交接:review、change、tasks、负责人、下一步
15
+
16
+ `base/prd.md` 提供这个骨架。其他模板不是附录,而是 lens:它们改变正文组织、需求矩阵和验收重点。
17
+
18
+ ## Base
19
+
20
+ 用于无法明确归类、或通用工程/产品需求。
21
+
22
+ 推荐章节:
23
+
24
+ - 决策摘要
25
+ - 背景与问题
26
+ - 用户与相关方
27
+ - 目标与成功标准
28
+ - 范围与非目标
29
+ - 场景与流程
30
+ - 需求矩阵
31
+ - 业务护栏
32
+ - 约束、依赖、风险、开放问题
33
+ - 交接与下一步
34
+
35
+ ## Consumer
36
+
37
+ 用于个人用户、C 端体验、内容、增长、留存或情绪价值明显的需求。
38
+
39
+ 把以下问题融入正文:
40
+
41
+ - 用户画像和用户分层
42
+ - 用户旅程和关键触点
43
+ - 第一个成功时刻
44
+ - 激活指标和留存指标
45
+ - 情绪价值或生活方式价值
46
+ - 触达、转化、留存或增长实验
47
+
48
+ 需求矩阵建议增加:
49
+
50
+ - Journey Step
51
+ - User Motivation
52
+ - Aha Moment
53
+ - Activation / Retention Signal
54
+ - UX Risk
55
+
56
+ ## B2B
57
+
58
+ 用于企业、团队、后台、SaaS、组织流程、管理/审批/权限相关需求。
59
+
60
+ 把以下问题融入正文:
61
+
62
+ - 买方、使用者、管理员、运营者
63
+ - 现状流程和目标流程
64
+ - 角色权限矩阵
65
+ - 审批、审计、日志和追责
66
+ - 集成依赖、上线迁移、培训和支持
67
+ - SLA、数据边界、合规和安全
68
+
69
+ 需求矩阵建议增加:
70
+
71
+ - Role
72
+ - Permission / Approval
73
+ - Audit Evidence
74
+ - Admin / Operator Impact
75
+ - Integration Dependency
76
+
77
+ ## Agent
78
+
79
+ 用于 AI Agent、harness、skill、自动化、代码代理、人机协作或评估体系。
80
+
81
+ 把以下问题融入正文:
82
+
83
+ - Human-Agent contract
84
+ - 自主边界和人工确认点
85
+ - 工具边界和高风险动作
86
+ - 状态模型、记忆和跨会话续接
87
+ - 失败恢复和人工接管
88
+ - 评估计划和回归证据
89
+ - 成本、额度、滥用和停止条件
90
+
91
+ 需求矩阵建议增加:
92
+
93
+ - Autonomy Level
94
+ - Human Decision Point
95
+ - Tool Boundary
96
+ - State / Memory
97
+ - Fallback Path
98
+ - Evaluation Signal
99
+
100
+ ## 写作规则
101
+
102
+ - 不输出大段空字段或 TBD 墙;缺事实时进入开放问题。
103
+ - 不把类型专项字段堆在末尾;把它们融进用户、流程、需求矩阵、验收和风险。
104
+ - PRD 写产品判断,`design.md` 写技术方案,`tasks.md` 写执行步骤。
105
+ - 每条 requirement 都应能追踪到验收标准和后续 task。
@@ -0,0 +1,64 @@
1
+ # Requirement Routing Rubric
2
+
3
+ ## 判断维度
4
+
5
+ 按下面四个维度判断,不按固定关键词判断。
6
+
7
+ | 维度 | L0 | L1 | L2 |
8
+ |---|---|---|---|
9
+ | 影响面 | 单点文件、单个 UI 文案、局部 bug | 多文件或多状态,但边界清楚 | 跨模块、跨系统、跨角色、跨端或跨任务 |
10
+ | 未知数 | 几乎没有 | 有少量实现选择 | 目标、用户、范围、验收或风险未定 |
11
+ | 决策成本 | 不需要产品决策 | 需要简短方案选择 | 需要先评审意图和范围 |
12
+ | 验证成本 | 单元/局部验证 | 组合验证或 E2E | 需要分阶段任务、回归、业务/成本/权限验证 |
13
+
14
+ ## L0
15
+
16
+ 适合直接处理:
17
+
18
+ - 错别字、空格、标点、按钮文案小改
19
+ - 明确 bugfix,根因和验收都很窄
20
+ - 简单样式调整,不改变信息架构或用户流程
21
+ - 单个配置值或展示值修正
22
+
23
+ 输出:直接做,完成后说明验证。不要生成 PRD。
24
+
25
+ ## L1
26
+
27
+ 适合 mini-plan:
28
+
29
+ - 目标明确,但需要改多个文件
30
+ - 用户可见行为变化,但不引入新角色、新流程或新依赖
31
+ - 一个现有流程里的局部体验优化
32
+ - 一个明确 bug 的系统化修复,需要补测试和文档
33
+
34
+ 输出:先给 3-5 行 mini-plan,包含范围内、范围外、验证方式。用户已经要求执行时可继续。
35
+
36
+ ## L2
37
+
38
+ 必须进入 PRD:
39
+
40
+ - 新产品、新模块、新入口、新工作流或新信息架构
41
+ - 账号、权限、支付、订阅、计费、审批、审计、团队协作
42
+ - AI Agent、模型调用、第三方 API、云服务、成本或滥用风险
43
+ - 数据迁移、资源链路切换、发布链路、跨端/跨系统集成
44
+ - 用户说“继续任务”但补充了会改变范围的新目标
45
+ - 影响面和验收不清,Agent 需要猜产品决策
46
+
47
+ 输出:先澄清并进入 PRD/review/change/tasks。
48
+
49
+ ## 续接规则
50
+
51
+ 当用户提供会话 ID、work unit、task handle 或说“继续这个任务”:
52
+
53
+ 1. 先用 `openprd run . --context --message <用户原话>` 解析显式目标。
54
+ 2. 判断用户这次新增的话是否仍在原 PRD 范围内。
55
+ 3. 如果只是继续已拆任务,按 tasks 继续。
56
+ 4. 如果新增目标改变范围、验收、角色、依赖或风险,先更新 PRD/change/tasks。
57
+ 5. 不要让当前 active change 抢走用户明确给出的会话或任务目标。
58
+
59
+ ## 反例
60
+
61
+ - “把按钮文字从 A 改成 B”不是 L2。
62
+ - “修复支付失败”不一定是 L0;如果涉及登录、订单、回调、风控或退款,就是 L2。
63
+ - “把 OSS 全量切到 CDN”不是简单替换字符串;它涉及资源链路、证书、缓存、回滚和客户端验证,应按 L2。
64
+ - “继续这个任务,另外加一个跨对话任务名机制”不是普通继续;新增机制应回到 PRD。