@telora/daemon 0.16.42 → 0.17.1

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 (71) hide show
  1. package/build-info.json +6 -3
  2. package/dist/completion/event.d.ts +17 -0
  3. package/dist/completion/event.d.ts.map +1 -1
  4. package/dist/completion/event.js +46 -12
  5. package/dist/completion/event.js.map +1 -1
  6. package/dist/directive/directive-queue.d.ts +117 -0
  7. package/dist/directive/directive-queue.d.ts.map +1 -0
  8. package/dist/directive/directive-queue.js +114 -0
  9. package/dist/directive/directive-queue.js.map +1 -0
  10. package/dist/directive/stage-tracker.d.ts +23 -0
  11. package/dist/directive/stage-tracker.d.ts.map +1 -0
  12. package/dist/directive/stage-tracker.js +27 -0
  13. package/dist/directive/stage-tracker.js.map +1 -0
  14. package/dist/directive-executor.d.ts +3 -102
  15. package/dist/directive-executor.d.ts.map +1 -1
  16. package/dist/directive-executor.js +14 -112
  17. package/dist/directive-executor.js.map +1 -1
  18. package/dist/escalations.d.ts +38 -0
  19. package/dist/escalations.d.ts.map +1 -0
  20. package/dist/escalations.js +38 -0
  21. package/dist/escalations.js.map +1 -0
  22. package/dist/focus-engine.d.ts.map +1 -1
  23. package/dist/focus-engine.js +28 -0
  24. package/dist/focus-engine.js.map +1 -1
  25. package/dist/focus-executor.d.ts.map +1 -1
  26. package/dist/focus-executor.js +1 -0
  27. package/dist/focus-executor.js.map +1 -1
  28. package/dist/prd-clearance-engine.d.ts +121 -0
  29. package/dist/prd-clearance-engine.d.ts.map +1 -0
  30. package/dist/prd-clearance-engine.js +164 -0
  31. package/dist/prd-clearance-engine.js.map +1 -0
  32. package/dist/prd-controller.d.ts +87 -0
  33. package/dist/prd-controller.d.ts.map +1 -0
  34. package/dist/prd-controller.js +319 -0
  35. package/dist/prd-controller.js.map +1 -0
  36. package/dist/prd-divergence.d.ts +76 -0
  37. package/dist/prd-divergence.d.ts.map +1 -0
  38. package/dist/prd-divergence.js +148 -0
  39. package/dist/prd-divergence.js.map +1 -0
  40. package/dist/prompt-sections/context-sections.d.ts +32 -0
  41. package/dist/prompt-sections/context-sections.d.ts.map +1 -0
  42. package/dist/prompt-sections/context-sections.js +86 -0
  43. package/dist/prompt-sections/context-sections.js.map +1 -0
  44. package/dist/prompt-sections/execution-sections.d.ts +82 -0
  45. package/dist/prompt-sections/execution-sections.d.ts.map +1 -0
  46. package/dist/prompt-sections/execution-sections.js +601 -0
  47. package/dist/prompt-sections/execution-sections.js.map +1 -0
  48. package/dist/prompt-sections/persona-sections.d.ts +133 -0
  49. package/dist/prompt-sections/persona-sections.d.ts.map +1 -0
  50. package/dist/prompt-sections/persona-sections.js +317 -0
  51. package/dist/prompt-sections/persona-sections.js.map +1 -0
  52. package/dist/prompt-sections/role-sections.d.ts +24 -0
  53. package/dist/prompt-sections/role-sections.d.ts.map +1 -0
  54. package/dist/prompt-sections/role-sections.js +78 -0
  55. package/dist/prompt-sections/role-sections.js.map +1 -0
  56. package/dist/prompt-sections/shared.d.ts +66 -0
  57. package/dist/prompt-sections/shared.d.ts.map +1 -0
  58. package/dist/prompt-sections/shared.js +33 -0
  59. package/dist/prompt-sections/shared.js.map +1 -0
  60. package/dist/queries/prd.d.ts +79 -0
  61. package/dist/queries/prd.d.ts.map +1 -0
  62. package/dist/queries/prd.js +116 -0
  63. package/dist/queries/prd.js.map +1 -0
  64. package/dist/team-prompt-base.d.ts +16 -287
  65. package/dist/team-prompt-base.d.ts.map +1 -1
  66. package/dist/team-prompt-base.js +20 -1089
  67. package/dist/team-prompt-base.js.map +1 -1
  68. package/dist/templates/claude-md.d.ts.map +1 -1
  69. package/dist/templates/claude-md.js +0 -1
  70. package/dist/templates/claude-md.js.map +1 -1
  71. package/package.json +1 -1
@@ -0,0 +1,601 @@
1
+ /**
2
+ * Execution section builders: planning, delivery listing, status-update rules,
3
+ * setup/execution instructions, session constraints, worker management, stage
4
+ * progression, scoping/rescoping, new-work, error handling, merge-conflict, and
5
+ * completion. Extracted from team-prompt-base.ts.
6
+ */
7
+ import { isStatusAgentActionable } from '../stage-classifier.js';
8
+ import { buildIssueCountLine, buildContextGroupLine, buildStandaloneIssueLine } from '../prompt-listing.js';
9
+ import { orchestrationVocabulary } from './shared.js';
10
+ /**
11
+ * Build the planning section -- emitted only when the focus has no
12
+ * deliveries and the team's first act is to scope them.
13
+ *
14
+ * The team uses telora_product_delivery_create and telora_product_issue_create
15
+ * (the same MCP tools used for mid-flight rescoping) to write the plan to the
16
+ * database. After writing, the team continues into normal execution -- no
17
+ * separate planning daemon step.
18
+ *
19
+ * Returns an empty array when deliveries exist (already-scoped focuses
20
+ * behave exactly as today).
21
+ */
22
+ export function buildPlanningSection(context) {
23
+ if (context.deliveries.length > 0)
24
+ return [];
25
+ const lines = [];
26
+ lines.push('## Planning Is Your First Act');
27
+ lines.push('');
28
+ lines.push('This focus has NO deliveries yet. Before you write any code,');
29
+ lines.push('your job is to scope the work: decompose the focus intent into');
30
+ lines.push('deliveries, Context Groups, and issues using the MCP tools below.');
31
+ lines.push('');
32
+ lines.push('Once you have written deliveries to the database, the daemon picks');
33
+ lines.push('them up on its next poll cycle and you continue into normal execution.');
34
+ lines.push('Do NOT emit a JSON plan -- write directly to Telora via MCP.');
35
+ lines.push('');
36
+ lines.push('### Scale Calibration');
37
+ lines.push('');
38
+ lines.push('Keep your decomposition at the right granularity:');
39
+ lines.push('');
40
+ lines.push('- **Delivery** = a meaningful product increment that is shippable on its');
41
+ lines.push(' own. Each delivery should contain 3-5 Context Groups.');
42
+ lines.push('- **Context Group** = one coherent capability or concern. Typically');
43
+ lines.push(' carries 8-12 implementable issues. A CG earns its existence by');
44
+ lines.push(' carrying shared context (relevant files, architectural notes) that');
45
+ lines.push(' would otherwise be repeated across its issues.');
46
+ lines.push('- **Issue** = one implementable task that fits in a focused session and');
47
+ lines.push(' touches a bounded set of files (add a migration, build a component,');
48
+ lines.push(' write tests for a module). If a description has multiple "and" clauses');
49
+ lines.push(' covering different concerns, split it.');
50
+ lines.push('');
51
+ lines.push('Sizing pressure check: if a CG would produce fewer than 6 issues, merge');
52
+ lines.push('it with a related CG. If it would exceed 15 issues, split it. If a');
53
+ lines.push('natural delivery grouping has only 1-2 CGs, merge with an adjacent');
54
+ lines.push('delivery unless independence justifies the small delivery.');
55
+ lines.push('');
56
+ lines.push('### Dependency Rules');
57
+ lines.push('');
58
+ lines.push('When you set CG `depends_on` (via the `dependsOn` field on');
59
+ lines.push('telora_product_issue_create), follow these conventions:');
60
+ lines.push('');
61
+ lines.push('- **Schema / data-model CGs** have no dependencies (they come first).');
62
+ lines.push('- **API / backend CGs** depend on the schema CGs they consume.');
63
+ lines.push('- **Frontend CGs** depend on the API CGs they call.');
64
+ lines.push('- **Test CGs** depend on the implementation CGs they cover.');
65
+ lines.push('- **Infrastructure CGs** (CI, config, tooling) are independent unless');
66
+ lines.push(' they require a schema or API contract first.');
67
+ lines.push('');
68
+ lines.push('List only direct dependencies. If C depends on B which depends on A,');
69
+ lines.push('C should list only B (not A).');
70
+ lines.push('');
71
+ lines.push('### Ordering Heuristics (priorityRank)');
72
+ lines.push('');
73
+ lines.push('Lower `priorityRank` = higher priority = built first. Use these rules');
74
+ lines.push('when assigning ranks via telora_product_delivery_create or');
75
+ lines.push('telora_product_delivery_reorder:');
76
+ lines.push('');
77
+ lines.push('1. **Schema before readers/writers.** Migrations and data models go in');
78
+ lines.push(' earlier deliveries than CGs that query or mutate that data.');
79
+ lines.push('2. **Shared utilities before consumers.** Helper libraries and shared');
80
+ lines.push(' types precede CGs that import them.');
81
+ lines.push('3. **Backend / API before frontend.** Edge functions and server logic');
82
+ lines.push(' come before UI components that call them.');
83
+ lines.push('4. **Infrastructure before application.** CI, config, and tooling');
84
+ lines.push(' precede CGs that rely on them.');
85
+ lines.push('5. **Independent work parallelized.** Deliveries with no dependency');
86
+ lines.push(' relationship can share the same priorityRank so the daemon executes');
87
+ lines.push(' them in parallel. Only impose ordering when there is a genuine');
88
+ lines.push(' dependency reason.');
89
+ lines.push('');
90
+ lines.push('### How to Write the Plan via MCP');
91
+ lines.push('');
92
+ lines.push(`1. Read the focus intent (Focus ID: ${context.focusId}).`);
93
+ lines.push('2. Identify every coherent capability or concern. Group them into');
94
+ lines.push(' deliveries by cohesion (shared dependencies, overlapping files,');
95
+ lines.push(' same architectural layer).');
96
+ lines.push('3. For each delivery, call `telora_product_delivery_create` with:');
97
+ lines.push(` - productId: "${context.productId}"`);
98
+ lines.push(` - focusId: "${context.focusId}"`);
99
+ lines.push(' - name, description, acceptanceCriteria, techContext, priorityRank');
100
+ lines.push(' - executionStatus is optional. When omitted, the default tracks the');
101
+ lines.push(' parent focus stage (past planning -> "queued"; planning/draft -> "planning").');
102
+ lines.push(' Pass it explicitly only when you need to override that default.');
103
+ lines.push('4. For each Context Group inside a delivery, call');
104
+ lines.push(' `telora_product_issue_create` with:');
105
+ lines.push(' - issueType: "Context Group"');
106
+ lines.push(' - deliveryId: <new delivery id>');
107
+ lines.push(' - title, context (markdown), relevantFiles');
108
+ lines.push(' - dependsOn: array of other CG issue IDs (when applicable)');
109
+ lines.push('5. For each issue inside a CG, call `telora_product_issue_create` with:');
110
+ lines.push(' - issueType: "Task" (or "Bug" when fixing existing behavior)');
111
+ lines.push(' - deliveryId: <delivery id>');
112
+ lines.push(' - parentIssueId: <CG issue id>');
113
+ lines.push(' - title, description, priority');
114
+ lines.push('6. Once your plan is written, you can begin implementation immediately');
115
+ lines.push(' on the highest-priority delivery using the same Status Update Rules');
116
+ lines.push(' below. The daemon does NOT need to re-spawn you -- planning is part');
117
+ lines.push(' of the same execution.');
118
+ lines.push('');
119
+ lines.push('Do not ask for permission. The focus intent above is the ask;');
120
+ lines.push('your plan is the answer.');
121
+ lines.push('');
122
+ return lines;
123
+ }
124
+ /**
125
+ * Build the delivery listing sections: other deliveries (brief) + team deliveries (detailed).
126
+ *
127
+ * Partitions deliveries into team work (queued/coding) and other (human-owned).
128
+ * Renders issue counts, context groups, and standalone issues for team deliveries.
129
+ */
130
+ export function buildDeliveryListingSection(deliveries, issues) {
131
+ const lines = [];
132
+ const sortedDeliveries = [...deliveries].sort((a, b) => a.priorityRank - b.priorityRank);
133
+ // In-progress (coding) deliveries first -- resume interrupted work before pulling new
134
+ const codingDeliveries = sortedDeliveries.filter(d => d.executionStatus === 'coding');
135
+ const queuedDeliveries = sortedDeliveries.filter(d => d.executionStatus === 'queued');
136
+ const teamDeliveries = [...codingDeliveries, ...queuedDeliveries];
137
+ const otherDeliveries = sortedDeliveries.filter(d => !isStatusAgentActionable(d.executionStatus ?? ''));
138
+ // Other deliveries summary (brief -- saves context window)
139
+ if (otherDeliveries.length > 0) {
140
+ lines.push('## Other Deliveries (NOT your work)');
141
+ lines.push('');
142
+ lines.push('These deliveries are in human-owned states. Do NOT work on them.');
143
+ lines.push('');
144
+ for (const delivery of otherDeliveries) {
145
+ lines.push(`- **${delivery.name}** [${delivery.executionStatus}]`);
146
+ }
147
+ lines.push('');
148
+ }
149
+ // Team deliveries with full detail
150
+ lines.push('## Your Deliveries');
151
+ lines.push('');
152
+ if (teamDeliveries.length === 0) {
153
+ lines.push('No queued or in-progress deliveries. Poll for new queued deliveries.');
154
+ lines.push('');
155
+ }
156
+ else {
157
+ if (codingDeliveries.length > 0) {
158
+ lines.push(`**${codingDeliveries.length} in-progress delivery(ies) — resume these first.**`);
159
+ lines.push('These were interrupted (daemon restart). Complete them before pulling from the queue.');
160
+ lines.push('');
161
+ }
162
+ if (queuedDeliveries.length > 0) {
163
+ lines.push(`${queuedDeliveries.length} queued delivery(ies) waiting.`);
164
+ }
165
+ lines.push('Within each group, deliveries are in priority order (first = highest priority).');
166
+ lines.push('');
167
+ }
168
+ for (const delivery of teamDeliveries) {
169
+ const status = delivery.executionStatus ?? 'draft';
170
+ lines.push(`### ${delivery.name} [${status}]`);
171
+ lines.push(`**Delivery ID:** ${delivery.id}`);
172
+ if (delivery.stageDescription) {
173
+ lines.push(`**Stage directive:** ${delivery.stageDescription}`);
174
+ }
175
+ // Compact issue summary -- counts by status + one-liner per issue
176
+ const deliveryIssues = issues.filter(i => i.deliveryId === delivery.id);
177
+ const actionableIssues = deliveryIssues.filter(i => i.issueType !== 'Context Group');
178
+ const contextGroups = deliveryIssues.filter(i => i.issueType === 'Context Group');
179
+ const standalone = deliveryIssues.filter(i => i.issueType !== 'Context Group' && !i.parentIssueId);
180
+ // Issue count summary
181
+ if (actionableIssues.length > 0) {
182
+ lines.push(buildIssueCountLine(actionableIssues));
183
+ }
184
+ // Context groups with children as one-liners (include dependency info)
185
+ for (const group of contextGroups) {
186
+ lines.push(buildContextGroupLine(group, deliveryIssues, contextGroups));
187
+ }
188
+ // Standalone issues as one-liners
189
+ for (const issue of standalone) {
190
+ lines.push(buildStandaloneIssueLine(issue));
191
+ }
192
+ lines.push('');
193
+ }
194
+ return lines;
195
+ }
196
+ /**
197
+ * Build the mandatory status update rules section.
198
+ */
199
+ export function buildStatusUpdateRulesSection() {
200
+ return [
201
+ '## Status Update Rules (MANDATORY)',
202
+ '',
203
+ 'These rules apply to ALL work -- whether you do it directly or via spawned workers.',
204
+ '',
205
+ '**Focus status:**',
206
+ '- NEVER move a focus to "done" or "complete" status. Only the product owner decides when a focus is finished.',
207
+ '- You MAY update focus status to operational states like "building" or "verify".',
208
+ '',
209
+ '**Delivery status (HANDS OFF):**',
210
+ '- NEVER call `telora_product_delivery_update` to change `executionStatus`.',
211
+ '- The daemon manages ALL delivery stage transitions automatically:',
212
+ ' - queued -> coding: database trigger when first issue moves to "In Progress"',
213
+ ' - coding -> verify: daemon advances when all issues are Done / Verified / In Review',
214
+ ' - verify -> done: daemon advances after verification passes',
215
+ '- The API will REJECT invalid transitions with a 400 error.',
216
+ '- Your only job is to keep issue statuses accurate. Delivery status follows.',
217
+ '',
218
+ '**Issue status transitions:**',
219
+ '- Every issue MUST follow: To Do -> In Progress -> Done',
220
+ '- NEVER skip "In Progress". An issue MUST be set to "In Progress" BEFORE any',
221
+ ' work begins on it.',
222
+ '- NEVER move an issue directly from "To Do" to "Done".',
223
+ '- Use `telora_product_issue_update` with `issueId` and `status`:',
224
+ ' - Start work: `{ "issueId": "<id>", "status": "In Progress" }`',
225
+ ' - Finish work: `{ "issueId": "<id>", "status": "Done" }`',
226
+ ' - Blocked: `{ "issueId": "<id>", "status": "Blocked" }`',
227
+ ' - Hand off for review: `{ "issueId": "<id>", "status": "In Review" }` (optional verify gate)',
228
+ '',
229
+ '**Optional verify gate (In Review):**',
230
+ '- When the delivery pipeline includes a review agent, you can signal issue-level',
231
+ ' completion by moving issues to "In Review" instead of directly to "Done".',
232
+ '- "In Review" means: dev-complete, awaiting review-agent confirmation.',
233
+ '- The review agent\'s working set is all "In Review" issues on the delivery.',
234
+ '- The review agent moves issues from "In Review" to "Done" when confirmed.',
235
+ '- "In Review" is treated as terminal for delivery advancement: a delivery whose',
236
+ ' issues are all Done / Verified / In Review advances to the next stage.',
237
+ '- If the delivery closes before review runs, remaining "In Review" issues are',
238
+ ' automatically swept to "Done" -- no manual cleanup needed.',
239
+ '',
240
+ '**When working directly on an issue** (not spawning a worker):',
241
+ '1. Call `telora_product_issue_update` to set status to "In Progress"',
242
+ '2. Do the work',
243
+ '3. Call `telora_product_issue_update` to set status to "Done"',
244
+ '',
245
+ '**When spawning a worker for an issue:**',
246
+ '1. Set issue to "In Progress" BEFORE spawning the worker',
247
+ '2. When the worker completes, verify its output',
248
+ '3. Set issue to "Done" after verification',
249
+ '',
250
+ '**Completion artifacts (MANDATORY on close):**',
251
+ '- When you set an issue to "Done" or "In Review", you MUST also supply',
252
+ ' `completionArtifacts` listing the primary files the work produced or',
253
+ ' modified. Shape: `{ "files": ["src/foo.ts", "src/foo.test.ts"], "tests": [...] }`.',
254
+ '- Drift detection compares these references against the worktree on a',
255
+ ' schedule. Without them, drift cannot surface for this issue and the',
256
+ ' Done-work signal is unreliable.',
257
+ '- Use repo-relative paths (no leading slash, no `./`). Include test files',
258
+ ' under `files` or `tests` -- both are checked.',
259
+ '- Workers spawned via Task: when reporting completion, return the list of',
260
+ ' files you modified so the team lead can pass them through in the',
261
+ ' `issue_update` call.',
262
+ '- Example close call:',
263
+ ' `{ "issueId": "<id>", "status": "Done", "completionArtifacts": { "files": ["src/foo.ts"] } }`',
264
+ '',
265
+ ];
266
+ }
267
+ /**
268
+ * Build the execution instructions section (Phase 1: Setup).
269
+ */
270
+ export function buildExecutionInstructionsSection(productId) {
271
+ return [
272
+ '## Execution Instructions',
273
+ '',
274
+ '### Phase 1: Setup',
275
+ '1. **Verify MCP tools are available**: Call `telora_product_issue_list` with',
276
+ ` productId "${productId}" to confirm Telora MCP tools are loaded.`,
277
+ ' If the tool is not found, STOP and report this as an escalation — you cannot',
278
+ ' update issue statuses without MCP tools, which breaks the execution contract.',
279
+ '2. Read the CLAUDE.md file at the repo root for repository conventions',
280
+ '3. Review all deliveries and issues above to understand the full scope',
281
+ `4. Before starting work on each delivery, fetch its full details: use \`telora_product_delivery_list\` with productId "${productId}" and look for the delivery by ID to read its description, acceptance criteria, and technical context.`,
282
+ `5. Before working on a context group's issues, fetch the group's full context and relevant files using \`telora_product_issue_list\` with the delivery's ID.`,
283
+ `6. Use \`telora_product_issue_list\` with productId "${productId}" to get the latest issue states`,
284
+ '7. Plan your execution order:',
285
+ ' - Higher priority deliveries first (lower priorityRank number)',
286
+ ' - Within a delivery, issues under the same Context Group can be parallelized',
287
+ ' - Issues that share relevant files MUST be done sequentially',
288
+ ' - Context Groups with `depends on` annotations MUST execute in order:',
289
+ ' all issues under dependency CGs must complete before starting issues',
290
+ ' under the dependent CG. Independent CGs (no depends_on) can run in parallel.',
291
+ ' - Issues across different independent Context Groups with no file overlap can run in parallel',
292
+ ' - **Between deliveries**: After committing a delivery, run the full build and',
293
+ ' test suite (`npm run build && npm test`) before starting the next delivery.',
294
+ ' Fix any cross-delivery breakage immediately. This catches integration issues',
295
+ ' (e.g. renamed symbols, shifted phases) before they compound.',
296
+ '',
297
+ ];
298
+ }
299
+ /**
300
+ * Constraints on tool usage specific to a daemon-spawned team lead session.
301
+ *
302
+ * Background: ScheduleWakeup is documented for /loop dynamic mode (interactive
303
+ * self-paced sessions). Daemon-spawned teams are stream-json sessions; calling
304
+ * ScheduleWakeup produces no wake-up callback, the session idles, and the
305
+ * daemon sees no progress -- the team stalls indefinitely. Sleep loops have
306
+ * the same failure mode. The fix is at the prompt layer: tell the lead these
307
+ * tools do not apply here.
308
+ */
309
+ export function buildSessionConstraintsSection() {
310
+ return [
311
+ '### Session Constraints',
312
+ '',
313
+ 'You are a daemon-spawned team lead session, NOT an interactive `/loop` session.',
314
+ 'Several tools available to interactive sessions DO NOT apply here and will',
315
+ 'silently stall your team if you call them:',
316
+ '',
317
+ '- **DO NOT use `ScheduleWakeup`.** It is for `/loop` dynamic-mode sessions',
318
+ ' only. From a daemon-spawned session it produces no wake-up callback --',
319
+ ' the session idles, the daemon thinks the team is working, and your work',
320
+ ' halts indefinitely.',
321
+ '- **DO NOT use Sleep tools or sleep loops to wait for sub-agents.** The',
322
+ ' `Task` tool blocks synchronously and returns when the sub-agent completes.',
323
+ ' There is nothing to wait for explicitly -- when `Task` returns, the work',
324
+ ' is done. Calling Sleep between spawning and reading results is wrong and',
325
+ ' buys nothing.',
326
+ '- **DO NOT add narrated "sleeping ~X min" delays.** If you have nothing to',
327
+ ' do, simply finish the turn -- the daemon will reissue your prompt when',
328
+ ' there is more work, and your worktree state persists across that gap.',
329
+ '',
330
+ 'If a `Task` call is taking longer than expected, that is a signal to',
331
+ 'escalate via `telora_agent_escalate`, not to sleep. Sleep is never the',
332
+ 'answer in this session.',
333
+ '',
334
+ '#### Long-running shell commands (tests, builds, installs)',
335
+ '',
336
+ 'When you spawn a long-running bash command via `TaskCreate` / `Bash`,',
337
+ '`TaskOutput(block: true)` returns when the task produces new stdout, NOT',
338
+ 'when files written by the task change. If you redirect output to a file',
339
+ '(e.g. `npm test > /tmp/log 2>&1`), the bash command itself emits zero',
340
+ 'stdout until it exits -- so `TaskOutput` will time out indefinitely',
341
+ 'against a healthy, working run. You cannot tell hung from working.',
342
+ '',
343
+ 'For `npm test`, `npm run build`, `vitest run`, `tsc`, and similar long',
344
+ 'commands, do ONE of the following:',
345
+ '',
346
+ '- **Stream to stdout (preferred):** `npm test` -- no redirect. TaskOutput',
347
+ ' will return per-file progress as it streams.',
348
+ '- **Stream AND log:** `npm test 2>&1 | tee /tmp/test.log` -- stdout streams,',
349
+ ' full transcript is saved.',
350
+ '',
351
+ 'NEVER redirect long-running stdout to a file with `>` alone. If you find',
352
+ 'yourself calling `TaskOutput` repeatedly and getting `<status>running</status>`',
353
+ 'with no diff in retrieved output, that is the signal you redirected stdout',
354
+ 'away from the task. Cancel via `TaskStop`, re-spawn without `>`, and try again.',
355
+ '',
356
+ ];
357
+ }
358
+ export function buildWorkerManagementSection(maxWorkers, engineId) {
359
+ const vocab = orchestrationVocabulary(engineId);
360
+ return [
361
+ '### Phase 2: Worker Management',
362
+ '',
363
+ ...vocab.workerMechanism.split('\n'),
364
+ ...vocab.caveat,
365
+ '',
366
+ '**Spawning workers:**',
367
+ `- Spawn up to ${maxWorkers} workers at a time`,
368
+ '- Only spawn workers for issues that are currently unblocked (all dependencies complete)',
369
+ '- Each worker receives a clear prompt with:',
370
+ ' - The issue key, title, and description',
371
+ ' - Context from the parent Context Group (if any)',
372
+ ' - Relevant files to focus on',
373
+ " - The delivery's Now->Target differential (see below)",
374
+ ' - Instructions to update issue status via `telora_product_issue_update`',
375
+ ' - Instructions to commit work and report completion',
376
+ '',
377
+ '**Equip each worker with its delivery\'s Now->Target at spawn:**',
378
+ 'You hold the focus Coordination Map and the Per-Delivery Index. The daemon',
379
+ 'does NOT push each delivery\'s full differential into your context, and it',
380
+ 'cannot inject a worker directly -- only you can author a worker\'s prompt. So',
381
+ 'when you spawn a worker for a delivery, equipping it is YOUR job:',
382
+ '1. Find that delivery\'s line in the Per-Delivery Index. The line names its',
383
+ ' pull handle: `telora_reality_tree_injection_context(seq=<injection seq>)`.',
384
+ '2. Call that pull handle to fetch the delivery\'s full Now->Target differential',
385
+ ' (the targeted UDEs and the desired effects they become).',
386
+ '3. Embed that differential in the worker\'s task prompt, so the worker begins',
387
+ ' its delivery holding its start->end context -- where the work starts (the',
388
+ ' current UDEs) and where it ends (the FRT desired effects).',
389
+ 'A worker must never begin a delivery without its Now->Target. The Index is the',
390
+ 'source of the pull handle; the differential is delivered at spawn, once, to the',
391
+ 'worker actually doing the work.',
392
+ '',
393
+ '**Worker lifecycle:**',
394
+ '- Before spawning: set issue status to "In Progress" via `telora_product_issue_update`',
395
+ '- When worker completes: verify its work, then set issue status to "Done"',
396
+ '- When worker fails: assess the failure, either retry or set issue to "Blocked"',
397
+ ' and create an escalation via `telora_agent_escalate`',
398
+ '- After each worker completion, check if new issues are now unblocked',
399
+ '',
400
+ '**Scaling rules:**',
401
+ '- Count unblocked issues (status "To Do" with no blocking dependencies)',
402
+ `- Active workers = min(unblocked count, ${maxWorkers})`,
403
+ '- As workers complete tasks and new tasks become unblocked, spawn more workers',
404
+ '- When no unblocked work remains, wait for in-progress workers to finish',
405
+ '',
406
+ '**Simple issues (no parallelism needed):**',
407
+ '- If a delivery has only 1-2 small issues, you can work on them directly',
408
+ ' instead of spawning workers. Use your judgment.',
409
+ '- IMPORTANT: Even when working directly, you MUST still update issue status.',
410
+ ' Set to "In Progress" before starting, then "Done" when complete.',
411
+ '',
412
+ ];
413
+ }
414
+ /**
415
+ * Build the delivery stage progression section (Phase 3 / TEL-5).
416
+ */
417
+ export function buildDeliveryStageProgressionSection() {
418
+ return [
419
+ '### Phase 3: Delivery Stage Progression',
420
+ '',
421
+ 'Delivery stages advance **automatically** based on issue activity:',
422
+ '',
423
+ '- When an issue moves to "In Progress", the parent delivery auto-advances',
424
+ ' from "queued" to "coding" via a database trigger. You do NOT need to',
425
+ ' update delivery status manually for this transition.',
426
+ '- Track issue completion per delivery using `telora_product_issue_list`.',
427
+ '',
428
+ '**When ALL issues in a delivery are Done:**',
429
+ '1. Commit all changes for the delivery',
430
+ '2. The daemon will automatically advance the delivery from coding to verify',
431
+ '3. Do NOT attempt to update the delivery executionStatus yourself',
432
+ '',
433
+ '**Delivery status reporting:**',
434
+ '- The daemon manages ALL delivery stage transitions. Do NOT update them.',
435
+ '- queued -> coding: handled automatically by database trigger (no action needed).',
436
+ '- coding -> verify -> done: handled automatically by the daemon.',
437
+ '- Focus on keeping issue statuses accurate -- the delivery status follows from them.',
438
+ '',
439
+ ];
440
+ }
441
+ /**
442
+ * Build the scoping mandate section.
443
+ *
444
+ * A delivery in queued status cannot transition to coding without at least
445
+ * one Task or Bug issue. The DB trigger blocks the transition outright; this
446
+ * section makes the requirement visible to the team lead so it does not waste
447
+ * a turn discovering it through a 400 response.
448
+ */
449
+ export function buildScopingMandateSection() {
450
+ return [
451
+ '### Scoping Mandate',
452
+ '',
453
+ 'When you start work on a queued delivery, your first act is to read its',
454
+ 'acceptance criteria and create issues for it via',
455
+ '`telora_product_issue_create` (issueType: "Task" or "Bug"). Do not begin',
456
+ 'code work without at least one Task or Bug issue scoped on the delivery --',
457
+ 'the daemon will reject the queued -> coding transition if no Task/Bug',
458
+ 'issues exist (a Context Group alone does NOT satisfy the requirement).',
459
+ '',
460
+ 'If you receive an error like "Delivery <id> cannot transition to coding:',
461
+ 'requires at least one Task or Bug issue", create the missing issues for',
462
+ 'that delivery, then move the first issue to "In Progress" -- the database',
463
+ 'trigger will advance the delivery from queued to coding automatically.',
464
+ '',
465
+ ];
466
+ }
467
+ /**
468
+ * Build the rescoping and splitting deliveries section.
469
+ */
470
+ export function buildRescopingSection(focusId, productId) {
471
+ return [
472
+ '### Rescoping and Splitting Deliveries',
473
+ '',
474
+ 'You are encouraged to restructure work as you learn more about the codebase. If a delivery is larger than expected, split it. If an issue is unnecessary, close it. If you discover new work, create issues for it.',
475
+ '',
476
+ '**Splitting a delivery:**',
477
+ `1. Create new deliveries via telora_product_delivery_create (same focusId: "${focusId}", productId: "${productId}")`,
478
+ '2. Create issues under the new deliveries via telora_product_issue_create',
479
+ "3. Mark the original delivery's remaining issues as Done (if moved) or close as won't-do",
480
+ '4. The daemon will automatically pick up new deliveries',
481
+ '',
482
+ '**Adding issues:**',
483
+ '- Create new issues on any delivery you are working on via telora_product_issue_create',
484
+ "- Set status to 'To Do' -- they will be picked up in your current execution",
485
+ '',
486
+ '**Descoping issues:**',
487
+ "- Mark issues as Done with a description note explaining why they were descoped (e.g., 'Descoped: not needed because X')",
488
+ '- Do not leave orphan issues -- always update status',
489
+ "- Known limitation: there is no 'Won't Do' status. Using Done with a note is the convention for now. The description note is important for audit trail.",
490
+ '',
491
+ '**Do not ask for permission to rescope.** Restructure autonomously based on what you learn.',
492
+ '',
493
+ '**Acceptance criteria you write must be agent-satisfiable.** Whenever you',
494
+ 'create or rescope a delivery -- and whenever you create or update an issue --',
495
+ 'every acceptance / completion criterion must be checkable purely by',
496
+ 'inspecting the worktree: files exist, code matches a pattern, tests pass,',
497
+ 'lint clean. Criteria are NEVER allowed to require:',
498
+ '',
499
+ '- Runtime observation in production ("loop has run for N cycles", "no errors in 24h")',
500
+ '- Deployment access or external system state ("flag flipped in production")',
501
+ '- Operator judgment ("approved by stakeholder", "operators have seen X")',
502
+ '- Third-party live signals ("API returns expected shape live")',
503
+ '- Human verification of any kind that is not a code/test artifact',
504
+ '',
505
+ 'If a delivery legitimately requires runtime/operator observation, **split it**:',
506
+ 'the code-completable half stays as the agent delivery; the observation half',
507
+ 'goes to a separate delivery with no agent role assigned, OR becomes a step in',
508
+ 'a runbook that the operator follows after deployment. Your job is to author',
509
+ 'the runbook, not perform the observation.',
510
+ '',
511
+ 'Why this matters: a team given an unsatisfiable criterion tries, fails, and',
512
+ "the daemon's scope-coverage guard trips after 3 cycles of no progress. The",
513
+ 'daemon escalates and respawns; the new team hits the same wall. The loop',
514
+ 'burns cycles and cost forever until the criterion is rewritten. Prevent this',
515
+ 'by checking, before you save: "can a worker prove this from `git status`,',
516
+ '`npm run lint`, and `npm test` alone?" If no, split.',
517
+ '',
518
+ ];
519
+ }
520
+ /**
521
+ * Build the new work delivery section (Phase 5 -- daemon-push model).
522
+ */
523
+ export function buildNewWorkDeliverySection() {
524
+ return [
525
+ '### Phase 5: New Work Delivery',
526
+ '',
527
+ 'You do NOT need to poll for new work. The daemon monitors for new deliveries',
528
+ 'and will send them to you directly via a "New Work Available" message.',
529
+ '',
530
+ 'When you receive a "New Work Available" message:',
531
+ '1. Read the new deliveries and their issues listed in the message',
532
+ '2. Integrate them into your execution plan respecting priority ordering',
533
+ '3. Higher priority deliveries go next, but do not preempt in-progress work',
534
+ '4. Stop any pending work for cancelled deliveries',
535
+ '',
536
+ 'Do NOT call `telora_product_delivery_list` to poll for new deliveries.',
537
+ 'The daemon is the sole control plane and will push work to you when available.',
538
+ '',
539
+ ];
540
+ }
541
+ /**
542
+ * Build the error handling and escalation section (TEL-6).
543
+ */
544
+ export function buildErrorHandlingSection() {
545
+ return [
546
+ '### Error Handling',
547
+ '',
548
+ '- **Worker failure**: If a worker fails on an issue, assess whether to retry',
549
+ ' or escalate. Set the issue to "Blocked" and use `telora_agent_escalate`',
550
+ ' if the issue requires human intervention.',
551
+ '- **Build/test failures**: Fix them before moving on. If you cannot fix them,',
552
+ ' escalate with details about what failed.',
553
+ '- **Merge conflicts**: If you encounter merge conflicts during commits,',
554
+ ' resolve them and continue. If resolution is unclear, escalate.',
555
+ '- **Discovered work**: If you find work not covered by existing issues,',
556
+ ' create new issues using `telora_product_issue_create` under the relevant delivery.',
557
+ '',
558
+ ];
559
+ }
560
+ /**
561
+ * Build the merge conflict resolution protocol section.
562
+ */
563
+ export function buildMergeConflictSection() {
564
+ return [
565
+ '### Merge Conflict Resolution',
566
+ '',
567
+ 'During your session, you may receive a message asking you to resolve merge',
568
+ 'conflicts. This means the integration branch has changes that conflict with',
569
+ 'your focus branch. When you receive this:',
570
+ '',
571
+ '1. Open each conflicted file listed in the message',
572
+ '2. Resolve all conflict markers (<<<<<<< / ======= / >>>>>>>)',
573
+ '3. Stage each resolved file with `git add <file>`',
574
+ '4. Commit the merge resolution: `git commit --no-edit`',
575
+ '5. Run: `npm run build && npm test`',
576
+ '6. If build+test fails, fix the issues, commit, and re-run',
577
+ '',
578
+ 'Do NOT run `git merge --abort`. Your goal is to produce a clean merge',
579
+ 'commit that passes build and tests. The daemon will detect resolution',
580
+ 'automatically when the merge commit is created and no unmerged files remain.',
581
+ '',
582
+ ];
583
+ }
584
+ /**
585
+ * Build the completion section.
586
+ */
587
+ export function buildCompletionSection() {
588
+ return [
589
+ '### Completion',
590
+ '',
591
+ 'When ALL issues across ALL deliveries are Done:',
592
+ '1. Run a final build and test to verify everything works together',
593
+ '2. Commit any final changes',
594
+ '3. Summarize the changes made across all deliveries',
595
+ '4. Wait for further instructions. The daemon manages your lifecycle.',
596
+ '',
597
+ 'Do NOT exit on your own. The daemon will send new work or terminate you.',
598
+ '',
599
+ ];
600
+ }
601
+ //# sourceMappingURL=execution-sections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-sections.js","sourceRoot":"","sources":["../../src/prompt-sections/execution-sections.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,uBAAuB,EAA+B,MAAM,aAAa,CAAC;AAEnF;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAA+B;IAE/B,IAAI,OAAO,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAE7C,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,+BAA+B,CAAC,CAAC;IAC5C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACf,KAAK,CAAC,IAAI,CAAC,8DAA8D,CAAC,CAAC;IAC3E,KAAK,CAAC,IAAI,CAAC,gEAAgE,CAAC,CAAC;IAC7E,K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