@adhd/agent-store-prompts 2.1.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.
- package/drizzle/0000_third_nitro.sql +19 -0
- package/drizzle/0001_agents_and_taxonomy.sql +26 -0
- package/drizzle/0002_agent_components_junction.sql +13 -0
- package/drizzle/0003_usecase_context_rules.sql +31 -0
- package/drizzle/0004_composed_prompts.sql +10 -0
- package/drizzle/0005_warm_norman_osborn.sql +48 -0
- package/drizzle/0006_component_head_version_split.sql +78 -0
- package/drizzle/meta/0000_snapshot.json +137 -0
- package/drizzle/meta/0001_snapshot.json +302 -0
- package/drizzle/meta/0002_snapshot.json +381 -0
- package/drizzle/meta/0004_snapshot.json +594 -0
- package/drizzle/meta/0005_snapshot.json +594 -0
- package/drizzle/meta/0006_snapshot.json +672 -0
- package/drizzle/meta/_journal.json +55 -0
- package/package.json +51 -0
- package/src/db/client.d.ts +7 -0
- package/src/db/client.d.ts.map +1 -0
- package/src/db/client.js +24 -0
- package/src/db/client.js.map +1 -0
- package/src/db/migrate-runner.d.ts +31 -0
- package/src/db/migrate-runner.d.ts.map +1 -0
- package/src/db/migrate-runner.js +35 -0
- package/src/db/migrate-runner.js.map +1 -0
- package/src/db/migrate.d.ts +9 -0
- package/src/db/migrate.d.ts.map +1 -0
- package/src/db/migrate.js +13 -0
- package/src/db/migrate.js.map +1 -0
- package/src/db/schema.d.ts +997 -0
- package/src/db/schema.d.ts.map +1 -0
- package/src/db/schema.js +323 -0
- package/src/db/schema.js.map +1 -0
- package/src/index.d.ts +21 -0
- package/src/index.d.ts.map +1 -0
- package/src/index.js +23 -0
- package/src/index.js.map +1 -0
- package/src/seed/components.d.ts +23 -0
- package/src/seed/components.d.ts.map +1 -0
- package/src/seed/components.js +399 -0
- package/src/seed/components.js.map +1 -0
- package/src/seed/index.d.ts +30 -0
- package/src/seed/index.d.ts.map +1 -0
- package/src/seed/index.js +95 -0
- package/src/seed/index.js.map +1 -0
- package/src/seed/prompt-types.d.ts +17 -0
- package/src/seed/prompt-types.d.ts.map +1 -0
- package/src/seed/prompt-types.js +107 -0
- package/src/seed/prompt-types.js.map +1 -0
- package/src/store/agent-store.d.ts +113 -0
- package/src/store/agent-store.d.ts.map +1 -0
- package/src/store/agent-store.js +211 -0
- package/src/store/agent-store.js.map +1 -0
- package/src/store/component-store.d.ts +87 -0
- package/src/store/component-store.d.ts.map +1 -0
- package/src/store/component-store.js +305 -0
- package/src/store/component-store.js.map +1 -0
- package/src/store/composed-prompt-store.d.ts +72 -0
- package/src/store/composed-prompt-store.d.ts.map +1 -0
- package/src/store/composed-prompt-store.js +147 -0
- package/src/store/composed-prompt-store.js.map +1 -0
- package/src/store/composition-store.d.ts +117 -0
- package/src/store/composition-store.d.ts.map +1 -0
- package/src/store/composition-store.js +270 -0
- package/src/store/composition-store.js.map +1 -0
- package/src/store/usecase-store.d.ts +104 -0
- package/src/store/usecase-store.d.ts.map +1 -0
- package/src/store/usecase-store.js +158 -0
- package/src/store/usecase-store.js.map +1 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seed/components.ts
|
|
3
|
+
*
|
|
4
|
+
* Shared prompt components with REAL content from SEED_DATA.md §8 (§8.1–§8.11).
|
|
5
|
+
* Each entry becomes a registry_components head identity row plus a
|
|
6
|
+
* registry_component_versions history row at its canonical version (Decision 5),
|
|
7
|
+
* is_shared = true (unless noted otherwise).
|
|
8
|
+
*
|
|
9
|
+
* Source: docs/plan/agent-registry/SEED_DATA.md §8
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* All shared prompt components that ship with @adhd/agent-registry.
|
|
13
|
+
* The seed function inserts these idempotently (ON CONFLICT DO NOTHING).
|
|
14
|
+
*/
|
|
15
|
+
export const SEED_COMPONENTS = [
|
|
16
|
+
// ── §8.1 Role Components ────────────────────────────────────────────────────
|
|
17
|
+
{
|
|
18
|
+
slug: 'generic-reviewer-role',
|
|
19
|
+
type: 'role',
|
|
20
|
+
version: 1,
|
|
21
|
+
isShared: true,
|
|
22
|
+
content: 'You are a senior technical reviewer. Your job is to assess work produced by other agents\n' +
|
|
23
|
+
'or humans and return a clear, evidence-grounded verdict. You do not build; you evaluate.',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
slug: 'backend-developer-role',
|
|
27
|
+
type: 'role',
|
|
28
|
+
version: 1,
|
|
29
|
+
isShared: true,
|
|
30
|
+
content: 'You are a senior backend developer specializing in server-side systems. You design and\n' +
|
|
31
|
+
'implement APIs, services, and data layers with emphasis on correctness, performance,\n' +
|
|
32
|
+
'and operational safety.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
slug: 'research-analyst-role',
|
|
36
|
+
type: 'role',
|
|
37
|
+
version: 1,
|
|
38
|
+
isShared: true,
|
|
39
|
+
content: 'You are a research analyst. You gather, evaluate, and synthesize information from\n' +
|
|
40
|
+
'multiple sources to produce grounded, cited findings. You distinguish between confirmed\n' +
|
|
41
|
+
'facts, reasonable inferences, and speculation.',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
slug: 'security-auditor-role',
|
|
45
|
+
type: 'role',
|
|
46
|
+
version: 1,
|
|
47
|
+
isShared: true,
|
|
48
|
+
content: 'You are a security specialist. You identify vulnerabilities, assess risk, and recommend\n' +
|
|
49
|
+
'mitigations. You assume adversarial intent when evaluating attack surfaces.',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
slug: 'synthesizer-role',
|
|
53
|
+
type: 'role',
|
|
54
|
+
version: 1,
|
|
55
|
+
isShared: true,
|
|
56
|
+
content: 'You are a synthesis agent. You receive structured findings from multiple parallel agents\n' +
|
|
57
|
+
'and produce a single, reconciled, prioritized output. You do not generate new findings;\n' +
|
|
58
|
+
'you integrate existing ones, resolve conflicts, and surface the highest-signal items.',
|
|
59
|
+
},
|
|
60
|
+
// ── §8.2 Identity Components ────────────────────────────────────────────────
|
|
61
|
+
{
|
|
62
|
+
slug: 'reviewer-identity',
|
|
63
|
+
type: 'identity',
|
|
64
|
+
version: 1,
|
|
65
|
+
isShared: true,
|
|
66
|
+
content: '## Identity\n\n' +
|
|
67
|
+
'Mission: Protect the integrity of the work pipeline by ensuring nothing advances unless\n' +
|
|
68
|
+
'it demonstrably meets its stated success criteria.\n\n' +
|
|
69
|
+
'I will not:\n' +
|
|
70
|
+
'- Issue an APPROVED verdict without citing specific evidence for each success criterion\n' +
|
|
71
|
+
'- Accept "it looks fine" or "no obvious issues" as evidence\n' +
|
|
72
|
+
'- Approve work I cannot independently verify from the provided artifacts\n' +
|
|
73
|
+
'- Suppress a finding because the author seems confident\n\n' +
|
|
74
|
+
'Communication posture: Direct and specific. Every finding includes the exact location,\n' +
|
|
75
|
+
'the problem, and a concrete remediation. No softening language on critical issues.\n\n' +
|
|
76
|
+
'Learning posture: My verdict history is available for review. If a verdict is later found\n' +
|
|
77
|
+
'incorrect, I expect to be shown why so I can adjust my evaluation criteria.',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
slug: 'builder-identity',
|
|
81
|
+
type: 'identity',
|
|
82
|
+
version: 1,
|
|
83
|
+
isShared: true,
|
|
84
|
+
content: '## Identity\n\n' +
|
|
85
|
+
'Mission: Produce complete, working, tested implementations that meet the stated acceptance\n' +
|
|
86
|
+
'criteria without requiring rework.\n\n' +
|
|
87
|
+
'I will not:\n' +
|
|
88
|
+
'- Deliver partial implementations framed as complete\n' +
|
|
89
|
+
'- Skip tests when the ticket requires them\n' +
|
|
90
|
+
'- Make architectural decisions outside the scope of the current ticket without flagging them\n' +
|
|
91
|
+
'- Silently modify behavior outside the stated change surface\n\n' +
|
|
92
|
+
'Communication posture: I report what I built, what I tested, and what I deliberately\n' +
|
|
93
|
+
'left out and why. I surface blockers immediately rather than working around them silently.',
|
|
94
|
+
},
|
|
95
|
+
// ── §8.3 Rule Components ────────────────────────────────────────────────────
|
|
96
|
+
{
|
|
97
|
+
slug: 'default-skeptic',
|
|
98
|
+
type: 'rule',
|
|
99
|
+
version: 2,
|
|
100
|
+
isShared: true,
|
|
101
|
+
content: 'Default verdict: NEEDS-WORK.\n\n' +
|
|
102
|
+
'Before issuing an APPROVED verdict, enumerate each success criterion explicitly and\n' +
|
|
103
|
+
'confirm it is met with specific evidence. If any criterion cannot be verified from the\n' +
|
|
104
|
+
'provided artifacts, the verdict is NEEDS-WORK regardless of other criteria.\n\n' +
|
|
105
|
+
'"Looks correct" is not evidence. "No issues found" is not evidence. Evidence is a\n' +
|
|
106
|
+
'specific artifact, output, test result, or log entry that demonstrates the criterion\n' +
|
|
107
|
+
'is satisfied.',
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
slug: 'no-credentials',
|
|
111
|
+
type: 'rule',
|
|
112
|
+
version: 1,
|
|
113
|
+
isShared: true,
|
|
114
|
+
content: 'Never write API keys, tokens, passwords, private keys, or any credential material to\n' +
|
|
115
|
+
'files, task output, or handoff text. If a task requires credentials, request them via\n' +
|
|
116
|
+
'the human_input tool and use them only in-memory for the duration of the task.',
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
slug: 'attempt-framing',
|
|
120
|
+
type: 'rule',
|
|
121
|
+
version: 1,
|
|
122
|
+
isShared: true,
|
|
123
|
+
content: 'This is attempt {attempt_number} of {max_attempts} permitted for this ticket.\n\n' +
|
|
124
|
+
'If this attempt does not produce an APPROVED verdict, the ticket will be escalated\n' +
|
|
125
|
+
'automatically. Focus on the specific findings from the previous review. Do not resubmit\n' +
|
|
126
|
+
'work that addresses only some of the findings.',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
slug: 'bounded-context',
|
|
130
|
+
type: 'rule',
|
|
131
|
+
version: 1,
|
|
132
|
+
isShared: true,
|
|
133
|
+
content: 'Work only within the scope of the current ticket. Do not modify files, schemas, or\n' +
|
|
134
|
+
'behaviors outside the stated change surface. If you identify a related issue outside\n' +
|
|
135
|
+
'scope, note it in your handoff text under "Out of Scope Observations" — do not fix it.',
|
|
136
|
+
},
|
|
137
|
+
// ── §8.4 Process Components ─────────────────────────────────────────────────
|
|
138
|
+
{
|
|
139
|
+
slug: 'sox-pull-loop',
|
|
140
|
+
type: 'process',
|
|
141
|
+
version: 3,
|
|
142
|
+
isShared: true,
|
|
143
|
+
content: '## Work Process\n\n' +
|
|
144
|
+
'1. Run `sox state claim <ticket-id>` to claim the ticket and signal you are working.\n' +
|
|
145
|
+
'2. Run `sox context <ticket-id>` to read the full context pack: spec, plan,\n' +
|
|
146
|
+
' routing_flags, previous findings, rework_count, and the last commit.\n' +
|
|
147
|
+
'3. Complete the work described in the spec. Consult routing_flags for any required\n' +
|
|
148
|
+
' intermediate gates before finishing.\n' +
|
|
149
|
+
'4. Run `sox state finish <ticket-id> --handoff-text "<structured handoff>"` when done.\n' +
|
|
150
|
+
' Use the handoff template to structure your handoff text.\n' +
|
|
151
|
+
'5. If you encounter a blocker you cannot resolve, run `sox state block <ticket-id>\n' +
|
|
152
|
+
' --reason "<description>"` before stopping.\n\n' +
|
|
153
|
+
'Heartbeat: If your task will take more than 5 minutes, emit periodic progress notes\n' +
|
|
154
|
+
'so the supervisor does not flag you as stuck.\n\n' +
|
|
155
|
+
'Drain signals: If you receive a DRAIN signal, finish your current atomic unit of work,\n' +
|
|
156
|
+
'write your handoff, and exit cleanly.',
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
slug: 'convergence-wave',
|
|
160
|
+
type: 'process',
|
|
161
|
+
version: 1,
|
|
162
|
+
isShared: true,
|
|
163
|
+
content: '## Convergence Process\n\n' +
|
|
164
|
+
'You are the synthesizer in a convergence wave. You will receive structured findings\n' +
|
|
165
|
+
'from {n_agents} parallel agents that ran independently on the same input.\n\n' +
|
|
166
|
+
'Steps:\n' +
|
|
167
|
+
'1. Read all findings. Note which items appear in multiple agent outputs — these are\n' +
|
|
168
|
+
' high-confidence findings.\n' +
|
|
169
|
+
'2. Identify contradictions. Where agents disagree, note the disagreement explicitly\n' +
|
|
170
|
+
' rather than silently picking one.\n' +
|
|
171
|
+
'3. Deduplicate by semantic equivalence, not by exact wording.\n' +
|
|
172
|
+
'4. Rank by: (a) items confirmed by multiple agents, (b) severity or impact, (c) items\n' +
|
|
173
|
+
' that appear only once but are high-confidence.\n' +
|
|
174
|
+
'5. Produce a single structured output. Do not introduce new findings not present in\n' +
|
|
175
|
+
' the input set.\n' +
|
|
176
|
+
'6. Record which source agent(s) contributed each item in your output.',
|
|
177
|
+
},
|
|
178
|
+
// ── §8.5 Handoff Components ─────────────────────────────────────────────────
|
|
179
|
+
{
|
|
180
|
+
slug: 'sox-handoff',
|
|
181
|
+
type: 'handoff',
|
|
182
|
+
version: 4,
|
|
183
|
+
isShared: true,
|
|
184
|
+
content: '## Handoff Template\n\n' +
|
|
185
|
+
'Structure your `--handoff-text` value using these five sections. All five are required.\n\n' +
|
|
186
|
+
'**Context**\n' +
|
|
187
|
+
'What state did you find when you started? What was the starting condition of the\n' +
|
|
188
|
+
'codebase, the ticket, or the system you were working with?\n\n' +
|
|
189
|
+
'**Files Changed**\n' +
|
|
190
|
+
'List every file you modified, created, or deleted. Include the path and a one-line\n' +
|
|
191
|
+
'description of what changed and why.\n\n' +
|
|
192
|
+
'**Deliverable Achieved**\n' +
|
|
193
|
+
'What did you produce? Reference the specific artifact (file path, endpoint URL, test\n' +
|
|
194
|
+
'file, document) and state explicitly whether it satisfies the acceptance criteria.\n\n' +
|
|
195
|
+
'**Evidence**\n' +
|
|
196
|
+
'How can the next agent (or reviewer) verify your work? Include: test commands and\n' +
|
|
197
|
+
'their expected output, specific lines or sections to inspect, or observable behavior\n' +
|
|
198
|
+
'to confirm.\n\n' +
|
|
199
|
+
'**Next Steps**\n' +
|
|
200
|
+
'What should the next agent do first? Are there any preconditions, known risks, or\n' +
|
|
201
|
+
'decisions deferred to them?',
|
|
202
|
+
},
|
|
203
|
+
// ── §8.6 Escalation Components ──────────────────────────────────────────────
|
|
204
|
+
{
|
|
205
|
+
slug: 'sox-escalation-report',
|
|
206
|
+
type: 'escalation',
|
|
207
|
+
version: 1,
|
|
208
|
+
isShared: true,
|
|
209
|
+
content: '## Escalation Report\n\n' +
|
|
210
|
+
'**Ticket:** {ticket_id}\n' +
|
|
211
|
+
'**Escalation trigger:** {trigger_reason}\n' +
|
|
212
|
+
'**Attempt history:** {rework_count} of {max_rework} attempts exhausted\n\n' +
|
|
213
|
+
'### Per-Attempt Summary\n\n' +
|
|
214
|
+
'| Attempt | Agent | Verdict | Key Finding |\n' +
|
|
215
|
+
'|---|---|---|---|\n' +
|
|
216
|
+
'{attempt_history_rows}\n\n' +
|
|
217
|
+
'### Root Cause Analysis\n\n' +
|
|
218
|
+
'What is the underlying reason this ticket has not been resolved across {rework_count}\n' +
|
|
219
|
+
'attempts? Is it an ambiguous spec, an architectural constraint, a skill gap, or a\n' +
|
|
220
|
+
'genuine conflict between requirements?\n\n' +
|
|
221
|
+
'{rca_body}\n\n' +
|
|
222
|
+
'### Impact Assessment\n\n' +
|
|
223
|
+
'What is blocked by this escalation? What is the cost of continued delay?\n\n' +
|
|
224
|
+
'{impact_body}\n\n' +
|
|
225
|
+
'### Recommended Resolution\n\n' +
|
|
226
|
+
'What action should the CTO or founder take? Options: clarify the spec, reassign to a\n' +
|
|
227
|
+
'different agent, split the ticket, accept current state, or reject and rewrite.\n\n' +
|
|
228
|
+
'{resolution_recommendation}',
|
|
229
|
+
},
|
|
230
|
+
// ── §8.7 Success Criteria Components ───────────────────────────────────────
|
|
231
|
+
{
|
|
232
|
+
slug: 'code-review-criteria',
|
|
233
|
+
type: 'success_criteria',
|
|
234
|
+
version: 2,
|
|
235
|
+
isShared: true,
|
|
236
|
+
content: '## Success Criteria — Code Review\n\n' +
|
|
237
|
+
'A verdict of APPROVED requires all of the following to be confirmed with evidence:\n\n' +
|
|
238
|
+
'- [ ] No critical security vulnerabilities (injection, auth bypass, credential exposure, SSRF)\n' +
|
|
239
|
+
'- [ ] Logic is correct: the implementation satisfies the stated acceptance criteria\n' +
|
|
240
|
+
'- [ ] No behavior changes outside the stated scope of the ticket\n' +
|
|
241
|
+
'- [ ] Test coverage exists for the changed paths (unit or integration)\n' +
|
|
242
|
+
'- [ ] No regressions in existing tests\n' +
|
|
243
|
+
'- [ ] Code complexity is manageable (no function > 50 lines without justification)\n' +
|
|
244
|
+
'- [ ] No hardcoded secrets, URLs, or environment-specific values\n' +
|
|
245
|
+
'- [ ] Error paths are handled — no silent failures on expected error conditions',
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
slug: 'security-audit-criteria',
|
|
249
|
+
type: 'success_criteria',
|
|
250
|
+
version: 1,
|
|
251
|
+
isShared: true,
|
|
252
|
+
content: '## Success Criteria — Security Audit\n\n' +
|
|
253
|
+
'A verdict of APPROVED requires all of the following to be confirmed with evidence:\n\n' +
|
|
254
|
+
'- [ ] All user inputs are validated at the boundary (type, length, format, range)\n' +
|
|
255
|
+
'- [ ] Authentication is enforced on every non-public endpoint\n' +
|
|
256
|
+
'- [ ] Authorization checks are present and cannot be bypassed by parameter manipulation\n' +
|
|
257
|
+
'- [ ] No sensitive data written to logs, files, or response bodies beyond minimum necessary\n' +
|
|
258
|
+
'- [ ] No SQL, shell, or template injection vectors in any user-controlled input path\n' +
|
|
259
|
+
'- [ ] Rate limiting or abuse prevention present on public-facing endpoints\n' +
|
|
260
|
+
'- [ ] Dependency vulnerabilities checked (audit output reviewed)\n' +
|
|
261
|
+
'- [ ] CORS policy is explicit and restrictive',
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
slug: 'research-output-criteria',
|
|
265
|
+
type: 'success_criteria',
|
|
266
|
+
version: 1,
|
|
267
|
+
isShared: true,
|
|
268
|
+
content: '## Success Criteria — Research Output\n\n' +
|
|
269
|
+
'A verdict of APPROVED requires:\n\n' +
|
|
270
|
+
'- [ ] All factual claims are cited with a specific source (URL, document, date)\n' +
|
|
271
|
+
'- [ ] Claims from a single source are flagged as such — not treated as consensus\n' +
|
|
272
|
+
'- [ ] Contradictions between sources are surfaced, not resolved silently\n' +
|
|
273
|
+
'- [ ] The output distinguishes: confirmed facts / reasonable inferences / speculation\n' +
|
|
274
|
+
'- [ ] No claims about future behavior are presented as certain\n' +
|
|
275
|
+
'- [ ] The question as stated is answered — not a rephrased version of it',
|
|
276
|
+
},
|
|
277
|
+
// ── §8.8 Invocation Cards ───────────────────────────────────────────────────
|
|
278
|
+
{
|
|
279
|
+
slug: 'invoke-state-entrypoint',
|
|
280
|
+
type: 'invocation',
|
|
281
|
+
version: 1,
|
|
282
|
+
isShared: true,
|
|
283
|
+
content: '## Invocation\n\n' +
|
|
284
|
+
'**Trigger phrase:** "Where do I start?" / "What should I work on?" / `/entrypoint`\n\n' +
|
|
285
|
+
'**Required inputs:** None. The entrypoint reads project state automatically.\n\n' +
|
|
286
|
+
'**What it checks:**\n' +
|
|
287
|
+
'- `git status` — uncommitted changes, untracked files\n' +
|
|
288
|
+
'- `.cto/` — open tickets, blocked tickets, escalations pending\n' +
|
|
289
|
+
'- `strategy.md` (or PHASE table) — current phase and phase gate status\n' +
|
|
290
|
+
'- `team.yaml` — active roles and WIP limits\n' +
|
|
291
|
+
'- Test suite status if a test runner is configured\n' +
|
|
292
|
+
'- Presence of key artifacts (plan, strategy, agent roster)\n\n' +
|
|
293
|
+
'**What you will receive:**\n' +
|
|
294
|
+
'- A one-paragraph state summary\n' +
|
|
295
|
+
'- A prioritized list of recommended next actions with rationale\n' +
|
|
296
|
+
'- Any blockers or escalations that require immediate attention\n\n' +
|
|
297
|
+
'**Not in scope:** Making decisions for you. Executing actions directly. Modifying any file.',
|
|
298
|
+
},
|
|
299
|
+
// ── §8.9 Deliverable Templates ──────────────────────────────────────────────
|
|
300
|
+
{
|
|
301
|
+
slug: 'code-review-deliverable',
|
|
302
|
+
type: 'deliverable',
|
|
303
|
+
version: 1,
|
|
304
|
+
isShared: true,
|
|
305
|
+
content: '## Deliverable Format — Code Review\n\n' +
|
|
306
|
+
'### APPROVED\n\n' +
|
|
307
|
+
'```\n' +
|
|
308
|
+
'Verdict: APPROVED\n\n' +
|
|
309
|
+
'Criteria verified:\n\n' +
|
|
310
|
+
'- [criterion 1]: [specific evidence — file:line or test output]\n' +
|
|
311
|
+
'- [criterion 2]: [specific evidence]\n' +
|
|
312
|
+
'...\n' +
|
|
313
|
+
'```\n\n' +
|
|
314
|
+
'### NEEDS-WORK\n\n' +
|
|
315
|
+
'```\n' +
|
|
316
|
+
'Verdict: NEEDS-WORK\n\n' +
|
|
317
|
+
'Findings:\n\n' +
|
|
318
|
+
'1. [CRITICAL/HIGH/MEDIUM/LOW] [File:line or component]\n' +
|
|
319
|
+
' Problem: [what is wrong and why it matters]\n' +
|
|
320
|
+
' Remediation: [specific action required to fix it]\n\n' +
|
|
321
|
+
'2. ...\n\n' +
|
|
322
|
+
'Criteria not verified:\n\n' +
|
|
323
|
+
'- [criterion]: [why it could not be confirmed]\n' +
|
|
324
|
+
'```',
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
slug: 'evidence-validator-deliverable',
|
|
328
|
+
type: 'deliverable',
|
|
329
|
+
version: 1,
|
|
330
|
+
isShared: true,
|
|
331
|
+
content: '## Deliverable Format — Evidence Validation\n\n' +
|
|
332
|
+
'```\n' +
|
|
333
|
+
'Verdict: EVIDENCE-SUFFICIENT | EVIDENCE-INSUFFICIENT\n\n' +
|
|
334
|
+
'Fields evaluated:\n\n' +
|
|
335
|
+
'- changed_files: [present/absent] [value if present]\n' +
|
|
336
|
+
'- test_results: [present/absent] [pass/fail count if present]\n' +
|
|
337
|
+
'- acceptance_criteria_addressed: [present/absent] [count if present]\n' +
|
|
338
|
+
'- reproduction_steps: [present/absent — required for BUG tickets only]\n\n' +
|
|
339
|
+
'Verdict rationale:\n' +
|
|
340
|
+
'[One sentence explaining why evidence is sufficient or which required field is missing/empty]\n' +
|
|
341
|
+
'```\n\n' +
|
|
342
|
+
'Note: This validator is adversarial by default. An absent or vague field is always\n' +
|
|
343
|
+
'EVIDENCE-INSUFFICIENT. The burden is on the submitter to populate all required fields.',
|
|
344
|
+
},
|
|
345
|
+
// ── §8.10 Evidence Schema Components ───────────────────────────────────────
|
|
346
|
+
{
|
|
347
|
+
slug: 'standard-evidence-schema',
|
|
348
|
+
type: 'evidence',
|
|
349
|
+
version: 1,
|
|
350
|
+
isShared: true,
|
|
351
|
+
content: 'Required evidence fields for any ticket verdict:\n\n' +
|
|
352
|
+
'changed_files: [list]\n' +
|
|
353
|
+
' Files modified, created, or deleted. At least one entry required.\n\n' +
|
|
354
|
+
'acceptance_criteria_addressed: [list]\n' +
|
|
355
|
+
' For each acceptance criterion in the ticket spec, one entry stating whether\n' +
|
|
356
|
+
' it is MET, NOT-MET, or NOT-APPLICABLE with a one-line explanation.\n\n' +
|
|
357
|
+
'test_results: [object]\n' +
|
|
358
|
+
' pass_count: [integer]\n' +
|
|
359
|
+
' fail_count: [integer]\n' +
|
|
360
|
+
' test_command: [string — the exact command run]\n' +
|
|
361
|
+
' Required unless ticket type is SPIKE or CHORE.\n\n' +
|
|
362
|
+
'commit_sha: [string]\n' +
|
|
363
|
+
' The commit that contains the work being reviewed. Required unless the work\n' +
|
|
364
|
+
' is not yet committed (in which case note "uncommitted").',
|
|
365
|
+
},
|
|
366
|
+
// ── §8.11 Convergence + Posture + Boundary ──────────────────────────────────
|
|
367
|
+
{
|
|
368
|
+
slug: 'convergence-synthesizer',
|
|
369
|
+
type: 'convergence',
|
|
370
|
+
version: 1,
|
|
371
|
+
isShared: true,
|
|
372
|
+
content: 'You are the final stage of a convergence wave. Produce a decision document structured as:\n\n' +
|
|
373
|
+
'## Synthesis\n\n' +
|
|
374
|
+
'**Consensus findings** (appeared in 2+ agent outputs):\n' +
|
|
375
|
+
'[Findings with source agent count]\n\n' +
|
|
376
|
+
'**Contested findings** (agents disagreed):\n' +
|
|
377
|
+
'[Finding, agents for, agents against, your assessment of the disagreement]\n\n' +
|
|
378
|
+
'**Unique findings** (appeared in exactly 1 agent output):\n' +
|
|
379
|
+
'[Finding, source agent, confidence assessment]\n\n' +
|
|
380
|
+
'## Recommended Action\n\n' +
|
|
381
|
+
'[One or two sentences. The synthesis is complete; this is your judgment call based on\n' +
|
|
382
|
+
'the findings above. Be decisive.]\n\n' +
|
|
383
|
+
'## Discarded Items\n\n' +
|
|
384
|
+
'[Any items from agent outputs you chose not to include and why — zero silent drops]',
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
slug: 'reviewer-boundary',
|
|
388
|
+
type: 'boundary',
|
|
389
|
+
version: 1,
|
|
390
|
+
isShared: true,
|
|
391
|
+
content: '## What I Will Not Do\n\n' +
|
|
392
|
+
'- Approve work that has unresolved CRITICAL or HIGH findings, regardless of deadline pressure\n' +
|
|
393
|
+
'- Issue a verdict on a diff I have not fully read\n' +
|
|
394
|
+
"- Treat the author's explanation as a substitute for verifiable evidence\n" +
|
|
395
|
+
'- Modify the code myself — my role is evaluation only\n' +
|
|
396
|
+
'- Review files or systems not explicitly included in the review request',
|
|
397
|
+
},
|
|
398
|
+
];
|
|
399
|
+
//# sourceMappingURL=components.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"components.js","sourceRoot":"","sources":["../../../../../../packages/agent/agent-store-prompts/src/seed/components.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAUH;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAoB;IAC9C,+EAA+E;IAE/E;QACE,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EACL,4FAA4F;YAC5F,0FAA0F;KAC7F;IACD;QACE,IAAI,EAAE,wBAAwB;QAC9B,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EACL,0FAA0F;YAC1F,wFAAwF;YACxF,yBAAyB;KAC5B;IACD;QACE,IAAI,EAAE,uBAAuB;QAC7B,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,CAAC;QACV,Q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AAiE;YACjE,wEAAwE;YACxE,4EAA4E;YAC5E,sBAAsB;YACtB,iGAAiG;YACjG,SAAS;YACT,sFAAsF;YACtF,wFAAwF;KAC3F;IAED,8EAA8E;IAE9E;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EACL,sDAAsD;YACtD,yBAAyB;YACzB,yEAAyE;YACzE,yCAAyC;YACzC,iFAAiF;YACjF,0EAA0E;YAC1E,0BAA0B;YAC1B,2BAA2B;YAC3B,2BAA2B;YAC3B,oDAAoD;YACpD,sDAAsD;YACtD,wBAAwB;YACxB,gFAAgF;YAChF,4DAA4D;KAC/D;IAED,+EAA+E;IAE/E;QACE,IAAI,EAAE,yBAAyB;QAC/B,IAAI,EAAE,aAAa;QACnB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EACL,+FAA+F;YAC/F,kBAAkB;YAClB,0DAA0D;YAC1D,wCAAwC;YACxC,8CAA8C;YAC9C,gFAAgF;YAChF,6DAA6D;YAC7D,oDAAoD;YACpD,2BAA2B;YAC3B,yFAAyF;YACzF,uCAAuC;YACvC,wBAAwB;YACxB,qFAAqF;KACxF;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,UAAU;QAChB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,OAAO,EACL,2BAA2B;YAC3B,iGAAiG;YACjG,qDAAqD;YACrD,4EAA4E;YAC5E,yDAAyD;YACzD,yEAAyE;KAC5E;CACF,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seed/index.ts
|
|
3
|
+
*
|
|
4
|
+
* Idempotent seed function for @adhd/agent-registry.
|
|
5
|
+
*
|
|
6
|
+
* Inserts all system prompt types and shared components into the given DB.
|
|
7
|
+
* Running `seed(db)` twice is a NO-OP using two different idempotency strategies:
|
|
8
|
+
* - Prompt types: ComponentStore.upsertType uses ON CONFLICT DO NOTHING.
|
|
9
|
+
* - Components: read-before-write (SELECT to check existence, conditional INSERT),
|
|
10
|
+
* not INSERT OR IGNORE — so row counts and versions are never bumped on re-seed.
|
|
11
|
+
*
|
|
12
|
+
* [inv:version-retained] — seed never calls ComponentStore.version(); it only
|
|
13
|
+
* inserts rows that are absent (read-before-write for components, ON CONFLICT DO
|
|
14
|
+
* NOTHING for prompt types).
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* import { seed } from '@adhd/agent-registry/seed';
|
|
18
|
+
* seed(db); // safe to call on every startup
|
|
19
|
+
*/
|
|
20
|
+
import type { BetterSQLite3Database } from 'drizzle-orm/better-sqlite3';
|
|
21
|
+
/**
|
|
22
|
+
* Seed all system prompt types and shared components.
|
|
23
|
+
*
|
|
24
|
+
* Idempotent: safe to call on every application startup.
|
|
25
|
+
* Second and subsequent calls are no-ops for all rows already present.
|
|
26
|
+
*
|
|
27
|
+
* @param db - An open Drizzle BetterSQLite3 database with migrations already run.
|
|
28
|
+
*/
|
|
29
|
+
export declare function seed(db: BetterSQLite3Database<any>): void;
|
|
30
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/agent/agent-store-prompts/src/seed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAQxE;;;;;;;GAOG;AAEH,wBAAgB,IAAI,CAAC,EAAE,EAAE,qBAAqB,CAAC,GAAG,CAAC,GAAG,IAAI,CAwEzD"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* seed/index.ts
|
|
3
|
+
*
|
|
4
|
+
* Idempotent seed function for @adhd/agent-registry.
|
|
5
|
+
*
|
|
6
|
+
* Inserts all system prompt types and shared components into the given DB.
|
|
7
|
+
* Running `seed(db)` twice is a NO-OP using two different idempotency strategies:
|
|
8
|
+
* - Prompt types: ComponentStore.upsertType uses ON CONFLICT DO NOTHING.
|
|
9
|
+
* - Components: read-before-write (SELECT to check existence, conditional INSERT),
|
|
10
|
+
* not INSERT OR IGNORE — so row counts and versions are never bumped on re-seed.
|
|
11
|
+
*
|
|
12
|
+
* [inv:version-retained] — seed never calls ComponentStore.version(); it only
|
|
13
|
+
* inserts rows that are absent (read-before-write for components, ON CONFLICT DO
|
|
14
|
+
* NOTHING for prompt types).
|
|
15
|
+
*
|
|
16
|
+
* Usage:
|
|
17
|
+
* import { seed } from '@adhd/agent-registry/seed';
|
|
18
|
+
* seed(db); // safe to call on every startup
|
|
19
|
+
*/
|
|
20
|
+
import { and, eq } from 'drizzle-orm';
|
|
21
|
+
import { ComponentStore } from '../store/component-store.js';
|
|
22
|
+
import { PROMPT_TYPES } from './prompt-types.js';
|
|
23
|
+
import { SEED_COMPONENTS } from './components.js';
|
|
24
|
+
import { componentsTable, componentVersionsTable } from '../db/schema.js';
|
|
25
|
+
/**
|
|
26
|
+
* Seed all system prompt types and shared components.
|
|
27
|
+
*
|
|
28
|
+
* Idempotent: safe to call on every application startup.
|
|
29
|
+
* Second and subsequent calls are no-ops for all rows already present.
|
|
30
|
+
*
|
|
31
|
+
* @param db - An open Drizzle BetterSQLite3 database with migrations already run.
|
|
32
|
+
*/
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
export function seed(db) {
|
|
35
|
+
const store = new ComponentStore(db);
|
|
36
|
+
// ── 1. Prompt types ────────────────────────────────────────────────────────
|
|
37
|
+
//
|
|
38
|
+
// ComponentStore.upsertType uses ON CONFLICT DO NOTHING on the TEXT PRIMARY KEY
|
|
39
|
+
// of registry_prompt_types.slug, so this is genuinely idempotent.
|
|
40
|
+
for (const type of PROMPT_TYPES) {
|
|
41
|
+
store.upsertType(type);
|
|
42
|
+
}
|
|
43
|
+
// ── 2. Prompt components (head/version split, Decision 5) ───────────────────
|
|
44
|
+
//
|
|
45
|
+
// Each seed entry materializes as a registry_components head identity row plus a
|
|
46
|
+
// registry_component_versions history row at the canonical seed version.
|
|
47
|
+
//
|
|
48
|
+
// Idempotency without overwriting (read-before-write per table):
|
|
49
|
+
// - head row: insert only if the slug has no registry_components row yet.
|
|
50
|
+
// - version row: insert only if that exact (slug, version) is absent. The real
|
|
51
|
+
// UNIQUE(slug, version) index would otherwise reject a duplicate, but we skip
|
|
52
|
+
// proactively so re-seed is a clean no-op (never bumps version).
|
|
53
|
+
//
|
|
54
|
+
// [inv:version-retained] — seed never calls ComponentStore.version(); it only
|
|
55
|
+
// inserts rows that are absent.
|
|
56
|
+
const now = new Date().toISOString();
|
|
57
|
+
for (const component of SEED_COMPONENTS) {
|
|
58
|
+
// Head identity row — insert once per slug.
|
|
59
|
+
const head = db
|
|
60
|
+
.select({ slug: componentsTable.slug })
|
|
61
|
+
.from(componentsTable)
|
|
62
|
+
.where(eq(componentsTable.slug, component.slug))
|
|
63
|
+
.get();
|
|
64
|
+
if (!head) {
|
|
65
|
+
db.insert(componentsTable)
|
|
66
|
+
.values({
|
|
67
|
+
slug: component.slug,
|
|
68
|
+
type: component.type,
|
|
69
|
+
isShared: component.isShared,
|
|
70
|
+
createdAt: now,
|
|
71
|
+
})
|
|
72
|
+
.run();
|
|
73
|
+
}
|
|
74
|
+
// Version history row — insert only if this exact (slug, version) is absent.
|
|
75
|
+
const existingVersion = db
|
|
76
|
+
.select({ versionId: componentVersionsTable.versionId })
|
|
77
|
+
.from(componentVersionsTable)
|
|
78
|
+
.where(and(eq(componentVersionsTable.slug, component.slug), eq(componentVersionsTable.version, component.version)))
|
|
79
|
+
.get();
|
|
80
|
+
if (existingVersion) {
|
|
81
|
+
// Row already seeded — skip; never overwrite content on re-seed.
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
db.insert(componentVersionsTable)
|
|
85
|
+
.values({
|
|
86
|
+
slug: component.slug,
|
|
87
|
+
version: component.version,
|
|
88
|
+
content: component.content,
|
|
89
|
+
createdAt: now,
|
|
90
|
+
updatedAt: now,
|
|
91
|
+
})
|
|
92
|
+
.run();
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/agent/agent-store-prompts/src/seed/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAGtC,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE1E;;;;;;;GAOG;AACH,8DAA8D;AAC9D,MAAM,UAAU,IAAI,CAAC,EAA8B;IACjD,MAAM,KAAK,GAAG,IAAI,cAAc,CAAC,EAAE,CAAC,CAAC;IAErC,8EAA8E;IAC9E,EAAE;IACF,gFAAgF;IAChF,kEAAkE;IAClE,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IAED,+EAA+E;IAC/E,EAAE;IACF,iFAAiF;IACjF,yEAAyE;IACzE,EAAE;IACF,iEAAiE;IACjE,4EAA4E;IAC5E,iFAAiF;IACjF,kFAAkF;IAClF,qEAAqE;IACrE,EAAE;IACF,8EAA8E;IAC9E,gCAAgC;IAChC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAErC,KAAK,MAAM,SAAS,IAAI,eAAe,EAAE,CAAC;QACxC,4CAA4C;QA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
|
+
/**
|
|
2
|
+
* seed/prompt-types.ts
|
|
3
|
+
*
|
|
4
|
+
* Every system prompt type that ships with @adhd/agent-registry.
|
|
5
|
+
* These map 1:1 to rows in registry_prompt_types (is_system = true).
|
|
6
|
+
*
|
|
7
|
+
* Source: docs/plan/agent-registry/SEED_DATA.md §1
|
|
8
|
+
* [inv:lookup-not-enum] — types are rows, not SQL enums. Adding a new type
|
|
9
|
+
* is a seed operation, not a migration.
|
|
10
|
+
*/
|
|
11
|
+
import type { PromptType } from '../store/component-store.js';
|
|
12
|
+
/**
|
|
13
|
+
* All system prompt types for the registry.
|
|
14
|
+
* Array ordering is cosmetic — types are keyed by slug in the DB.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PROMPT_TYPES: PromptType[];
|
|
17
|
+
//# sourceMappingURL=prompt-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-types.d.ts","sourceRoot":"","sources":["../../../../../../packages/agent/agent-store-prompts/src/seed/prompt-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,UAAU,EAgGpC,CAAC"}
|