@geraldmaron/construct 1.0.3 → 1.0.4

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 (75) hide show
  1. package/README.md +4 -4
  2. package/agents/prompts/cx-ai-engineer.md +6 -26
  3. package/agents/prompts/cx-architect.md +1 -0
  4. package/agents/prompts/cx-business-strategist.md +2 -0
  5. package/agents/prompts/cx-data-analyst.md +6 -26
  6. package/agents/prompts/cx-docs-keeper.md +1 -31
  7. package/agents/prompts/cx-explorer.md +1 -0
  8. package/agents/prompts/cx-orchestrator.md +40 -112
  9. package/agents/prompts/cx-platform-engineer.md +2 -22
  10. package/agents/prompts/cx-product-manager.md +2 -1
  11. package/agents/prompts/cx-qa.md +0 -20
  12. package/agents/prompts/cx-rd-lead.md +2 -0
  13. package/agents/prompts/cx-researcher.md +77 -31
  14. package/agents/prompts/cx-security.md +11 -49
  15. package/agents/prompts/cx-sre.md +9 -43
  16. package/agents/prompts/cx-ux-researcher.md +1 -0
  17. package/agents/role-manifests.json +4 -4
  18. package/bin/construct +23 -0
  19. package/db/schema/004_recommendations.sql +46 -0
  20. package/db/schema/005_strategy.sql +21 -0
  21. package/lib/auto-docs.mjs +1 -2
  22. package/lib/beads-automation.mjs +16 -7
  23. package/lib/cli-commands.mjs +8 -2
  24. package/lib/embed/conflict-detection.mjs +26 -9
  25. package/lib/embed/customer-profiles.mjs +37 -17
  26. package/lib/embed/daemon.mjs +10 -8
  27. package/lib/embed/recommendation-store.mjs +213 -14
  28. package/lib/embed/workspaces.mjs +53 -18
  29. package/lib/gates-audit.mjs +3 -3
  30. package/lib/health-check.mjs +1 -1
  31. package/lib/hooks/pre-compact.mjs +3 -0
  32. package/lib/hooks/read-tracker.mjs +10 -101
  33. package/lib/host-capabilities.mjs +90 -1
  34. package/lib/init-update.mjs +246 -131
  35. package/lib/intent-classifier.mjs +1 -0
  36. package/lib/knowledge/layout.mjs +10 -0
  37. package/lib/mcp/tools/telemetry.mjs +30 -78
  38. package/lib/model-router.mjs +61 -1
  39. package/lib/ollama-manager.mjs +1 -1
  40. package/lib/opencode-telemetry.mjs +4 -5
  41. package/lib/orchestration-policy.mjs +9 -0
  42. package/lib/parity.mjs +124 -21
  43. package/lib/prompt-composer.js +106 -29
  44. package/lib/read-tracker-store.mjs +149 -0
  45. package/lib/server/index.mjs +76 -0
  46. package/lib/server/telemetry-login.mjs +17 -25
  47. package/lib/service-manager.mjs +30 -22
  48. package/lib/services/local-postgres.mjs +15 -0
  49. package/lib/services/telemetry-backend.mjs +1 -2
  50. package/lib/setup.mjs +8 -43
  51. package/lib/status.mjs +51 -5
  52. package/lib/storage/backend.mjs +12 -2
  53. package/lib/strategy-store.mjs +371 -0
  54. package/lib/telemetry/backends/local.mjs +6 -4
  55. package/lib/telemetry/client.mjs +185 -0
  56. package/lib/telemetry/ingest.mjs +13 -5
  57. package/lib/telemetry/team-rollup.mjs +9 -2
  58. package/lib/worker/trace.mjs +17 -27
  59. package/package.json +5 -2
  60. package/rules/common/research.md +44 -12
  61. package/skills/docs/backlog-proposal-workflow.md +2 -2
  62. package/skills/docs/customer-profile-workflow.md +1 -1
  63. package/skills/docs/evidence-ingest-workflow.md +5 -5
  64. package/skills/docs/prfaq-workflow.md +1 -1
  65. package/skills/docs/product-intelligence-review.md +1 -1
  66. package/skills/docs/product-intelligence-workflow.md +3 -3
  67. package/skills/docs/product-signal-workflow.md +48 -18
  68. package/skills/docs/research-workflow.md +26 -14
  69. package/skills/docs/strategy-workflow.md +36 -0
  70. package/skills/roles/data-analyst.product-intelligence.md +1 -1
  71. package/skills/roles/researcher.md +28 -15
  72. package/skills/routing.md +8 -1
  73. package/templates/docs/research-brief.md +63 -9
  74. package/templates/docs/strategy.md +36 -0
  75. package/templates/homebrew/construct.rb +6 -6
@@ -7,16 +7,11 @@
7
7
  *
8
8
  * 1. `.cx/traces/<YYYY-MM-DD>.jsonl` — append-only local JSONL. Always on,
9
9
  * no credentials required. Tail live, archive, or replay.
10
- * 2. Remote telemetry backendfire-and-forget batched ingest when
11
- * CONSTRUCT_TELEMETRY_PUBLIC_KEY + CONSTRUCT_TELEMETRY_SECRET_KEY are
12
- * configured and CONSTRUCT_TRACE_BACKEND is `remote` (or unset).
13
- * Each unique traceId triggers one trace-create plus an event-create
14
- * per emitted event. Failures never throw — observability must not
10
+ * 2. Optional remote exportselected by CONSTRUCT_TRACE_BACKEND. Each
11
+ * unique traceId triggers one trace-create plus an event-create per
12
+ * emitted event. Failures never throw because observability must not
15
13
  * break the caller.
16
14
  *
17
- * Reads CONSTRUCT_TELEMETRY_PUBLIC_KEY / CONSTRUCT_TELEMETRY_SECRET_KEY /
18
- * CONSTRUCT_TELEMETRY_URL from env.
19
- *
20
15
  * Event types in current use:
21
16
  * intake.received — daemon ingested a file
22
17
  * intake.triaged — classifyRdIntake produced a triage block
@@ -35,7 +30,7 @@ import { existsSync, mkdirSync, appendFileSync } from 'node:fs';
35
30
  import { randomBytes } from 'node:crypto';
36
31
  import path from 'node:path';
37
32
 
38
- import { createIngestClient } from '../telemetry/ingest.mjs';
33
+ import { createTelemetryClient } from '../telemetry/client.mjs';
39
34
 
40
35
  const TRACE_SUBDIR = '.cx/traces';
41
36
 
@@ -73,23 +68,18 @@ export function newSpanId() {
73
68
  return `span-${randomBytes(6).toString('hex')}`;
74
69
  }
75
70
 
76
- // Reused per-process. The ingest client batches; recreating it would lose
77
- // the queue. `available` flips false when keys aren't set, which is the
78
- // graceful no-op path for solo-mode users without no telemetry backend configured.
71
+ // Reused per-process. The adapter batches remote export; recreating it would
72
+ // lose the queue. Local JSONL is already written by emitTraceEvent, so this
73
+ // client disables its own local writer.
79
74
  let telemetryClient = null;
80
75
  const seenTraces = new Set();
81
76
 
82
- function getTelemetryClient(env = process.env) {
77
+ function getTelemetryClient(env = process.env, rootDir) {
83
78
  if (telemetryClient !== null) return telemetryClient;
84
- const backend = (env.CONSTRUCT_TRACE_BACKEND || 'remote').toLowerCase();
85
- if (backend === 'none' || backend === 'off' || backend === 'local') {
86
- telemetryClient = { available: false, trace: () => {}, event: () => {} };
87
- return telemetryClient;
88
- }
89
- telemetryClient = createIngestClient({
90
- baseUrl: (env.CONSTRUCT_TELEMETRY_URL ?? '').replace(/\/$/, ''),
91
- publicKey: env.CONSTRUCT_TELEMETRY_PUBLIC_KEY,
92
- secretKey: env.CONSTRUCT_TELEMETRY_SECRET_KEY,
79
+ telemetryClient = createTelemetryClient({
80
+ env,
81
+ rootDir,
82
+ localWrites: false,
93
83
  });
94
84
  return telemetryClient;
95
85
  }
@@ -103,9 +93,9 @@ export function _resetTelemetryClient() {
103
93
  }
104
94
 
105
95
 
106
- function exportToRemote(event, env) {
107
- const client = getTelemetryClient(env);
108
- if (!client.available) return;
96
+ function exportToRemote(event, env, rootDir) {
97
+ const client = getTelemetryClient(env, rootDir);
98
+ if (!client.remoteAvailable) return;
109
99
 
110
100
  // First time we see a traceId, register the trace so subsequent events
111
101
  // attach to a known parent.
@@ -176,7 +166,7 @@ export function emitTraceEvent({
176
166
  };
177
167
  appendFileSync(path.join(dir, `${todayShard()}.jsonl`), `${JSON.stringify(event)}\n`, 'utf8');
178
168
 
179
- // Fire-and-forget export to remote telemetry backend. Silent no-op when not configured.
180
- exportToRemote(event, env);
169
+ // Fire-and-forget export to the configured remote adapter. Silent no-op when not configured.
170
+ exportToRemote(event, env, rootDir);
181
171
  return event;
182
172
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geraldmaron/construct",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "type": "module",
5
5
  "description": "Construct — agent orchestration layer for OpenCode, Claude Code, and other coding surfaces",
6
6
  "bin": {
@@ -51,6 +51,8 @@
51
51
  "lint:templates": "node scripts/lint-commits-pr.mjs",
52
52
  "eval:routing": "node scripts/eval/score-intent-classifier.mjs",
53
53
  "release:check": "node ./bin/construct doctor && npm test && node ./bin/construct docs:update --check && node ./bin/construct dashboard:sync --check && node ./bin/construct lint:comments && node scripts/lint-commits-pr.mjs",
54
+ "release:preflight": "node scripts/pre-release-check.mjs",
55
+ "release:preflight:no-auth": "node scripts/pre-release-check.mjs --skip-auth",
54
56
  "npm:publish": "npm run release:check && npm publish --access public",
55
57
  "postinstall": "node ./bin/construct-postinstall.mjs"
56
58
  },
@@ -61,6 +63,7 @@
61
63
  "postgres": "^3.4.9"
62
64
  },
63
65
  "overrides": {
64
- "express-rate-limit": "8.5.1"
66
+ "express-rate-limit": "8.5.1",
67
+ "protobufjs": "^8.4.2"
65
68
  }
66
69
  }
@@ -10,7 +10,31 @@ that depends on external facts or evolving internal evidence.
10
10
 
11
11
  Construct treats research as a reproducible evidence-gathering process, not free-form browsing. If a claim could change decisions, scope, architecture, or roadmap, it must be tied to verifiable evidence.
12
12
 
13
- ## 1. Start order
13
+ ## 1. Recency discipline
14
+
15
+ Research always starts from the most recent available evidence.
16
+
17
+ - Default to sources from the current year before earlier years — always search most-recent-first.
18
+ - For fast-moving topics (AI tools, LLM behavior, cloud APIs, security advisories, market data), treat anything older than 12 months as presumptively stale unless a newer source confirms it is still accurate.
19
+ - When using a search engine or index, always filter or sort by date — do not rely on relevance ranking alone.
20
+ - State the publication or access date for every external source. If a source has no date, treat its confidence as `low` until recency is established another way.
21
+
22
+ ## 2. Domain-specific starting points
23
+
24
+ Use the narrowest, most authoritative starting point for the research domain:
25
+
26
+ | Domain | Starting points (most recent first) |
27
+ |---|---|
28
+ | AI tools, LLM behavior, multi-agent | arXiv (cs.AI, cs.SE, cs.CL), ACL Anthology, NeurIPS/ICML/ICLR proceedings, then vendor research blogs |
29
+ | Developer tools, IDE, editor | Stack Overflow Developer Survey (current year), JetBrains Developer Survey, GitHub/Copilot blog, then product changelogs |
30
+ | Security, CVEs, supply chain | NVD, GitHub Security Advisories, OWASP, vendor security blogs (Google Project Zero, Microsoft Security Response), then ProjectDiscovery/Snyk reports |
31
+ | Market data, adoption, ARR | Primary company announcements or SEC filings, then TechCrunch/Bloomberg/WSJ (where citing company sources), then analyst reports |
32
+ | Cloud infra, APIs, SDKs | Official vendor docs for the exact version, changelog, migration guides |
33
+ | Regulatory, compliance, privacy | Primary regulation text, then official guidance from the issuing authority, then law firm analysis |
34
+
35
+ Tertiary sources (blogs, forums, Q&A, AI-generated summaries) may help locate primaries. They are not sufficient evidence for load-bearing claims.
36
+
37
+ ## 3. Start order
14
38
 
15
39
  Start with the narrowest authoritative source that can answer the question:
16
40
 
@@ -28,9 +52,7 @@ Start with the narrowest authoritative source that can answer the question:
28
52
  4. **Tertiary sources last**
29
53
  - blogs, forums, Q&A, analyst summaries, AI-generated summaries
30
54
 
31
- Tertiary sources may help discover primary sources. They are not sufficient evidence for load-bearing claims.
32
-
33
- ## 2. Required metadata for every source
55
+ ## 4. Required metadata for every source
34
56
 
35
57
  Record:
36
58
 
@@ -40,9 +62,16 @@ Record:
40
62
  - publication date, release date, or access date
41
63
  - why this source is relevant
42
64
 
43
- If a source has no date and the topic is time-sensitive, treat confidence as reduced until recency is established another way.
65
+ ## 5. URL verification
66
+
67
+ Every URL cited in a committed document must be verified before the document is published.
68
+
69
+ - Fetch the URL. Confirm it resolves and the content matches the cited claim.
70
+ - Do not cite aggregate or index pages (e.g., arxiv.org search results, Google Scholar listings) for quantitative claims — cite the specific paper or article URL.
71
+ - If a URL returns a 404, paywall, or redirect loop, find the canonical source or replace the citation.
72
+ - Unverified URLs must be marked `[unverified]` until confirmed.
44
73
 
45
- ## 3. Verification rules
74
+ ## 6. Verification rules
46
75
 
47
76
  For each load-bearing claim:
48
77
 
@@ -54,7 +83,7 @@ For each load-bearing claim:
54
83
 
55
84
  Claims about versions, APIs, security, pricing, compatibility, regulations, and timelines must cite the exact version/date basis.
56
85
 
57
- ## 4. Reproducibility
86
+ ## 7. Reproducibility
58
87
 
59
88
  Research must be reproducible by another person in the repo.
60
89
 
@@ -67,7 +96,7 @@ Record:
67
96
 
68
97
  If you cannot explain how the answer was obtained, the research is incomplete.
69
98
 
70
- ## 5. Evidence thresholds
99
+ ## 8. Evidence thresholds
71
100
 
72
101
  Recommendations must state what evidence threshold was used.
73
102
 
@@ -81,27 +110,30 @@ Examples:
81
110
 
82
111
  If the threshold is not met, the output should recommend more research, a weaker artifact, or a narrower decision.
83
112
 
84
- ## 6. Output standard
113
+ ## 9. Output standard
85
114
 
86
115
  Research outputs should include:
87
116
 
88
117
  - question
89
118
  - method
90
- - sources
119
+ - sources (with dates and classes)
91
120
  - findings
92
121
  - confidence
93
122
  - open questions
94
123
  - recommendation or next step
95
124
 
96
- Every substantive finding should point to a source path, URL, or document reference.
125
+ Every substantive finding should point to a verified source path, URL, or document reference.
97
126
 
98
- ## 7. Anti-patterns
127
+ ## 10. Anti-patterns
99
128
 
100
129
  Do not:
101
130
 
131
+ - start research from older years when more-recent sources are available
102
132
  - stop at the first plausible answer
103
133
  - cite a blog when the spec or source code is available
134
+ - cite an aggregate or index page when the specific document is available
104
135
  - present inference as if the source said it directly
105
136
  - ignore conflicting evidence
106
137
  - use stale undated material for fast-moving topics without saying so
107
138
  - promote weak product evidence into committed requirements
139
+ - include URLs that have not been fetched and confirmed
@@ -8,8 +8,8 @@ Use when: product evidence should create or update Jira, Linear, GitHub Issues,
8
8
  ## Steps
9
9
 
10
10
  1. Load source evidence, evidence brief, PRD, or signal brief.
11
- 2. Search existing tracker context if an MCP is configured; otherwise search local docs and product-intel artifacts.
12
- 3. Create `.cx/product-intel/backlog-proposals/{date}-{slug}.md` with `get_template("backlog-proposal")`.
11
+ 2. Search existing tracker context if an MCP is configured; otherwise search local docs and knowledge artifacts.
12
+ 3. Create `.cx/knowledge/internal/backlog-proposals/{date}-{slug}.md` with `get_template("backlog-proposal")`.
13
13
  4. Include duplicate/conflict analysis and exact proposed writes.
14
14
  5. Return `NEEDS_MAIN_INPUT` for approval before any external write.
15
15
  6. After approval, apply changes and update the proposal's application log.
@@ -7,7 +7,7 @@ Use when: customer evidence should update durable product memory.
7
7
 
8
8
  ## Steps
9
9
 
10
- 1. Load the existing customer profile from `.cx/product-intel/customer-profiles/` if present.
10
+ 1. Load the existing customer profile from `.cx/knowledge/internal/customer-profiles/` if present.
11
11
  2. Read the new source evidence.
12
12
  3. Add new facts, asks, pain points, contacts, product areas, and evidence links.
13
13
  4. Preserve historical entries. Do not delete or rewrite prior history without explicit approval.
@@ -1,5 +1,5 @@
1
1
  <!--
2
- skills/docs/evidence-ingest-workflow.md — Normalize raw product evidence into Construct product-intel artifacts.
2
+ skills/docs/evidence-ingest-workflow.md — Normalize raw product evidence into Construct knowledge artifacts.
3
3
  -->
4
4
  # Evidence Ingest Workflow
5
5
 
@@ -11,9 +11,9 @@ Follow [rules/common/research.md](../../rules/common/research.md) for source met
11
11
 
12
12
  1. Identify the source type and date.
13
13
  2. Extract source metadata: customer, actor, product area, channel, linked issue, and confidence.
14
- 3. Save raw or lightly normalized source material under `.cx/product-intel/sources/`.
15
- 4. If customer-specific, update or create `.cx/product-intel/customer-profiles/{customer}.md` using `get_template("customer-profile")`.
16
- 5. Create `.cx/product-intel/evidence-briefs/{date}-{slug}.md` using `get_template("evidence-brief")` when the evidence supports a product decision.
14
+ 3. Save raw or lightly normalized source material under `.cx/knowledge/internal/sources/`.
15
+ 4. If customer-specific, update or create `.cx/knowledge/internal/customer-profiles/{customer}.md` using `get_template("customer-profile")`.
16
+ 5. Create `.cx/knowledge/internal/evidence-briefs/{date}-{slug}.md` using `get_template("evidence-brief")` when the evidence supports a product decision.
17
17
  6. If evidence is weak but worth preserving, create a signal brief with `get_template("signal-brief")`.
18
18
 
19
19
  ## Rules
@@ -29,4 +29,4 @@ Always preserve:
29
29
 
30
30
  ## Storage
31
31
 
32
- Files in `.cx/product-intel/` are indexed by Construct's hybrid retrieval path. Postgres stores them as `product-intel` documents during sync, and the vector layer makes them semantically retrievable for future PRDs and Meta PRDs.
32
+ Files in `.cx/knowledge/` are indexed by Construct's hybrid retrieval path. The vector layer makes them semantically retrievable for future PRDs and Meta PRDs.
@@ -18,7 +18,7 @@ Use when: the user asks for a PRFAQ, working-backwards doc, launch narrative, or
18
18
  4. Write the press release in shipped-state language.
19
19
  5. Write external FAQ for customers and internal FAQ for engineering, sales, support, security, finance, and leadership.
20
20
  6. Include unknowns as `TBD` with what would resolve them.
21
- 7. Save to `.cx/product-intel/prfaqs/` until approved.
21
+ 7. Save to `.cx/knowledge/internal/prfaqs/` until approved.
22
22
 
23
23
  ## Approval
24
24
 
@@ -14,7 +14,7 @@ Score each dimension as pass, warning, or fail:
14
14
  - Acceptance criteria: observable and pass/fail.
15
15
  - Scope discipline: goals, non-goals, and tradeoffs are explicit.
16
16
  - Approval safety: external writes and approved status are gated.
17
- - Storage readiness: artifact path is under `.cx/product-intel/`, `docs/prd/`, or `docs/meta-prd/` so hybrid retrieval can index it.
17
+ - Storage readiness: artifact path is under `.cx/knowledge/`, `docs/prd/`, or `docs/meta-prd/` so hybrid retrieval can index it.
18
18
  - Readability: balanced paragraphs, tables, and bullets. Few em dashes.
19
19
 
20
20
  ## Output
@@ -14,7 +14,7 @@ Follow [rules/common/research.md](../../rules/common/research.md) for source ord
14
14
 
15
15
  Product Intelligence is a Construct-native loop:
16
16
 
17
- 1. Capture evidence into `.cx/product-intel/sources/` or link existing sources.
17
+ 1. Capture evidence into `.cx/knowledge/internal/sources/` or link existing sources.
18
18
  2. Normalize evidence into field notes, customer profiles, and evidence briefs.
19
19
  3. Synthesize themes, asks, pain points, product areas, and confidence.
20
20
  4. Select the PM flavor: product, platform, enterprise, ai-product, or growth.
@@ -53,9 +53,9 @@ Load the core product-manager role guidance and the selected overlay before draf
53
53
 
54
54
  ## Storage
55
55
 
56
- Write working artifacts under `.cx/product-intel/` unless they are docs of record. Approved PRDs live in `docs/prd/`; approved Meta PRDs live in `docs/meta-prd/`.
56
+ Write working artifacts under `.cx/knowledge/` unless they are docs of record. Approved PRDs live in `docs/prd/`; approved Meta PRDs live in `docs/meta-prd/`.
57
57
 
58
- The hybrid storage layer indexes `.cx/product-intel/`, `docs/prd/`, and `docs/meta-prd/`. When Postgres is configured, `construct storage sync` can persist these artifacts into shared SQL rows. The vector layer scores the same documents for local, remote, or file-backed semantic retrieval.
58
+ The hybrid storage layer indexes `.cx/knowledge/`, `docs/prd/`, and `docs/meta-prd/`. When Postgres is configured, `construct storage sync` can persist these artifacts into shared SQL rows. The vector layer scores the same documents for local, remote, or file-backed semantic retrieval.
59
59
 
60
60
  ## Approval boundaries
61
61
 
@@ -1,31 +1,61 @@
1
1
  <!--
2
- skills/docs/product-signal-workflow.md — Synthesize product signals from evidence.
2
+ skills/docs/product-signal-workflow.md — Synthesize product signals from evidence into the right artifact.
3
+ Confidence rubric, contradiction resolution, artifact decision tree, and storage are all defined here.
4
+ Follow rules/common/research.md for source-handling policy.
3
5
  -->
4
6
  # Product Signal Workflow
5
7
 
6
8
  Use when: the user asks what customers are asking for, what themes are emerging, whether evidence is strong enough, or what should become a PRD.
7
9
 
8
- Follow [rules/common/research.md](../../rules/common/research.md) for confidence, contradictions, and source handling.
10
+ ## Confidence Rubric
9
11
 
10
- ## Steps
12
+ | Level | Criteria |
13
+ |---|---|
14
+ | **high** | ≥ 3 independent customers mention the same problem verbatim, OR 1 enterprise blocker with revenue at risk named |
15
+ | **medium** | 2 independent customers, OR 1 customer with high frequency (≥ 3 mentions), OR corroborated by a competitor signal |
16
+ | **low** | 1 customer mention, OR internal opinion without user observation, OR inferred from adjacent evidence |
17
+
18
+ ## Contradiction Resolution
11
19
 
12
- 1. Gather relevant evidence briefs, customer profiles, notes, tickets, research, and product docs.
13
- 2. Group evidence into themes, asks, pain points, affected personas, product areas, and counter-signals.
14
- 3. Assign confidence: high, medium, or low.
15
- 4. Choose the next artifact:
16
- - signal brief for weak or early evidence
17
- - evidence brief for decision-ready synthesis
18
- - PRD or PRFAQ for strong customer-facing product demand
19
- - Meta PRD for operating-system or process changes
20
- - backlog proposal for tracker changes after approval
21
- 5. Store synthesis in `.cx/product-intel/signals/` or `.cx/product-intel/evidence-briefs/`.
20
+ When two signals conflict:
21
+ 1. Name both signals explicitly do not average them away.
22
+ 2. Weight by customer tier (enterprise > growth > SMB) and recency (weight decays after 90 days).
23
+ 3. Record the contradiction in the signal brief as an open question.
24
+ 4. Never let a minority signal disappear it may be the leading indicator.
22
25
 
23
- ## Evidence threshold
26
+ ## Artifact Decision Tree
24
27
 
25
- Default threshold for PRD-ready evidence: at least two independent customers, three independent mentions, one severe enterprise blocker, or a clear strategic mandate with named risk. If the threshold is not met, write a signal brief instead of inventing requirements.
28
+ | Condition | Artifact |
29
+ |---|---|
30
+ | < 2 independent sources OR < medium confidence | signal brief |
31
+ | ≥ 2 independent sources AND ≥ medium confidence AND no strategic mandate yet | evidence brief |
32
+ | ≥ 3 sources OR 1 enterprise blocker OR PM has declared this a bet | PRD |
33
+ | PRD is approved AND launch narrative needed | PRFAQ |
34
+ | Subject is an internal process, agent workflow, or governance mechanism | Meta PRD |
35
+ | Artifact is approved AND needs a tracker item | backlog proposal (requires approval gate) |
26
36
 
27
- ## Quality bar
37
+ ## Strategy Check
28
38
 
29
- Separate asks from requirements. Separate observation from inference. Name what evidence would change the recommendation.
39
+ After grouping evidence, check `.cx/knowledge/decisions/strategy/` for any declared strategy documents:
40
+ - Signal aligns with a declared Bet → raise priority, note alignment explicitly.
41
+ - Signal conflicts with a declared Non-bet → flag the conflict; the user must make an explicit override decision before proceeding.
42
+ - No strategy documents exist → continue without blocking; note that strategy grounding is not available.
43
+
44
+ ## Steps
30
45
 
31
- When a claim depends on time-sensitive or external information, include the date or version basis. If evidence conflicts, state the counter-signal explicitly instead of averaging it away.
46
+ 1. **Gather** collect evidence briefs, customer profiles, field notes, tickets, and research from `.cx/knowledge/` and linked sources.
47
+ 2. **Group** — cluster by theme, ask, pain point, affected persona, product area, and counter-signal.
48
+ 3. **Assign confidence** — apply the rubric above; separate observation from inference.
49
+ 4. **Check strategy** — check `.cx/knowledge/decisions/strategy/`; flag alignment or conflict with Bets and Non-bets if documents exist.
50
+ 5. **Select artifact** — apply the decision tree; write the artifact; store to the path below.
51
+
52
+ ## Storage
53
+
54
+ | Artifact | Path |
55
+ |---|---|
56
+ | Signal brief | `.cx/knowledge/internal/signals/` |
57
+ | Evidence brief | `.cx/knowledge/internal/evidence-briefs/` |
58
+ | PRD | `docs/prd/` |
59
+ | PRFAQ | `docs/prfaq/` |
60
+ | Meta PRD | `docs/meta-prd/` |
61
+ | Backlog proposal | pending approval gate — do not file until explicit user approval |
@@ -12,25 +12,37 @@ Follow [rules/common/research.md](../../rules/common/research.md) as the default
12
12
  ## Steps
13
13
 
14
14
  1. **Clarify the question** — one specific, falsifiable question the research must answer.
15
- 2. **Check internal evidence first** — search `.cx/research/`, `.cx/product-intel/`, `docs/prd/`, `docs/meta-prd/`, ADRs, runbooks, and ingested artifacts before going external.
16
- 3. **Choose the research path**:
17
- - Library/API/framework/version questions primary vendor docs, source code, changelogs, exact-version references
18
- - Market, competitive, policy, or general evidence → cx-researcher using primary sources first
19
- 4. **Use a source hierarchy**:
20
- - Primary: official docs, exact-version API references, standards, source code
21
- - Secondary: changelogs, migration guides, maintainer issue comments
22
- - Tertiary: blogs/forums/Q&A only to locate primaries
23
- 5. **Structure findings** using the template from `get_template("research-brief")` resolves `.cx/templates/docs/research-brief.md` (override) then `templates/docs/research-brief.md` (shipped)
24
- 6. **Write to `.cx/research/{topic-slug}.md`** cx-docs-keeper owns this
25
- 7. **Reference the research doc** in the requesting agent's output (link by path)
15
+ 2. **Apply recency discipline** — always search from the most recent year backward. For fast-moving domains (AI tools, security, market data), treat anything older than 12 months as presumptively stale unless a newer source confirms it is still accurate.
16
+ 3. **Check internal evidence first** — search `.cx/research/`, `.cx/knowledge/`, `docs/prd/`, `docs/meta-prd/`, ADRs, runbooks, and ingested artifacts before going external.
17
+ 4. **Choose the research path and starting point** by domain:
18
+
19
+ | Domain | Authoritative starting points |
20
+ |---|---|
21
+ | AI tools / LLM behavior / multi-agent | arXiv (cs.AI, cs.SE, cs.CL), ACL Anthology, conference proceedings (NeurIPS, ICML, ICLR, HICSS) |
22
+ | Developer tools / IDE / adoption | Stack Overflow Developer Survey, JetBrains Developer Ecosystem Report, GitHub blog, editor changelogs |
23
+ | Security / CVEs / supply chain | NVD, GitHub Security Advisories, OWASP, vendor security blogs (Google Project Zero, Microsoft Security), ProjectDiscovery |
24
+ | Market data / ARR / adoption | Primary company announcements, SEC filings, then TechCrunch/Bloomberg citing company sources |
25
+ | Cloud / API / SDK / version | Official vendor docs for exact version, changelog, migration guide |
26
+ | Regulatory / compliance / privacy | Primary regulation text, then official agency guidance |
27
+
28
+ 5. **Use a source hierarchy**:
29
+ - Primary: official docs, exact-version API references, standards, source code, peer-reviewed papers
30
+ - Secondary: changelogs, migration guides, maintainer issue comments, release notes
31
+ - Tertiary: blogs/forums/Q&A only to locate primaries — never cite tertiary alone for a load-bearing claim
32
+ 6. **Verify every URL** — fetch each URL cited and confirm it resolves and matches the cited claim. Mark unconfirmed URLs as `[unverified]`.
33
+ 7. **Structure findings** using the template from `get_template("research-brief")` — resolves `.cx/templates/docs/research-brief.md` (override) then `templates/docs/research-brief.md` (shipped)
34
+ 8. **Write to `.cx/research/{topic-slug}.md`** — cx-docs-keeper owns this
35
+ 9. **Reference the research doc** in the requesting agent's output (link by path)
26
36
 
27
37
  ## Verification bar
28
38
 
29
- - Every load-bearing claim must cite a source path, URL, or document reference.
30
- - Record publication date, version, or access date for each source.
31
- - Separate observation from inference.
39
+ - Every load-bearing claim must cite a verified source path, URL, or document reference.
40
+ - Record publication date, version, or access date for each source. If no date is available, state `[undated]` and treat confidence as `low`.
41
+ - Fetch and confirm every URL before including it in a committed document.
42
+ - Separate observation from inference — label each finding's confidence as `high`, `medium`, or `low`.
32
43
  - Name contradictions and unresolved gaps.
33
44
  - Prefer two independent sources per load-bearing claim unless one authoritative primary source is sufficient.
45
+ - State the strongest counter-evidence when one exists.
34
46
 
35
47
  ## File naming
36
48
  - Topic slug: lowercase, hyphens, no spaces — e.g., `firebase-auth-v9-migration.md`
@@ -0,0 +1,36 @@
1
+ <!--
2
+ skills/docs/strategy-workflow.md — Read, update, and reason about the product strategy.
3
+ Canonical store: ~/.cx/strategy.md (user-global) or .cx/strategy.md (project-local, committed).
4
+ Template: templates/docs/strategy.md.
5
+ -->
6
+ # Strategy Workflow
7
+
8
+ Use when: the user asks about product direction, strategic bets, what to prioritize, whether a signal aligns with strategy, or wants to update the strategy.
9
+
10
+ ## Reading Strategy
11
+
12
+ 1. Read `~/.cx/strategy.md` (or project-local `.cx/strategy.md`).
13
+ 2. If the file does not exist, inform the user and offer to create it using `templates/docs/strategy.md`.
14
+ 3. Parse sections: Vision, Bets, Non-bets, Time Horizon, North Star Metric, Competitive Positioning.
15
+
16
+ ## Checking Signal Alignment
17
+
18
+ Given a product signal or PRD, check:
19
+ - Does the signal target a declared Bet? → flag as strategically aligned.
20
+ - Does the signal conflict with a Non-bet? → flag the conflict; the user must make an explicit override decision.
21
+ - Does the signal address the Time Horizon goal? → note this in the signal brief.
22
+
23
+ ## Updating Strategy
24
+
25
+ 1. Show the user the current section being updated.
26
+ 2. Propose the change with rationale.
27
+ 3. Write the updated section and increment the `updated` date.
28
+ 4. If a Bet is being added, check for conflicting Non-bets and surface them.
29
+ 5. Strategy changes are always approved by the user before writing.
30
+
31
+ ## Storage
32
+
33
+ | Scope | Path | Committed? |
34
+ |---|---|---|
35
+ | User-global | `~/.cx/strategy.md` | No — local only |
36
+ | Project-local | `.cx/strategy.md` | Yes — source of truth for this repo |
@@ -28,7 +28,7 @@ Additional failure modes on top of the data-analyst core.
28
28
  ### 3. Evidence store ignored
29
29
  **Symptom**: new briefs are written without checking prior Product Intelligence artifacts.
30
30
  **Why it fails**: teams rediscover the same signal and lose longitudinal context.
31
- **Counter-move**: query `.cx/product-intel`, `docs/prd`, and `docs/meta-prd` through hybrid search before drafting.
31
+ **Counter-move**: query `.cx/knowledge`, `docs/prd`, and `docs/meta-prd` through hybrid search before drafting.
32
32
 
33
33
  ## Self-check before shipping
34
34
  - [ ] Evidence count, confidence, and counter-evidence are explicit
@@ -27,42 +27,55 @@ Load this before drafting. These are the failure modes that separate strong role
27
27
  **Counter-move**: require at least two independent sources for each load-bearing claim. Note when they disagree.
28
28
 
29
29
  ### 3. Freshness blindness
30
- **Symptom**: cited source dated 2019 used as current for a fast-moving topic — AI capabilities, framework APIs, security advisories.
30
+ **Symptom**: cited source dated 2019–2024 used as current for a fast-moving topic — AI capabilities, framework APIs, security advisories.
31
31
  **Why it fails**: the reader assumes the finding is current; acts on stale information.
32
- **Counter-move**: check and record the publication date of every source. For fast-moving topics, prefer sources within the last 12 months.
32
+ **Counter-move**: start searches from the most recent year and step backward only if insufficient. Record the publication date of every source. For fast-moving topics (LLM behavior, security advisories, market data), treat anything older than 12 months as presumptively stale unless a newer source confirms it is still accurate.
33
33
 
34
- ### 4. Findings without confidence
34
+ ### 4. Wrong starting point
35
+ **Symptom**: searching Google or a general index when a domain-specific authoritative source exists — arXiv for AI research, NVD for CVEs, NeurIPS/ICML proceedings for ML, official vendor docs for APIs.
36
+ **Why it fails**: general search returns popularity-ranked results, not authority-ranked ones. The most-cited blog post is not the same as the primary paper.
37
+ **Counter-move**: use the domain's authoritative starting point first (see `rules/common/research.md` §2). Only fall back to general search if the authoritative source is insufficient.
38
+
39
+ ### 5. Unverified URLs
40
+ **Symptom**: URLs included in the brief have not been fetched — the researcher copied them from a search result or from memory.
41
+ **Why it fails**: URLs rot. A confident citation pointing to a 404 or a different page than intended is worse than no citation.
42
+ **Counter-move**: fetch every URL before including it. Confirm the content matches the cited claim. Mark any URL that cannot be fetched `[unverified]` and flag it as a gap.
43
+
44
+ ### 6. Findings without confidence
35
45
  **Symptom**: all findings presented flatly, with no distinction between what is well-established and what is speculative.
36
46
  **Why it fails**: the reader cannot decide how much weight to place on each claim.
37
47
  **Counter-move**: label each finding high / medium / low confidence, with a one-line reason.
38
48
 
39
- ### 5. Observation confused with inference
49
+ ### 7. Observation confused with inference
40
50
  **Symptom**: the doc presents what the author concluded as what the source said.
41
51
  **Why it fails**: the conclusion cannot be audited. Reviewers who disagree cannot find the step where the logic turned.
42
52
  **Counter-move**: separate "what the source said" from "what I infer from this". Label them.
43
53
 
44
- ### 6. Secondary sources passed as primary
54
+ ### 8. Secondary sources passed as primary
45
55
  **Symptom**: citations point to summaries, listicles, or syntheses instead of the underlying paper, spec, or changelog.
46
56
  **Why it fails**: the summary may misrepresent the primary source. The chain of error is invisible.
47
57
  **Counter-move**: cite primary sources — the actual paper, spec, commit, or dataset. Use secondary sources only to discover primary ones.
48
58
 
49
- ### 7. Scope creep
59
+ ### 9. Scope creep
50
60
  **Symptom**: the research question was about X but the brief covers X, Y, and Z because they came up.
51
61
  **Why it fails**: the original question does not get answered well; reviewers cannot tell which findings are load-bearing.
52
62
  **Counter-move**: answer the original question first and completely. Tangential findings go into a separate section or a follow-up.
53
63
 
54
- ### 8. Action without evidence threshold
64
+ ### 10. Action without evidence threshold
55
65
  **Symptom**: the implications section recommends a change without stating what evidence would have led to a different recommendation.
56
66
  **Why it fails**: the research is unfalsifiable. Any finding leads to the same recommendation.
57
67
  **Counter-move**: state up-front what evidence would cause the recommendation to flip. Verify the actual evidence meets the threshold.
58
68
 
59
69
  ## Self-check before shipping
60
70
 
61
- - [ ] Strongest counter-finding is named and addressed
62
- - [ ] Each load-bearing claim has at least two independent sources
63
- - [ ] Source dates recorded; fast-moving topics use recent sources
64
- - [ ] Each finding labeled with confidence and reason
65
- - [ ] Observation separated from inference
66
- - [ ] Citations point to primary sources
67
- - [ ] Original question is answered first; tangents are separate
68
- - [ ] Evidence threshold for the recommendation is stated
71
+ - [ ] Started search from the most recent year and stepped back only when insufficient
72
+ - [ ] Used domain-specific authoritative starting point (see `rules/common/research.md` §2), not general search as default
73
+ - [ ] Every URL fetched and confirmed to match the cited claim
74
+ - [ ] Strongest counter-finding named and addressed
75
+ - [ ] Each load-bearing claim has at least two independent sources (or one authoritative primary)
76
+ - [ ] Source dates recorded; fast-moving topics use sources within last 12 months
77
+ - [ ] Each finding labeled with confidence (high/medium/low) and one-line reason
78
+ - [ ] Observation separated from inference labeled differently
79
+ - [ ] Citations point to primary sources, not summaries or index pages
80
+ - [ ] Original question answered first; tangents in a separate section
81
+ - [ ] Evidence threshold for the recommendation is stated explicitly
package/skills/routing.md CHANGED
@@ -122,7 +122,8 @@ Read the matching skill file before responding when the user's request matches t
122
122
  | init docs, create docs structure, set up documentation, docs scaffold, documentation init | `skills/docs/init-docs.md` | Initialize required project-state docs and documentation structure |
123
123
  | research X, investigate X, find evidence, gather evidence | `skills/docs/research-workflow.md` | Research workflow — question to .cx/research/ file |
124
124
  | 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 |
125
- | 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/product-intel/ |
125
+ | strategy, product strategy, strategic bet, non-bet, north star, time horizon, competitive positioning | `skills/docs/strategy-workflow.md` | Product strategyread, update, and reason about the strategy store |
126
+ | 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/ |
126
127
  | 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/ |
127
128
  | write a PRFAQ, working backwards doc, press release FAQ | `skills/docs/prfaq-workflow.md` | PRFAQ workflow — launch narrative from PRD or evidence |
128
129
  | create Jira proposal, update Linear, backlog proposal, issue proposal | `skills/docs/backlog-proposal-workflow.md` | Backlog proposal workflow — approval-gated issue tracker changes |
@@ -137,3 +138,9 @@ Read the matching skill file before responding when the user's request matches t
137
138
  3. Detect programming language from file extensions or context and read the corresponding development skill.
138
139
  4. Read each skill file once per conversation.
139
140
  5. Skill file content is authoritative over training data when they conflict.
141
+
142
+ ## Agent Roster Disambiguation
143
+
144
+ **cx-engineer vs cx-platform-engineer:** cx-engineer builds product features for end users. cx-platform-engineer builds the internal platform — CI/CD, deployment tooling, developer environments, internal APIs, and reliability infrastructure. They operate in distinct domains with different quality bars (user-facing UX vs. developer ergonomics and system reliability). Use cx-platform-engineer when the subject is a platform service, internal tool, build pipeline, or infrastructure component that engineers consume, not end users.
145
+
146
+ **Platform domain overlays** (`roles/product-manager.platform`, `roles/architect.platform`, `roles/engineer.platform`) apply when the PRODUCT being designed or built is a platform — an API, SDK, or developer surface consumed by other developers. These are skill overlays on PM/architect/engineer roles, not routing to cx-platform-engineer. Route to cx-platform-engineer only when the work is infra/ops, not product.