@openprd/cli 0.1.0 → 0.1.8
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.
- package/.openprd/README.md +43 -69
- package/.openprd/README_EN.md +84 -0
- package/.openprd/benchmarks/index.md +7 -0
- package/.openprd/benchmarks/sources.yaml +25 -3
- package/.openprd/discovery/config.json +16 -2
- package/.openprd/engagements/active/flows.md +19 -14
- package/.openprd/engagements/active/handoff.md +11 -4
- package/.openprd/engagements/active/prd.md +99 -71
- package/.openprd/engagements/active/review.html +4 -4
- package/.openprd/engagements/active/roles.md +9 -8
- package/.openprd/engagements/work-units/wu-20260524015648-6d33ded7.json +4 -4
- package/.openprd/engagements/work-units/wu-20260602113956-a99b5b88.json +18 -0
- package/.openprd/engagements/work-units/wu-20260602122244-78656aaf.json +18 -0
- package/.openprd/engagements/work-units/wu-20260602122442-e96489e2.json +18 -0
- package/.openprd/engagements/work-units/wu-20260602132835-695429e8.json +18 -0
- package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/candidate.json +78 -0
- package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/diagnostic-report.json +129 -0
- package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/root-cause-candidates.json +41 -0
- package/.openprd/knowledge/candidates/candidate-turn-1780116203372-5f266a79e968c758/timeline.json +14 -0
- package/.openprd/knowledge/drafts/openprd-experience-diagnostic-candidate-turn-1780116203372-5f266a79e968c758/SKILL.md +49 -0
- package/.openprd/knowledge/index.json +44 -4
- package/.openprd/reviews/v0001.html +195 -129
- package/.openprd/reviews/v0002.html +1150 -0
- package/.openprd/reviews/v0003.html +1150 -0
- package/.openprd/reviews/v0004.html +1150 -0
- package/.openprd/reviews/v0005.html +1150 -0
- package/.openprd/standards/config.json +12 -9
- package/.openprd/state/changes.json +17 -2
- package/.openprd/state/current.json +399 -63
- package/.openprd/state/release-ledger.json +344 -0
- package/.openprd/state/version-index.json +52 -0
- package/.openprd/state/versions/v0002.json +264 -0
- package/.openprd/state/versions/v0002.md +183 -0
- package/.openprd/state/versions/v0003.json +269 -0
- package/.openprd/state/versions/v0003.md +188 -0
- package/.openprd/state/versions/v0004.json +274 -0
- package/.openprd/state/versions/v0004.md +193 -0
- package/.openprd/state/versions/v0005.json +299 -0
- package/.openprd/state/versions/v0005.md +189 -0
- package/.openprd/templates/agent/intake.md +5 -4
- package/.openprd/templates/b2b/intake.md +5 -4
- package/.openprd/templates/base/intake.md +10 -4
- package/.openprd/templates/company/README.md +9 -7
- package/.openprd/templates/company/README_EN.md +12 -0
- package/.openprd/templates/consumer/intake.md +5 -4
- package/.openprd/templates/industry/README.md +12 -10
- package/.openprd/templates/industry/README_EN.md +18 -0
- package/.openprd/templates/project/README.md +11 -9
- package/.openprd/templates/project/README_EN.md +16 -0
- package/.openprd/templates/session/README.md +11 -9
- package/.openprd/templates/session/README_EN.md +16 -0
- package/AGENTS.md +12 -8
- package/README.md +402 -441
- package/README_CN.md +4 -578
- package/README_EN.md +850 -0
- package/docs/assets/openprd-requirement-routing-en.png +0 -0
- package/docs/assets/openprd-requirement-routing-en.svg +102 -0
- package/docs/assets/openprd-requirement-routing-zh-refined.png +0 -0
- package/docs/assets/openprd-requirement-routing-zh.png +0 -0
- package/docs/assets/openprd-requirement-routing-zh.svg +102 -0
- package/package.json +6 -2
- package/scripts/dev-check-wrapup-copy.mjs +110 -0
- package/scripts/openprd-github-release-notes.mjs +99 -0
- package/scripts/quality-perf-check.mjs +203 -0
- package/skills/openprd-benchmark-router/SKILL.md +1 -0
- package/skills/openprd-benchmark-router/references/benchmark-sources.md +1 -0
- package/skills/openprd-benchmark-router/references/source-policy.md +2 -0
- package/skills/openprd-discovery-loop/SKILL.md +2 -2
- package/skills/openprd-harness/SKILL.md +46 -24
- package/skills/openprd-harness/references/workflow-gates.md +15 -0
- package/skills/openprd-quality/SKILL.md +10 -4
- package/skills/openprd-requirement-intake/SKILL.md +39 -23
- package/skills/openprd-requirement-intake/references/prd-template-lenses.md +6 -6
- package/skills/openprd-requirement-intake/references/routing-rubric.md +22 -8
- package/skills/openprd-router/SKILL.md +2 -2
- package/skills/openprd-shared/SKILL.md +51 -23
- package/skills/openprd-standards/SKILL.md +2 -1
- package/src/agent-integration.js +265 -65
- package/src/benchmark/constants.js +107 -0
- package/src/benchmark/operations.js +235 -0
- package/src/benchmark/registry.js +64 -0
- package/src/benchmark/render.js +115 -0
- package/src/benchmark/source.js +617 -0
- package/src/benchmark/storage.js +121 -0
- package/src/benchmark/verify.js +235 -0
- package/src/benchmark.js +50 -851
- package/src/change-summary.js +339 -0
- package/src/cli/args.js +67 -6
- package/src/cli/basic-print.js +365 -0
- package/src/cli/benchmark-print.js +91 -0
- package/src/cli/change-print.js +221 -0
- package/src/cli/doctor-print.js +268 -0
- package/src/cli/growth-print.js +176 -0
- package/src/cli/print.js +73 -1384
- package/src/cli/quality-print.js +284 -0
- package/src/cli/run-print.js +297 -0
- package/src/cli/shared-print.js +127 -0
- package/src/cli/workflow-print.js +195 -0
- package/src/codex-hook-runner-template.mjs +639 -117
- package/src/codex-runtime.js +324 -0
- package/src/dev-standards.js +178 -5
- package/src/diagram-core.js +5 -5
- package/src/discovery.js +2 -1
- package/src/execution-strategy.js +369 -0
- package/src/fleet.js +4 -0
- package/src/github-release.js +156 -0
- package/src/growth.js +311 -13
- package/src/html-artifact-utils.js +25 -0
- package/src/html-artifacts.js +157 -1596
- package/src/knowledge.js +1176 -75
- package/src/language-policy.js +2 -112
- package/src/learning-html-artifact.js +1031 -0
- package/src/learning-review.js +3 -2
- package/src/loop.js +280 -9
- package/src/openprd.js +341 -38
- package/src/openspec/change-validate.js +0 -9
- package/src/openspec/execute.js +79 -3
- package/src/openspec/generate.js +33 -20
- package/src/openspec/tasks.js +33 -2
- package/src/prd-core.js +10 -9
- package/src/product-type-copy.js +69 -0
- package/src/quality-html-artifact.js +108 -9
- package/src/quality-learning.js +30 -0
- package/src/quality-visual-review.js +237 -0
- package/src/quality.js +329 -43
- package/src/registry-hygiene.js +54 -0
- package/src/release-ledger.js +413 -0
- package/src/review-presentation.js +12 -6
- package/src/run-harness.js +722 -48
- package/src/self-update.js +1 -1
- package/src/session-binding.js +40 -3
- package/src/session-registry.js +159 -0
- package/src/standards.js +5 -3
- package/src/test-strategy.js +386 -0
- package/src/visual-compare.js +915 -34
- package/src/work-unit-migration.js +5 -1
- package/src/workspace-core.js +343 -19
- package/src/workspace-workflow.js +538 -134
package/README_EN.md
ADDED
|
@@ -0,0 +1,850 @@
|
|
|
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)
|
|
8
|
+
[](https://nodejs.org/)
|
|
9
|
+
[](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
|
+

|
|
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
|
+

|
|
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
|
+
## Common Real-World Scenarios
|
|
68
|
+
|
|
69
|
+
Recent Codex project usage kept clustering around the same kinds of work: fuzzy
|
|
70
|
+
product requests, existing-product redesigns, release/publish flows, production
|
|
71
|
+
incident closure, and reusable learning handoff.
|
|
72
|
+
|
|
73
|
+
| Scenario | Why OpenPrd stands out here | Main artifacts |
|
|
74
|
+
|----------|-----------------------------|----------------|
|
|
75
|
+
| 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` |
|
|
76
|
+
| Existing flow or auth-entry redesign | Reconstruct current behavior from repo and runtime evidence before proposing the next change. | `discovery`, `diagram`, `review.html`, `change` |
|
|
77
|
+
| 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 |
|
|
78
|
+
| 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 |
|
|
79
|
+
| 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` |
|
|
80
|
+
| 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 |
|
|
81
|
+
|
|
82
|
+
## HTML-First Collaboration Surfaces
|
|
83
|
+
|
|
84
|
+
OpenPrd produces stable, shareable HTML surfaces so product owners, engineers,
|
|
85
|
+
and agents can look at the same artifact before work moves forward.
|
|
86
|
+
|
|
87
|
+
### `review.html`
|
|
88
|
+
|
|
89
|
+
Use a review-ready PRD surface instead of asking teammates to reconstruct the
|
|
90
|
+
latest requirement state from chat history.
|
|
91
|
+
If the optional `release` ledger is enabled, the review header also shows the
|
|
92
|
+
current project version.
|
|
93
|
+
|
|
94
|
+

|
|
95
|
+
|
|
96
|
+
### Learning reader
|
|
97
|
+
|
|
98
|
+
Turn a finished requirement, fix, or workflow into a readable learning package
|
|
99
|
+
that new collaborators can study without replaying the whole thread.
|
|
100
|
+
|
|
101
|
+

|
|
102
|
+
|
|
103
|
+
### Quality regression report
|
|
104
|
+
|
|
105
|
+
Summarize readiness, required gates, evidence coverage, and manual decisions in
|
|
106
|
+
one human-readable quality surface before handoff, release, or publish.
|
|
107
|
+
|
|
108
|
+

|
|
109
|
+
|
|
110
|
+
### Auto-optimized reference-to-screenshot comparison
|
|
111
|
+
|
|
112
|
+
Put the reference and implementation into one side-by-side artifact for staged
|
|
113
|
+
UI review, especially for auth-entry redesign, localized legal pages, and modal
|
|
114
|
+
replication work.
|
|
115
|
+
|
|
116
|
+

|
|
117
|
+
|
|
118
|
+
## Self-Evolving Collaboration
|
|
119
|
+
|
|
120
|
+
OpenPrd gets easier to work with over time through two visible loops. One loop
|
|
121
|
+
keeps proven team habits as reusable `Project-Level Skill`s. The other keeps
|
|
122
|
+
`Dynamic Parameter Config` adaptive, so different project situations start with
|
|
123
|
+
different collaboration defaults instead of the same generic checklist.
|
|
124
|
+
|
|
125
|
+

|
|
126
|
+
|
|
127
|
+
### Scenario 1: Project-Level Skill
|
|
128
|
+
|
|
129
|
+
When a team reaches the same conclusion in real work more than once, OpenPrd
|
|
130
|
+
can keep that conclusion close to the project instead of leaving it buried in
|
|
131
|
+
chat.
|
|
132
|
+
|
|
133
|
+
- Example: a login-entry redesign confirms that log in, sign up, and password reset should all stay on the official site.
|
|
134
|
+
- What gets reused next time: related page checks, release review points, and the preferred path through similar requests.
|
|
135
|
+
- 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.
|
|
136
|
+
|
|
137
|
+
### Scenario 2: Dynamic Parameter Config
|
|
138
|
+
|
|
139
|
+
Not every project should start the same way. OpenPrd can keep different
|
|
140
|
+
collaboration defaults for different situations and bring them back
|
|
141
|
+
automatically.
|
|
142
|
+
|
|
143
|
+
- Example: a greenfield request starts with goal clarification and scope alignment, while an inherited project starts with current-state reconstruction and boundary mapping.
|
|
144
|
+
- What changes automatically: what to ask first, what to inspect first, and what proof to gather before handoff.
|
|
145
|
+
- 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.
|
|
146
|
+
|
|
147
|
+
## Features
|
|
148
|
+
|
|
149
|
+
- **Clarification-first workflow**: `clarify -> capture -> classify -> interview -> synthesize -> diagram -> freeze -> handoff`
|
|
150
|
+
- **Scenario-aware collaboration**: distinguish greenfield cold start, existing-project cold start, and continuing workspaces
|
|
151
|
+
- **Self-evolving collaboration**: turn confirmed project habits into reusable `Project-Level Skill`s and adapt `Dynamic Parameter Config` by scenario
|
|
152
|
+
- **Source-aware capture**: mark inputs as `user-confirmed`, `project-derived`, `agent-inferred`, or `agent-normalized`
|
|
153
|
+
- **Diagram review artifacts**: generate both architecture and product-flow diagrams
|
|
154
|
+
- **UI visual comparison artifacts**: combine reference images and implementation screenshots into side-by-side JPG reviews for visual replication work
|
|
155
|
+
- **Contract-driven diagrams**: render from validated JSON contracts
|
|
156
|
+
- **Review status tracking**: use `pending-confirmation`, `confirmed`, and `needs-revision`
|
|
157
|
+
- **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
|
|
158
|
+
- **OpenPrd discovery mode**: initialize durable coverage runs for existing projects, reference projects, or unclear requirements
|
|
159
|
+
- **Project standards**: initialize and verify `docs/basic/`, file manual templates, and folder README templates as part of execution quality gates
|
|
160
|
+
- **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
|
|
161
|
+
- **Project knowledge skills**: turn verified fixes and recurring diagnosis patterns into reusable `.openprd/knowledge/skills/` experience skills
|
|
162
|
+
- **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
|
|
163
|
+
- **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
|
|
164
|
+
- **Default agent integration**: generate Codex, Claude, and Cursor guidance from one OpenPrd source, including Codex hooks with `codex_hooks = true`
|
|
165
|
+
- **Agent harness skills**: repo-local skills for shared rules, workflow control, and diagram review
|
|
166
|
+
|
|
167
|
+
## Tech Stack
|
|
168
|
+
|
|
169
|
+
| Layer | Technology |
|
|
170
|
+
|-------|------------|
|
|
171
|
+
| Runtime | Node.js 20+ |
|
|
172
|
+
| CLI | Native Node ESM |
|
|
173
|
+
| Config / state | JSON + YAML |
|
|
174
|
+
| Diagram renderer | Self-contained HTML + inline SVG |
|
|
175
|
+
| Image processing | `sharp` for JPG / PNG / WebP visual comparison artifacts |
|
|
176
|
+
| Testing | `node --test` |
|
|
177
|
+
| Agent guidance | Repo-local `skills/` + `AGENTS.md` + Codex / Claude / Cursor generated adapters |
|
|
178
|
+
|
|
179
|
+
## One-line Install
|
|
180
|
+
|
|
181
|
+
Install from npm:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
npm install -g @openprd/cli
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
If you want a zero-PATH first run, or you are on Windows and `openprd` is not available yet, use `npx` directly:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npx @openprd/cli@latest --help
|
|
191
|
+
npx @openprd/cli@latest init . --template-pack agent
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
Then verify:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
openprd --help
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Windows Troubleshooting
|
|
201
|
+
|
|
202
|
+
If the global install succeeds but `openprd` is still not found, check:
|
|
203
|
+
|
|
204
|
+
```powershell
|
|
205
|
+
where openprd
|
|
206
|
+
npm config get prefix
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
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`.
|
|
210
|
+
|
|
211
|
+
Update the installed CLI later with a dry-run first:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
openprd self-update --dry-run
|
|
215
|
+
openprd self-update
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## Quick Start
|
|
219
|
+
|
|
220
|
+
### 1. Initialize a workspace
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
openprd init /path/to/project --template-pack agent
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
If `openprd` is not on `PATH` yet, run the same init command through `npx`:
|
|
227
|
+
|
|
228
|
+
```bash
|
|
229
|
+
npx @openprd/cli@latest init /path/to/project --template-pack agent
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
`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`.
|
|
233
|
+
|
|
234
|
+
Codex hooks default to `lite`: `UserPromptSubmit`, a lightweight `PreToolUse`
|
|
235
|
+
write gate, and a lightweight `Stop` end-of-turn review. Context is injected for prompts that explicitly mention OpenPrd,
|
|
236
|
+
PRD, deep research/benchmarking, replication, standards, fleet, documentation
|
|
237
|
+
standards, or look like new product/module/workflow requirements. The lite write
|
|
238
|
+
gate only matches direct editing tools so read-only shell exploration stays
|
|
239
|
+
quiet, while `Stop` reviews whether the current turn produced a reusable project
|
|
240
|
+
pattern; use `guarded` when shell commands should also pass through the write gate,
|
|
241
|
+
and `full` only for temporary deep diagnostics.
|
|
242
|
+
Concrete bugfix prompts with diagnostic evidence such as errors, logs, repro
|
|
243
|
+
steps, or root-cause investigation skip requirement intake when the user asks to
|
|
244
|
+
fix directly; confirmation wording also accepts phrases like "confirm the fix".
|
|
245
|
+
|
|
246
|
+
`init` also performs a non-blocking optional capability check and records the
|
|
247
|
+
result in `.openprd/harness/install-manifest.json` under `optionalCapabilities`.
|
|
248
|
+
Examples:
|
|
249
|
+
|
|
250
|
+
- `Context7`: helps the agent retrieve current third-party technical docs,
|
|
251
|
+
config, version differences, migration paths, and high-quality implementation
|
|
252
|
+
guidance
|
|
253
|
+
- `DeepWiki`: helps the agent understand public GitHub repositories through
|
|
254
|
+
conversational architecture and implementation lookup
|
|
255
|
+
|
|
256
|
+
If these capabilities are not configured yet, initialization still succeeds.
|
|
257
|
+
OpenPrd records them as follow-up suggestions and includes the official docs,
|
|
258
|
+
GitHub repo, and MCP endpoint so the current client can be configured later.
|
|
259
|
+
|
|
260
|
+
### 2. Check the current collaboration state
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
openprd status /path/to/project
|
|
264
|
+
openprd next /path/to/project
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
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.
|
|
268
|
+
|
|
269
|
+
### 2b. Optional: set a project release track
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
openprd release /path/to/project --set 0.1.23
|
|
273
|
+
openprd release /path/to/project --notes "Add a release-note entry point"
|
|
274
|
+
openprd release /path/to/project
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
`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.
|
|
278
|
+
|
|
279
|
+
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.
|
|
280
|
+
|
|
281
|
+
### 3. Clarify with the user
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
openprd clarify /path/to/project
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
Clarification stays in the conversation as an inline outline or short checklist. The formal HTML review surface is `review.html` after synthesis.
|
|
288
|
+
|
|
289
|
+
OpenPrd first routes the request by user-visible need type instead of forcing a long intake form:
|
|
290
|
+
|
|
291
|
+
- **Quick fix**: usually handle it directly, then report what changed and how it was verified.
|
|
292
|
+
- **Existing-flow improvement**: first share a mini-plan in plain language, then continue after direction is confirmed.
|
|
293
|
+
- **New feature / new workflow**: first clarify the scenario, scope, first version, and risks, then move into `review`, `change`, and `tasks`.
|
|
294
|
+
|
|
295
|
+
### 4. Capture answers back into the workspace
|
|
296
|
+
|
|
297
|
+
Single field:
|
|
298
|
+
|
|
299
|
+
```bash
|
|
300
|
+
openprd capture /path/to/project \
|
|
301
|
+
--field problem.problemStatement \
|
|
302
|
+
--value "Mobile users cannot efficiently manage agent sessions on the go" \
|
|
303
|
+
--source user-confirmed
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
Batch capture:
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
openprd capture /path/to/project --json-file answers.json
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
Use `--source agent-normalized` only for semantic-neutral wording cleanup after
|
|
313
|
+
capture; it should not reopen the current `review.html` decision.
|
|
314
|
+
|
|
315
|
+
### 5. Draft and review
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
openprd synthesize /path/to/project \
|
|
319
|
+
--title "Moticlaw Mobile" \
|
|
320
|
+
--owner "Moticlaw" \
|
|
321
|
+
--problem "Mobile users lack a direct-first client for node selection and agent interaction." \
|
|
322
|
+
--why-now "The control plane already exists and the missing piece is a mobile entry point."
|
|
323
|
+
|
|
324
|
+
openprd review-presentation /path/to/project --template
|
|
325
|
+
openprd review-presentation /path/to/project \
|
|
326
|
+
--presentation review-presentation.json \
|
|
327
|
+
--write \
|
|
328
|
+
--fail-on-violation
|
|
329
|
+
|
|
330
|
+
openprd diagram /path/to/project --type architecture --open
|
|
331
|
+
openprd diagram /path/to/project --type product-flow --open
|
|
332
|
+
openprd review /path/to/project --open
|
|
333
|
+
openprd review /path/to/project --mark confirmed --version <id> --digest <sha256> --work-unit <id>
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
`review.html` is the stable review artifact for the current PRD, but the default
|
|
337
|
+
approval policy is `decision-points`, not “always stop here”. In a normal lane,
|
|
338
|
+
the user reviews that stable artifact first and then the exact copied
|
|
339
|
+
`--version`, `--digest`, and `--work-unit` tuple is recorded. In a
|
|
340
|
+
`silent-record` lane, OpenPrd can record the exact current artifact without an
|
|
341
|
+
extra stop only when the user already made direct execution intent explicit and
|
|
342
|
+
explicitly opted out of additional review confirmation. Do not treat
|
|
343
|
+
implementation approval as permission to mark a different review artifact, and
|
|
344
|
+
do not treat review recording as execution authorization. After the current
|
|
345
|
+
artifact is recorded, generate the OpenPrd change and task breakdown. If the
|
|
346
|
+
user originally asked to implement, execution can continue once tasks are ready;
|
|
347
|
+
otherwise wait for an explicit execution request:
|
|
348
|
+
|
|
349
|
+
```bash
|
|
350
|
+
openprd change /path/to/project --generate --change <change-id>
|
|
351
|
+
openprd tasks /path/to/project --change <change-id>
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### 6. Freeze and handoff
|
|
355
|
+
|
|
356
|
+
```bash
|
|
357
|
+
openprd freeze /path/to/project
|
|
358
|
+
openprd handoff /path/to/project --target openprd
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
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.
|
|
362
|
+
|
|
363
|
+
### 7. Start OpenPrd discovery mode
|
|
364
|
+
|
|
365
|
+
Users can ask in natural language:
|
|
366
|
+
|
|
367
|
+
```text
|
|
368
|
+
Use OpenPrd to deeply complete this project.
|
|
369
|
+
Use OpenPrd to comprehensively mine this reference project into the new project.
|
|
370
|
+
Keep digging into this requirement until OpenPrd coverage is complete.
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
Discovery and loop execution require explicit depth or execution intent. For
|
|
374
|
+
planning, architecture review, impact analysis, or "which files would change?"
|
|
375
|
+
questions, agents should inspect state and answer read-only instead of advancing
|
|
376
|
+
coverage or launching loop tasks.
|
|
377
|
+
|
|
378
|
+
Agents route those requests internally. The underlying command is:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
openprd discovery /path/to/project --mode brownfield
|
|
382
|
+
openprd discovery /path/to/project --resume
|
|
383
|
+
openprd discovery /path/to/project --advance --claim "Users can start a session from the dashboard" --evidence src/app.ts
|
|
384
|
+
openprd discovery /path/to/project --verify
|
|
385
|
+
openprd change /path/to/project --generate --change <change-id>
|
|
386
|
+
openprd change /path/to/project --validate --change <change-id>
|
|
387
|
+
openprd standards /path/to/project --verify
|
|
388
|
+
openprd tasks /path/to/project --change <change-id>
|
|
389
|
+
openprd tasks /path/to/project --change <change-id> --advance --verify --item T001.01
|
|
390
|
+
openprd change /path/to/project --apply --change <change-id>
|
|
391
|
+
openprd change /path/to/project --archive --change <change-id>
|
|
392
|
+
openprd specs /path/to/project
|
|
393
|
+
openprd changes /path/to/project
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Discovery verification also checks the active OpenPrd change structure, spec deltas,
|
|
397
|
+
`docs/basic/` standards, and long-running task files. Keep `tasks.md` as the first
|
|
398
|
+
entry, cap each task file at 25 substantive checkbox tasks, and continue with
|
|
399
|
+
`tasks-002.md`, `tasks-003.md`, etc. The final checkbox in every non-final file
|
|
400
|
+
should hand off to the next file so agents can resume in order. A project can use
|
|
401
|
+
a stricter local cap with `.openprd/discovery/config.json` at
|
|
402
|
+
`taskSharding.maxItemsPerFile`.
|
|
403
|
+
|
|
404
|
+
That 25-item limit is only a sharding cap, not a decomposition target. Prefer task
|
|
405
|
+
titles that describe concrete implementation units, wiring boundaries, entry
|
|
406
|
+
surfaces, integration closures, and regression passes instead of mirroring PRD
|
|
407
|
+
section labels like "primary flow", "requirement", or "acceptance goal".
|
|
408
|
+
|
|
409
|
+
When a task needs a stable id for long-running execution, keep the metadata small:
|
|
410
|
+
|
|
411
|
+
```md
|
|
412
|
+
- [ ] T009.07 Port legacy database import preview
|
|
413
|
+
- type: implementation
|
|
414
|
+
- deps: T001.14, T007.06
|
|
415
|
+
- done: preview shows counts, conflicts, skipped items, warnings
|
|
416
|
+
- verify: npm run test -- migration
|
|
417
|
+
- test-layer: unit, integration
|
|
418
|
+
- test-size: medium
|
|
419
|
+
- test-scope: cli-contract
|
|
420
|
+
- evidence-plan: unit tests for import parsing plus CLI contract output evidence
|
|
421
|
+
- oracle: compare sample import output against the legacy preview and record mismatches
|
|
422
|
+
```
|
|
423
|
+
|
|
424
|
+
Use `type` to distinguish `implementation`, `verification`, `documentation`, and
|
|
425
|
+
`governance` work. `deps` is only needed when the task depends on earlier task ids.
|
|
426
|
+
`done` is the completion condition, and `verify` is the command or review step
|
|
427
|
+
that proves it. For `implementation` and `verification` tasks, generated tasks
|
|
428
|
+
default to `openprd tasks . --change <id> --item <task-id> --evidence-required`:
|
|
429
|
+
the agent must run the smallest useful task-level test or review, then pass
|
|
430
|
+
`--evidence <path-or-summary>` or record `evidence:` / `waiver-reason:` in the
|
|
431
|
+
task metadata. Documentation tasks still use standards checks. Reserve
|
|
432
|
+
`openprd run . --verify` for phase/final gates instead of every task; do not use
|
|
433
|
+
`openprd change . --validate` as the only proof. Legacy generated tasks that
|
|
434
|
+
still say `verify: openprd run . --verify` are treated as task evidence checks
|
|
435
|
+
when run through `openprd tasks --verify`, so old task files do not keep
|
|
436
|
+
regenerating workspace quality reports. Use `oracle` when the task must compare against a reference
|
|
437
|
+
implementation, golden data set, screenshot baseline, or other explicit source
|
|
438
|
+
of truth; `openprd loop --finish` then requires `--notes` or `--evidence` so the
|
|
439
|
+
comparison result is recorded.
|
|
440
|
+
|
|
441
|
+
Tasks may also include test strategy metadata. `test-layer`, `test-size`,
|
|
442
|
+
`test-scope`, and `evidence-plan` help OpenPrd choose the smallest useful
|
|
443
|
+
verification evidence: unit tests for isolated logic, integration or contract
|
|
444
|
+
tests for CLI/API/agent boundaries, and e2e/visual/weapp/performance/security
|
|
445
|
+
checks when a task touches user flows or higher-risk runtime behavior. These
|
|
446
|
+
fields route evidence by risk; they are not a fixed 70/20/10 quota.
|
|
447
|
+
|
|
448
|
+
`tasks` lists the next dependency-ready task by default. `--advance` marks
|
|
449
|
+
one task complete, and `--verify` runs that task's `verify` command before marking
|
|
450
|
+
it complete. Execution events are stored outside the task files so the task metadata
|
|
451
|
+
stays small.
|
|
452
|
+
|
|
453
|
+
## Project Standards
|
|
454
|
+
|
|
455
|
+
`openprd init` creates a project standards contract:
|
|
456
|
+
|
|
457
|
+
- `docs/basic/file-structure.md`
|
|
458
|
+
- `docs/basic/app-flow.md`
|
|
459
|
+
- `docs/basic/prd.md`
|
|
460
|
+
- `docs/basic/frontend-guidelines.md`
|
|
461
|
+
- `docs/basic/backend-structure.md`
|
|
462
|
+
- `docs/basic/tech-stack.md`
|
|
463
|
+
- `.openprd/standards/file-manual-template.md`
|
|
464
|
+
- `.openprd/standards/folder-readme-template.md`
|
|
465
|
+
|
|
466
|
+
Use:
|
|
467
|
+
|
|
468
|
+
```bash
|
|
469
|
+
openprd standards /path/to/project --verify
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
OpenPrd generated changes include standards maintenance tasks, and change validation
|
|
473
|
+
checks the standards contract. The canonical project docs path is only
|
|
474
|
+
`docs/basic/`.
|
|
475
|
+
|
|
476
|
+
During implementation, standards maintenance is an explicit impact check, not a
|
|
477
|
+
best-effort cleanup. For every added or modified source file, agents should check
|
|
478
|
+
whether `docs/basic/`, the file manual, or the containing folder README is missing
|
|
479
|
+
or stale. Missing docs must be created; existing docs should be updated whenever
|
|
480
|
+
the change affects responsibilities, flows, structure, dependencies, or product
|
|
481
|
+
behavior. If no documentation update is needed, agents should say the check was
|
|
482
|
+
performed and why the existing docs still match the code.
|
|
483
|
+
|
|
484
|
+
## Auto-optimized reference-to-screenshot comparison
|
|
485
|
+
|
|
486
|
+
When UI work already has a reference effect image, design image, user-provided
|
|
487
|
+
screenshot, or agent-generated mock, the agent should capture the implemented
|
|
488
|
+
UI and generate a side-by-side review image before claiming visual completion:
|
|
489
|
+
|
|
490
|
+
```bash
|
|
491
|
+
openprd visual-compare /path/to/project \
|
|
492
|
+
--reference effect-image.png \
|
|
493
|
+
--actual implementation-screenshot.jpg
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
The default output is a compact JPG under
|
|
497
|
+
`.openprd/harness/visual-reviews/`. The left panel is labeled `效果图`; the
|
|
498
|
+
right panel is labeled `实现截图`. Inputs can be common image formats supported
|
|
499
|
+
by `sharp`.
|
|
500
|
+
|
|
501
|
+
When UI work has no reference image, capture the current screen before editing,
|
|
502
|
+
apply the change, then capture the same entry, viewport, account, and data state
|
|
503
|
+
after editing:
|
|
504
|
+
|
|
505
|
+
```bash
|
|
506
|
+
openprd visual-compare /path/to/project \
|
|
507
|
+
--before before-screenshot.png \
|
|
508
|
+
--after after-screenshot.jpg
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
The before/after mode labels the panels `修改前` and `修改后`, giving the agent a
|
|
512
|
+
visual self-check for expected changes and unintended drift. The output can be
|
|
513
|
+
adjusted when needed:
|
|
514
|
+
|
|
515
|
+
```bash
|
|
516
|
+
openprd visual-compare /path/to/project \
|
|
517
|
+
--reference effect-image.png \
|
|
518
|
+
--actual implementation-screenshot.jpg \
|
|
519
|
+
--out review.webp \
|
|
520
|
+
--format webp \
|
|
521
|
+
--quality 82 \
|
|
522
|
+
--max-panel-width 1180
|
|
523
|
+
```
|
|
524
|
+
|
|
525
|
+
Agents should inspect the generated image and keep iterating until there are no
|
|
526
|
+
obvious visual differences. The final response for reference-driven UI work
|
|
527
|
+
should include the generated review image path and note whether differences
|
|
528
|
+
remain.
|
|
529
|
+
|
|
530
|
+
## Quality Regression Reports
|
|
531
|
+
|
|
532
|
+
`openprd init` also creates a quality contract:
|
|
533
|
+
|
|
534
|
+
- `.openprd/quality/config.json`
|
|
535
|
+
- `.openprd/quality/reports/`
|
|
536
|
+
- `.openprd/knowledge/`
|
|
537
|
+
|
|
538
|
+
Use:
|
|
539
|
+
|
|
540
|
+
```bash
|
|
541
|
+
openprd quality /path/to/project --verify
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
The command writes both JSON and HTML reports under `.openprd/quality/reports/`.
|
|
545
|
+
The HTML regression report is the human-readable quality surface: overall
|
|
546
|
+
regression status, per-requirement module status, test-block pass/fail results,
|
|
547
|
+
test strategy matrix, missing items, and the small set of gaps that need a
|
|
548
|
+
person to decide whether they are in scope for the current delivery. EVO is
|
|
549
|
+
OpenPrd's internal shorthand for the evaluation/verification quality layer; the
|
|
550
|
+
visible report does not ask users to know that acronym. A script or fixture
|
|
551
|
+
being present only proves capability; required gates need current evidence or an
|
|
552
|
+
explicit waiver.
|
|
553
|
+
|
|
554
|
+
When a requirement involves free users, quotas, AI calls, third-party APIs,
|
|
555
|
+
generation, storage, downloads, or other metered costs, `quality --verify`
|
|
556
|
+
also checks for cost drivers, user-level limits, negative abuse-path
|
|
557
|
+
verification, usage/cost monitoring, alert thresholds, and stop-loss actions.
|
|
558
|
+
|
|
559
|
+
`openprd quality --verify` is blocking by default when required test blocks are
|
|
560
|
+
not production-ready. `openprd run --verify` repeats that quality gate so final
|
|
561
|
+
readiness cannot ignore the report. Agents should not claim readiness until
|
|
562
|
+
every required test block is either passing with evidence or explicitly out of
|
|
563
|
+
scope for the scenario.
|
|
564
|
+
|
|
565
|
+
For UI work with an existing reference image, visual readiness also requires a
|
|
566
|
+
current `openprd visual-compare` artifact under `.openprd/harness/visual-reviews/`.
|
|
567
|
+
If the combined image still shows obvious differences, the task should return to
|
|
568
|
+
implementation instead of treating the gap as ready.
|
|
569
|
+
|
|
570
|
+
After a fix has been verified and reviewed, promote the abstract pattern into
|
|
571
|
+
project knowledge:
|
|
572
|
+
|
|
573
|
+
```bash
|
|
574
|
+
openprd quality /path/to/project --learn --review --from .openprd/harness/turn-state.json
|
|
575
|
+
openprd quality /path/to/project --learn --from <report-id-or-json>
|
|
576
|
+
openprd quality /path/to/project --learn --from ./diagnostics/incident-2026-05-24
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
`--learn --review` first writes a pending knowledge candidate under
|
|
580
|
+
`.openprd/knowledge/candidates/` plus a draft skill under
|
|
581
|
+
`.openprd/knowledge/drafts/`. Once the draft is worth keeping, `--learn --from`
|
|
582
|
+
promotes it into incident, pattern, and experience skill artifacts under
|
|
583
|
+
`.openprd/knowledge/` so future tasks can retrieve the lesson instead of
|
|
584
|
+
rediscovering it. `--from` now accepts either a quality report JSON or an
|
|
585
|
+
extracted diagnostics directory / evidence file that already contains
|
|
586
|
+
`diagnostic-report`, `runtime-events`, `timeline`, or `root-cause-candidates`
|
|
587
|
+
artifacts, so a verified fix can be promoted directly into a reusable
|
|
588
|
+
troubleshooting skill.
|
|
589
|
+
|
|
590
|
+
## Agent Setup
|
|
591
|
+
|
|
592
|
+
OpenPrd can install the project harness into the agent environment so users do not
|
|
593
|
+
need to remember which skill, command, or hook to invoke:
|
|
594
|
+
|
|
595
|
+
```bash
|
|
596
|
+
openprd setup /path/to/project
|
|
597
|
+
openprd doctor /path/to/project
|
|
598
|
+
openprd self-update --dry-run
|
|
599
|
+
openprd self-update
|
|
600
|
+
openprd update /path/to/project
|
|
601
|
+
openprd update /path/to/project --hook-profile lite
|
|
602
|
+
openprd upgrade /path/to/project --dry-run
|
|
603
|
+
openprd upgrade /path/to/project
|
|
604
|
+
openprd upgrade /path/to/projects --fleet --dry-run
|
|
605
|
+
openprd fleet /path/to/projects --dry-run
|
|
606
|
+
openprd fleet /path/to/projects --sync-registry
|
|
607
|
+
openprd fleet /path/to/projects --backfill-work-units
|
|
608
|
+
openprd run /path/to/project --context
|
|
609
|
+
openprd run /path/to/project --verify
|
|
610
|
+
openprd loop /path/to/project --plan --change <change-id>
|
|
611
|
+
openprd loop /path/to/project --run --agent codex --dry-run
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Installing the CLI alone does not mutate a project or user config. The full
|
|
615
|
+
Codex/Claude/Cursor adapter set is installed when the user runs `openprd init`
|
|
616
|
+
or `openprd setup` inside a project.
|
|
617
|
+
|
|
618
|
+
`setup` and `init` generate:
|
|
619
|
+
|
|
620
|
+
- `AGENTS.md` managed OpenPrd rules
|
|
621
|
+
- `.codex/skills/`, `.codex/prompts/`, `.codex/config.toml`, `.codex/hooks.json`, and `.codex/hooks/openprd-hook.mjs`
|
|
622
|
+
- user-level Codex config with `features.codex_hooks = true`
|
|
623
|
+
- `.claude/skills/`, `.claude/commands/openprd/`, and `CLAUDE.md`
|
|
624
|
+
- `.cursor/rules/openprd.mdc` and `.cursor/commands/`
|
|
625
|
+
- `.openprd/harness/install-manifest.json`, `hook-state.json`, `events.jsonl`, `drift-report.json`, and `visual-reviews/`
|
|
626
|
+
|
|
627
|
+
`setup`, `init`, `update`, and `doctor` also maintain
|
|
628
|
+
`optionalCapabilities` inside `.openprd/harness/install-manifest.json`. These
|
|
629
|
+
entries are only “better when configured” recommendations and never turn
|
|
630
|
+
initialization, diagnostics, or the current task into a failure.
|
|
631
|
+
|
|
632
|
+
`doctor` verifies that the generated rules, Codex hooks feature flag, standards,
|
|
633
|
+
and workspace validation are healthy, and also surfaces optional enhancement
|
|
634
|
+
recommendations such as Context7 or DeepWiki. `update` refreshes the generated
|
|
635
|
+
adapter files from the canonical OpenPrd source while preserving unrelated user
|
|
636
|
+
hook groups.
|
|
637
|
+
|
|
638
|
+
`self-update` updates the OpenPrd CLI itself from the public npm package.
|
|
639
|
+
`upgrade` composes the two update layers: it first runs `self-update`, then
|
|
640
|
+
re-resolves the installed `openprd` executable and runs either `update <project>`
|
|
641
|
+
or, with `--fleet`, `fleet <root> --update-openprd`. Both commands support
|
|
642
|
+
`--dry-run`; dry-run prints the planned install and refresh commands without
|
|
643
|
+
modifying the CLI, project, registry, or harness state.
|
|
644
|
+
|
|
645
|
+
The harness is stateful, but hooks are proportional to the chosen profile.
|
|
646
|
+
Default `lite` keeps a lightweight `PreToolUse` write gate for requirement
|
|
647
|
+
intake and limits it to direct editing tools, while `Stop` performs a lightweight
|
|
648
|
+
end-of-turn knowledge review instead of full telemetry. This avoids read-only shell hook
|
|
649
|
+
noise while still nudging the agent to capture reusable project patterns. `guarded` also gates shell tools, while
|
|
650
|
+
`full` restores SessionStart/PreToolUse/PostToolUse/Stop telemetry for temporary
|
|
651
|
+
diagnostics. High-risk actions such as freeze, handoff, accepted spec
|
|
652
|
+
apply/archive, commit, push, release, or publish are gated by
|
|
653
|
+
`openprd run . --verify`, which covers standards, workspace validation, active
|
|
654
|
+
change validation, and active discovery verification.
|
|
655
|
+
|
|
656
|
+
`openprd run . --context` is the Ralph-style loop surface for agents. It selects
|
|
657
|
+
the next executable unit from active change tasks, discovery coverage, or normal
|
|
658
|
+
OpenPrd workflow state, and records hook turns in `.openprd/harness/iterations.jsonl`.
|
|
659
|
+
|
|
660
|
+
### Long-Running Agent Loop
|
|
661
|
+
|
|
662
|
+
For implementation work that should behave like the harness pattern described by
|
|
663
|
+
Anthropic's long-running agent guidance, use `openprd loop`. The loop is stricter
|
|
664
|
+
than `run --context`: it creates a durable feature list, writes a single-task
|
|
665
|
+
prompt, starts a fresh Codex or Claude session for exactly one task, verifies the
|
|
666
|
+
task, and can commit that task before moving on.
|
|
667
|
+
|
|
668
|
+
For UI tasks, the loop prompt and generated guidance require the agent to run
|
|
669
|
+
`openprd visual-compare` before finishing: use `--reference/--actual` when a
|
|
670
|
+
reference image exists, or `--before/--after` when the agent must verify a UI
|
|
671
|
+
change without an explicit reference image.
|
|
672
|
+
|
|
673
|
+
`openprd run --context` may surface loop commands as execution commands, but they
|
|
674
|
+
are not automatic instructions. Agents should run `openprd loop --run`,
|
|
675
|
+
`openprd tasks --advance`, `openprd discovery --advance`, or commit commands only
|
|
676
|
+
when the current user message explicitly asks for development, implementation,
|
|
677
|
+
task continuation, deep research/benchmarking, replication, or commit. Read-only
|
|
678
|
+
planning and review turns should stop at the module/file plan.
|
|
679
|
+
|
|
680
|
+
Loop is recommended from the substantive implementation task count, not from every
|
|
681
|
+
checkbox. When a change has 10 or more pending/total `implementation` tasks,
|
|
682
|
+
`run --context` recommends an isolated worktree or equivalent environment plus a
|
|
683
|
+
single-task Loop session.
|
|
684
|
+
|
|
685
|
+
```bash
|
|
686
|
+
openprd loop . --init
|
|
687
|
+
openprd loop . --plan --change <change-id>
|
|
688
|
+
openprd loop . --next
|
|
689
|
+
openprd loop . --prompt --agent codex
|
|
690
|
+
openprd loop . --run --agent codex --dry-run
|
|
691
|
+
openprd loop . --run --agent claude --dry-run
|
|
692
|
+
openprd loop . --verify --item T001.01
|
|
693
|
+
openprd loop . --finish --item T001.01 --commit --message "Add a release-note entry point"
|
|
694
|
+
```
|
|
695
|
+
|
|
696
|
+
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.
|
|
697
|
+
|
|
698
|
+
The loop writes its durable state under `.openprd/harness/`:
|
|
699
|
+
|
|
700
|
+
- `feature-list.json` is the ordered implementation task list.
|
|
701
|
+
- Each loop task carries a human-readable `taskHandle` such as
|
|
702
|
+
`change-id:T001.01:task-title`, so another conversation can continue the same
|
|
703
|
+
task without relying on a chat-specific UUID.
|
|
704
|
+
- `progress.md` is the human-readable progress log.
|
|
705
|
+
- `failed-approaches.md` is the dead-end ledger for mismatches, rejected fixes,
|
|
706
|
+
and why they failed, so the next session does not retry the same path.
|
|
707
|
+
- `agent-sessions.jsonl` records each prompt/run/finish event, including the
|
|
708
|
+
task handle and task title for cross-session lookup.
|
|
709
|
+
- `bootstrap.sh` is the startup check each fresh agent session runs.
|
|
710
|
+
- `loop-state.json` stores the current task id, task handle, task title, and
|
|
711
|
+
the last agent session metadata.
|
|
712
|
+
- `loop-prompts/` stores generated single-task prompts for audit and reuse.
|
|
713
|
+
|
|
714
|
+
Use `--dry-run` first when you want OpenPrd to prepare the prompt and exact command
|
|
715
|
+
without launching an agent. Use `--agent codex` or `--agent claude` for the default
|
|
716
|
+
CLI integrations. Use `--agent-command "<custom command>"` only when you want to
|
|
717
|
+
pipe the OpenPrd prompt into a project-specific wrapper.
|
|
718
|
+
|
|
719
|
+
For historical projects, use `fleet` instead of hand-writing shell loops. By
|
|
720
|
+
default it scans and reports only, while also telling you how many known
|
|
721
|
+
OpenPrd workspaces already exist in the global registry and how many are outside
|
|
722
|
+
the current root. `--sync-registry` backfills initialized `.openprd/`
|
|
723
|
+
workspaces into `~/.openprd/registry/workspaces.jsonl`. `--update-openprd`
|
|
724
|
+
refreshes projects that already contain `.openprd/` and also backfills
|
|
725
|
+
historical PRD work unit bindings. Project standards or validation gaps are
|
|
726
|
+
reported as health items, but they do not block generated guidance updates. Use
|
|
727
|
+
`--backfill-work-units` when you only want to refresh versioned review artifacts
|
|
728
|
+
and identity bindings, while agent-only or plain projects stay untouched unless
|
|
729
|
+
explicitly selected with `--setup-missing`.
|
|
730
|
+
|
|
731
|
+
## How to Read `status` and `next`
|
|
732
|
+
|
|
733
|
+
OpenPrd is not just a command runner. It exposes collaboration state.
|
|
734
|
+
|
|
735
|
+
### `openprd status`
|
|
736
|
+
|
|
737
|
+
Use it to understand:
|
|
738
|
+
|
|
739
|
+
- current scenario
|
|
740
|
+
- user participation mode
|
|
741
|
+
- current gate
|
|
742
|
+
- upcoming gate
|
|
743
|
+
- current project version, if the release track is enabled
|
|
744
|
+
|
|
745
|
+
Example signals:
|
|
746
|
+
|
|
747
|
+
- `Scenario: Cold start (existing project)`
|
|
748
|
+
- `User participation mode: context-plus-confirmation`
|
|
749
|
+
- `Current gate: clarify-user`
|
|
750
|
+
- `Upcoming gate: architecture diagram review`
|
|
751
|
+
|
|
752
|
+
### `openprd next`
|
|
753
|
+
|
|
754
|
+
Use it to understand:
|
|
755
|
+
|
|
756
|
+
- what should happen next
|
|
757
|
+
- why that step is recommended
|
|
758
|
+
- which questions should be asked now
|
|
759
|
+
|
|
760
|
+
## Diagram Contracts
|
|
761
|
+
|
|
762
|
+
OpenPrd supports:
|
|
763
|
+
|
|
764
|
+
- `architecture`
|
|
765
|
+
- `product-flow`
|
|
766
|
+
|
|
767
|
+
You can let the tool infer a draft from the current workspace, or supply an explicit contract:
|
|
768
|
+
|
|
769
|
+
```bash
|
|
770
|
+
openprd diagram /path/to/project \
|
|
771
|
+
--type product-flow \
|
|
772
|
+
--input ./product-flow-contract.json
|
|
773
|
+
```
|
|
774
|
+
|
|
775
|
+
The diagram contract is validated against built-in schema files in `.openprd/schema/`.
|
|
776
|
+
|
|
777
|
+
## Agent Skills
|
|
778
|
+
|
|
779
|
+
This repository ships a repo-local `skills/` directory modeled after the `lark-shared + domain skills` pattern used by `larksuite/cli`.
|
|
780
|
+
|
|
781
|
+
- `skills/openprd-shared/` — shared guardrails and language/review rules
|
|
782
|
+
- `skills/openprd-harness/` — main OpenPrd workflow sequencing
|
|
783
|
+
- `skills/openprd-standards/` — project docs, file manual, and folder README standards
|
|
784
|
+
- `skills/openprd-diagram-review/` — diagram generation and review loop guidance
|
|
785
|
+
- `skills/openprd-discovery-loop/` — sustained OpenPrd coverage discovery
|
|
786
|
+
|
|
787
|
+
Agents entering this repository should read:
|
|
788
|
+
|
|
789
|
+
- `AGENTS.md`
|
|
790
|
+
|
|
791
|
+
## Project Structure
|
|
792
|
+
|
|
793
|
+
```text
|
|
794
|
+
.
|
|
795
|
+
├── AGENTS.md
|
|
796
|
+
├── bin/
|
|
797
|
+
├── src/
|
|
798
|
+
├── skills/
|
|
799
|
+
├── test/
|
|
800
|
+
├── docs/
|
|
801
|
+
│ └── basic/
|
|
802
|
+
├── openprd/
|
|
803
|
+
│ ├── changes/
|
|
804
|
+
│ ├── specs/
|
|
805
|
+
│ └── archive/
|
|
806
|
+
└── .openprd/
|
|
807
|
+
├── schema/
|
|
808
|
+
├── templates/
|
|
809
|
+
├── engagements/
|
|
810
|
+
├── state/
|
|
811
|
+
└── exports/
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
Key directories:
|
|
815
|
+
|
|
816
|
+
- `src/` — CLI logic, PRD core, diagram rendering
|
|
817
|
+
- `docs/basic/` — project-level baseline docs maintained by OpenPrd standards
|
|
818
|
+
- `skills/` — repo-local agent skill system
|
|
819
|
+
- `.openprd/` — shipped workspace seed
|
|
820
|
+
- `test/` — regression coverage for clarify / capture / diagram / gate logic
|
|
821
|
+
|
|
822
|
+
## Agent Prompt Examples
|
|
823
|
+
|
|
824
|
+
You can steer agents with prompts like:
|
|
825
|
+
|
|
826
|
+
```text
|
|
827
|
+
Use $openprd-harness to initialize and advance an OpenPrd workspace for this product idea.
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
```text
|
|
831
|
+
Use $openprd-diagram-review to generate a product-flow review artifact before freeze.
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
## Contributing
|
|
835
|
+
|
|
836
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
837
|
+
|
|
838
|
+
## Security
|
|
839
|
+
|
|
840
|
+
See [SECURITY.md](./SECURITY.md).
|
|
841
|
+
|
|
842
|
+
## License
|
|
843
|
+
|
|
844
|
+
MIT — see [LICENSE](./LICENSE).
|
|
845
|
+
|
|
846
|
+
## Author
|
|
847
|
+
|
|
848
|
+
- X: [Mileson07](https://x.com/Mileson07)
|
|
849
|
+
- Xiaohongshu: [超级峰](https://xhslink.com/m/4LnJ9aB1f97)
|
|
850
|
+
- Douyin: [超级峰](https://v.douyin.com/rH645q7trd8/)
|