@rallycry/conveyor-agent 11.0.0 → 11.0.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.
@@ -7091,8 +7091,11 @@ function formatTaskFile(file) {
7091
7091
  }
7092
7092
  function formatChatHistory(chatHistory, limit) {
7093
7093
  const relevant = chatHistory.slice(-(limit ?? PM_CHAT_HISTORY_LIMIT));
7094
- const parts = [`
7095
- ## Recent Chat Context`];
7094
+ const parts = [
7095
+ `
7096
+ ## New Messages`,
7097
+ `Posted since this card's last agent turn. For the rest of the conversation call \`mcp__conveyor__read_task_chat\`.`
7098
+ ];
7096
7099
  for (const msg of relevant) {
7097
7100
  const sender = msg.userName ?? msg.role;
7098
7101
  parts.push(`[${sender}]: ${msg.content}`);
@@ -7703,6 +7706,9 @@ function truncatePlanForPrompt(plan) {
7703
7706
  }
7704
7707
 
7705
7708
  // src/execution/pm-relaunch-instructions.ts
7709
+ function branchLine(context) {
7710
+ return `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`;
7711
+ }
7706
7712
  function resolvePmRelaunchIntent(context, isAuto, agentMode) {
7707
7713
  switch (agentMode) {
7708
7714
  case "building":
@@ -7725,24 +7731,14 @@ function buildRelaunchMessageSummary(context, lastAgentIdx) {
7725
7731
  ...newMessages.map((m) => `[${m.userName ?? "user"}]: ${m.content}`)
7726
7732
  ];
7727
7733
  }
7728
- function buildPmBuildRelaunchParts(context, isAuto) {
7729
- const parts = [
7734
+ function buildPmBuildRelaunchParts(context) {
7735
+ return [
7730
7736
  `
7731
- Your plan has been approved. Begin implementing it now.`,
7732
- `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`,
7733
- `Start by reading the relevant source files mentioned in the plan, then write code.`,
7737
+ Your plan has been approved \u2014 you are the Builder on this card now.`,
7738
+ ...buildSkillInvocation("/conveyor-build"),
7739
+ branchLine(context),
7734
7740
  `When finished, use the mcp__conveyor__create_pull_request tool to open a PR. Do NOT use gh CLI.`
7735
7741
  ];
7736
- if (isAuto) {
7737
- parts.push(
7738
- `
7739
- CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or go idle without making code changes.`,
7740
- `Your FIRST action must be reading source files from the plan, then immediately writing code.`,
7741
- `Do NOT summarize the plan or say "ready to implement" \u2014 start implementing.`,
7742
- `If you are genuinely blocked, explain the specific blocker \u2014 do not go idle silently.`
7743
- );
7744
- }
7745
- return parts;
7746
7742
  }
7747
7743
  function buildPmReviewRelaunchParts() {
7748
7744
  return [
@@ -7754,20 +7750,21 @@ Resume reviewing and coordinating this task.`,
7754
7750
  `Do not implement code directly or create a new PR from the PM review session.`
7755
7751
  ];
7756
7752
  }
7757
- function buildPmAutoWithPlanRelaunchParts() {
7753
+ function buildPmAutoWithPlanRelaunchParts(context) {
7758
7754
  return [
7759
7755
  `
7760
- You are in auto mode. A plan already exists for this task.`,
7761
- `Begin implementing it now \u2014 refine story points, title, and tags via update_task_properties if they look like placeholders.`,
7762
- `Do NOT wait for team input \u2014 proceed autonomously.`
7756
+ A plan already exists for this card \u2014 you are the Builder on it.`,
7757
+ ...buildSkillInvocation("/conveyor-build"),
7758
+ branchLine(context)
7763
7759
  ];
7764
7760
  }
7765
- function buildPmAutoPlanningRelaunchParts() {
7761
+ function buildPmAutoPlanningRelaunchParts(context) {
7766
7762
  return [
7767
7763
  `
7768
- You are in auto mode. Continue building autonomously.`,
7769
- `No plan is saved on this card yet \u2014 save a concise plan with update_task before writing further code; never pause or wait for approval.`,
7770
- `Do NOT wait for team input \u2014 proceed autonomously.`
7764
+ No plan is saved on this card yet.`,
7765
+ ...buildSkillInvocation("/conveyor-plan"),
7766
+ `Save it with update_task, then continue with \`/conveyor-build\`.`,
7767
+ branchLine(context)
7771
7768
  ];
7772
7769
  }
7773
7770
  function buildPmWaitForTeamRelaunchParts() {
@@ -7781,10 +7778,10 @@ function buildPmRelaunchParts(context, lastAgentIdx, isAuto, agentMode) {
7781
7778
  const parts = buildRelaunchMessageSummary(context, lastAgentIdx);
7782
7779
  const intent = resolvePmRelaunchIntent(context, isAuto, agentMode);
7783
7780
  const intentPartsByIntent = {
7784
- ["build" /* Build */]: () => buildPmBuildRelaunchParts(context, isAuto),
7781
+ ["build" /* Build */]: () => buildPmBuildRelaunchParts(context),
7785
7782
  ["review" /* Review */]: buildPmReviewRelaunchParts,
7786
- ["auto_with_plan" /* AutoWithPlan */]: buildPmAutoWithPlanRelaunchParts,
7787
- ["auto_planning" /* AutoPlanning */]: buildPmAutoPlanningRelaunchParts,
7783
+ ["auto_with_plan" /* AutoWithPlan */]: () => buildPmAutoWithPlanRelaunchParts(context),
7784
+ ["auto_planning" /* AutoPlanning */]: () => buildPmAutoPlanningRelaunchParts(context),
7788
7785
  ["wait_for_team" /* WaitForTeam */]: buildPmWaitForTeamRelaunchParts
7789
7786
  };
7790
7787
  parts.push(...intentPartsByIntent[intent]());
@@ -7975,6 +7972,7 @@ function branchRule(context, forReview = false) {
7975
7972
  return forReview ? `Work on the git branch "${context.githubBranch}". Stay on this branch for the entire review. Do not checkout or create other branches.` : `Work on the git branch "${context.githubBranch}". Stay on this branch \u2014 do not checkout or create other branches.`;
7976
7973
  }
7977
7974
  function newMessagesBlock(messages) {
7975
+ if (messages.length === 0) return [];
7978
7976
  return [
7979
7977
  `
7980
7978
  New messages since your last run:`,
@@ -7984,6 +7982,25 @@ New messages since your last run:`,
7984
7982
  function pullRequestLine(context) {
7985
7983
  return context.githubPRUrl ? `An existing PR is open at ${context.githubPRUrl} \u2014 push to the same branch to update it. Do NOT create a new PR.` : `When finished, use the mcp__conveyor__create_pull_request tool to open a PR. Do NOT use gh CLI or any other method to create PRs.`;
7986
7984
  }
7985
+ function isPlanningSession(mode, agentMode, isAuto) {
7986
+ if (mode === "plan") return true;
7987
+ if (agentMode === "discovery" || agentMode === "help") return true;
7988
+ if (mode !== "pm") return false;
7989
+ return !(agentMode === "building" || agentMode === "auto" || !!isAuto);
7990
+ }
7991
+ function builderKickoff(context, role) {
7992
+ const parts = [role, ...buildSkillInvocation("/conveyor-build"), branchRule(context)];
7993
+ if (!context.plan?.trim()) {
7994
+ parts.push(
7995
+ `No plan is saved on this card yet \u2014 run \`/conveyor-plan\` first and save it with update_task, then continue with \`/conveyor-build\`.`
7996
+ );
7997
+ }
7998
+ parts.push(pullRequestLine(context));
7999
+ return parts;
8000
+ }
8001
+ function plannerKickoff(role) {
8002
+ return [role, ...buildSkillInvocation("/conveyor-plan")];
8003
+ }
7987
8004
  function buildRelaunchWithSession(mode, context, agentMode, isAuto) {
7988
8005
  const scenario = detectRelaunchScenario(context);
7989
8006
  const hasPriorTurn = !!context.lastSeenMessageId || !!context.claudeSessionId;
@@ -8002,36 +8019,32 @@ function buildRelaunchWithSession(mode, context, agentMode, isAuto) {
8002
8019
  }
8003
8020
  if (mode === "pm") {
8004
8021
  parts.push(...buildPmRelaunchParts(context, lastAgentIdx, isAuto, agentMode));
8022
+ } else if (isPlanningSession(mode, agentMode, isAuto)) {
8023
+ parts.push(
8024
+ scenario === "feedback_relaunch" ? `You have been relaunched with new feedback.` : `You were relaunched but no new instructions have been given since your last run.`,
8025
+ ...newMessagesBlock(allNew.filter((m) => m.role === "user")),
8026
+ ...plannerKickoff(`You are the Planner on this card.`)
8027
+ );
8005
8028
  } else if (scenario === "feedback_relaunch") {
8006
- const newMessages = allNew.filter((m) => m.role === "user");
8007
8029
  parts.push(
8008
8030
  `You have been relaunched with new feedback.`,
8009
- branchRule(context),
8010
- ...newMessagesBlock(newMessages),
8011
- `
8012
- Address the requested changes. Do NOT re-investigate the codebase from scratch or write a new plan \u2014 review the feedback and implement the changes directly.`,
8013
- `Commit and push your updates.`,
8014
- pullRequestLine(context)
8031
+ ...newMessagesBlock(allNew.filter((m) => m.role === "user")),
8032
+ ...builderKickoff(context, `You are the Builder on this card \u2014 address the feedback above.`)
8015
8033
  );
8016
8034
  } else {
8017
- parts.push(
8018
- `You were relaunched but no new instructions have been given since your last run.`,
8019
- branchRule(context),
8020
- `Run \`git log --oneline -10\` to review what you already committed.`,
8021
- `Review the current state of the codebase and verify everything is working correctly.`
8022
- );
8035
+ parts.push(`You were relaunched but no new instructions have been given since your last run.`);
8023
8036
  if (agentMode === "auto" || agentMode === "building" || isAuto) {
8024
8037
  parts.push(
8025
- `If work is incomplete, continue implementing the plan. When finished, commit, push, and use mcp__conveyor__create_pull_request to open a PR.`,
8026
- `Do NOT go idle or wait for instructions \u2014 you are in auto mode.`
8038
+ ...builderKickoff(context, `You are the Builder on this card \u2014 pick up where you left off.`)
8027
8039
  );
8028
8040
  } else {
8029
8041
  parts.push(
8042
+ branchRule(context),
8030
8043
  `Post a brief status update with post_to_chat (your turn output is NOT shown in chat \u2014 post_to_chat is how the team sees it), then wait for further instructions.`
8031
8044
  );
8032
- }
8033
- if (context.githubPRUrl) {
8034
- parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
8045
+ if (context.githubPRUrl) {
8046
+ parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
8047
+ }
8035
8048
  }
8036
8049
  }
8037
8050
  return parts.join("\n");
@@ -8117,87 +8130,17 @@ ${truncatePlanForPrompt(context.plan)}`);
8117
8130
  if (context.incidents && context.incidents.length > 0) {
8118
8131
  parts.push(...formatIncidents(context.incidents));
8119
8132
  }
8120
- if (context.chatHistory.length > 0) {
8133
+ const undelivered = relaunchMessageBatch(context);
8134
+ if (undelivered.length > 0) {
8121
8135
  const chatLimit = runnerMode === "task" ? TASK_CHAT_HISTORY_LIMIT : PM_CHAT_HISTORY_LIMIT;
8122
- parts.push(...formatChatHistory(context.chatHistory, chatLimit));
8136
+ parts.push(...formatChatHistory(undelivered, chatLimit));
8123
8137
  }
8124
8138
  return parts;
8125
8139
  }
8126
- function buildFreshInstructions(isPm, isAutoMode, context, agentMode) {
8127
- if (isPm && agentMode === "building") {
8128
- return [
8129
- `Your plan has been approved. Begin implementing it now.`,
8130
- branchRule(context),
8131
- `Start by reading the relevant source files mentioned in the plan, then write code.`,
8132
- pullRequestLine(context),
8133
- `
8134
- CRITICAL: You are in Auto mode. Do NOT report status, ask for confirmation, or go idle without making code changes.`,
8135
- `Your FIRST action must be reading source files from the plan, then immediately writing code.`,
8136
- `Do NOT summarize the plan or say "ready to implement" \u2014 start implementing.`,
8137
- `When all changes are ready, use mcp__conveyor__create_pull_request to open a PR.`,
8138
- `If you are genuinely blocked, explain the specific blocker \u2014 do not go idle silently.`
8139
- ];
8140
- }
8141
- if (isAutoMode && isPm) {
8142
- if (context.plan?.trim()) {
8143
- return [
8144
- `You are operating autonomously. A plan already exists for this task.`,
8145
- `Begin implementing it now \u2014 do NOT re-plan or wait for team input.`,
8146
- `Refine story points, title, and tags via update_task_properties if they look like placeholders.`
8147
- ];
8148
- }
8149
- return [
8150
- `You are operating autonomously. No plan is saved on this card yet.`,
8151
- `1. Search the codebase (grep/glob) to locate relevant files, then read the critical ones`,
8152
- `2. Save a concise plan with update_task BEFORE writing any code \u2014 the plan is a record for the team, not a gate; never pause or wait for approval`,
8153
- `3. Implement the work, keeping the plan current if your approach changes materially`,
8154
- `4. Refine story points, tags, and title (update_task_properties) if they look like placeholders`,
8155
- `Do NOT wait for team input \u2014 proceed autonomously.`
8156
- ];
8157
- }
8158
- if (isPm && context.isParentTask) {
8159
- return [
8160
- `You are the project manager for this task and its subtasks.`,
8161
- `Review existing subtasks via \`list_subtasks\` and the chat history before taking action.`,
8162
- `Read the task description and chat history carefully \u2014 the team has provided the initial context below. Acknowledge what they've asked for and respond in chat before taking silent tool actions.`,
8163
- `Start planning now \u2014 explore the codebase, ask clarifying questions if needed, and propose a subtask breakdown. Do not wait for additional team input before engaging.`,
8164
- `When you finish planning, save the plan with update_task, post a short summary for the team with post_to_chat (your turn output is NOT shown in chat), then end your turn.`
8165
- ];
8166
- }
8167
- if (isPm) {
8168
- return [
8169
- `You are the project manager for this task \u2014 a thoughtful, collaborative planner, not the implementer.`,
8170
- `Your job right now is to help the team turn this request into a clear, well-scoped plan. Be a helpful planning partner: think out loud, surface trade-offs, and keep the human in the loop.`,
8171
- `Read the task description and chat history carefully \u2014 the team has provided the initial context below. Acknowledge what they've asked for and respond in chat before taking silent tool actions.`,
8172
- `Start planning now \u2014 explore the codebase, ask clarifying questions if anything is ambiguous, and draft a plan. Do not wait for additional team input before engaging; the initial message IS the team engaging.`,
8173
- `When you finish planning, save the plan with update_task, post a summary of the plan for the team with post_to_chat (your turn output is NOT shown in chat), then end your turn. A separate task agent will execute the plan after review.`
8174
- ];
8175
- }
8176
- return buildFreshLeafInstructions(context, isAutoMode);
8177
- }
8178
- function buildFreshLeafInstructions(context, isAutoMode) {
8179
- const parts = context.plan?.trim() ? [`Start now by reading the source files the plan names, then writing code.`] : [
8180
- `No plan is saved on this card yet. Investigate the task briefly (search first, read only critical files), then save a concise implementation plan with update_task (file:line citations) BEFORE you start writing code.`,
8181
- `The plan is a step, not the goal: the moment it's posted, IMPLEMENT it in code \u2014 do NOT pause, wait for approval, or treat the posted plan as the deliverable. The card is already In Progress and advances automatically.`
8182
- ];
8183
- const base = context.baseBranch?.trim() || "dev";
8184
- parts.push(
8185
- `Post to chat when you begin implementing and again when the PR is ready.`,
8186
- `Pre-PR order (\`/conveyor-build\` has the detail): commit, then sync the base (\`git fetch origin ${base} && git merge origin/${base} --no-edit\`), then ONE verification pass \u2014 \`bun run check\` (lint + typecheck) plus \`bun run test:affected\` (tests scoped to your diff; docs-only changes need no local gates) \u2014 then open the PR. Do NOT re-merge the base or re-run a gate that already passed.`,
8187
- `If a gate fails, iterate on just the failing test files (\`bun run --cwd <pkg> test:unit <files>\`) and confirm with a single final scoped-gate run. Do NOT open a PR with known failing gates.`,
8188
- `Open the PR with mcp__conveyor__create_pull_request when the work is done and the gates are green.`
8189
- );
8190
- if (isAutoMode) {
8191
- parts.push(
8192
- `
8193
- CRITICAL: You are in Auto mode. Your job is to BUILD the change, not to produce a plan \u2014 making a plan and opening a PR of the plan is NOT the goal. The plan is only an intermediate step; you must then write the code that implements it.`,
8194
- `Do NOT report status, ask for confirmation, or go idle without making code changes. Do NOT summarize the plan or say "ready to implement" \u2014 start implementing immediately.`,
8195
- `Your pull request MUST contain the actual code implementation. Never open a plan-only or empty-diff PR. (If the task genuinely needs no code changes, do not open a PR \u2014 deliver the result in chat and mark the card Complete.)`,
8196
- `When the implementation is complete and verified, you MUST use mcp__conveyor__create_pull_request to open a PR before finishing.`,
8197
- `If you are genuinely blocked, explain the specific blocker \u2014 do not go idle silently.`
8198
- );
8199
- }
8200
- return parts;
8140
+ function buildFreshInstructions(isPlanning, context) {
8141
+ return isPlanning ? plannerKickoff(
8142
+ `You are the Planner on this card \u2014 scope and plan it with the team. A separate Builder session implements it.`
8143
+ ) : builderKickoff(context, `You are the Builder on this card \u2014 implement its plan.`);
8201
8144
  }
8202
8145
  function buildFreshCodeReviewInstructions(context) {
8203
8146
  const parts = [...buildSkillInvocation("/conveyor-review"), branchRule(context, true)];
@@ -8206,92 +8149,34 @@ function buildFreshCodeReviewInstructions(context) {
8206
8149
  }
8207
8150
  return parts;
8208
8151
  }
8209
- function buildFeedbackInstructions(context, isPm, agentMode, isAuto) {
8210
- const lastAgentIdx = findLastAgentMessageIndex(context.chatHistory);
8211
- const newMessages = context.chatHistory.slice(lastAgentIdx + 1).filter((m) => m.role === "user");
8212
- if (isPm) {
8213
- const parts2 = [
8214
- `You were relaunched with new feedback since your last run.`,
8215
- `You are the project manager for this task.`,
8216
- ...newMessagesBlock(newMessages)
8217
- ];
8218
- if (isAuto && (agentMode === "building" || agentMode === "review")) {
8219
- parts2.push(
8220
- `
8221
- Your plan has been approved. Address the feedback above, then begin implementing.`,
8222
- branchRule(context),
8223
- `Start by reading the relevant source files mentioned in the plan, then write code.`,
8224
- pullRequestLine(context)
8225
- );
8226
- } else if (isAuto) {
8227
- parts2.push(
8228
- `
8229
- You are in auto mode. Address the feedback above and continue building \u2014 update the saved plan with update_task if the feedback changes your approach.`,
8230
- `Do NOT wait for additional team input \u2014 the messages above ARE the team's input. Proceed autonomously.`
8231
- );
8232
- } else {
8233
- parts2.push(
8234
- `
8235
- Review these messages and wait for the team to provide instructions before taking action.`
8236
- );
8237
- }
8238
- return parts2;
8239
- }
8240
- const parts = [
8241
- `You have been relaunched to address feedback on your previous work.`,
8242
- branchRule(context),
8243
- `Start by running \`${baseDiffCommand(context.baseBranch, "--stat")}\` to review what you already committed on this branch.`,
8244
- ...newMessagesBlock(newMessages),
8245
- `
8246
- Address the requested changes directly. Do NOT re-investigate the codebase from scratch or write a new plan \u2014 go straight to implementing the feedback.`,
8247
- // Scoped to what the follow-up actually changed. An unconditional full
8248
- // re-verify on every relaunch made a one-line or docs-only follow-up cost
8249
- // the same gate time as the original build.
8250
- `Re-verify in proportion to what THIS follow-up changed, not the whole branch: a docs/\`.claude\`-only change needs no local gates; a code change runs \`bun run check\` plus the directly-affected test files (\`bun run --cwd <pkg> test:unit <files>\`); escalate to a full \`bun run test:affected\` only when the follow-up touched \`packages/shared\`, \`packages/db\`, or root config, or when no gate has ever run on this branch. Fix any failures before pushing \u2014 relaunches are the most common place verification gets skipped.`,
8251
- `Implement your updates and open a PR when finished.`,
8252
- pullRequestLine(context)
8253
- ];
8254
- return parts;
8152
+ function buildFeedbackInstructions(context, isPlanning) {
8153
+ return isPlanning ? plannerKickoff(
8154
+ `You have been relaunched with the feedback in New Messages above. You are the Planner on this card \u2014 fold it into the plan.`
8155
+ ) : builderKickoff(
8156
+ context,
8157
+ `You have been relaunched to address the feedback in New Messages above.`
8158
+ );
8255
8159
  }
8256
- function buildIdleRelaunchInstructions(context, isPm, agentMode, isAuto) {
8257
- if (isPm && agentMode === "auto" && PRE_BUILD_TASK_STATUSES.has(context.status ?? "")) {
8258
- if (context.plan?.trim()) {
8259
- return [
8260
- `You were relaunched in auto mode. A plan already exists for this task.`,
8261
- `Begin implementing it now \u2014 refine story points, title, and tags via update_task_properties if they look like placeholders.`,
8262
- `Do NOT wait for instructions or go idle \u2014 you are in auto mode.`
8263
- ];
8264
- }
8160
+ function buildIdleRelaunchInstructions(context, isPlanning, agentMode, isAuto) {
8161
+ const opener = `You were relaunched but no new instructions have been given since your last run.`;
8162
+ if (isPlanning) {
8265
8163
  return [
8266
- `You were relaunched in auto mode. Continue building autonomously.`,
8267
- `No plan is saved on this card yet \u2014 save a concise plan with update_task before writing further code; never pause or wait for approval.`,
8268
- `Do NOT wait for instructions or go idle \u2014 you are in auto mode.`
8164
+ opener,
8165
+ `You are the Planner on this card. Post a brief status update with post_to_chat (your turn output is NOT shown in chat \u2014 post_to_chat is how the team sees it), then wait for the team.`
8269
8166
  ];
8270
8167
  }
8271
- if (isPm && !(agentMode === "building" || agentMode === "review" || agentMode === "auto")) {
8168
+ if (agentMode === "auto" || agentMode === "building" || isAuto) {
8272
8169
  return [
8273
- `You were relaunched but no new instructions have been given since your last run.`,
8274
- `You are the project manager for this task.`,
8275
- `Wait for the team to provide instructions before taking action.`
8170
+ opener,
8171
+ ...builderKickoff(context, `You are the Builder on this card \u2014 pick up where you left off.`)
8276
8172
  ];
8277
8173
  }
8278
- const isAutoMode = agentMode === "auto" || agentMode === "building" || isAuto;
8279
8174
  const parts = [
8280
- `You were relaunched but no new instructions have been given since your last run.`,
8175
+ opener,
8281
8176
  branchRule(context),
8282
- `Run \`git log --oneline -10\` to review what you already committed, then verify the current state is correct.`
8177
+ `Post a brief status update summarizing where things stand with post_to_chat (your turn output is NOT shown in chat \u2014 post_to_chat is how the team sees it).`,
8178
+ `Then wait for further instructions \u2014 do NOT redo work that was already completed.`
8283
8179
  ];
8284
- if (isAutoMode) {
8285
- parts.push(
8286
- `If work is incomplete, continue implementing the plan. When finished, use mcp__conveyor__create_pull_request to open a PR.`,
8287
- `Do NOT go idle or wait for instructions \u2014 you are in auto mode.`
8288
- );
8289
- } else {
8290
- parts.push(
8291
- `Post a brief status update summarizing where things stand with post_to_chat (your turn output is NOT shown in chat \u2014 post_to_chat is how the team sees it).`,
8292
- `Then wait for further instructions \u2014 do NOT redo work that was already completed.`
8293
- );
8294
- }
8295
8180
  if (context.githubPRUrl) {
8296
8181
  parts.push(`An existing PR is open at ${context.githubPRUrl}. Do not create a new PR.`);
8297
8182
  }
@@ -8302,6 +8187,7 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
8302
8187
  ## Instructions`];
8303
8188
  const isPm = mode === "pm";
8304
8189
  const isCodeReview = mode === "code-review" || !isPm && agentMode === "review";
8190
+ const isPlanning = isPlanningSession(mode, agentMode, isAuto);
8305
8191
  if (agentMode === "chat") {
8306
8192
  parts.push(...buildChatInstructions(context, scenario, relaunchMessageBatch(context)));
8307
8193
  return parts;
@@ -8311,9 +8197,7 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
8311
8197
  return parts;
8312
8198
  }
8313
8199
  if (scenario === "fresh") {
8314
- parts.push(
8315
- ...buildFreshInstructions(isPm, agentMode === "auto" || !!isAuto, context, agentMode)
8316
- );
8200
+ parts.push(...buildFreshInstructions(isPlanning, context));
8317
8201
  return parts;
8318
8202
  }
8319
8203
  const newBatch = relaunchMessageBatch(context);
@@ -8327,10 +8211,10 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
8327
8211
  return parts;
8328
8212
  }
8329
8213
  if (scenario === "idle_relaunch") {
8330
- parts.push(...buildIdleRelaunchInstructions(context, isPm, agentMode, isAuto));
8214
+ parts.push(...buildIdleRelaunchInstructions(context, isPlanning, agentMode, isAuto));
8331
8215
  return parts;
8332
8216
  }
8333
- parts.push(...buildFeedbackInstructions(context, isPm, agentMode, isAuto));
8217
+ parts.push(...buildFeedbackInstructions(context, isPlanning));
8334
8218
  return parts;
8335
8219
  }
8336
8220
  async function buildInitialPrompt(mode, context, isAuto, agentMode, packExecution) {
@@ -13580,6 +13464,9 @@ async function* watchForParkedTui(inner, host, opts) {
13580
13464
  clearTimeout(timer);
13581
13465
  }
13582
13466
  }
13467
+ function takesPlannerOpeningTurn(host, mode) {
13468
+ return host.config.mode === "plan" && mode === "discovery";
13469
+ }
13583
13470
  async function runSdkQuery(host, context, followUpContent, promptDeliveryOverride) {
13584
13471
  if (host.isStopped()) return;
13585
13472
  const mode = host.agentMode;
@@ -13607,7 +13494,10 @@ async function runSdkQuery(host, context, followUpContent, promptDeliveryOverrid
13607
13494
  await runFollowUpQuery(host, context, options, resume, followUpContent);
13608
13495
  return;
13609
13496
  }
13610
- if (isDiscoveryLike && (resume || host.harnessKind === "sdk")) {
13497
+ if (isDiscoveryLike && host.harnessKind === "sdk") {
13498
+ return;
13499
+ }
13500
+ if (isDiscoveryLike && resume && !takesPlannerOpeningTurn(host, mode)) {
13611
13501
  return;
13612
13502
  }
13613
13503
  await runInitialQuery(host, context, options, resume, promptDelivery);
package/dist/cli.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  resolveTuiKindFromEnv,
28
28
  runUsageProbe,
29
29
  sampleKeyUsage
30
- } from "./chunk-PEEGCZAR.js";
30
+ } from "./chunk-QETNCXIR.js";
31
31
  import "./chunk-XORJ6SII.js";
32
32
  import {
33
33
  AgentConnection,
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  SessionRunner,
3
3
  unshallowRepo
4
- } from "./chunk-PEEGCZAR.js";
4
+ } from "./chunk-QETNCXIR.js";
5
5
  import "./chunk-XORJ6SII.js";
6
6
  import {
7
7
  AgentConnection,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rallycry/conveyor-agent",
3
- "version": "11.0.0",
3
+ "version": "11.0.1",
4
4
  "description": "Conveyor Agent Runner v10 - PTY harness for the task chat (SDK harness for audit/project-chat). Agent-as-User architecture with BaseService patterns. Works locally too.",
5
5
  "keywords": [
6
6
  "agent",