@papi-ai/server 0.7.4-alpha.4 → 0.7.6
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/dist/index.js +590 -138
- package/dist/prompts.js +29 -4
- package/package.json +1 -1
package/dist/prompts.js
CHANGED
|
@@ -201,7 +201,7 @@ Standard planning cycle with full board review.
|
|
|
201
201
|
- **What to do with premature tasks:** Leave them in Backlog. Do NOT generate BUILD HANDOFFs for them. If a high-priority task fails the maturity gate due to phase prerequisites or dependencies, note it in the cycle log: "task-XXX deferred \u2014 Phase N prerequisites not met". Raw tasks are NOT premature \u2014 they just need scoping (see Task maturity above).
|
|
202
202
|
|
|
203
203
|
7. **Recommendation** \u2014 Select tasks for this cycle:
|
|
204
|
-
**Pre-assigned tasks:** If a "Pre-Assigned Tasks" section is provided in the context below, those tasks are ALREADY committed to this cycle by the user. Include them automatically \u2014 do NOT re-evaluate whether they belong. Generate BUILD HANDOFFs for each. Count their effort toward the cycle budget. Then fill remaining slots
|
|
204
|
+
**Pre-assigned tasks:** If a "Pre-Assigned Tasks" section is provided in the context below, those tasks are ALREADY committed to this cycle by the user. Include them automatically \u2014 do NOT re-evaluate whether they belong. Generate BUILD HANDOFFs for each. Count their effort toward the cycle budget. Then fill remaining slots from the backlog using the priority rules and cycle sizing rules below.
|
|
205
205
|
**If USER DIRECTION is provided above:** Follow the user's stated focus. Pick the highest-impact task that aligns with their direction. The user knows what they need. Only deviate if a genuine P0 Critical fix exists (broken builds, data loss).
|
|
206
206
|
**Otherwise, select by priority level then impact:**
|
|
207
207
|
- **P0 Critical** \u2014 Broken, blocking, or data-loss risk. Always first.
|
|
@@ -225,7 +225,7 @@ Standard planning cycle with full board review.
|
|
|
225
225
|
- **Backlog as steering wheel:** Task priority and notes in the backlog are the user's primary control mechanism over what gets planned. Respect the priority rankings and read task notes carefully \u2014 they contain user intent that shapes scope and scheduling.
|
|
226
226
|
- **Planning quality is the bar:** Strategy review depth and plan quality set the standard for the product. Do not cut corners on analysis depth, triage thoroughness, or handoff specificity \u2014 these are what users experience as PAPI's value.
|
|
227
227
|
|
|
228
|
-
10. **BUILD HANDOFFs** \u2014 Generate a full BUILD HANDOFF block for
|
|
228
|
+
10. **BUILD HANDOFFs** \u2014 Generate a full BUILD HANDOFF block for every task selected for this cycle. Include each handoff in the \`cycleHandoffs\` array in the structured output. The handoffs are written to each task on the board for durability.
|
|
229
229
|
**SKIP existing handoffs:** Tasks marked with "Has BUILD HANDOFF: yes" or "\u2713 handoff" on the board already have a valid handoff from a previous plan. Do NOT regenerate handoffs for these tasks \u2014 omit them from the \`cycleHandoffs\` array entirely. Only generate handoffs for tasks that do NOT have one yet. Exception: if a task's dependencies have been completed since its handoff was written, or a relevant Active Decision has changed, you MAY regenerate its handoff \u2014 but note this explicitly in the cycle log.
|
|
230
230
|
**Scope pre-check:** Before writing the SCOPE section of each handoff, cross-reference the task against the "Recently Shipped Capabilities" section in the context below (if present). For each candidate task: (1) check if the task's title or scope overlaps with any recently shipped task, (2) check if the FILES LIKELY TOUCHED overlap with files already modified in recent builds, (3) check the architecture notes from recent builds for patterns that already cover this task's scope. If >80% of a task's scope appears in recently shipped capabilities, recommend cancellation via \`boardCorrections\` or reduce the handoff scope to only the missing pieces \u2014 explicitly note what already exists. C126 task-728 was over-scoped because the planner assumed Blocked status needed creating from scratch \u2014 it already existed in types, DB, orient, and build_list. Over-scoped handoffs waste builder time on verification and cause estimation mismatches.
|
|
231
231
|
**Simplest Viable Path rule:** Before writing each BUILD HANDOFF, identify the simplest approach that satisfies the task's goal \u2014 the minimum change, fewest new abstractions, and smallest blast radius. Write the SCOPE (DO THIS) section for that simplest path FIRST. If you believe a more complex approach is warranted (new abstractions, multi-file refactors, framework changes), you MUST include a "WHY NOT SIMPLER" line in the handoff explaining why the simple path is insufficient. If you cannot articulate a concrete reason, use the simpler path. Pay special attention to tasks involving auth, data access, multi-user features, and infrastructure \u2014 these are the most common over-engineering targets.
|
|
@@ -388,7 +388,7 @@ Standard planning cycle with full board review.
|
|
|
388
388
|
- **What to do with premature tasks:** Leave them in Backlog. Do NOT generate BUILD HANDOFFs for them. If a high-priority task fails the maturity gate due to phase prerequisites or dependencies, note it in the cycle log: "task-XXX deferred \u2014 Phase N prerequisites not met". Raw tasks are NOT premature \u2014 they just need scoping (see Task maturity above).
|
|
389
389
|
|
|
390
390
|
7. **Recommendation** \u2014 Select tasks for this cycle:
|
|
391
|
-
**Pre-assigned tasks:** If a "Pre-Assigned Tasks" section is provided in the context below, those tasks are ALREADY committed to this cycle by the user. Include them automatically \u2014 do NOT re-evaluate whether they belong. Generate BUILD HANDOFFs for each. Count their effort toward the cycle budget. Then fill remaining slots
|
|
391
|
+
**Pre-assigned tasks:** If a "Pre-Assigned Tasks" section is provided in the context below, those tasks are ALREADY committed to this cycle by the user. Include them automatically \u2014 do NOT re-evaluate whether they belong. Generate BUILD HANDOFFs for each. Count their effort toward the cycle budget. Then fill remaining slots from the backlog using the priority rules and cycle sizing rules below.
|
|
392
392
|
**If USER DIRECTION is provided above:** Follow the user's stated focus. Pick the highest-impact task that aligns with their direction. The user knows what they need. Only deviate if a genuine P0 Critical fix exists (broken builds, data loss).
|
|
393
393
|
**Otherwise, select by priority level then impact:**
|
|
394
394
|
- **P0 Critical** \u2014 Broken, blocking, or data-loss risk. Always first.
|
|
@@ -412,7 +412,7 @@ Standard planning cycle with full board review.
|
|
|
412
412
|
- **Backlog as steering wheel:** Task priority and notes in the backlog are the user's primary control mechanism over what gets planned. Respect the priority rankings and read task notes carefully \u2014 they contain user intent that shapes scope and scheduling.
|
|
413
413
|
- **Planning quality is the bar:** Strategy review depth and plan quality set the standard for the product. Do not cut corners on analysis depth, triage thoroughness, or handoff specificity \u2014 these are what users experience as PAPI's value.
|
|
414
414
|
|
|
415
|
-
10. **BUILD HANDOFFs** \u2014 Generate a full BUILD HANDOFF block for
|
|
415
|
+
10. **BUILD HANDOFFs** \u2014 Generate a full BUILD HANDOFF block for every task selected for this cycle. Include each handoff in the \`cycleHandoffs\` array in the structured output. The handoffs are written to each task on the board for durability.
|
|
416
416
|
**SKIP existing handoffs:** Tasks marked with "Has BUILD HANDOFF: yes" or "\u2713 handoff" on the board already have a valid handoff from a previous plan. Do NOT regenerate handoffs for these tasks \u2014 omit them from the \`cycleHandoffs\` array entirely. Only generate handoffs for tasks that do NOT have one yet. Exception: if a task's dependencies have been completed since its handoff was written, or a relevant Active Decision has changed, you MAY regenerate its handoff \u2014 but note this explicitly in the cycle log.
|
|
417
417
|
**Scope pre-check:** Before writing the SCOPE section of each handoff, cross-reference the task against the "Recently Shipped Capabilities" section in the context below (if present). For each candidate task: (1) check if the task's title or scope overlaps with any recently shipped task, (2) check if the FILES LIKELY TOUCHED overlap with files already modified in recent builds, (3) check the architecture notes from recent builds for patterns that already cover this task's scope. If >80% of a task's scope appears in recently shipped capabilities, recommend cancellation via \`boardCorrections\` or reduce the handoff scope to only the missing pieces \u2014 explicitly note what already exists. C126 task-728 was over-scoped because the planner assumed Blocked status needed creating from scratch \u2014 it already existed in types, DB, orient, and build_list. Over-scoped handoffs waste builder time on verification and cause estimation mismatches.
|
|
418
418
|
**Simplest Viable Path rule:** Before writing each BUILD HANDOFF, identify the simplest approach that satisfies the task's goal \u2014 the minimum change, fewest new abstractions, and smallest blast radius. Write the SCOPE (DO THIS) section for that simplest path FIRST. If you believe a more complex approach is warranted (new abstractions, multi-file refactors, framework changes), you MUST include a "WHY NOT SIMPLER" line in the handoff explaining why the simple path is insufficient. If you cannot articulate a concrete reason, use the simpler path. Pay special attention to tasks involving auth, data access, multi-user features, and infrastructure \u2014 these are the most common over-engineering targets.
|
|
@@ -471,6 +471,24 @@ function buildPlanUserMessage(ctx) {
|
|
|
471
471
|
}) : PLAN_FULL_INSTRUCTIONS;
|
|
472
472
|
parts.push(instructions);
|
|
473
473
|
}
|
|
474
|
+
if (ctx.skipHandoffs) {
|
|
475
|
+
parts.push(
|
|
476
|
+
"",
|
|
477
|
+
"## SKIP HANDOFFS MODE",
|
|
478
|
+
"",
|
|
479
|
+
"**IMPORTANT OVERRIDE:** Do NOT generate BUILD HANDOFF blocks in this plan run.",
|
|
480
|
+
"Select tasks for the cycle using all the normal criteria (Steps 1-7), but SKIP Step 10 (BUILD HANDOFFs) entirely.",
|
|
481
|
+
"",
|
|
482
|
+
"In your Part 2 structured output:",
|
|
483
|
+
"- Set `cycleHandoffs` to an EMPTY array `[]`",
|
|
484
|
+
'- Add a `cycleTaskIds` array with the task IDs you selected for the cycle: `["task-123", "task-456", ...]`',
|
|
485
|
+
"- All other fields (cycleLogTitle, cycleLogContent, newTasks, boardCorrections, activeDecisions, etc.) work as normal.",
|
|
486
|
+
"",
|
|
487
|
+
"BUILD HANDOFFs will be generated separately via `handoff_generate` after this plan completes.",
|
|
488
|
+
"This reduces your cognitive load \u2014 focus on triage, selection, and board management only.",
|
|
489
|
+
""
|
|
490
|
+
);
|
|
491
|
+
}
|
|
474
492
|
parts.push("", "---", "", "## PROJECT CONTEXT", "");
|
|
475
493
|
parts.push("### Product Brief", "", ctx.productBrief, "");
|
|
476
494
|
if (ctx.northStar) {
|
|
@@ -647,6 +665,7 @@ function coerceStructuredOutput(parsed) {
|
|
|
647
665
|
id: coerceToString(ad.id),
|
|
648
666
|
body: coerceToString(ad.body)
|
|
649
667
|
})) : [];
|
|
668
|
+
const cycleTaskIds = Array.isArray(parsed.cycleTaskIds) ? parsed.cycleTaskIds.map((id) => coerceToString(id)) : void 0;
|
|
650
669
|
return {
|
|
651
670
|
cycleLogTitle: coerceToString(parsed.cycleLogTitle),
|
|
652
671
|
cycleLogContent: coerceToString(parsed.cycleLogContent),
|
|
@@ -657,6 +676,7 @@ function coerceStructuredOutput(parsed) {
|
|
|
657
676
|
strategicDirection: coerceToString(parsed.strategicDirection),
|
|
658
677
|
recommendedTaskId: parsed.recommendedTaskId === null ? null : coerceToString(parsed.recommendedTaskId),
|
|
659
678
|
cycleHandoffs,
|
|
679
|
+
cycleTaskIds,
|
|
660
680
|
newTasks,
|
|
661
681
|
boardCorrections,
|
|
662
682
|
productBrief: parsed.productBrief === null ? null : coerceToString(parsed.productBrief),
|
|
@@ -734,6 +754,8 @@ You MUST cover these 5 sections. Each is mandatory.
|
|
|
734
754
|
- Note any hierarchy/phase issues worth correcting (1-2 bullets max)
|
|
735
755
|
- Delete ADs that are legacy, process-level, or redundant without discussion
|
|
736
756
|
|
|
757
|
+
**Registered Documents:** If a "### Registered Documents" section is present in context, scan it for: (a) research findings that contradict current ADs or strategy, (b) unactioned research that should influence the next plan. Reference relevant docs by title in your review. If unregistered docs are listed, flag 1-2 that look strategically relevant and suggest registering them.
|
|
758
|
+
|
|
737
759
|
## CONDITIONAL SECTIONS (include only when genuinely useful \u2014 most reviews should have 0-2 of these)
|
|
738
760
|
|
|
739
761
|
6. **Security Posture Review** \u2014 Only if \`[SECURITY]\` tags exist in recent cycle logs.
|
|
@@ -954,6 +976,9 @@ function buildReviewUserMessage(ctx) {
|
|
|
954
976
|
if (ctx.taskComments) {
|
|
955
977
|
parts.push("### Task Discussion (Recent Comments)", "", ctx.taskComments, "");
|
|
956
978
|
}
|
|
979
|
+
if (ctx.docActionStaleness) {
|
|
980
|
+
parts.push("### Doc Action Staleness", "", ctx.docActionStaleness, "");
|
|
981
|
+
}
|
|
957
982
|
return parts.join("\n");
|
|
958
983
|
}
|
|
959
984
|
function parseReviewStructuredOutput(raw) {
|
package/package.json
CHANGED