@openprd/cli 0.1.1 → 0.1.9

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 (137) hide show
  1. package/.openprd/README.md +43 -69
  2. package/.openprd/README_EN.md +84 -0
  3. package/.openprd/benchmarks/index.md +7 -0
  4. package/.openprd/benchmarks/sources.yaml +25 -3
  5. package/.openprd/discovery/config.json +16 -2
  6. package/.openprd/engagements/active/flows.md +19 -14
  7. package/.openprd/engagements/active/handoff.md +11 -4
  8. package/.openprd/engagements/active/prd.md +99 -71
  9. package/.openprd/engagements/active/review.html +4 -4
  10. package/.openprd/engagements/active/roles.md +9 -8
  11. package/.openprd/engagements/work-units/wu-20260524015648-6d33ded7.json +4 -4
  12. package/.openprd/engagements/work-units/wu-20260602113956-a99b5b88.json +18 -0
  13. package/.openprd/engagements/work-units/wu-20260602122244-78656aaf.json +18 -0
  14. package/.openprd/engagements/work-units/wu-20260602122442-e96489e2.json +18 -0
  15. package/.openprd/engagements/work-units/wu-20260602132835-695429e8.json +18 -0
  16. package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/candidate.json +78 -0
  17. package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/diagnostic-report.json +129 -0
  18. package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/root-cause-candidates.json +41 -0
  19. package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/timeline.json +14 -0
  20. package/.openprd/knowledge/drafts/openprd-experience-diagnostic-candidate-turn-1780116203372-5f266a79e968c758/SKILL.md +49 -0
  21. package/.openprd/knowledge/index.json +44 -4
  22. package/.openprd/reviews/v0001.html +195 -129
  23. package/.openprd/reviews/v0002.html +1150 -0
  24. package/.openprd/reviews/v0003.html +1150 -0
  25. package/.openprd/reviews/v0004.html +1150 -0
  26. package/.openprd/reviews/v0005.html +1150 -0
  27. package/.openprd/standards/config.json +12 -9
  28. package/.openprd/state/changes.json +17 -2
  29. package/.openprd/state/current.json +399 -63
  30. package/.openprd/state/release-ledger.json +387 -0
  31. package/.openprd/state/version-index.json +52 -0
  32. package/.openprd/state/versions/v0002.json +264 -0
  33. package/.openprd/state/versions/v0002.md +183 -0
  34. package/.openprd/state/versions/v0003.json +269 -0
  35. package/.openprd/state/versions/v0003.md +188 -0
  36. package/.openprd/state/versions/v0004.json +274 -0
  37. package/.openprd/state/versions/v0004.md +193 -0
  38. package/.openprd/state/versions/v0005.json +299 -0
  39. package/.openprd/state/versions/v0005.md +189 -0
  40. package/.openprd/templates/agent/intake.md +5 -4
  41. package/.openprd/templates/b2b/intake.md +5 -4
  42. package/.openprd/templates/base/intake.md +10 -4
  43. package/.openprd/templates/company/README.md +9 -7
  44. package/.openprd/templates/company/README_EN.md +12 -0
  45. package/.openprd/templates/consumer/intake.md +5 -4
  46. package/.openprd/templates/industry/README.md +12 -10
  47. package/.openprd/templates/industry/README_EN.md +18 -0
  48. package/.openprd/templates/project/README.md +11 -9
  49. package/.openprd/templates/project/README_EN.md +16 -0
  50. package/.openprd/templates/session/README.md +11 -9
  51. package/.openprd/templates/session/README_EN.md +16 -0
  52. package/AGENTS.md +12 -8
  53. package/README.md +419 -438
  54. package/README_CN.md +4 -578
  55. package/README_EN.md +870 -0
  56. package/docs/assets/openprd-requirement-routing-en.png +0 -0
  57. package/docs/assets/openprd-requirement-routing-en.svg +102 -0
  58. package/docs/assets/openprd-requirement-routing-zh-refined.png +0 -0
  59. package/docs/assets/openprd-requirement-routing-zh.png +0 -0
  60. package/docs/assets/openprd-requirement-routing-zh.svg +102 -0
  61. package/package.json +6 -2
  62. package/scripts/dev-check-wrapup-copy.mjs +110 -0
  63. package/scripts/openprd-github-release-notes.mjs +99 -0
  64. package/scripts/quality-perf-check.mjs +203 -0
  65. package/skills/openprd-benchmark-router/SKILL.md +1 -0
  66. package/skills/openprd-benchmark-router/references/benchmark-sources.md +1 -0
  67. package/skills/openprd-benchmark-router/references/source-policy.md +2 -0
  68. package/skills/openprd-discovery-loop/SKILL.md +2 -2
  69. package/skills/openprd-harness/SKILL.md +47 -25
  70. package/skills/openprd-harness/references/workflow-gates.md +15 -0
  71. package/skills/openprd-quality/SKILL.md +11 -5
  72. package/skills/openprd-requirement-intake/SKILL.md +31 -20
  73. package/skills/openprd-requirement-intake/references/prd-template-lenses.md +6 -6
  74. package/skills/openprd-requirement-intake/references/routing-rubric.md +10 -2
  75. package/skills/openprd-router/SKILL.md +2 -2
  76. package/skills/openprd-shared/SKILL.md +51 -23
  77. package/skills/openprd-standards/SKILL.md +2 -1
  78. package/src/agent-integration.js +271 -71
  79. package/src/benchmark/constants.js +107 -0
  80. package/src/benchmark/operations.js +235 -0
  81. package/src/benchmark/registry.js +64 -0
  82. package/src/benchmark/render.js +115 -0
  83. package/src/benchmark/source.js +617 -0
  84. package/src/benchmark/storage.js +121 -0
  85. package/src/benchmark/verify.js +235 -0
  86. package/src/benchmark.js +50 -851
  87. package/src/change-summary.js +339 -0
  88. package/src/cli/args.js +67 -6
  89. package/src/cli/basic-print.js +365 -0
  90. package/src/cli/benchmark-print.js +91 -0
  91. package/src/cli/change-print.js +221 -0
  92. package/src/cli/doctor-print.js +268 -0
  93. package/src/cli/growth-print.js +176 -0
  94. package/src/cli/print.js +73 -1384
  95. package/src/cli/quality-print.js +284 -0
  96. package/src/cli/run-print.js +297 -0
  97. package/src/cli/shared-print.js +127 -0
  98. package/src/cli/workflow-print.js +195 -0
  99. package/src/codex-hook-runner-template.mjs +659 -124
  100. package/src/codex-runtime.js +324 -0
  101. package/src/dev-standards.js +178 -5
  102. package/src/diagram-core.js +5 -5
  103. package/src/discovery.js +2 -1
  104. package/src/execution-strategy.js +369 -0
  105. package/src/fleet.js +4 -0
  106. package/src/github-release.js +156 -0
  107. package/src/growth.js +311 -13
  108. package/src/html-artifact-utils.js +25 -0
  109. package/src/html-artifacts.js +157 -1596
  110. package/src/knowledge.js +1321 -76
  111. package/src/language-policy.js +2 -112
  112. package/src/learning-html-artifact.js +1031 -0
  113. package/src/learning-review.js +3 -2
  114. package/src/loop.js +280 -9
  115. package/src/openprd.js +341 -38
  116. package/src/openspec/change-validate.js +0 -9
  117. package/src/openspec/execute.js +79 -3
  118. package/src/openspec/generate.js +33 -20
  119. package/src/openspec/tasks.js +33 -2
  120. package/src/prd-core.js +10 -9
  121. package/src/product-type-copy.js +69 -0
  122. package/src/quality-html-artifact.js +108 -9
  123. package/src/quality-learning.js +30 -0
  124. package/src/quality-visual-review.js +237 -0
  125. package/src/quality.js +329 -43
  126. package/src/registry-hygiene.js +54 -0
  127. package/src/release-ledger.js +413 -0
  128. package/src/review-presentation.js +12 -6
  129. package/src/run-harness.js +722 -48
  130. package/src/session-binding.js +40 -3
  131. package/src/session-registry.js +159 -0
  132. package/src/standards.js +5 -3
  133. package/src/test-strategy.js +386 -0
  134. package/src/visual-compare.js +915 -34
  135. package/src/work-unit-migration.js +5 -1
  136. package/src/workspace-core.js +343 -19
  137. package/src/workspace-workflow.js +538 -134
package/README_EN.md ADDED
@@ -0,0 +1,870 @@
1
+ # OpenPrd
2
+
3
+ [简体中文](./README.md) | English
4
+
5
+ > An AI-native PRD workspace and CLI that helps teams clarify requests, confirm direction, and ship with evidence.
6
+
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](./LICENSE)
8
+ [![Node.js](https://img.shields.io/badge/node-%3E%3D20.19.0-339933.svg)](https://nodejs.org/)
9
+ [![GitHub stars](https://img.shields.io/github/stars/mileson/openprd?style=social)](https://github.com/mileson/openprd)
10
+
11
+ OpenPrd is a lightweight **PRD harness**. Start by describing the problem in plain language, and it helps teams and agents turn that request into:
12
+
13
+ - requirement clarification
14
+ - shared confirmation
15
+ - visual review
16
+ - structured handoff into execution
17
+
18
+ Instead of hiding key decisions in prompts or terminal logs, OpenPrd keeps people and agents aligned around stable HTML artifacts such as `review.html`, learning readers, and quality reports.
19
+
20
+ ![OpenPrd capability overview](https://raw.githubusercontent.com/mileson/openprd/main/docs/assets/openprd-capability-overview-en.png)
21
+
22
+ ## Why OpenPrd
23
+
24
+ OpenPrd is designed for the gap between:
25
+
26
+ - vague product ideas that need clarification
27
+ - agent-assisted requirement drafting
28
+ - human confirmation at the right decision points before implementation
29
+ - structured handoff into execution systems
30
+
31
+ It is especially useful when you want:
32
+
33
+ - **clarify before drafting** instead of jumping straight to implementation
34
+ - **source-aware capture** so user-confirmed facts stay separate from repo-derived, agent-inferred, or agent-normalized context
35
+ - **policy-based review gates** that keep stable artifacts without forcing the same stop every time
36
+ - **agent-facing skills** shipped with the tool, not hidden in a local environment
37
+
38
+ If your teammates often say “we kind of know what we want, but it is not fully shaped yet”, that is usually the moment when OpenPrd is most useful.
39
+
40
+ ## How OpenPrd routes a request
41
+
42
+ You do not need to decide whether your request is `L0 / L1 / L2`, and you do not need a technical design up front. Start with business language: who is stuck, in what situation, and what you want fixed first. OpenPrd helps turn that into the right working rhythm.
43
+
44
+ ![OpenPrd requirement routing](https://raw.githubusercontent.com/mileson/openprd/main/docs/assets/openprd-requirement-routing-en.png)
45
+
46
+ - **Quick fix**: the problem is already clear, the blast radius is small, and success is easy to verify. OpenPrd usually handles it directly and then reports back what changed and how it was checked.
47
+ - **Existing-flow improvement**: the goal is clear, but it affects several screens, states, or user actions. OpenPrd first gives a plain-language mini-plan, then continues once the direction is aligned.
48
+ - **New feature / new workflow**: the surface area is bigger, more roles are involved, or the business risk is still unclear. OpenPrd first clarifies the user scenario, first version, what stays out of scope, and the main risks before moving into the full review/spec/task path.
49
+
50
+ If the request is more consumer-oriented, OpenPrd pays extra attention to the user moment, the first felt value, and whether people will want to come back. If it is more B2B, it cares more about who approves, who uses, and who must drive rollout. If it is more agent-oriented, it focuses on what can be automated, where human backup is required, and what happens when the flow fails. The default conversation is about outcomes, situations, and risks, not internal tooling words.
51
+
52
+ ## Where OpenPrd Is Different
53
+
54
+ OpenPrd lives in a different spot than tools that are centered only on spec files
55
+ or only on coding execution.
56
+
57
+ | Tool | Center of gravity | Main user-facing artifacts | Best fit |
58
+ |------|-------------------|----------------------------|----------|
59
+ | **OpenPrd** | Requirement clarification, HTML-first collaboration, and delivery gates | `review.html`, learning readers, quality reports, diagrams, structured change/task state | Teams that need humans and agents to stay aligned through planning, review, execution, and ship decisions |
60
+ | **OpenSpec** | Spec and change lifecycle | Markdown proposals, specs, design docs, tasks | Teams that want disciplined spec deltas and a clean change-management workflow |
61
+ | **Superpowers** | Skill-driven coding execution | Skills, plans, worktree/subagent flows, code-review checkpoints | Engineering-heavy teams optimizing how AI agents plan, code, review, and finish branches |
62
+
63
+ OpenPrd is strongest when the hard part is not just "what code should be written,"
64
+ but "what should people confirm, what should stay visible, and what evidence is
65
+ enough to move forward."
66
+
67
+ ## Built-In Best-Practice Routing And Default Enhancers
68
+
69
+ OpenPrd does more than sequence requirement work. It also ships with a best-practice routing layer so the agent can look in the right place before it changes design, copy, or code.
70
+
71
+ - **Public-repo architecture understanding**: when the task is to understand a public GitHub repository, its subsystem layout, or a key execution flow, OpenPrd pushes the agent toward `DeepWiki` first
72
+ - **Third-party technical documentation**: when the task depends on library, framework, API, CLI, or MCP usage, config, limits, version differences, or migration paths, OpenPrd pushes the agent toward `Context7` first
73
+ - **Icons and visual assets**: when the task is to choose UI icons, AI brand icons, tech-stack icons, 3D assets, or functional icon resources, OpenPrd routes that request toward more appropriate sources instead of making the agent guess on the fly
74
+ - **Project-level long-term references**: repeatedly adopted external sources can be promoted into the project's own reusable best-practice registry
75
+
76
+ The goal is not to pile up links. The goal is to make "where should we look first, why this source, and when is the evidence sufficient" part of the normal collaboration flow. For AI coding work, that directly affects design quality, technical judgment, and implementation stability.
77
+
78
+ Common built-in enhancement directions include:
79
+
80
+ - `DeepWiki`: understand public GitHub repository architecture, module relationships, and key flows
81
+ - `Context7`: retrieve current third-party technical docs, config guidance, version differences, and migration notes
82
+ - Icon and visual-asset routing: prefer sources such as `Phosphor Icons`, `LobeHub Icons`, `Tech Icons`, `Thiings`, and `iconfont` by use case
83
+ - Icon implementation library suggestions: when the work reaches frontend code, narrow to `Lucide`, `Tabler`, or `React Icons` based on project fit
84
+
85
+ ## Common Real-World Scenarios
86
+
87
+ Recent Codex project usage kept clustering around the same kinds of work: fuzzy
88
+ product requests, existing-product redesigns, release/publish flows, production
89
+ incident closure, and reusable learning handoff.
90
+
91
+ | Scenario | Why OpenPrd stands out here | Main artifacts |
92
+ |----------|-----------------------------|----------------|
93
+ | Fuzzy product request before anyone codes | Clarify first, separate user-confirmed facts from agent inference, then turn the result into a stable review surface. | `clarify`, `capture`, `synthesize`, `review.html` |
94
+ | Existing flow or auth-entry redesign | Reconstruct current behavior from repo and runtime evidence before proposing the next change. | `discovery`, `diagram`, `review.html`, `change` |
95
+ | Visual or product-flow confirmation | Keep architecture, product flow, or UI replication reviewable instead of burying decisions in chat. | `diagram`, `visual-compare`, side-by-side JPG reviews |
96
+ | Long-running agent implementation chain | Turn accepted work into dependency-ready tasks and run one focused agent session per task with verify gates. | `tasks`, `loop`, prompts, progress logs, verification reports |
97
+ | Release, publish, or handoff readiness | Make "ready to ship" a visible decision with standards, regression evidence, abuse/cost guardrails, and workspace health. | `quality`, `run --verify`, `doctor`, `handoff` |
98
+ | Learning handoff after a fix or project | Package the final requirement, reasoning, and outcome into something new collaborators can actually study. | learning reader, `.openprd/knowledge/skills/`, docs sync |
99
+
100
+ ## HTML-First Collaboration Surfaces
101
+
102
+ OpenPrd produces stable, shareable HTML surfaces so product owners, engineers,
103
+ and agents can look at the same artifact before work moves forward.
104
+
105
+ ### `review.html`
106
+
107
+ Use a review-ready PRD surface instead of asking teammates to reconstruct the
108
+ latest requirement state from chat history.
109
+ If the optional `release` ledger is enabled, the review header also shows the
110
+ current project version.
111
+
112
+ ![OpenPrd review HTML](https://raw.githubusercontent.com/mileson/openprd/main/docs/assets/openprd-review-html.png)
113
+
114
+ ### Learning reader
115
+
116
+ Turn a finished requirement, fix, or workflow into a readable learning package
117
+ that new collaborators can study without replaying the whole thread.
118
+
119
+ ![OpenPrd learning HTML](https://raw.githubusercontent.com/mileson/openprd/main/docs/assets/openprd-learning-html.png)
120
+
121
+ ### Quality regression report
122
+
123
+ Summarize readiness, required gates, evidence coverage, and manual decisions in
124
+ one human-readable quality surface before handoff, release, or publish.
125
+
126
+ ![OpenPrd quality HTML](https://raw.githubusercontent.com/mileson/openprd/main/docs/assets/openprd-quality-html.png)
127
+
128
+ ### Auto-optimized reference-to-screenshot comparison
129
+
130
+ Put the reference and implementation into one side-by-side artifact for staged
131
+ UI review, especially for auth-entry redesign, localized legal pages, and modal
132
+ replication work.
133
+
134
+ ![Auto-optimized reference-to-screenshot comparison](https://raw.githubusercontent.com/mileson/openprd/main/docs/assets/openprd-visual-compare-case-study-en.png)
135
+
136
+ ## Self-Evolving Collaboration
137
+
138
+ OpenPrd gets easier to work with over time through two visible loops. One loop
139
+ keeps proven team habits as reusable `Project-Level Skill`s. The other keeps
140
+ `Dynamic Parameter Config` adaptive, so different project situations start with
141
+ different collaboration defaults instead of the same generic checklist.
142
+
143
+ ![OpenPrd self-evolving collaboration](https://raw.githubusercontent.com/mileson/openprd/main/docs/assets/openprd-self-evolving-mechanisms-en.png)
144
+
145
+ ### Scenario 1: Project-Level Skill
146
+
147
+ When a team reaches the same conclusion in real work more than once, OpenPrd
148
+ can keep that conclusion close to the project instead of leaving it buried in
149
+ chat.
150
+
151
+ - Example: a login-entry redesign confirms that log in, sign up, and password reset should all stay on the official site.
152
+ - What gets reused next time: related page checks, release review points, and the preferred path through similar requests.
153
+ - Why it matters: the next similar request starts from a shared playbook, and new teammates can follow the same steps without retelling the whole history.
154
+
155
+ ### Scenario 2: Dynamic Parameter Config
156
+
157
+ Not every project should start the same way. OpenPrd can keep different
158
+ collaboration defaults for different situations and bring them back
159
+ automatically.
160
+
161
+ - Example: a greenfield request starts with goal clarification and scope alignment, while an inherited project starts with current-state reconstruction and boundary mapping.
162
+ - What changes automatically: what to ask first, what to inspect first, and what proof to gather before handoff.
163
+ - Why it matters: teams spend less time re-explaining how this kind of project should run and more time moving with the right setup from the start.
164
+
165
+ ## Features
166
+
167
+ - **Clarification-first workflow**: `clarify -> capture -> classify -> interview -> synthesize -> diagram -> freeze -> handoff`
168
+ - **Scenario-aware collaboration**: distinguish greenfield cold start, existing-project cold start, and continuing workspaces
169
+ - **Self-evolving collaboration**: turn confirmed project habits into reusable `Project-Level Skill`s and adapt `Dynamic Parameter Config` by scenario
170
+ - **Source-aware capture**: mark inputs as `user-confirmed`, `project-derived`, `agent-inferred`, or `agent-normalized`
171
+ - **Best-practice routing**: route public-repo understanding, third-party technical docs, icon resources, and workflow optimization requests to stronger evidence sources before implementation
172
+ - **Project-level benchmark registry**: support `benchmark add / observe / approve / verify` so repeatedly adopted external sources can become durable project references
173
+ - **Diagram review artifacts**: generate both architecture and product-flow diagrams
174
+ - **UI visual comparison artifacts**: combine reference images and implementation screenshots into side-by-side JPG reviews for visual replication work
175
+ - **Contract-driven diagrams**: render from validated JSON contracts
176
+ - **Review status tracking**: use `pending-confirmation`, `confirmed`, and `needs-revision`
177
+ - **Project release/version ledger**: optionally track project versions such as `0.1.23`, version-scoped change items, and local git tag coordination without mixing them with internal PRD `v000x` versions
178
+ - **OpenPrd discovery mode**: initialize durable coverage runs for existing projects, reference projects, or unclear requirements
179
+ - **Project standards**: initialize and verify `docs/basic/`, file manual templates, and folder README templates as part of execution quality gates
180
+ - **Quality Regression Reports**: review overall regression status, per-requirement module status, test-block results, observability, business cost and abuse guardrails, smoke coverage, performance baselines, and project knowledge through HTML reports
181
+ - **Project knowledge skills**: turn verified fixes and recurring diagnosis patterns into reusable `.openprd/knowledge/skills/` experience skills
182
+ - **OpenPrd change and task execution**: materialize PRD snapshots into change files, validate them, apply accepted specs, archive changes, and advance structured tasks by dependency order
183
+ - **Long-running agent loop**: turn accepted change tasks into one-task-per-session Codex or Claude execution prompts with verification, progress logs, and optional task commits
184
+ - **Default agent integration**: generate Codex, Claude, and Cursor guidance from one OpenPrd source, including Codex hooks with `codex_hooks = true`
185
+ - **Agent harness skills**: repo-local skills for shared rules, workflow control, and diagram review
186
+
187
+ ## Tech Stack
188
+
189
+ | Layer | Technology |
190
+ |-------|------------|
191
+ | Runtime | Node.js 20+ |
192
+ | CLI | Native Node ESM |
193
+ | Config / state | JSON + YAML |
194
+ | Diagram renderer | Self-contained HTML + inline SVG |
195
+ | Image processing | `sharp` for JPG / PNG / WebP visual comparison artifacts |
196
+ | Testing | `node --test` |
197
+ | Agent guidance | Repo-local `skills/` + `AGENTS.md` + Codex / Claude / Cursor generated adapters |
198
+
199
+ ## One-line Install
200
+
201
+ Install from npm:
202
+
203
+ ```bash
204
+ npm install -g @openprd/cli
205
+ ```
206
+
207
+ If you want a zero-PATH first run, or you are on Windows and `openprd` is not available yet, use `npx` directly:
208
+
209
+ ```bash
210
+ npx @openprd/cli@latest --help
211
+ npx @openprd/cli@latest init . --template-pack agent
212
+ ```
213
+
214
+ Then verify:
215
+
216
+ ```bash
217
+ openprd --help
218
+ ```
219
+
220
+ ### Windows Troubleshooting
221
+
222
+ If the global install succeeds but `openprd` is still not found, check:
223
+
224
+ ```powershell
225
+ where openprd
226
+ npm config get prefix
227
+ ```
228
+
229
+ If `where openprd` returns nothing, add the npm global prefix to `PATH` and reopen the terminal. On Windows that directory is usually `%AppData%\npm`, not the Unix-style `{prefix}/bin`.
230
+
231
+ Update the installed CLI later with a dry-run first:
232
+
233
+ ```bash
234
+ openprd self-update --dry-run
235
+ openprd self-update
236
+ ```
237
+
238
+ ## Quick Start
239
+
240
+ ### 1. Initialize a workspace
241
+
242
+ ```bash
243
+ openprd init /path/to/project --template-pack agent
244
+ ```
245
+
246
+ If `openprd` is not on `PATH` yet, run the same init command through `npx`:
247
+
248
+ ```bash
249
+ npx @openprd/cli@latest init /path/to/project --template-pack agent
250
+ ```
251
+
252
+ `init` creates `.openprd/`, `docs/basic/`, `AGENTS.md`, and generated Codex / Claude / Cursor guidance. Codex projects also get `.codex/config.toml`, `.codex/hooks.json`, `.codex/hooks/openprd-hook.mjs`, and user-level Codex `codex_hooks = true`.
253
+
254
+ Codex hooks default to `lite`: `UserPromptSubmit`, a lightweight `PreToolUse`
255
+ write gate, and a lightweight `Stop` end-of-turn review. Context is injected for prompts that explicitly mention OpenPrd,
256
+ PRD, deep research/benchmarking, replication, standards, fleet, documentation
257
+ standards, or look like new product/module/workflow requirements. The lite write
258
+ gate only matches direct editing tools so read-only shell exploration stays
259
+ quiet, while `Stop` reviews whether the current turn produced a reusable project
260
+ pattern; use `guarded` when shell commands should also pass through the write gate,
261
+ and `full` only for temporary deep diagnostics.
262
+ Concrete bugfix prompts with diagnostic evidence such as errors, logs, repro
263
+ steps, or root-cause investigation skip requirement intake when the user asks to
264
+ fix directly; confirmation wording also accepts phrases like "confirm the fix".
265
+
266
+ `init` also performs a non-blocking optional capability check and records the
267
+ result in `.openprd/harness/install-manifest.json` under `optionalCapabilities`.
268
+ Examples:
269
+
270
+ - `Context7`: helps the agent retrieve current third-party technical docs,
271
+ config, version differences, migration paths, and high-quality implementation
272
+ guidance
273
+ - `DeepWiki`: helps the agent understand public GitHub repositories through
274
+ conversational architecture and implementation lookup
275
+
276
+ If these capabilities are not configured yet, initialization still succeeds.
277
+ OpenPrd records them as follow-up suggestions and includes the official docs,
278
+ GitHub repo, and MCP endpoint so the current client can be configured later.
279
+
280
+ ### 2. Check the current collaboration state
281
+
282
+ ```bash
283
+ openprd status /path/to/project
284
+ openprd next /path/to/project
285
+ ```
286
+
287
+ When the project-level release track is enabled, `status` also shows the current project version and how many change items are currently accumulated under it.
288
+
289
+ ### 2b. Optional: set a project release track
290
+
291
+ ```bash
292
+ openprd release /path/to/project --set 0.1.23
293
+ openprd release /path/to/project --notes "Add a release-note entry point"
294
+ openprd release /path/to/project
295
+ ```
296
+
297
+ `release` manages the project-level version ledger, not the internal OpenPrd PRD version such as `v0004`. Once enabled, handoff exports, release-note snippets, and local tag coordination in `loop --finish --commit` will reuse that version state.
298
+
299
+ When OpenPrd itself publishes a new version to GitHub, the release should also include a matching version tag and GitHub Release. You can preview the body with `node scripts/openprd-github-release-notes.mjs /path/to/project --version 0.1.23 --tag v0.1.23 --out /tmp/openprd-release.md`; the repo `github-release` workflow will create or update the GitHub Release from the same `release-ledger` on tag push or manual dispatch.
300
+
301
+ ### 3. Clarify with the user
302
+
303
+ ```bash
304
+ openprd clarify /path/to/project
305
+ ```
306
+
307
+ Clarification stays in the conversation as an inline outline or short checklist. The formal HTML review surface is `review.html` after synthesis.
308
+
309
+ OpenPrd first routes the request by user-visible need type instead of forcing a long intake form:
310
+
311
+ - **Quick fix**: usually handle it directly, then report what changed and how it was verified.
312
+ - **Existing-flow improvement**: first share a mini-plan in plain language, then continue after direction is confirmed.
313
+ - **New feature / new workflow**: first clarify the scenario, scope, first version, and risks, then move into `review`, `change`, and `tasks`.
314
+
315
+ ### 4. Capture answers back into the workspace
316
+
317
+ Single field:
318
+
319
+ ```bash
320
+ openprd capture /path/to/project \
321
+ --field problem.problemStatement \
322
+ --value "Mobile users cannot efficiently manage agent sessions on the go" \
323
+ --source user-confirmed
324
+ ```
325
+
326
+ Batch capture:
327
+
328
+ ```bash
329
+ openprd capture /path/to/project --json-file answers.json
330
+ ```
331
+
332
+ Use `--source agent-normalized` only for semantic-neutral wording cleanup after
333
+ capture; it should not reopen the current `review.html` decision.
334
+
335
+ ### 5. Draft and review
336
+
337
+ ```bash
338
+ openprd synthesize /path/to/project \
339
+ --title "Moticlaw Mobile" \
340
+ --owner "Moticlaw" \
341
+ --problem "Mobile users lack a direct-first client for node selection and agent interaction." \
342
+ --why-now "The control plane already exists and the missing piece is a mobile entry point."
343
+
344
+ openprd review-presentation /path/to/project --template
345
+ openprd review-presentation /path/to/project \
346
+ --presentation review-presentation.json \
347
+ --write \
348
+ --fail-on-violation
349
+
350
+ openprd diagram /path/to/project --type architecture --open
351
+ openprd diagram /path/to/project --type product-flow --open
352
+ openprd review /path/to/project --open
353
+ openprd review /path/to/project --mark confirmed --version <id> --digest <sha256> --work-unit <id>
354
+ ```
355
+
356
+ `review.html` is the stable review artifact for the current PRD, but the default
357
+ approval policy is `decision-points`, not “always stop here”. In a normal lane,
358
+ the user reviews that stable artifact first and then the exact copied
359
+ `--version`, `--digest`, and `--work-unit` tuple is recorded. In a
360
+ `silent-record` lane, OpenPrd can record the exact current artifact without an
361
+ extra stop only when the user already made direct execution intent explicit and
362
+ explicitly opted out of additional review confirmation. Do not treat
363
+ implementation approval as permission to mark a different review artifact, and
364
+ do not treat review recording as execution authorization. After the current
365
+ artifact is recorded, generate the OpenPrd change and task breakdown. If the
366
+ user originally asked to implement, execution can continue once tasks are ready;
367
+ otherwise wait for an explicit execution request:
368
+
369
+ ```bash
370
+ openprd change /path/to/project --generate --change <change-id>
371
+ openprd tasks /path/to/project --change <change-id>
372
+ ```
373
+
374
+ ### 6. Freeze and handoff
375
+
376
+ ```bash
377
+ openprd freeze /path/to/project
378
+ openprd handoff /path/to/project --target openprd
379
+ ```
380
+
381
+ If the optional `release` ledger is enabled, handoff exports prefer the change items accumulated under the current project version and also include a human-readable `Project version: 0.1.23` field.
382
+
383
+ ### 7. Start OpenPrd discovery mode
384
+
385
+ Users can ask in natural language:
386
+
387
+ ```text
388
+ Use OpenPrd to deeply complete this project.
389
+ Use OpenPrd to comprehensively mine this reference project into the new project.
390
+ Keep digging into this requirement until OpenPrd coverage is complete.
391
+ ```
392
+
393
+ Discovery and loop execution require explicit depth or execution intent. For
394
+ planning, architecture review, impact analysis, or "which files would change?"
395
+ questions, agents should inspect state and answer read-only instead of advancing
396
+ coverage or launching loop tasks.
397
+
398
+ Agents route those requests internally. The underlying command is:
399
+
400
+ ```bash
401
+ openprd discovery /path/to/project --mode brownfield
402
+ openprd discovery /path/to/project --resume
403
+ openprd discovery /path/to/project --advance --claim "Users can start a session from the dashboard" --evidence src/app.ts
404
+ openprd discovery /path/to/project --verify
405
+ openprd change /path/to/project --generate --change <change-id>
406
+ openprd change /path/to/project --validate --change <change-id>
407
+ openprd standards /path/to/project --verify
408
+ openprd tasks /path/to/project --change <change-id>
409
+ openprd tasks /path/to/project --change <change-id> --advance --verify --item T001.01
410
+ openprd change /path/to/project --apply --change <change-id>
411
+ openprd change /path/to/project --archive --change <change-id>
412
+ openprd specs /path/to/project
413
+ openprd changes /path/to/project
414
+ ```
415
+
416
+ Discovery verification also checks the active OpenPrd change structure, spec deltas,
417
+ `docs/basic/` standards, and long-running task files. Keep `tasks.md` as the first
418
+ entry, cap each task file at 25 substantive checkbox tasks, and continue with
419
+ `tasks-002.md`, `tasks-003.md`, etc. The final checkbox in every non-final file
420
+ should hand off to the next file so agents can resume in order. A project can use
421
+ a stricter local cap with `.openprd/discovery/config.json` at
422
+ `taskSharding.maxItemsPerFile`.
423
+
424
+ That 25-item limit is only a sharding cap, not a decomposition target. Prefer task
425
+ titles that describe concrete implementation units, wiring boundaries, entry
426
+ surfaces, integration closures, and regression passes instead of mirroring PRD
427
+ section labels like "primary flow", "requirement", or "acceptance goal".
428
+
429
+ When a task needs a stable id for long-running execution, keep the metadata small:
430
+
431
+ ```md
432
+ - [ ] T009.07 Port legacy database import preview
433
+ - type: implementation
434
+ - deps: T001.14, T007.06
435
+ - done: preview shows counts, conflicts, skipped items, warnings
436
+ - verify: npm run test -- migration
437
+ - test-layer: unit, integration
438
+ - test-size: medium
439
+ - test-scope: cli-contract
440
+ - evidence-plan: unit tests for import parsing plus CLI contract output evidence
441
+ - oracle: compare sample import output against the legacy preview and record mismatches
442
+ ```
443
+
444
+ Use `type` to distinguish `implementation`, `verification`, `documentation`, and
445
+ `governance` work. `deps` is only needed when the task depends on earlier task ids.
446
+ `done` is the completion condition, and `verify` is the command or review step
447
+ that proves it. For `implementation` and `verification` tasks, generated tasks
448
+ default to `openprd tasks . --change <id> --item <task-id> --evidence-required`:
449
+ the agent must run the smallest useful task-level test or review, then pass
450
+ `--evidence <path-or-summary>` or record `evidence:` / `waiver-reason:` in the
451
+ task metadata. Documentation tasks still use standards checks. Reserve
452
+ `openprd run . --verify` for phase/final gates instead of every task; do not use
453
+ `openprd change . --validate` as the only proof. Legacy generated tasks that
454
+ still say `verify: openprd run . --verify` are treated as task evidence checks
455
+ when run through `openprd tasks --verify`, so old task files do not keep
456
+ regenerating workspace quality reports. Use `oracle` when the task must compare against a reference
457
+ implementation, golden data set, screenshot baseline, or other explicit source
458
+ of truth; `openprd loop --finish` then requires `--notes` or `--evidence` so the
459
+ comparison result is recorded.
460
+
461
+ Tasks may also include test strategy metadata. `test-layer`, `test-size`,
462
+ `test-scope`, and `evidence-plan` help OpenPrd choose the smallest useful
463
+ verification evidence: unit tests for isolated logic, integration or contract
464
+ tests for CLI/API/agent boundaries, and e2e/visual/weapp/performance/security
465
+ checks when a task touches user flows or higher-risk runtime behavior. These
466
+ fields route evidence by risk; they are not a fixed 70/20/10 quota.
467
+
468
+ `tasks` lists the next dependency-ready task by default. `--advance` marks
469
+ one task complete, and `--verify` runs that task's `verify` command before marking
470
+ it complete. Execution events are stored outside the task files so the task metadata
471
+ stays small.
472
+
473
+ ## Project Standards
474
+
475
+ `openprd init` creates a project standards contract:
476
+
477
+ - `docs/basic/file-structure.md`
478
+ - `docs/basic/app-flow.md`
479
+ - `docs/basic/prd.md`
480
+ - `docs/basic/frontend-guidelines.md`
481
+ - `docs/basic/backend-structure.md`
482
+ - `docs/basic/tech-stack.md`
483
+ - `.openprd/standards/file-manual-template.md`
484
+ - `.openprd/standards/folder-readme-template.md`
485
+
486
+ Use:
487
+
488
+ ```bash
489
+ openprd standards /path/to/project --verify
490
+ ```
491
+
492
+ OpenPrd generated changes include standards maintenance tasks, and change validation
493
+ checks the standards contract. The canonical project docs path is only
494
+ `docs/basic/`.
495
+
496
+ During implementation, standards maintenance is an explicit impact check, not a
497
+ best-effort cleanup. For every added or modified source file, agents should check
498
+ whether `docs/basic/`, the file manual, or the containing folder README is missing
499
+ or stale. Missing docs must be created; existing docs should be updated whenever
500
+ the change affects responsibilities, flows, structure, dependencies, or product
501
+ behavior. If no documentation update is needed, agents should say the check was
502
+ performed and why the existing docs still match the code.
503
+
504
+ ## Auto-optimized reference-to-screenshot comparison
505
+
506
+ When UI work already has a reference effect image, design image, user-provided
507
+ screenshot, or agent-generated mock, the agent should capture the implemented
508
+ UI and generate a side-by-side review image before claiming visual completion:
509
+
510
+ ```bash
511
+ openprd visual-compare /path/to/project \
512
+ --reference effect-image.png \
513
+ --actual implementation-screenshot.jpg
514
+ ```
515
+
516
+ The default output is a compact JPG under
517
+ `.openprd/harness/visual-reviews/`. The left panel is labeled `效果图`; the
518
+ right panel is labeled `实现截图`. Inputs can be common image formats supported
519
+ by `sharp`.
520
+
521
+ When UI work has no reference image, capture the current screen before editing,
522
+ apply the change, then capture the same entry, viewport, account, and data state
523
+ after editing:
524
+
525
+ ```bash
526
+ openprd visual-compare /path/to/project \
527
+ --before before-screenshot.png \
528
+ --after after-screenshot.jpg
529
+ ```
530
+
531
+ The before/after mode labels the panels `修改前` and `修改后`, giving the agent a
532
+ visual self-check for expected changes and unintended drift. The output can be
533
+ adjusted when needed:
534
+
535
+ ```bash
536
+ openprd visual-compare /path/to/project \
537
+ --reference effect-image.png \
538
+ --actual implementation-screenshot.jpg \
539
+ --out review.webp \
540
+ --format webp \
541
+ --quality 82 \
542
+ --max-panel-width 1180
543
+ ```
544
+
545
+ Agents should inspect the generated image and keep iterating until there are no
546
+ obvious visual differences. The final response for reference-driven UI work
547
+ should include the generated review image path and note whether differences
548
+ remain.
549
+
550
+ ## Quality Regression Reports
551
+
552
+ `openprd init` also creates a quality contract:
553
+
554
+ - `.openprd/quality/config.json`
555
+ - `.openprd/quality/reports/`
556
+ - `.openprd/knowledge/`
557
+
558
+ Use:
559
+
560
+ ```bash
561
+ openprd quality /path/to/project --verify
562
+ ```
563
+
564
+ The command writes both JSON and HTML reports under `.openprd/quality/reports/`.
565
+ The HTML regression report is the human-readable quality surface: overall
566
+ regression status, per-requirement module status, test-block pass/fail results,
567
+ test strategy matrix, missing items, and the small set of gaps that need a
568
+ person to decide whether they are in scope for the current delivery. EVO is
569
+ OpenPrd's internal shorthand for the evaluation/verification quality layer; the
570
+ visible report does not ask users to know that acronym. A script or fixture
571
+ being present only proves capability; required gates need current evidence or an
572
+ explicit waiver.
573
+
574
+ When a requirement involves free users, quotas, AI calls, third-party APIs,
575
+ generation, storage, downloads, or other metered costs, `quality --verify`
576
+ also checks for cost drivers, user-level limits, negative abuse-path
577
+ verification, usage/cost monitoring, alert thresholds, and stop-loss actions.
578
+
579
+ `openprd quality --verify` is blocking by default when required test blocks are
580
+ not production-ready. `openprd run --verify` repeats that quality gate so final
581
+ readiness cannot ignore the report. Agents should not claim readiness until
582
+ every required test block is either passing with evidence or explicitly out of
583
+ scope for the scenario.
584
+
585
+ For UI work with an existing reference image, visual readiness also requires a
586
+ current `openprd visual-compare` artifact under `.openprd/harness/visual-reviews/`.
587
+ If the combined image still shows obvious differences, the task should return to
588
+ implementation instead of treating the gap as ready.
589
+
590
+ After a fix has been verified and reviewed, promote the abstract pattern into
591
+ project knowledge:
592
+
593
+ ```bash
594
+ openprd quality /path/to/project --learn --review --from .openprd/harness/turn-state.json
595
+ openprd quality /path/to/project --learn --from <report-id-or-json>
596
+ openprd quality /path/to/project --learn --from ./diagnostics/incident-2026-05-24
597
+ ```
598
+
599
+ `--learn --review` first writes a pending knowledge candidate under
600
+ `.openprd/knowledge/candidates/` plus a draft skill under
601
+ `.openprd/knowledge/drafts/`. Once the draft is worth keeping, `--learn --from`
602
+ promotes it into incident, pattern, and experience skill artifacts under
603
+ `.openprd/knowledge/` so future tasks can retrieve the lesson instead of
604
+ rediscovering it. `--from` now accepts either a quality report JSON or an
605
+ extracted diagnostics directory / evidence file that already contains
606
+ `diagnostic-report`, `runtime-events`, `timeline`, or `root-cause-candidates`
607
+ artifacts, so a verified fix can be promoted directly into a reusable
608
+ troubleshooting skill.
609
+
610
+ ## Agent Setup
611
+
612
+ OpenPrd can install the project harness into the agent environment so users do not
613
+ need to remember which skill, command, or hook to invoke:
614
+
615
+ ```bash
616
+ openprd setup /path/to/project
617
+ openprd doctor /path/to/project
618
+ openprd self-update --dry-run
619
+ openprd self-update
620
+ openprd update /path/to/project
621
+ openprd update /path/to/project --hook-profile lite
622
+ openprd upgrade /path/to/project --dry-run
623
+ openprd upgrade /path/to/project
624
+ openprd upgrade /path/to/projects --fleet --dry-run
625
+ openprd fleet /path/to/projects --dry-run
626
+ openprd fleet /path/to/projects --sync-registry
627
+ openprd fleet /path/to/projects --backfill-work-units
628
+ openprd run /path/to/project --context
629
+ openprd run /path/to/project --verify
630
+ openprd loop /path/to/project --plan --change <change-id>
631
+ openprd loop /path/to/project --run --agent codex --dry-run
632
+ ```
633
+
634
+ Installing the CLI alone does not mutate a project or user config. The full
635
+ Codex/Claude/Cursor adapter set is installed when the user runs `openprd init`
636
+ or `openprd setup` inside a project.
637
+
638
+ `setup` and `init` generate:
639
+
640
+ - `AGENTS.md` managed OpenPrd rules
641
+ - `.codex/skills/`, `.codex/prompts/`, `.codex/config.toml`, `.codex/hooks.json`, and `.codex/hooks/openprd-hook.mjs`
642
+ - user-level Codex config with `features.codex_hooks = true`
643
+ - `.claude/skills/`, `.claude/commands/openprd/`, and `CLAUDE.md`
644
+ - `.cursor/rules/openprd.mdc` and `.cursor/commands/`
645
+ - `.openprd/harness/install-manifest.json`, `hook-state.json`, `events.jsonl`, `drift-report.json`, and `visual-reviews/`
646
+
647
+ `setup`, `init`, `update`, and `doctor` also maintain
648
+ `optionalCapabilities` inside `.openprd/harness/install-manifest.json`. These
649
+ entries are only “better when configured” recommendations and never turn
650
+ initialization, diagnostics, or the current task into a failure.
651
+
652
+ `doctor` verifies that the generated rules, Codex hooks feature flag, standards,
653
+ and workspace validation are healthy, and also surfaces optional enhancement
654
+ recommendations such as Context7 or DeepWiki. `update` refreshes the generated
655
+ adapter files from the canonical OpenPrd source while preserving unrelated user
656
+ hook groups.
657
+
658
+ `self-update` updates the OpenPrd CLI itself from the public npm package.
659
+ `upgrade` composes the two update layers: it first runs `self-update`, then
660
+ re-resolves the installed `openprd` executable and runs either `update <project>`
661
+ or, with `--fleet`, `fleet <root> --update-openprd`. Both commands support
662
+ `--dry-run`; dry-run prints the planned install and refresh commands without
663
+ modifying the CLI, project, registry, or harness state.
664
+
665
+ The harness is stateful, but hooks are proportional to the chosen profile.
666
+ Default `lite` keeps a lightweight `PreToolUse` write gate for requirement
667
+ intake and limits it to direct editing tools, while `Stop` performs a lightweight
668
+ end-of-turn knowledge review instead of full telemetry. This avoids read-only shell hook
669
+ noise while still nudging the agent to capture reusable project patterns. `guarded` also gates shell tools, while
670
+ `full` restores SessionStart/PreToolUse/PostToolUse/Stop telemetry for temporary
671
+ diagnostics. High-risk actions such as freeze, handoff, accepted spec
672
+ apply/archive, commit, push, release, or publish are gated by
673
+ `openprd run . --verify`, which covers standards, workspace validation, active
674
+ change validation, and active discovery verification.
675
+
676
+ `openprd run . --context` is the Ralph-style loop surface for agents. It selects
677
+ the next executable unit from active change tasks, discovery coverage, or normal
678
+ OpenPrd workflow state, and records hook turns in `.openprd/harness/iterations.jsonl`.
679
+
680
+ ### Long-Running Agent Loop
681
+
682
+ For implementation work that should behave like the harness pattern described by
683
+ Anthropic's long-running agent guidance, use `openprd loop`. The loop is stricter
684
+ than `run --context`: it creates a durable feature list, writes a single-task
685
+ prompt, starts a fresh Codex or Claude session for exactly one task, verifies the
686
+ task, and can commit that task before moving on.
687
+
688
+ For UI tasks, the loop prompt and generated guidance require the agent to run
689
+ `openprd visual-compare` before finishing: use `--reference/--actual` when a
690
+ reference image exists, or `--before/--after` when the agent must verify a UI
691
+ change without an explicit reference image.
692
+
693
+ `openprd run --context` may surface loop commands as execution commands, but they
694
+ are not automatic instructions. Agents should run `openprd loop --run`,
695
+ `openprd tasks --advance`, `openprd discovery --advance`, or commit commands only
696
+ when the current user message explicitly asks for development, implementation,
697
+ task continuation, deep research/benchmarking, replication, or commit. Read-only
698
+ planning and review turns should stop at the module/file plan.
699
+
700
+ Loop is recommended from the substantive implementation task count, not from every
701
+ checkbox. When a change has 10 or more pending/total `implementation` tasks,
702
+ `run --context` recommends an isolated worktree or equivalent environment plus a
703
+ single-task Loop session.
704
+
705
+ ```bash
706
+ openprd loop . --init
707
+ openprd loop . --plan --change <change-id>
708
+ openprd loop . --next
709
+ openprd loop . --prompt --agent codex
710
+ openprd loop . --run --agent codex --dry-run
711
+ openprd loop . --run --agent claude --dry-run
712
+ openprd loop . --verify --item T001.01
713
+ openprd loop . --finish --item T001.01 --commit --message "Add a release-note entry point"
714
+ ```
715
+
716
+ When the project-level release track is enabled, `loop --finish --commit` records the task's short user-facing summary under the current project version and then tries to move the same-name local tag (for example `0.1.23`) to the latest commit. If a remote tag with the same name already exists, OpenPrd warns and skips the local retag instead of silently rewriting remote history.
717
+
718
+ The loop writes its durable state under `.openprd/harness/`:
719
+
720
+ - `feature-list.json` is the ordered implementation task list.
721
+ - Each loop task carries a human-readable `taskHandle` such as
722
+ `change-id:T001.01:task-title`, so another conversation can continue the same
723
+ task without relying on a chat-specific UUID.
724
+ - `progress.md` is the human-readable progress log.
725
+ - `failed-approaches.md` is the dead-end ledger for mismatches, rejected fixes,
726
+ and why they failed, so the next session does not retry the same path.
727
+ - `agent-sessions.jsonl` records each prompt/run/finish event, including the
728
+ task handle and task title for cross-session lookup.
729
+ - `bootstrap.sh` is the startup check each fresh agent session runs.
730
+ - `loop-state.json` stores the current task id, task handle, task title, and
731
+ the last agent session metadata.
732
+ - `loop-prompts/` stores generated single-task prompts for audit and reuse.
733
+
734
+ Use `--dry-run` first when you want OpenPrd to prepare the prompt and exact command
735
+ without launching an agent. Use `--agent codex` or `--agent claude` for the default
736
+ CLI integrations. Use `--agent-command "<custom command>"` only when you want to
737
+ pipe the OpenPrd prompt into a project-specific wrapper.
738
+
739
+ For historical projects, use `fleet` instead of hand-writing shell loops. By
740
+ default it scans and reports only, while also telling you how many known
741
+ OpenPrd workspaces already exist in the global registry and how many are outside
742
+ the current root. `--sync-registry` backfills initialized `.openprd/`
743
+ workspaces into `~/.openprd/registry/workspaces.jsonl`. `--update-openprd`
744
+ refreshes projects that already contain `.openprd/` and also backfills
745
+ historical PRD work unit bindings. Project standards or validation gaps are
746
+ reported as health items, but they do not block generated guidance updates. Use
747
+ `--backfill-work-units` when you only want to refresh versioned review artifacts
748
+ and identity bindings, while agent-only or plain projects stay untouched unless
749
+ explicitly selected with `--setup-missing`.
750
+
751
+ ## How to Read `status` and `next`
752
+
753
+ OpenPrd is not just a command runner. It exposes collaboration state.
754
+
755
+ ### `openprd status`
756
+
757
+ Use it to understand:
758
+
759
+ - current scenario
760
+ - user participation mode
761
+ - current gate
762
+ - upcoming gate
763
+ - current project version, if the release track is enabled
764
+
765
+ Example signals:
766
+
767
+ - `Scenario: Cold start (existing project)`
768
+ - `User participation mode: context-plus-confirmation`
769
+ - `Current gate: clarify-user`
770
+ - `Upcoming gate: architecture diagram review`
771
+
772
+ ### `openprd next`
773
+
774
+ Use it to understand:
775
+
776
+ - what should happen next
777
+ - why that step is recommended
778
+ - which questions should be asked now
779
+
780
+ ## Diagram Contracts
781
+
782
+ OpenPrd supports:
783
+
784
+ - `architecture`
785
+ - `product-flow`
786
+
787
+ You can let the tool infer a draft from the current workspace, or supply an explicit contract:
788
+
789
+ ```bash
790
+ openprd diagram /path/to/project \
791
+ --type product-flow \
792
+ --input ./product-flow-contract.json
793
+ ```
794
+
795
+ The diagram contract is validated against built-in schema files in `.openprd/schema/`.
796
+
797
+ ## Agent Skills
798
+
799
+ This repository ships a repo-local `skills/` directory modeled after the `lark-shared + domain skills` pattern used by `larksuite/cli`.
800
+
801
+ - `skills/openprd-shared/` — shared guardrails and language/review rules
802
+ - `skills/openprd-harness/` — main OpenPrd workflow sequencing
803
+ - `skills/openprd-standards/` — project docs, file manual, and folder README standards
804
+ - `skills/openprd-diagram-review/` — diagram generation and review loop guidance
805
+ - `skills/openprd-discovery-loop/` — sustained OpenPrd coverage discovery
806
+
807
+ Agents entering this repository should read:
808
+
809
+ - `AGENTS.md`
810
+
811
+ ## Project Structure
812
+
813
+ ```text
814
+ .
815
+ ├── AGENTS.md
816
+ ├── bin/
817
+ ├── src/
818
+ ├── skills/
819
+ ├── test/
820
+ ├── docs/
821
+ │ └── basic/
822
+ ├── openprd/
823
+ │ ├── changes/
824
+ │ ├── specs/
825
+ │ └── archive/
826
+ └── .openprd/
827
+ ├── schema/
828
+ ├── templates/
829
+ ├── engagements/
830
+ ├── state/
831
+ └── exports/
832
+ ```
833
+
834
+ Key directories:
835
+
836
+ - `src/` — CLI logic, PRD core, diagram rendering
837
+ - `docs/basic/` — project-level baseline docs maintained by OpenPrd standards
838
+ - `skills/` — repo-local agent skill system
839
+ - `.openprd/` — shipped workspace seed
840
+ - `test/` — regression coverage for clarify / capture / diagram / gate logic
841
+
842
+ ## Agent Prompt Examples
843
+
844
+ You can steer agents with prompts like:
845
+
846
+ ```text
847
+ Use $openprd-harness to initialize and advance an OpenPrd workspace for this product idea.
848
+ ```
849
+
850
+ ```text
851
+ Use $openprd-diagram-review to generate a product-flow review artifact before freeze.
852
+ ```
853
+
854
+ ## Contributing
855
+
856
+ See [CONTRIBUTING.md](./CONTRIBUTING.md).
857
+
858
+ ## Security
859
+
860
+ See [SECURITY.md](./SECURITY.md).
861
+
862
+ ## License
863
+
864
+ MIT — see [LICENSE](./LICENSE).
865
+
866
+ ## Author
867
+
868
+ - X: [Mileson07](https://x.com/Mileson07)
869
+ - Xiaohongshu: [超级峰](https://xhslink.com/m/4LnJ9aB1f97)
870
+ - Douyin: [超级峰](https://v.douyin.com/rH645q7trd8/)