@geraldmaron/construct 1.2.1 → 1.2.3

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 (208) hide show
  1. package/README.md +6 -6
  2. package/apps/chat/engine/ai-sdk-agent.mjs +183 -0
  3. package/apps/chat/engine/loop-driver.mjs +211 -0
  4. package/apps/chat/engine/models.mjs +122 -0
  5. package/apps/chat/engine/provider-adapters.mjs +171 -0
  6. package/apps/chat/engine/tools/permission.mjs +54 -0
  7. package/apps/chat/engine/tools/primitives.mjs +180 -0
  8. package/apps/chat/engine/tools/registry.mjs +122 -0
  9. package/apps/chat/engine/turn-controls.mjs +70 -0
  10. package/bin/construct +93 -79
  11. package/commands/plan/decide.md +1 -1
  12. package/commands/remember/runbook.md +1 -1
  13. package/examples/README.md +1 -1
  14. package/examples/distribution/README.md +1 -1
  15. package/examples/distribution/sources/adr.md +2 -2
  16. package/examples/distribution/sources/deck-one-pager.md +1 -1
  17. package/examples/distribution/sources/prd-platform.md +1 -1
  18. package/examples/distribution/sources/research-brief.md +2 -2
  19. package/examples/distribution/sources/rfc-platform.md +1 -1
  20. package/examples/distribution/sources/runbook.md +2 -2
  21. package/examples/distribution/sources/strategy.md +1 -1
  22. package/lib/agent-instructions/inject.mjs +1 -1
  23. package/lib/artifact-type-from-path.mjs +9 -5
  24. package/lib/audit-specialists.mjs +1 -1
  25. package/lib/audit-trail.mjs +3 -3
  26. package/lib/auto-docs.mjs +10 -10
  27. package/lib/bootstrap/built-ins.mjs +3 -3
  28. package/lib/boundary.mjs +3 -2
  29. package/lib/brand-prose.mjs +1 -1
  30. package/lib/cache-governor.js +4 -4
  31. package/lib/certification/document-io-fixtures.mjs +1 -1
  32. package/lib/chat/config.mjs +2 -2
  33. package/lib/chat/desktop-binary.mjs +5 -3
  34. package/lib/cli-commands.mjs +4 -6
  35. package/lib/cli-service-inventory.mjs +1 -1
  36. package/lib/comment-lint.mjs +9 -5
  37. package/lib/config/alias.mjs +3 -2
  38. package/lib/config/intake-policy.mjs +8 -78
  39. package/lib/config/legacy-config-migration.mjs +59 -0
  40. package/lib/config/project-config.mjs +95 -5
  41. package/lib/config/schema.mjs +9 -19
  42. package/lib/config/xdg.mjs +63 -0
  43. package/lib/contracts/violation-log.mjs +2 -2
  44. package/lib/cost-ledger.mjs +4 -3
  45. package/lib/cost.mjs +3 -2
  46. package/lib/decisions/registry.mjs +3 -3
  47. package/lib/distill.mjs +2 -2
  48. package/lib/docs-verify.mjs +2 -0
  49. package/lib/doctor/audit.mjs +4 -3
  50. package/lib/doctor/cli.mjs +0 -1
  51. package/lib/doctor/index.mjs +4 -4
  52. package/lib/doctor/report.mjs +3 -3
  53. package/lib/doctor/watchers/bd-watch.mjs +5 -5
  54. package/lib/doctor/watchers/cost.mjs +4 -4
  55. package/lib/doctor/watchers/disk.mjs +4 -3
  56. package/lib/doctor/watchers/service-health.mjs +5 -5
  57. package/lib/document-export.mjs +1 -1
  58. package/lib/document-extract.mjs +3 -3
  59. package/lib/document-ingest.mjs +13 -3
  60. package/lib/efficiency.mjs +2 -1
  61. package/lib/embed/approval-queue.mjs +3 -2
  62. package/lib/embed/cli.mjs +7 -5
  63. package/lib/embed/config.mjs +6 -5
  64. package/lib/embed/daemon.mjs +6 -5
  65. package/lib/embed/inbox-live-watcher.mjs +1 -1
  66. package/lib/embed/inbox.mjs +52 -37
  67. package/lib/embed/intake-metrics.mjs +3 -2
  68. package/lib/embed/reconcile.mjs +1 -1
  69. package/lib/embed/semantic.mjs +3 -2
  70. package/lib/embed/supervision.mjs +4 -2
  71. package/lib/engine/registry.mjs +3 -3
  72. package/lib/env-config.mjs +34 -12
  73. package/lib/features.mjs +4 -3
  74. package/lib/health-check.mjs +7 -6
  75. package/lib/hook-health.mjs +5 -4
  76. package/lib/hooks/_lib/log.mjs +4 -3
  77. package/lib/hooks/_lib/output-mode.mjs +2 -1
  78. package/lib/hooks/agent-tracker.mjs +3 -4
  79. package/lib/hooks/audit-reads.mjs +2 -2
  80. package/lib/hooks/audit-trail.mjs +2 -2
  81. package/lib/hooks/bash-output-logger.mjs +3 -3
  82. package/lib/hooks/brand-prose-lint.mjs +1 -1
  83. package/lib/hooks/ci-status-check.mjs +3 -2
  84. package/lib/hooks/context-watch.mjs +2 -2
  85. package/lib/hooks/context-window-recovery.mjs +5 -5
  86. package/lib/hooks/dep-audit.mjs +2 -2
  87. package/lib/hooks/doc-coupling-check.mjs +3 -2
  88. package/lib/hooks/edit-accumulator.mjs +3 -2
  89. package/lib/hooks/edit-guard.mjs +3 -3
  90. package/lib/hooks/guard-bash.mjs +2 -2
  91. package/lib/hooks/model-fallback.mjs +2 -1
  92. package/lib/hooks/policy-engine.mjs +4 -3
  93. package/lib/hooks/pre-compact.mjs +7 -7
  94. package/lib/hooks/readme-age-check.mjs +2 -2
  95. package/lib/hooks/session-optimize.mjs +4 -3
  96. package/lib/hooks/session-start.mjs +6 -5
  97. package/lib/hooks/stop-notify.mjs +9 -8
  98. package/lib/hooks/stop-typecheck.mjs +4 -3
  99. package/lib/hooks/test-watch.mjs +2 -2
  100. package/lib/host-disposition.mjs +1 -1
  101. package/lib/ingest/provider-extract.mjs +2 -1
  102. package/lib/init/detect-existing-structure.mjs +2 -2
  103. package/lib/init/doc-lanes.mjs +3 -10
  104. package/lib/init-docs.mjs +12 -54
  105. package/lib/init-unified.mjs +35 -81
  106. package/lib/init.mjs +7 -5
  107. package/lib/install/desktop-binary-download.mjs +5 -2
  108. package/lib/intake/daemon.mjs +31 -8
  109. package/lib/intake/intake-config.mjs +5 -32
  110. package/lib/integrations/intake-integrations.mjs +8 -7
  111. package/lib/knowledge/rag.mjs +2 -2
  112. package/lib/knowledge/search.mjs +15 -15
  113. package/lib/maintenance/cleanup.mjs +14 -10
  114. package/lib/mcp/server.mjs +1 -1
  115. package/lib/mcp/tools/project.mjs +2 -1
  116. package/lib/model-cheapest-provider.mjs +4 -3
  117. package/lib/model-pricing.mjs +3 -2
  118. package/lib/model-router.mjs +4 -3
  119. package/lib/models/catalog.mjs +2 -1
  120. package/lib/models/execution-capability-profile.mjs +2 -1
  121. package/lib/models/provider-poll.mjs +2 -1
  122. package/lib/ollama-manager.mjs +0 -1
  123. package/lib/op-log.mjs +2 -1
  124. package/lib/opencode-runtime-plugin.mjs +3 -2
  125. package/lib/oracle/artifact-gate.mjs +3 -0
  126. package/lib/oracle/cli.mjs +2 -1
  127. package/lib/oracle/execute.mjs +3 -2
  128. package/lib/oracle/index.mjs +2 -1
  129. package/lib/oracle/read-model.mjs +3 -2
  130. package/lib/performance/generate.mjs +4 -3
  131. package/lib/platforms/capabilities.mjs +1 -1
  132. package/lib/plugin-registry.mjs +2 -1
  133. package/lib/profiles/lifecycle.mjs +3 -3
  134. package/lib/project-profile.mjs +2 -1
  135. package/lib/project-root.mjs +9 -7
  136. package/lib/provider-capabilities.js +4 -3
  137. package/lib/providers/auth-manager.mjs +2 -1
  138. package/lib/providers/copilot-auth.mjs +3 -2
  139. package/lib/providers/creds.mjs +3 -2
  140. package/lib/providers/registry.mjs +3 -3
  141. package/lib/providers/secret-resolver.mjs +3 -2
  142. package/lib/read-tracker-store.mjs +2 -1
  143. package/lib/reconcile/mcp-entry-reconcile.mjs +2 -2
  144. package/lib/reflect.mjs +2 -1
  145. package/lib/registry/generate-docs.mjs +2 -2
  146. package/lib/roles/approval-surface.mjs +5 -4
  147. package/lib/roles/event-bus.mjs +0 -1
  148. package/lib/roles/gateway.mjs +6 -2
  149. package/lib/rules-delivery.mjs +1 -1
  150. package/lib/runtime-env.mjs +1 -1
  151. package/lib/runtime-pressure.mjs +5 -3
  152. package/lib/sandbox.mjs +3 -2
  153. package/lib/scheduler/solo.mjs +6 -4
  154. package/lib/server/auth.mjs +4 -3
  155. package/lib/server/index.mjs +24 -26
  156. package/lib/server/insights.mjs +5 -4
  157. package/lib/server/webhook.mjs +2 -1
  158. package/lib/service-manager.mjs +5 -3
  159. package/lib/setup.mjs +21 -11
  160. package/lib/status.mjs +6 -5
  161. package/lib/storage/embeddings-local.mjs +3 -2
  162. package/lib/storage/sync.mjs +2 -2
  163. package/lib/telemetry/client.mjs +0 -1
  164. package/lib/telemetry/intent-verifications.mjs +6 -6
  165. package/lib/telemetry/model-pricing-catalog.mjs +4 -3
  166. package/lib/telemetry/rule-calls.mjs +3 -3
  167. package/lib/telemetry/skill-calls.mjs +3 -3
  168. package/lib/template-registry.mjs +1 -0
  169. package/lib/templates/visual-requirements.mjs +1 -1
  170. package/lib/test-corpus-inventory.mjs +1 -1
  171. package/lib/uninstall/uninstall.mjs +12 -10
  172. package/package.json +4 -3
  173. package/platforms/claude/settings.template.json +43 -43
  174. package/rules/common/no-fabrication.md +1 -1
  175. package/rules/common/release-gates.md +1 -1
  176. package/rules/common/research.md +1 -1
  177. package/rules/common/review-before-change.md +1 -1
  178. package/scripts/sync-specialists.mjs +11 -8
  179. package/skills/docs/adr-workflow.md +3 -3
  180. package/skills/docs/init-docs.md +9 -9
  181. package/skills/docs/prd-workflow.md +5 -5
  182. package/skills/docs/product-intelligence-review.md +1 -1
  183. package/skills/docs/product-intelligence-workflow.md +2 -2
  184. package/skills/docs/product-signal-workflow.md +1 -1
  185. package/skills/docs/runbook-workflow.md +4 -4
  186. package/skills/exploration/unknown-codebase-onboarding.md +1 -1
  187. package/skills/operating/orchestration-reference.md +1 -1
  188. package/skills/routing.md +3 -3
  189. package/specialists/prompts/cx-architect.md +1 -1
  190. package/specialists/prompts/cx-docs-keeper.md +1 -1
  191. package/specialists/prompts/cx-researcher.md +1 -1
  192. package/specialists/prompts/cx-sre.md +1 -1
  193. package/specialists/role-manifests.json +6 -6
  194. package/templates/docs/README.md +125 -0
  195. package/templates/docs/construct_guide.md +3 -4
  196. package/templates/docs/persona-artifact.md +1 -1
  197. package/templates/docs/prds/README.md +25 -0
  198. package/templates/docs/prds/templates/_template.md +206 -0
  199. package/templates/docs/prds/templates/meta-prd.template.md +177 -0
  200. package/templates/docs/prds/templates/prd-business.template.md +61 -0
  201. package/templates/docs/prds/templates/prd-platform.template.md +81 -0
  202. package/templates/docs/prds/templates/prfaq.template.md +38 -0
  203. package/templates/docs/rfcs/README.md +22 -0
  204. package/templates/docs/rfcs/templates/_template.md +58 -0
  205. package/templates/docs/rfcs/templates/rfc-platform.template.md +72 -0
  206. package/templates/homebrew/construct.rb +1 -1
  207. package/templates/workflows/new-feature.yml +8 -8
  208. package/lib/intake/legacy-paths.mjs +0 -5
@@ -17,7 +17,7 @@ Construct is the underlying orchestration system for the **current project**. Tr
17
17
  The two task-shaped surfaces are siblings, not duplicates:
18
18
 
19
19
  - **`.cx/workflow.json`**: single project-wide workflow file. Holds the cross-cutting task ledger and intent / category metadata. Drives `workflow_status` and `project_context` MCP tools.
20
- - **`.cx/task-graphs/<id>.json`**: per-incoming-signal plan generated by `construct graph from-intake <intake-id>`. One graph per triaged inbox file, one node per persona in the recommendedChain, evidence records gating `done`. See [Concepts → Intake and triage](/concepts/intake-and-triage).
20
+ - **`.cx/task-graphs/<id>.json`**: per-incoming-signal plan generated by `construct graph from-intake <intake-id>`. One graph per triaged inbox file, one node per persona in the recommendedChain, evidence records gating `done`. See [Concepts → Intake and triage](/guides/concepts/intake-and-triage).
21
21
 
22
22
  A signal that becomes durable cross-session work crosses over: the graph nodes are executed, the resulting work is tracked in `.cx/workflow.json` and in beads. The intake queue and task graphs are how new signals enter the loop; the workflow ledger and beads are how durable work is carried.
23
23
 
package/skills/routing.md CHANGED
@@ -126,11 +126,11 @@ Read the matching skill file before responding when the user's request matches t
126
126
  | product intelligence, customer notes, field notes, product signals, customer profile, evidence brief, signal brief, backlog proposal | `skills/docs/product-intelligence-workflow.md` | Product Intelligence workflow: evidence to product artifacts |
127
127
  | strategy, product strategy, strategic bet, non-bet, north star, time horizon, competitive positioning | `skills/docs/strategy-workflow.md` | Product strategy: read, update, and reason about the strategy store |
128
128
  | ingest evidence, ingest customer notes, ingest Slack thread, ingest support ticket, normalize field notes | `skills/docs/evidence-ingest-workflow.md` | Evidence ingest workflow: raw source to .cx/knowledge/ |
129
- | write a PRD, create requirements, spec out, requirements document, Meta PRD, platform PRD | `skills/docs/prd-workflow.md` | PRD workflow: requirements to docs/prd/ or docs/meta-prd/ |
129
+ | write a PRD, create requirements, spec out, requirements document, Meta PRD, platform PRD | `skills/docs/prd-workflow.md` | PRD workflow: requirements to docs/specs/prd/ or docs/meta-prd/ |
130
130
  | write a PRFAQ, working backwards doc, press release FAQ | `skills/docs/prfaq-workflow.md` | PRFAQ workflow: launch narrative from PRD or evidence |
131
131
  | create Jira proposal, update Linear, backlog proposal, issue proposal | `skills/docs/backlog-proposal-workflow.md` | Backlog proposal workflow: approval-gated issue tracker changes |
132
- | record this decision, create an ADR, architecture decision | `skills/docs/adr-workflow.md` | ADR workflow: decision to docs/adr/ file |
133
- | write a runbook, document this operation, operational procedure | `skills/docs/runbook-workflow.md` | Runbook workflow: operation to docs/runbooks/ file |
132
+ | record this decision, create an ADR, architecture decision | `skills/docs/adr-workflow.md` | ADR workflow: decision to docs/decisions/adr/ file |
133
+ | write a runbook, document this operation, operational procedure | `skills/docs/runbook-workflow.md` | Runbook workflow: operation to docs/operations/runbooks/ file |
134
134
  | init project, new project setup, join project, set up doc structure | `skills/docs/init-project.md` | Project initialization via `construct init --docs-preset=*` |
135
135
 
136
136
  ## Routing Rules
@@ -61,7 +61,7 @@ DATA MODELS: schema with types, constraints, relationships, and migration plan
61
61
  DEPENDENCY GRAPH: modules and their directions; flag cycles
62
62
  TEST IMPACTS: what needs unit, integration, or E2E coverage
63
63
 
64
- Decision persistence: ask cx-docs-keeper to create or update `docs/adr/ADR-{NNN}-{slug}.md` and `.cx/decisions/{date}-{slug}.md`. If workspace writes aren't available, include the full DECISION rationale inline for docs-keeper to persist.
64
+ Decision persistence: ask cx-docs-keeper to create or update `docs/decisions/adr/ADR-{NNN}-{slug}.md` and `.cx/decisions/{date}-{slug}.md`. If workspace writes aren't available, include the full DECISION rationale inline for docs-keeper to persist.
65
65
 
66
66
  When producing an implementation plan, use the canonical task format:
67
67
  `### T{N}: {title}` sections with **Owner**, **Phase**, **Files**, **Depends on**, **Read first**, **Do not change**, and **Acceptance criteria** fields. This keeps `plan.md` and tracker-linked task slices explicit and preserves the single-writer boundary for each file.
@@ -72,7 +72,7 @@ Memory write-back: after updating docs, call `create_entities` or `add_observati
72
72
 
73
73
  Maintenance: keep `.cx/context.md` under 100 lines. Summarize and archive older entries. Check for documentation drift before work is declared complete.
74
74
 
75
- Doc structure: skills at skills/docs/ define the workflow for each doc type. Product Intelligence working artifacts live under .cx/knowledge/. Research: .cx/research/{slug}.md. ADRs: docs/adr/ADR-{NNN}-{slug}.md. PRDs: docs/prd/{date}-{slug}.md. Meta PRDs: docs/meta-prd/{date}-{slug}.md. Runbooks: docs/runbooks/{service}-{operation}.md. Always use the matching template as the starting structure.
75
+ Doc structure: skills at skills/docs/ define the workflow for each doc type. Product Intelligence working artifacts live under .cx/knowledge/. Research: .cx/research/{slug}.md. ADRs: docs/decisions/adr/ADR-{NNN}-{slug}.md. PRDs: docs/specs/prd/{date}-{slug}.md. Meta PRDs: docs/meta-prd/{date}-{slug}.md. Runbooks: docs/operations/runbooks/{service}-{operation}.md. Always use the matching template as the starting structure.
76
76
 
77
77
  ## Document Quality Loop (Evaluator-Optimizer)
78
78
 
@@ -68,7 +68,7 @@ When querying search engines or paper indexes, always filter or sort by date: ne
68
68
 
69
69
  ### Step 4: Check internal evidence
70
70
 
71
- Before going external, search: `.cx/research/`, `.cx/knowledge/`, `docs/prd/`, `docs/meta-prd/`, ADRs, runbooks, and ingested artifacts. If a prior research brief exists for the topic, cite and extend it rather than redoing the search from scratch.
71
+ Before going external, search: `.cx/research/`, `.cx/knowledge/`, `docs/specs/prd/`, `docs/meta-prd/`, ADRs, runbooks, and ingested artifacts. If a prior research brief exists for the topic, cite and extend it rather than redoing the search from scratch.
72
72
 
73
73
  ### Step 5: Verify every URL
74
74
 
@@ -100,7 +100,7 @@ Every alert MUST include:
100
100
  Alert: service_error_rate
101
101
  Trigger: error_rate > 1% for 5m
102
102
  Severity: critical
103
- Runbook: docs/runbooks/service-error-rate.md
103
+ Runbook: docs/operations/runbooks/service-error-rate.md
104
104
  Immediate Action: Check error logs, verify dependencies
105
105
  Escalation: On-call SRE → Service owner → Incident commander
106
106
  Rollback: If deployment-related, revert to last known good
@@ -6,7 +6,7 @@
6
6
  "events": ["push_gate.fail", "service.down", "mcp.unhealthy.persistent", "edit_loop.stuck"],
7
7
  "severityImmediate": ["service.down"],
8
8
  "fence": {
9
- "allowedPaths": ["docs/runbooks/**", "docs/incidents/**", "docs/postmortems/**"],
9
+ "allowedPaths": ["docs/operations/runbooks/**", "docs/runbooks/**", "docs/operations/incidents/**", "docs/incidents/**", "docs/postmortems/**"],
10
10
  "allowedBdLabels": ["incident", "sre", "reliability"],
11
11
  "allowedCommands": ["bd create", "bd note", "bd update", "bd link", "bd label"],
12
12
  "approvalRequired": ["commit", "push", "edit:lib/**", "edit:bin/**", "edit:specialists/**"]
@@ -86,7 +86,7 @@
86
86
  "events": ["handoff.received", "adr.requested", "arch.boundary.violated"],
87
87
  "severityImmediate": [],
88
88
  "fence": {
89
- "allowedPaths": ["docs/adr/**", "docs/rfc/**", "docs/concepts/architecture.md", "docs/system-design/**"],
89
+ "allowedPaths": ["docs/decisions/adr/**", "docs/adr/**", "docs/decisions/rfc/**", "docs/rfc/**", "docs/guides/concepts/architecture.md", "docs/concepts/architecture.md", "docs/system-design/**"],
90
90
  "allowedBdLabels": ["architecture", "adr", "rfc", "design"],
91
91
  "allowedCommands": ["bd create", "bd note", "bd update", "bd label"],
92
92
  "approvalRequired": ["commit", "push", "edit:lib/**", "edit:bin/**", "edit:specialists/**"]
@@ -112,7 +112,7 @@
112
112
  "events": ["handoff.received", "release.candidate", "version.bump.needed"],
113
113
  "severityImmediate": [],
114
114
  "fence": {
115
- "allowedPaths": ["docs/releases/**", "CHANGELOG.md"],
115
+ "allowedPaths": ["docs/operations/releases/**", "docs/releases/**", "CHANGELOG.md"],
116
116
  "allowedBdLabels": ["release", "version", "shipping"],
117
117
  "allowedCommands": ["bd create", "bd note", "bd update", "bd label"],
118
118
  "approvalRequired": ["commit", "push", "edit:package.json", "edit:lib/**", "edit:bin/**"]
@@ -125,7 +125,7 @@
125
125
  "events": ["handoff.received", "backlog.stale", "prd.requested"],
126
126
  "severityImmediate": [],
127
127
  "fence": {
128
- "allowedPaths": ["docs/prd/**", "docs/meta-prd/**", "docs/prfaq/**", "docs/one-pager/**", ".cx/knowledge/**"],
128
+ "allowedPaths": ["docs/specs/prd/**", "docs/prd/**", "docs/meta-prd/**", "docs/prfaq/**", "docs/one-pager/**", ".cx/knowledge/**"],
129
129
  "allowedBdLabels": ["product", "prd", "backlog", "feature"],
130
130
  "allowedCommands": ["bd create", "bd note", "bd update", "bd label", "bd priority"],
131
131
  "approvalRequired": ["commit", "push", "edit:lib/**", "edit:bin/**"]
@@ -197,7 +197,7 @@
197
197
  "events": ["handoff.received", "research.requested", "evidence.requested"],
198
198
  "severityImmediate": [],
199
199
  "fence": {
200
- "allowedPaths": ["docs/research/**", ".cx/research/**", "docs/evidence-briefs/**", "docs/signal-briefs/**"],
200
+ "allowedPaths": ["docs/notes/research/**", "docs/research/**", ".cx/research/**", "docs/evidence-briefs/**", "docs/signal-briefs/**"],
201
201
  "allowedBdLabels": ["research", "evidence", "investigation"],
202
202
  "allowedCommands": ["bd create", "bd note", "bd update", "bd label"],
203
203
  "approvalRequired": ["commit", "push", "edit:lib/**", "edit:bin/**"]
@@ -210,7 +210,7 @@
210
210
  "explorer": { "events": ["handoff.received"], "severityImmediate": [], "fence": { "allowedPaths": ["docs/explorations/**", ".cx/explorations/**"], "allowedBdLabels": ["exploration", "spike"], "allowedCommands": ["bd create", "bd note", "bd update"], "approvalRequired": ["commit", "push", "edit:**"] }, "outputs": { "bdLabels": ["exploration"], "docTypes": ["memo"] }, "handoffCandidates": ["engineer", "architect", "researcher"], "killSwitchEnv": "CONSTRUCT_ROLE_EXPLORER" },
211
211
  "operations": { "events": ["handoff.received"], "severityImmediate": [], "fence": { "allowedPaths": ["docs/ops/**", "docs/operations/**"], "allowedBdLabels": ["ops", "operations"], "allowedCommands": ["bd create", "bd note", "bd update"], "approvalRequired": ["commit", "push", "edit:**"] }, "outputs": { "bdLabels": ["ops"], "docTypes": ["memo", "runbook"] }, "handoffCandidates": ["sre", "platform-engineer", "release-manager"], "killSwitchEnv": "CONSTRUCT_ROLE_OPERATIONS" },
212
212
  "orchestrator": { "events": ["handoff.received"], "severityImmediate": [], "fence": { "allowedPaths": ["docs/**", "plan.md", ".cx/context.md"], "allowedBdLabels": ["orchestration", "workflow", "dispatch"], "allowedCommands": ["bd create", "bd note", "bd update", "bd label", "bd link"], "approvalRequired": ["commit", "push", "edit:lib/**", "edit:bin/**", "edit:specialists/**"] }, "outputs": { "bdLabels": ["orchestration", "dispatch"], "docTypes": ["memo"] }, "handoffCandidates": ["product-manager", "architect", "engineer", "security", "qa", "sre"], "killSwitchEnv": "CONSTRUCT_ROLE_ORCHESTRATOR" },
213
- "rd-lead": { "events": ["handoff.received"], "severityImmediate": [], "fence": { "allowedPaths": ["docs/research/**", "docs/experiments/**", ".cx/experiments/**"], "allowedBdLabels": ["rd", "research", "experiment"], "allowedCommands": ["bd create", "bd note", "bd update"], "approvalRequired": ["commit", "push", "edit:**"] }, "outputs": { "bdLabels": ["rd"], "docTypes": ["memo", "research-brief"] }, "handoffCandidates": ["researcher", "architect", "ai-engineer"], "killSwitchEnv": "CONSTRUCT_ROLE_RD_LEAD" },
213
+ "rd-lead": { "events": ["handoff.received"], "severityImmediate": [], "fence": { "allowedPaths": ["docs/notes/research/**", "docs/research/**", "docs/experiments/**", ".cx/experiments/**"], "allowedBdLabels": ["rd", "research", "experiment"], "allowedCommands": ["bd create", "bd note", "bd update"], "approvalRequired": ["commit", "push", "edit:**"] }, "outputs": { "bdLabels": ["rd"], "docTypes": ["memo", "research-brief"] }, "handoffCandidates": ["researcher", "architect", "ai-engineer"], "killSwitchEnv": "CONSTRUCT_ROLE_RD_LEAD" },
214
214
  "legal-compliance": { "events": ["handoff.received"], "severityImmediate": [], "fence": { "allowedPaths": ["docs/legal/**", "docs/compliance/**", "docs/security/**", ".cx/knowledge/**"], "allowedBdLabels": ["legal", "compliance", "privacy"], "allowedCommands": ["bd create", "bd note", "bd update"], "approvalRequired": ["commit", "push", "edit:**"] }, "outputs": { "bdLabels": ["legal", "compliance"], "docTypes": ["memo"] }, "handoffCandidates": ["security", "product-manager"], "killSwitchEnv": "CONSTRUCT_ROLE_LEGAL_COMPLIANCE" },
215
215
  "devil-advocate": { "events": ["handoff.received"], "severityImmediate": [], "fence": { "allowedPaths": ["docs/critiques/**"], "allowedBdLabels": ["critique", "devil-advocate"], "allowedCommands": ["bd create", "bd note", "bd update"], "approvalRequired": ["commit", "push", "edit:**"] }, "outputs": { "bdLabels": ["critique"], "docTypes": ["memo"] }, "handoffCandidates": ["architect", "product-manager", "engineer"], "killSwitchEnv": "CONSTRUCT_ROLE_DEVIL_ADVOCATE" }
216
216
  }
@@ -0,0 +1,125 @@
1
+ # Doc Templates & Role Anti-Patterns
2
+
3
+ See `../prompt-surfaces.md` for the canonical public-vs-internal prompt surface model. This document covers only templates and internal role overlays.
4
+
5
+ Construct specialists produce standard documents (PRDs, ADRs, runbooks, memos, etc.) from shared templates, and they self-check against shared role anti-patterns. Both can be overridden per-project.
6
+
7
+ ## Templates
8
+
9
+ Shipped templates live in [`templates/docs/`](../../templates/docs/):
10
+
11
+ | Layer | Path | Purpose |
12
+ |---|---|---|
13
+ | Specialist source | `templates/docs/{name}.md` | Canonical shape for `get_template()` MCP |
14
+ | Init lane starters | `docs/{lane}/templates/` | Copied into downstream projects by `construct init --docs-preset=*` |
15
+ | Project override | `.cx/templates/docs/{name}.md` | Per-project template override at fetch time |
16
+
17
+ Do not duplicate starters at `docs/{lane}/_template.md` — lane READMEs link only to `./templates/`.
18
+
19
+ | Template | Produced by | Purpose |
20
+ |---|---|---|
21
+ | `prd.md` | cx-product-manager | Product requirements doc |
22
+ | `meta-prd.md` | cx-product-manager, cx-docs-keeper | Requirements for product operating systems, agent workflows, document standards, and evaluation loops |
23
+ | `prfaq.md` | cx-product-manager, cx-business-strategist | Working-backwards press release and FAQ |
24
+ | `evidence-brief.md` | cx-product-manager, cx-ux-researcher, cx-researcher | Product evidence synthesis before decisions |
25
+ | `signal-brief.md` | cx-product-manager, cx-researcher | Weak or emerging product signal preservation |
26
+ | `customer-profile.md` | cx-product-manager, cx-docs-keeper | Durable customer/account product memory |
27
+ | `product-intelligence-report.md` | cx-product-manager, cx-business-strategist | Cross-source product intelligence synthesis |
28
+ | `backlog-proposal.md` | cx-product-manager | Approval-gated external tracker proposal |
29
+ | `memo.md` | cx-business-strategist | Strategy memo (~1 page) |
30
+ | `one-pager.md` | cx-product-manager, cx-business-strategist | Executive one-pager |
31
+ | `adr.md` | cx-architect, cx-rd-lead | Architecture decision record |
32
+ | `research-brief.md` | cx-researcher, cx-ux-researcher, cx-explorer | Research findings |
33
+ | `runbook.md` | cx-sre, cx-operations | Operational runbook |
34
+ | `incident-report.md` | cx-sre, cx-operations, cx-release-manager | Post-mortem |
35
+
36
+ ### How specialists use them
37
+
38
+ Each specialist prompt points to the template via an MCP call:
39
+
40
+ ```markdown
41
+ **Template**: call `get_template("prd")` when drafting a product PRD, or `get_template("meta-prd")` when drafting a Meta PRD, ...
42
+ ```
43
+
44
+ The `get_template(name)` MCP tool (see [`lib/mcp/server.mjs`](../../lib/mcp/server.mjs)) resolves:
45
+
46
+ 1. `.cx/templates/docs/{name}.md`: **project override** (preferred if present)
47
+ 2. `templates/docs/{name}.md`: **shipped default** (fallback)
48
+
49
+ Use `list_templates` to see both shipped and overridden names.
50
+
51
+ ### Overriding a template
52
+
53
+ Drop a file at `.cx/templates/docs/{name}.md` inside your project. That's it: next time a specialist drafts that doc type, they'll pick up your version. No sync, no restart.
54
+
55
+ Example: reshape the PRD to lead with success metrics:
56
+
57
+ ```bash
58
+ mkdir -p .cx/templates/docs
59
+ cp templates/docs/prd.md .cx/templates/docs/prd.md
60
+ # edit .cx/templates/docs/prd.md to your shape
61
+ ```
62
+
63
+ Ask Construct for a PRD; it'll follow the new shape.
64
+
65
+ ## Role Anti-Patterns
66
+
67
+ Each specialist is cognitively rooted in a **role** (product-manager, engineer, architect, etc.) with a core set of failure modes to avoid. Flavored specialists extend the core with an overlay.
68
+
69
+ Core roles live in [`skills/roles/`](../../skills/roles/):
70
+
71
+ | Core role | Flavors | Applied to |
72
+ |---|---|---|
73
+ | `engineer` | `engineer.ai`, `engineer.data`, `engineer.platform` | cx-engineer, cx-ai-engineer, cx-data-engineer, cx-platform-engineer |
74
+ | `reviewer` | `reviewer.devil-advocate`, `reviewer.evaluator`, `reviewer.trace` | cx-reviewer, cx-devil-advocate, cx-evaluator, cx-trace-reviewer |
75
+ | `researcher` | `researcher.ux`, `researcher.explorer` | cx-researcher, cx-ux-researcher, cx-explorer |
76
+ | `operator` | `operator.sre`, `operator.release`, `operator.docs` | cx-sre, cx-release-manager, cx-operations, cx-docs-keeper |
77
+ | `product-manager` | `product-manager.product`, `product-manager.platform`, `product-manager.enterprise`, `product-manager.ai-product`, `product-manager.growth`, `product-manager.business-strategy` | cx-product-manager, cx-business-strategist |
78
+ | `designer` | `designer.accessibility` | cx-designer, cx-accessibility |
79
+ | `security` | `security.legal-compliance` | cx-security, cx-legal-compliance |
80
+ | `qa` | `qa.test-automation` | cx-qa, cx-test-automation |
81
+ | `architect` |: | cx-architect, cx-rd-lead |
82
+ | `debugger` |: | cx-debugger |
83
+ | `data-analyst` |: | cx-data-analyst |
84
+ | `orchestrator` |: | cx-orchestrator |
85
+
86
+ ### How they're loaded
87
+
88
+ Unlike templates, role anti-patterns are **inlined at sync time** (not fetched at runtime). The specialist source prompt carries a marker:
89
+
90
+ ```markdown
91
+ **Anti-patterns**: call `get_skill("roles/engineer.ai")` before drafting.
92
+ ```
93
+
94
+ `construct sync` (via [`lib/role-preload.mjs`](../../lib/role-preload.mjs)) replaces that line with the full core role body + flavor overlay under `## Role anti-patterns`. The content is always present in the final platform prompt: no runtime dependency, no chance for the model to skip the pre-work.
95
+
96
+ ### Editing or adding roles
97
+
98
+ - **Edit a role**: change the file under `skills/roles/`, then run `construct sync` to propagate to all platforms.
99
+ - **Add a flavor**: create `skills/roles/{core}.{flavor}.md` with YAML frontmatter:
100
+ ```yaml
101
+ ---
102
+ role: {core}.{flavor}
103
+ applies_to: [cx-...]
104
+ inherits: {core}
105
+ version: 1
106
+ ---
107
+ ```
108
+ Update the corresponding `cx-*.md` source prompt to reference the new flavor name, then `construct sync`.
109
+ - **No project-level override for roles** today: roles are platform-wide and curated. If you need per-project role overrides, open a request.
110
+
111
+ ## Verification
112
+
113
+ After editing either surface, run:
114
+
115
+ ```bash
116
+ npm test # tests/agent-prompts.test.mjs covers both
117
+ node scripts/sync-agents.mjs # regenerate platform adapters
118
+ construct doctor # health check
119
+ ```
120
+
121
+ Spot-check propagation:
122
+
123
+ ```bash
124
+ grep -l "## Role anti-patterns" ~/.claude/agents/cx-*.md
125
+ ```
@@ -33,11 +33,10 @@ Generated tooling (`.construct/`, `.claude/`, `.cx/`, `plan.md`) is gitignored;
33
33
 
34
34
  ## Where to drop information you want Construct to use
35
35
 
36
- Three intake paths, ordered by formality:
36
+ Two intake paths, ordered by formality:
37
37
 
38
- 1. **`.cx/inbox/`** — drop a file here (URL, screenshot, paste, anything). The embed daemon watches the directory; when a file lands, it ingests it into the local knowledge base within a second or two and writes a triage packet to `.cx/intake/pending/` describing the new content, its classification (intake type, stage, owner persona, recommended chain), its suggested docs lane, and existing docs that overlap. The agent surfaces pending items at the next session start and you can ask it to process them.
39
- 2. **`docs/intake/`** for proper intake batches (research notes, evidence from a meeting, raw source material). Has a template. Survives in git history.
40
- 3. **`AGENTS.md`**: for rules and conventions you want the agent to follow every time. "We prefer functional components. Don't introduce new dependencies without flagging." Read at session start.
38
+ 1. **`inbox/`** — the single canonical drop zone. Drop a file here (URL, screenshot, paste, anything). The embed daemon watches the directory; when a file lands, it ingests it into the local knowledge base within a second or two and writes a triage packet to `.cx/intake/pending/` describing the new content, its classification (intake type, stage, owner persona, recommended chain), its suggested docs lane, and existing docs that overlap. The agent surfaces pending items at the next session start and you can ask it to process them. For large or slowly-written files, stage under `inbox/.staging/` and rename in so the watcher never sees a half-written file.
39
+ 2. **`AGENTS.md`**: for rules and conventions you want the agent to follow every time. "We prefer functional components. Don't introduce new dependencies without flagging." Read at session start.
41
40
 
42
41
  For URLs or quick notes, the easiest path is to drop a file into `~/Downloads` and run:
43
42
 
@@ -1,6 +1,6 @@
1
1
  # <Role display name>
2
2
 
3
- > Anchor doc for the <role-id> persona. Methodology: `docs/concepts/persona-research.md`. This file is generated by `construct profile create` and is part of the discover + frame phases. The persona is not promotable until every section below is filled from evidence, not opinion.
3
+ > Anchor doc for the <role-id> persona. Methodology: `docs/guides/concepts/persona-research.md`. This file is generated by `construct profile create` and is part of the discover + frame phases. The persona is not promotable until every section below is filled from evidence, not opinion.
4
4
 
5
5
  ## Goals
6
6
 
@@ -0,0 +1,25 @@
1
+ ---
2
+ cx_doc_id: 019ddb68-5aeb-7c30-9c7e-0d994ab6c06b
3
+ created_at: "2026-04-29T22:42:22.571Z"
4
+ updated_at: "2026-04-29T22:42:22.572Z"
5
+ generator: construct/init-docs
6
+ body_hash: "sha256:64607fda2fa55def5dd8af0e31f88cf190f68841da0223b45f0d36db83221669"
7
+ ---
8
+ <!--
9
+ templates/docs/prds/README.md: lane guide for PRDs.
10
+
11
+ Generated from the Construct documentation lane templates. Keep this lane focused on one document
12
+ family. If it no longer has a distinct purpose, prune it or merge it elsewhere.
13
+ -->
14
+
15
+ # PRDs
16
+
17
+ Product and capability requirement documents.
18
+
19
+ ## Starter templates
20
+
21
+ - [_template.md](./templates/_template.md)
22
+ - [meta-prd.template.md](./templates/meta-prd.template.md)
23
+ - [prd-business.template.md](./templates/prd-business.template.md)
24
+ - [prd-platform.template.md](./templates/prd-platform.template.md)
25
+ - [prfaq.template.md](./templates/prfaq.template.md)
@@ -0,0 +1,206 @@
1
+ # PRD: {title}
2
+
3
+ - **Date**: {YYYY-MM-DD}
4
+ - **Owner**: {name}
5
+ - **Status**: draft | in-review | approved | shipped | deprecated
6
+
7
+ <!--
8
+ Use this for a product capability, user workflow, or customer-facing requirement set.
9
+ Use meta-prd.md instead when defining the requirements for a product system, agent,
10
+ process, template, evaluation loop, or operating model.
11
+
12
+ Before drafting, read rules/common/framing.md.
13
+
14
+ Owning specialist: cx-product-manager (see rules/common/doc-ownership.md).
15
+ Construct must route PRD authoring to cx-product-manager rather than drafting directly.
16
+ doing so is how requirements traceability, user grounding, and external research fire.
17
+
18
+ Write with a balance of short paragraphs, tables, and bullets. Bullets are for scans,
19
+ not the whole document. Keep em dashes rare; prefer commas, periods, or parentheses.
20
+ -->
21
+
22
+ ## Summary
23
+ <!--
24
+ One paragraph (3-5 sentences) that a busy reader can use as the whole PRD.
25
+ What the change is, who it's for, why now, and what changes when it ships.
26
+ No solutions in this section that aren't decided. No ticket IDs. No team names.
27
+ -->
28
+
29
+ ## Background
30
+ <!--
31
+ Context the reader needs to evaluate this PRD without asking around.
32
+ Include relevant prior work (linked PRDs, ADRs, RFCs), observed signals, and
33
+ the current state of the user experience or system. State what is already
34
+ true today so the reader can compare against the proposed change.
35
+
36
+ Cite evidence: support tickets, interviews, telemetry, sales calls, research.
37
+ Avoid roadmap-speak ("this is a Q3 priority"); state what is happening to users.
38
+ -->
39
+
40
+ ## Problem
41
+ <!--
42
+ The specific user or business outcome that is currently blocked. One or two
43
+ paragraphs. State the pain, not the solution.
44
+
45
+ Must NOT reference:
46
+ - Jira / Linear ticket IDs or "this came from ticket X"
47
+ - Roadmap items, OKR line items, or quarterly goals
48
+ - "The team decided we should build this"
49
+
50
+ Must reference:
51
+ - Observed user behavior, quantitative signals, or qualitative evidence
52
+ - The specific outcome that is not currently achievable
53
+ - The constraint that makes this non-trivial today
54
+ -->
55
+
56
+ ## Goals
57
+ <!--
58
+ What success looks like, in outcome terms. Three to five goals max. Each
59
+ goal is the *change* you want, not the activity. Order by importance.
60
+
61
+ Examples:
62
+ - Reduce p95 onboarding time from 12m to under 4m for new accounts.
63
+ - Eliminate the manual reconciliation step our top 20 customers do every Monday.
64
+ - Halve the support volume for "where is my data" questions.
65
+ -->
66
+
67
+ ## Outcome
68
+ <!--
69
+ What is concretely different for users, the business, or the system once this
70
+ ships and is adopted. This is the observable end state: written from the
71
+ user's perspective when possible. The acceptance criteria below should be the
72
+ falsifiable evidence that this outcome was achieved.
73
+
74
+ A reader should be able to compare the current state (Background) to this
75
+ section and see the delta in plain language.
76
+ -->
77
+
78
+ ## User flow
79
+
80
+ ```mermaid
81
+ flowchart TD
82
+ A[User starts] --> B{Current friction?}
83
+ B -->|Yes| C[Proposed path]
84
+ B -->|No| D[Existing path]
85
+ C --> E[Success outcome]
86
+ D --> E
87
+ ```
88
+
89
+ ## In scope and out of scope
90
+
91
+ | | Description |
92
+ |---|---|
93
+ | **In scope** | <what this PRD covers and commits to ship> |
94
+ | **Out of scope** | <related work explicitly deferred: name the reason> |
95
+ | **Adjacent (deferred)** | <work that's a natural follow-up but not in this PRD> |
96
+
97
+ <!--
98
+ Be specific. "Authentication" is too vague; "OAuth login for the web dashboard,
99
+ not for the CLI" is right. The Out of scope list is a tool for protecting
100
+ schedule and reviewer attention: use it.
101
+ -->
102
+
103
+ ## Phases
104
+
105
+ <!--
106
+ Phases are how this work ships, not how it's organized internally. Each phase
107
+ is independently shippable and provides observable user value (or a clearly
108
+ defined platform capability). Avoid "phase 1: backend, phase 2: frontend".
109
+ that's a task list, not a phasing.
110
+
111
+ Each phase below holds its own goal, status, functional requirements (FR),
112
+ and non-functional requirements (NFR), with acceptance criteria written
113
+ inline next to each requirement. Use `FR-<phase>.<n>` and `NFR-<phase>.<n>`
114
+ so requirements can be referenced from reviews and tests.
115
+
116
+ Status values: not started | in progress | shipped | deferred.
117
+
118
+ NFR categories to consider: performance, reliability, security, privacy,
119
+ accessibility, observability, compliance, cost. Numeric targets where possible.
120
+ -->
121
+
122
+ ### Phase 1: <name>
123
+
124
+ - **Goal**: <what this phase delivers>
125
+ - **Status**: not started
126
+
127
+ **Functional**
128
+
129
+ - **FR-1.1**: <imperative statement of what the system must do>
130
+ - *Acceptance*: <observable, falsifiable condition a reviewer can check without asking the author>
131
+ - **FR-1.2**: <...>
132
+ - *Acceptance*: <...>
133
+
134
+ **Non-functional**
135
+
136
+ - **NFR-1.1**: <category>: <target with number>
137
+ - *Acceptance*: <how this is measured and what counts as pass>
138
+
139
+ ### Phase 2: <name>
140
+
141
+ - **Goal**: <what this phase delivers>
142
+ - **Status**: not started
143
+
144
+ **Functional**
145
+
146
+ - **FR-2.1**: <...>
147
+ - *Acceptance*: <...>
148
+ - **FR-2.2**: <...>
149
+ - *Acceptance*: <...>
150
+
151
+ **Non-functional**
152
+
153
+ - **NFR-2.1**: <category>: <target>
154
+ - *Acceptance*: <...>
155
+
156
+ ### Phase 3: <name>
157
+
158
+ - **Goal**: <what this phase delivers>
159
+ - **Status**: not started
160
+
161
+ **Functional**
162
+
163
+ - **FR-3.1**: <...>
164
+ - *Acceptance*: <...>
165
+
166
+ **Non-functional**
167
+
168
+ - **NFR-3.1**: <category>: <target>
169
+ - *Acceptance*: <...>
170
+
171
+ ## Success metrics
172
+ <!--
173
+ How we will know this worked in production over time, beyond the per-requirement
174
+ acceptance criteria. Leading vs. lagging. Avoid vanity metrics.
175
+ -->
176
+
177
+ | Metric | Baseline | Target |
178
+ |---|---|---|
179
+ | {name} | {current} | {goal} |
180
+
181
+ ## Constraints
182
+ <!--
183
+ Budget, timeline, platform, team, legal, technical debt: anything that shapes
184
+ the solution and isn't a requirement.
185
+ -->
186
+
187
+ ## Dependencies
188
+ <!--
189
+ Teams, services, contracts, data sources, vendor timelines. Each dependency
190
+ should name an owner and the date it must be ready by.
191
+ -->
192
+
193
+ ## Risks and mitigations
194
+
195
+ | Risk | Likelihood | Impact | Mitigation |
196
+ |---|---|---|---|
197
+ | <risk> | low / med / high | low / med / high | <how this is reduced or what we accept> |
198
+
199
+ ## Open questions
200
+
201
+ | Question | Owner | Decision needed by |
202
+ |---|---|---|
203
+ | <unknown> | <name> | <YYYY-MM-DD> |
204
+
205
+ ## References
206
+ <!-- Linked research, prior PRDs, ADRs, tickets, designs. -->