@zeyue0329/xiaoma-cli 1.11.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/.playwright-cli/console-2026-05-13T06-36-26-793Z.log +2 -0
  2. package/.playwright-cli/page-2026-05-13T06-36-27-725Z.yml +1 -0
  3. package/CLAUDE.md +25 -7
  4. package/XiaoMa-CLI-2026H2-/350/277/255/344/273/243/350/247/204/345/210/222.pptx +0 -0
  5. package/demo/xiaoma-bug-circle-resolve/SKILL.md +6 -0
  6. package/demo/xiaoma-bug-circle-resolve/workflow.md +254 -0
  7. package/demo/xiaoma-bug-resolve/SKILL.md +6 -0
  8. package/demo/xiaoma-bug-resolve/workflow.md +269 -0
  9. package/demo/xiaoma-prd-saas-zh/README.md +57 -0
  10. package/demo/xiaoma-prd-saas-zh/domain-research.md +128 -0
  11. package/demo/xiaoma-prd-saas-zh/epics.md +303 -0
  12. package/demo/xiaoma-prd-saas-zh/market-research-2026-q1.md +183 -0
  13. package/demo/xiaoma-prd-saas-zh/prd-bad-examples.md +268 -0
  14. package/demo/xiaoma-prd-saas-zh/prd.md +409 -0
  15. package/demo/xiaoma-prd-saas-zh/product-brief.md +97 -0
  16. package/demo/xiaoma-prd-saas-zh/validation-report.md +279 -0
  17. package/docs/roadshow/01-/351/241/271/347/233/256/346/246/202/350/247/210/344/270/216/346/236/266/346/236/204.md +189 -0
  18. package/docs/roadshow/02-/346/231/272/350/203/275/344/275/223/347/263/273/347/273/237/350/257/246/350/247/243.md +464 -0
  19. package/docs/roadshow/03-/346/231/272/350/203/275/344/275/223/344/272/244/344/272/222/346/265/201/347/250/213/345/233/276.md +334 -0
  20. package/docs/roadshow/04-/345/267/245/344/275/234/346/265/201/346/211/247/350/241/214/350/257/246/350/247/243.md +1038 -0
  21. package/docs/roadshow/05-/346/212/200/346/234/257/345/256/236/347/216/260/344/270/216/345/210/233/346/226/260/344/272/256/347/202/271.md +205 -0
  22. package/docs/roadshow/06-/350/267/257/346/274/224/346/200/273/347/273/223/344/270/216/346/274/224/347/244/272/345/273/272/350/256/256.md +167 -0
  23. package/media/doc1_fig1.png +0 -0
  24. package/media/doc1_fig2.png +0 -0
  25. package/media/doc1_fig3.png +0 -0
  26. package/media/doc1_fig4.png +0 -0
  27. package/media/doc2_fig1.png +0 -0
  28. package/media/doc2_fig2.png +0 -0
  29. package/media/doc2_fig3.png +0 -0
  30. package/media/doc2_fig4.png +0 -0
  31. package/media/doc3_fig1.png +0 -0
  32. package/media/doc3_fig2.png +0 -0
  33. package/media/doc3_fig3.png +0 -0
  34. package/media/doc3_fig4.png +0 -0
  35. package/media/doc4_fig1.png +0 -0
  36. package/media/doc4_fig2.png +0 -0
  37. package/media/doc4_fig3.png +0 -0
  38. package/media/doc5_fig1.png +0 -0
  39. package/media/doc5_fig2.png +0 -0
  40. package/media/doc5_fig3.png +0 -0
  41. package/package.json +1 -1
  42. package/patent-disclosure-optimized/SKILL.md +416 -0
  43. package/patent-disclosure-optimized/references/disclosure-template.md +84 -0
  44. package/patent-disclosure-optimized/references/docx-format-spec.md +183 -0
  45. package/patent-disclosure-optimized/references/mining-principles.md +168 -0
  46. package/patent-disclosure-optimized/scripts/md2docx.js +777 -0
  47. package/src/core/tasks/xiaoma-create-prd/data/prd-purpose.md +157 -0
  48. package/src/core/tasks/xiaoma-create-prd/data/upstream-input-contract.md +168 -0
  49. package/src/core/tasks/xiaoma-create-prd/templates/prd-skeleton-reference.md +428 -0
  50. package/src/core/tasks/xiaoma-create-prd/templates/prd-template.md +101 -3
  51. package/src/xmc/agents/sm.agent.yaml +9 -1
  52. package/src/xmc/workflows/2-plan-workflows/xiaoma-validate-prd/data/prd-quality-rubric.csv +14 -0
  53. package/src/xmc/workflows/4-implementation/auto-story-pipeline/SKILL.md +1 -1
  54. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-01-init-and-validate.md +10 -13
  55. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-02-create-story.md +0 -1
  56. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-08-complete-story.md +3 -4
  57. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-09-finalize.md +69 -0
  58. package/src/xmc/workflows/4-implementation/auto-story-pipeline/workflow.md +9 -14
  59. package/src/xmc/workflows/4-implementation/auto-story-pipeline/xiaoma-skill-manifest.yaml +1 -1
  60. package/src/xmc/workflows/4-implementation/auto-story-pipeline-batch/SKILL.md +6 -0
  61. package/src/xmc/workflows/4-implementation/auto-story-pipeline-batch/workflow.md +333 -0
  62. package/src/xmc/workflows/4-implementation/auto-story-pipeline-batch/xiaoma-skill-manifest.yaml +3 -0
  63. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/steps/step-01-init-and-validate.md +2 -2
  64. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/steps/step-04-run-story-pipeline.md +30 -41
  65. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/steps/step-05-finalize.md +2 -2
  66. package/src/xmc/workflows/5-full-pipeline/auto-full-pipeline/workflow.md +7 -9
  67. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/SKILL.md +6 -0
  68. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/checklist.md +43 -0
  69. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-01-init-and-validate.md +155 -0
  70. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-02-create-epics.md +156 -0
  71. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-03-bridge-sprint-planning.md +143 -0
  72. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-04-batch-create-stories.md +309 -0
  73. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/steps/step-05-finalize.md +311 -0
  74. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/workflow.md +105 -0
  75. package/src/xmc/workflows/5-full-pipeline/auto-prd-to-stories/xiaoma-skill-manifest.yaml +3 -0
  76. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_1_/351/235/242/345/220/221AI/346/231/272/350/203/275/344/275/223/347/232/204/345/244/232/351/200/232/351/201/223/344/276/235/350/265/226_20260318.md +483 -0
  77. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_2_/345/237/272/344/272/216/351/205/215/347/275/256/351/251/261/345/212/250/347/232/204/350/267/250/345/271/263/345/217/260IDE/346/231/272/350/203/275_20260318.md +592 -0
  78. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_3_AI/346/231/272/350/203/275/344/275/223/345/243/260/346/230/216/345/274/217/345/256/232/344/271/211/347/232/204/347/274/226/350/257/221/346/265/201/346/260/264_20260318.md +624 -0
  79. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_4_/345/237/272/344/272/216/345/223/210/345/270/214/346/214/207/347/272/271/347/232/204/346/231/272/350/203/275/344/275/223/351/231/204/345/261/236/350/265/204/346/272/220/351/200/211_20260318.md +628 -0
  80. package//344/270/223/345/210/251/344/272/244/345/272/225/344/271/246_5_AI/346/231/272/350/203/275/344/275/223/350/247/246/345/217/221/346/214/207/344/273/244/347/232/204/345/244/215/345/220/210/346/240/274/345/274/217/346/240/241_20260318.md +652 -0
  81. package/src/xmc/workflows/4-implementation/auto-story-pipeline/steps/step-09-cycle-check.md +0 -147
@@ -195,3 +195,160 @@ Certain industries have mandatory requirements that must be present:
195
195
  ---
196
196
 
197
197
  **Remember:** The PRD is the foundation. Quality here ripples through every subsequent phase. A dense, precise, well-traced PRD makes UX design, architecture, epic breakdown, and AI development dramatically more effective.
198
+
199
+ ---
200
+
201
+ ## Chinese PRD Anti-Patterns (中文 PRD 反模式)
202
+
203
+ When `{document_output_language}` is Chinese, the same density/SMART/no-leakage rules apply, but a few culture-specific traps appear repeatedly. Each anti-pattern is numbered (AP-NN) so the validation rubric (`xiaoma-validate-prd/data/prd-quality-rubric.csv`) can reference it directly via `detection_signals`.
204
+
205
+ ### AP-01 — 口号化目标 (Slogan-style goals)
206
+
207
+ PRDs written in Chinese B2B contexts often inherit marketing copy from internal slide decks. The result is unmeasurable, multi-claim sentences.
208
+
209
+ - **Detection signals:** "打造", "业界领先", "一站式", "赋能", "数字化转型", "智能化", "全方位"
210
+ - ❌ Bad: "打造业界领先的、智能化、一站式客户成功平台,赋能企业数字化转型。"
211
+ - ✅ Good: "Vision — 让中型企业的客户成功团队在统一画布上看见、解读并干预客户旅程,把流失预警的发现到触达从平均 7 天压到 24 小时内。"
212
+ - **Self-check:** 这一句能映射到至少 1 条可量化的 Success Criteria 吗?如果不能,重写。
213
+
214
+ ### AP-02 — 模糊主语 (Ambiguous subject)
215
+
216
+ Chinese drops subjects more readily than English, which makes "系统应支持..." sentences feel natural but breaks FR traceability.
217
+
218
+ - **Detection signals:** "系统应支持", "应当能够", "可以实现", subject-less imperative
219
+ - ❌ Bad: "系统应支持客户档案的查询和管理。"
220
+ - ✅ Good: "FR-PROFILE-01: CSM 可以按公司名 / 标签 / 客户健康度区间检索客户档案。"
221
+ - **Self-check:** Every FR sentence starts with `[Actor]` (CSM, Admin, system, ...)? If actor is "system", is it because no human user is involved (e.g., scheduled jobs)?
222
+
223
+ ### AP-03 — 实现泄漏 (Implementation leakage)
224
+
225
+ Tech stack names sneak in when authors come from engineering. PRD must describe *what*, not *how*.
226
+
227
+ - **Detection signals:** "Redis", "PostgreSQL", "Kafka", "JWT", "WebSocket", "Spring Boot", "Vue", any technology proper noun
228
+ - ❌ Bad: "FR-X: 系统使用 Redis 缓存订单查询结果,TTL 30 分钟。"
229
+ - ✅ Good: "FR-ORDER-04: 订单查询 p95 < 200ms(移到 §9 NFR)。"
230
+ - **Self-check:** Does this FR say *what capability exists* or *how it's built*? If "how", strip the tech and either restate as capability or move to NFR.
231
+
232
+ ### AP-04 — 复合需求 (Compound requirements)
233
+
234
+ A single FR that bundles 2-3 distinct capabilities. Decomposes into multiple stories, breaks 1 FR ↔ 1-3 story mapping.
235
+
236
+ - **Detection signals:** "且", "并", "同时", "以及", "并且能够"
237
+ - ❌ Bad: "FR-Y: CSM 可以查询客户、添加标签并导出 Excel。"
238
+ - ✅ Good: 拆为 FR-PROFILE-01(查询)/ FR-PROFILE-03(标签)/ FR-EXPORT-02(导出)
239
+ - **Self-check:** Count the verbs in the FR. > 1 verb usually means split. Use the "Channel / Data Object / Action" axis from FR-to-Story Heuristics below.
240
+
241
+ ### AP-05 — 量词缺失 (Missing quantifiers)
242
+
243
+ Subjective adjectives appear in success criteria and NFRs.
244
+
245
+ - **Detection signals:** "显著", "明显", "极大", "尽可能", "高效", "快速", "稳定", "良好"
246
+ - ❌ Bad: "客户满意度显著提升,流失率明显下降。"
247
+ - ✅ Good: "SC-02 客户满意度 NPS ≥ 45(季度调研,N ≥ 100);SC-03 月度流失率从 4.2% 降至 ≤ 2.5%(CRM 仪表板)。"
248
+ - **Self-check:** Does every success metric carry baseline + target + measurement + time window?
249
+
250
+ ---
251
+
252
+ ## FR-to-Story Heuristics (FR→Story 启发式映射规则)
253
+
254
+ A FR is the capability contract; user stories are the implementation contract. The PM agent uses these heuristics during `step-09-functional` to keep FR granularity right-sized for downstream Epic/Story breakdown.
255
+
256
+ ### Rule 1 — 1 FR maps to 1-3 stories
257
+
258
+ A FR that decomposes into 4+ stories is too coarse — split it. A FR that decomposes into 0 stories is either redundant with another FR or belongs to NFR.
259
+
260
+ - 1 story: simple CRUD or read-only capability
261
+ - 2 stories: capability + admin/config variant
262
+ - 3 stories: capability + read-side + write-side (or empty / typical / extreme states)
263
+
264
+ ### Rule 2 — Single Actor only
265
+
266
+ If a FR mentions two actors, split. Two actors = two journeys = two FRs.
267
+
268
+ - ❌ "Admin and CSM can both export reports." → split into FR-REPORT-01 (Admin) + FR-REPORT-02 (CSM)
269
+ - Exception: when the actor is "system" for a background job, this rule doesn't apply.
270
+
271
+ ### Rule 3 — "且 / 并 / 同时" usually signals a split
272
+
273
+ Composite requirements (AP-04 above) are the most common over-coarse pattern. The connective itself is a refactor signal.
274
+
275
+ ### Rule 4 — Split axes
276
+
277
+ When unclear how to split, use these axes in priority order:
278
+
279
+ 1. **Actor** — who performs it (CSM vs. Admin vs. system)
280
+ 2. **Action verb** — what they do (create vs. read vs. update vs. delete)
281
+ 3. **Data object** — what they act on (customer vs. tag vs. ticket)
282
+ 4. **Channel** — through what surface (web vs. API vs. webhook)
283
+
284
+ ### Rule 5 — Capability area naming
285
+
286
+ Capability areas (the §8 sub-headers grouping FRs) must be **noun phrases**.
287
+
288
+ - ✅ "客户档案管理" / "Customer Profile Management"
289
+ - ❌ "管理客户档案" / "Manage Customer Profiles" (verb phrase = becomes a story title, not a capability area)
290
+
291
+ Suggested area prefixes when generating FR IDs: `PROFILE`, `JOURNEY`, `RISK`, `SUMMARY`, `TICKET`, `TENANT`, `AUTH`, `EXPORT`, `INTEGRATE`, `AUDIT`.
292
+
293
+ ---
294
+
295
+ ## NFR Industry Baselines (NFR 行业基准库)
296
+
297
+ When the PM agent reaches `step-10-nonfunctional`, it selects a profile based on `project-types.csv` detection in `step-07`, then uses these baselines as the default candidate list. The user can override any threshold during the A/P/C menu, but every NFR must end up with a quantitative threshold + measurement method.
298
+
299
+ ### Profile selection rules
300
+
301
+ 1. If `project_type ∈ {saas_b2b, web_app}` and target users are external paying customers → **SaaS B2B**
302
+ 2. If `project_type ∈ {developer_tool, cli_tool}` or target is internal-only → **Internal Tool**
303
+ 3. If consumer-facing, public traffic, or expected ≥ 10k concurrent users → **High-concurrency C-end**
304
+ 4. Unmatched → fall back to **SaaS B2B** (most stringent middle ground)
305
+
306
+ ### Baseline matrix
307
+
308
+ | Dimension | SaaS B2B (默认) | Internal Tool | High-concurrency C-end |
309
+ | --------------- | ----------------------------------------------------------------- | ------------------------------ | -------------------------------------------- |
310
+ | Performance | API p95 < 500ms · p99 < 1.5s · 页面 LCP < 2.5s | API p95 < 1s · LCP < 4s | API p95 < 200ms · p99 < 800ms · LCP < 1.8s |
311
+ | Availability | 月度 SLA 99.9% · RTO < 4h · RPO < 15min | SLA 99.5% · RTO < 1 day | SLA 99.95% · RTO < 30min · RPO < 1min |
312
+ | Security | OWASP Top 10 全覆盖 · TLS 1.2+ · 静态加密 AES-256 · MFA 可选 | RBAC 强制 · TLS 1.2+ | + DDoS 防护 · WAF · 风控规则引擎 |
313
+ | Scalability | 单租户 1k 并发 · 横向扩容 ≤ 5min | 100 并发 (内部工具) | 50k QPS · 弹性扩容触发延迟 < 2min |
314
+ | Observability | 关键链路 trace 覆盖 ≥ 95% · 错误率告警 < 5min · 日志保留 90d | 日志保留 30d · 错误日志告警 | + RUM 全采样 · 业务指标分钟级 · 日志保留 1y |
315
+ | Compliance | 数据本地化 · 等保二级 · 审计日志 ≥ 180d · 个保法授权链 | 等保二级 (推荐) | + 个保法专项 · 跨境数据评估 · 行业专项合规 |
316
+
317
+ ### Per-NFR template
318
+
319
+ ```
320
+ NFR-<DIM>-<NN>: [metric] [condition] [threshold] (measured by [method]) [profile=<profile-name>]
321
+ ```
322
+
323
+ Example (SaaS B2B):
324
+
325
+ > NFR-PERF-01: API 接口在正常负载下 p95 < 500ms(APM 监控统计,profile=saas_b2b)
326
+
327
+ When the threshold deviates from the baseline (either tighter or looser), the NFR must include a one-line **rationale**. Example:
328
+
329
+ > NFR-AVAIL-01: 月度 SLA ≥ 99.95%(profile=saas_b2b override;rationale: 试点客户 SLA 合同要求 99.95%)
330
+
331
+ ---
332
+
333
+ ## Dual-Audience Writing Checklist
334
+
335
+ A PRD that scores well on this checklist works equally well for the human reviewer (skim → skip → scan) and the LLM downstream consumer (chunk → anchor → cite).
336
+
337
+ ### Human-readable path (Skim · Skip · Scan)
338
+
339
+ 1. **Skim** — Reading only `## Level 2` headers reveals the full structure of the document
340
+ 2. **Skip** — Each section opens with a 1-2 sentence summary; reader can skip the rest if not relevant
341
+ 3. **Scan** — Tables, bulleted lists, and bolded keywords carry the dense data; prose is minimal
342
+
343
+ ### LLM-consumable path (Chunk · Anchor · Cite)
344
+
345
+ 4. **Chunk** — One concept per paragraph; paragraphs are separable without context loss
346
+ 5. **Anchor** — Every section/sub-section has a stable header used for cross-reference (`§N`, `FR-AREA-NN`)
347
+ 6. **Cite** — Cross-references inside the PRD use full IDs (e.g., `FR-PROFILE-01` not "the customer search FR")
348
+
349
+ ### Self-contained sections
350
+
351
+ 7. **Forward reference free** — A section never depends on reading a later section to be understood
352
+ 8. **Section-local definitions** — Domain terms first introduced in a section are defined within or linked to §5 Domain Requirements terminology table
353
+
354
+ A section that fails 2+ checklist items is a D13 Dual-Audience Readiness flag in the validation rubric.
@@ -0,0 +1,168 @@
1
+ # Analyst → PM Upstream Input Contract
2
+
3
+ > **Purpose:** Specify what the PM agent (xiaochan / 小蝉) requires from upstream Analyst (xiaofen / 小芬) artifacts when starting `xiaoma-create-prd`. Defines required fields, where they map into the PRD's 9 sections, and how to handle missing fields.
4
+ >
5
+ > **Loaded by:** `steps-c/step-01-init.md` (PRD initialization) and `auto-requirements-pipeline/steps/step-04-create-prd.md` (pipeline delegation).
6
+ >
7
+ > **Authoritative for:** Validation dimension D04 (Brief Coverage) in `xiaoma-validate-prd`.
8
+
9
+ ---
10
+
11
+ ## 1. Scope and Applicability
12
+
13
+ This contract applies whenever PRD creation is started **from upstream artifacts** rather than from scratch (i.e., `inputDocuments` array is non-empty after step-01 discovery).
14
+
15
+ It applies in two execution modes:
16
+
17
+ | Mode | Triggered by | Behavior on missing fields |
18
+ | ------------------- | ---------------------------------- | ----------------------------------------------------------------------- |
19
+ | **Interactive** | User invokes `pm *create-prd` | `reverse-ask` policy — pause and request from user / Analyst |
20
+ | **Pipeline (auto)** | `auto-requirements-pipeline` step 4 | Degrade `reverse-ask` to `placeholder` + write to `pipeline-status.json.blockers[]` |
21
+
22
+ Pipeline mode never blocks indefinitely on missing input — placeholders are tracked and surfaced by `step-08-finalize` as human-fixup tasks.
23
+
24
+ ---
25
+
26
+ ## 2. Upstream Artifact Catalog
27
+
28
+ Four artifact types feed PRD creation. Each is produced by a specific Analyst skill / workflow:
29
+
30
+ | Artifact | Producer skill | Default file pattern | Authoritative section reference |
31
+ | --------------------- | ------------------------------- | ------------------------------------------------------------- | -------------------------------------------- |
32
+ | **Product Brief** | `skill:xiaoma-create-product-brief` | `{planning_artifacts}/product-brief.md` or `*brief*.md` | step files: vision · users · metrics · scope |
33
+ | **Market Research** | `skill:xiaoma-market-research` | `{planning_artifacts}/research/market-*.md` | step files: customer-behavior · pain-points · decisions · competitive-analysis |
34
+ | **Domain Research** | `skill:xiaoma-domain-research` | `{planning_artifacts}/research/domain-*.md` | step files: domain-analysis · regulatory-focus · technical-trends |
35
+ | **Technical Research**| `skill:xiaoma-technical-research` | `{planning_artifacts}/research/technical-*.md` | step files: technical-overview · integration-patterns · architectural-patterns · implementation-research |
36
+
37
+ PM agent **must** load all four if present. Absence of a research file is acceptable — they are optional inputs. Absence of `product-brief.md` triggers `reverse-ask` (see §4).
38
+
39
+ ---
40
+
41
+ ## 3. Required Fields per Artifact
42
+
43
+ Each table lists the fields the PM agent extracts. `Source heading` is the H2/H3 the field was written under by the upstream workflow.
44
+
45
+ ### 3.1 Product Brief (`product-brief.md`)
46
+
47
+ | Field | Required | Source heading | Maps to PRD § | Missing-field strategy |
48
+ | ------------------------ | -------- | --------------------------- | -------------------- | ---------------------- |
49
+ | `vision_statement` | yes | `## Vision` | §1 Executive Summary | reverse-ask |
50
+ | `core_problem` | yes | `## Vision` (problem para) | §1 Executive Summary | reverse-ask |
51
+ | `target_personas` | yes | `## Target Users` | §1 + §4 Journeys | reverse-ask |
52
+ | `value_propositions` | yes | `## Vision` (value para) | §1 Executive Summary | reverse-ask |
53
+ | `success_metrics_draft` | yes | `## Success Metrics` | §2 Success Criteria | reverse-ask |
54
+ | `mvp_scope` | yes | `## Scope` (in-scope) | §3 Product Scope | reverse-ask |
55
+ | `out_of_scope` | partial | `## Scope` (out-of-scope) | §3 Product Scope | placeholder |
56
+ | `constraints` | optional | `## Scope` (constraints) | §3 Product Scope | skip |
57
+ | `differentiation` | partial | `## Vision` (diff para) | §1 + §6 Innovation | placeholder |
58
+
59
+ ### 3.2 Market Research (`market-*.md`)
60
+
61
+ | Field | Required | Source heading | Maps to PRD § | Missing-field strategy |
62
+ | ------------------------ | -------- | ----------------------------- | ----------------------- | ---------------------- |
63
+ | `customer_behavior` | partial | `## Customer Behavior` | §4 Journeys (context) | placeholder |
64
+ | `pain_points` | partial | `## Pain Points` | §1 + §4 + §8 (driver of FRs) | placeholder |
65
+ | `decision_factors` | partial | `## Customer Decisions` | §1 differentiation · §6 | placeholder |
66
+ | `competitive_analysis` | partial | `## Competitive Analysis` | §6 Innovation Analysis | placeholder |
67
+
68
+ If `competitive_analysis` is missing AND `domain_complexity` (from `domain-complexity.csv`) is `medium` or `high`, escalate to **reverse-ask** instead of placeholder — competitive context is load-bearing for the Innovation section in those domains.
69
+
70
+ ### 3.3 Domain Research (`domain-*.md`)
71
+
72
+ | Field | Required | Source heading | Maps to PRD § | Missing-field strategy |
73
+ | ------------------------ | -------- | ----------------------------- | ------------------------ | ---------------------- |
74
+ | `regulatory_landscape` | conditional | `## Regulatory Focus` | §5 Domain Requirements | `reverse-ask` if domain ∈ high-complexity (healthcare/fintech/govtech/aerospace/etc.); else skip |
75
+ | `domain_terminology` | partial | `## Domain Analysis` | §5 (terminology table) | placeholder |
76
+ | `technical_trends` | partial | `## Technical Trends` | §6 + §7 | skip |
77
+ | `competitive_landscape` | partial | `## Competitive Landscape` | §6 | skip (overlaps with market research) |
78
+
79
+ ### 3.4 Technical Research (`technical-*.md`)
80
+
81
+ | Field | Required | Source heading | Maps to PRD § | Missing-field strategy |
82
+ | ------------------------ | -------- | ----------------------------- | ------------------------- | ---------------------- |
83
+ | `technical_overview` | partial | `## Technical Overview` | §7 Project-Type Reqs | skip |
84
+ | `integration_patterns` | partial | `## Integration Patterns` | §7 + §9 NFR (integration latency) | skip |
85
+ | `architectural_constraints` | partial | `## Architectural Patterns` | §7 + §9 NFR scalability | skip |
86
+ | `implementation_options` | optional | `## Implementation Research` | informational only — **DO NOT** copy into PRD (implementation leakage AP-03) | skip |
87
+
88
+ **Important:** Technical research is the highest-risk source for AP-03 (implementation leakage). PM agent must extract NFR-shaping facts (latency, scale, integration) but **strip technology names, library choices, and concrete architecture decisions** before writing into the PRD.
89
+
90
+ ---
91
+
92
+ ## 4. Missing-Field Strategy
93
+
94
+ Three policies, escalated by severity:
95
+
96
+ ### 4.1 `reverse-ask` (interactive only)
97
+
98
+ - PRD workflow pauses at `step-01-init` (or wherever the missing field would be consumed)
99
+ - PM agent writes a clear request: "Need `<field>` from `<artifact>`. Source heading expected: `<heading>`. Continue from upstream Analyst (`/analyst *<command>`) or paste here."
100
+ - Output PRD frontmatter is not yet written; no placeholders are introduced
101
+ - **Pipeline override:** in `auto-requirements-pipeline`, this policy degrades to `placeholder` + a `blockers[]` entry, so the pipeline does not deadlock
102
+
103
+ ### 4.2 `placeholder`
104
+
105
+ - Insert literal `{{TBD: <field> from <artifact>}}` at the mapped PRD location
106
+ - Add an entry to PRD frontmatter: `tbds: [{field, artifact, suggested_command}]`
107
+ - `step-11-polish` is responsible for surfacing all unresolved `{{TBD: ...}}` markers and refusing to mark the PRD complete until they are resolved or explicitly waived
108
+ - In pipeline mode, `step-08-finalize` aggregates remaining TBDs into a human-fixup task list
109
+
110
+ ### 4.3 `skip`
111
+
112
+ - Field is treated as not required for this PRD
113
+ - PRD frontmatter `inputDocuments` entry adds `partial: [<field>]` so validation D04 (Brief Coverage) can still report it as a known gap, not silent omission
114
+
115
+ ---
116
+
117
+ ## 5. PRD-Section Reverse Index
118
+
119
+ A view of the same mapping organized by PRD section. Used by PM agent during `step-02c` through `step-10` — when authoring a section, read the corresponding row to know which upstream fields to consult.
120
+
121
+ | PRD § | Pulls from (artifact.field) | Merge rule |
122
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ |
123
+ | §1 Executive Summary | `brief.vision_statement`, `brief.core_problem`, `brief.target_personas`, `brief.value_propositions`, `brief.differentiation`, `market.pain_points` (context) | brief is authoritative; market provides supporting evidence; densify, don't concatenate |
124
+ | §2 Success Criteria | `brief.success_metrics_draft` | brief metrics are starting drafts; PM must add baseline + measurement + window if missing |
125
+ | §3 Product Scope | `brief.mvp_scope`, `brief.out_of_scope`, `brief.constraints` | brief is authoritative; PM may refine but not silently drop items |
126
+ | §4 User Journeys | `brief.target_personas`, `market.customer_behavior`, `market.pain_points` | brief defines personas; market provides journey context — synthesize, do not copy verbatim |
127
+ | §5 Domain Requirements | `domain.regulatory_landscape`, `domain.domain_terminology` + `domain-complexity.csv` | CSV defines required `special_sections`; domain research fills them; mark "N/A" if `general` low |
128
+ | §6 Innovation Analysis | `brief.differentiation`, `market.competitive_analysis`, `market.decision_factors` | combine for differentiation narrative; mark "N/A" only if no external competition |
129
+ | §7 Project-Type Requirements | `project-types.csv` + `technical.technical_overview`, `technical.integration_patterns`, `technical.architectural_constraints` | CSV defines `required_sections`; technical research informs but tech names are stripped (AP-03) |
130
+ | §8 Functional Requirements | derived from §1, §3, §4, §5, §7 — **not** from upstream artifacts directly | FRs synthesized in step-09; upstream feeds §1-§7, FRs trace back to those |
131
+ | §9 Non-Functional Requirements | `technical.architectural_constraints` (scale/latency facts), `domain.regulatory_landscape` (compliance NFRs) + `prd-purpose.md` NFR Industry Baselines | profile selected per §7 project type; baselines are defaults, upstream facts override |
132
+
133
+ ---
134
+
135
+ ## 6. Pipeline Integration Points
136
+
137
+ For `auto-requirements-pipeline/workflow.md`:
138
+
139
+ 1. **Step 1 init** — verify `req.md` exists (pipeline trigger doc) and at least one of `product-brief.md` exists. If neither, abort pipeline with a clear error.
140
+
141
+ 2. **Step 4 create-prd (delegation)** — before invoking `xiaoma-create-prd`:
142
+ - Run `validate_upstream_contract(inputDocuments)`:
143
+ - Iterate §3 tables; for each `required: yes` field, check existence in source heading
144
+ - Iterate `conditional` fields; check trigger condition then existence
145
+ - Output `{planning_artifacts}/contract-check.json`:
146
+ ```
147
+ {
148
+ "passed": false,
149
+ "missing_required": [{"artifact": "...", "field": "...", "expected_heading": "..."}],
150
+ "missing_conditional": [...],
151
+ "applied_policies": {"<field>": "placeholder|reverse-ask|skip"}
152
+ }
153
+ ```
154
+ - In pipeline mode, downgrade all `reverse-ask` to `placeholder` and append entries to `pipeline-status.json.blockers[]`. Continue.
155
+ - In interactive mode, if any required field missing, halt PRD creation and surface the request.
156
+
157
+ 3. **Step 5 validate-prd** — `step-v-04-brief-coverage-validation` reads `contract-check.json` as evidence:
158
+ - Pass if `missing_required.length == 0` and `tbds` resolved
159
+ - Partial if `missing_required.length == 0` and `tbds.length > 0` but ≤ 3
160
+ - Fail if `missing_required.length > 0` OR `tbds.length > 3`
161
+
162
+ ---
163
+
164
+ ## 7. Versioning and Updates
165
+
166
+ - This contract is versioned with `prd-purpose.md` (same milestone bumps).
167
+ - When upstream Analyst workflows change their step files (renaming a heading, adding/removing a step), the §3 tables here must be updated in the same PR. The validation refs `xiaoma-validate-prd/data/prd-quality-rubric.csv` D04 row references field names from §3 — keep in sync.
168
+ - Reference paths (file locations, step file names) tracked here are validated by `npm run validate:refs`.