@sellable/mcp 0.1.341 → 0.1.343

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/server.js CHANGED
@@ -43,6 +43,7 @@ import { addRubricItem, checkRubric, deleteRubricItem, draftRubrics, saveRubrics
43
43
  import { getSenderRoutingTool, setSenderRoutingTool, } from "./tools/sender-routing.js";
44
44
  import { getSender, listSenders } from "./tools/senders.js";
45
45
  import { attachRecommendedSequence, attachSequence, createWorkflowTable, } from "./tools/sequencer.js";
46
+ import { setupEvergreenCampaigns } from "./tools/setup-evergreen-campaigns.js";
46
47
  import { exportTableCsv, listTables } from "./tools/tables.js";
47
48
  import { handleVerifyTableRow } from "./tools/verify-row.js";
48
49
  import { sanitizeWatchUrlsForMcpResult } from "./tools/watch-url-security.js";
@@ -68,6 +69,32 @@ function parseOptionalNumber(value) {
68
69
  }
69
70
  return undefined;
70
71
  }
72
+ function markEvergreenSetupCampaignsDirty(args) {
73
+ if (!args || args.mode !== "verify")
74
+ return;
75
+ const campaignIds = new Set();
76
+ const bindings = Array.isArray(args.bindings) ? args.bindings : [];
77
+ for (const binding of bindings) {
78
+ if (!binding || typeof binding !== "object" || Array.isArray(binding))
79
+ continue;
80
+ const campaignId = binding.campaignId;
81
+ if (typeof campaignId === "string" && campaignId.trim()) {
82
+ campaignIds.add(campaignId.trim());
83
+ }
84
+ }
85
+ const receipts = Array.isArray(args.receipts) ? args.receipts : [];
86
+ for (const receipt of receipts) {
87
+ if (!receipt || typeof receipt !== "object" || Array.isArray(receipt))
88
+ continue;
89
+ const campaignId = receipt.campaignId;
90
+ if (typeof campaignId === "string" && campaignId.trim()) {
91
+ campaignIds.add(campaignId.trim());
92
+ }
93
+ }
94
+ for (const campaignId of campaignIds) {
95
+ markCampaignContextDirty(campaignId, "setup_evergreen_campaigns");
96
+ }
97
+ }
71
98
  function formatSubskillPromptText(result) {
72
99
  const header = result.chunkCount && result.chunkCount > 1
73
100
  ? [
@@ -187,6 +214,10 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
187
214
  case "get_campaign_refill_state":
188
215
  result = await getCampaignRefillState(args);
189
216
  break;
217
+ case "setup_evergreen_campaigns":
218
+ result = await setupEvergreenCampaigns(args);
219
+ markEvergreenSetupCampaignsDirty(args);
220
+ break;
190
221
  case "fill_campaign_horizon":
191
222
  result = await fillCampaignHorizon(args);
192
223
  if (args?.campaignId) {
@@ -373,7 +373,7 @@ export function getPostFindLeadsScoutRegistry() {
373
373
  codex: 'After confirm_lead_list copies source rows and the initial campaign-table execution slice exists, ask the filter-choice question immediately. Do not spawn anything before that question. After the answer, launch only Message Drafting. The filter-choice answer is the post-import user gate for this single worker; do not ask another question about starting it in step-wise or YOLO mode. The registry lookup is not a launch: after get_post_find_leads_scout_registry, immediately invoke Task/spawn_agent or the host background-agent mechanism before loading filter-leads.md, before saving rubrics, and before treating skip-filters as ready for message review. Both choices route through this kickoff; do not let filters_skipped jump straight from filter-choice to message-generation. If filters are chosen, the parent stays on Filter Rules and drafts/saves rubrics with MCP tools while Message Drafting runs in the background. If filters are skipped, move to Messages/message review only after Message Drafting has started or is ready; update_campaign(currentStep=messages) is not proof of launch. If the named Message Drafting custom agent is unavailable, spawn a generic gpt-5.5 xhigh Message Drafting background agent with the same lean campaign/table basis. When the background worker starts, persist workerDetails.messageDraftBuilder with statusSource "branch", status "branch-running", runId, startedAt, updatedAt, basisToken when known, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds; workerStatuses.messageDraftBuilder may be "running" as a simple badge only. Never put rich proof under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start the same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource "parent-thread-fallback" and status "fallback-active", and require the same live context, prompt, assets, and validation gate before message review; do not wait until filters are saved and then call the registry.',
374
374
  claude: "After confirm_lead_list copies source rows and the initial campaign-table execution slice exists, ask the filter-choice question immediately. Do not invoke any Task/Agent before that question. After the answer, invoke only Message Drafting. If filters are chosen, parent drafts/saves rubrics with MCP tools while Message Drafting runs, asks filter approval, then joins Message Drafting. If filters are skipped, invoke only Message Drafting and move to Messages/message review.",
375
375
  parentThreadRule: 'Named agents are optional acceleration, but message drafting is not optional. The only normal background worker is Message Drafting. The filter-choice answer is the campaign-scoped go-ahead for this single post-import worker; do not ask another question to start it in step-wise or YOLO mode. If a named agent is unavailable, use a generic gpt-5.5 xhigh Message Drafting background agent. source work and filter work stay in the parent thread with MCP tools. If post-find-leads-message-scout is available, run it as the background Message Draft Builder after the filter-choice answer. The registry lookup is not a launch: get_post_find_leads_scout_registry only identifies the worker, and Message Drafting counts as started only after Task/spawn_agent or the host background-agent tool is invoked, or after the parent begins the same full message branch inline because no background-agent tool is callable. This launch must happen before loading filter-leads.md, save_rubrics, filter approval, or skip-filter message review; currentStep=messages is not proof of launch. If post-find-leads-message-scout is absent, do not customer-surface install status. Do not silently treat message drafting as started; the main thread must either launch the background worker or execute the same message branch from CampaignOffer state, selected source state, workflowTableId, and initial campaign-table execution slice rows. For a spawned worker, record workerDetails.messageDraftBuilder with statusSource branch / status branch-running, runId, startedAt, updatedAt, and basis containing campaignId, selectedLeadListId, workflowTableId, filterChoice, and reviewBatchRowHash or reviewBatchRowIds. workerStatuses.messageDraftBuilder is optional simple badge text only ("running", "ready", "blocked", "idle"); never put runId/statusSource/basis under workerStatuses and never use workerStatuses.messageDrafting. If no background-agent tool is callable, start that same full message branch inline before filter drafting or before skip-filter message review, record workerDetails.messageDraftBuilder with statusSource parent-thread-fallback / status fallback-active then ready, and require the same live context, prompt, assets, and validation gate before message review; do not report that as a background worker failure. If neither branch nor inline fallback can run, return blocked/retry-needed; do not wait until filters are saved and then call the registry. The Message Drafting handoff must be lean. Do not paste copied row counts, brief hashes, review-batch hashes, full reviewBatchRowIds, broad row data, or local debug artifacts into the spawn prompt. Local markdown/json files are not normal-path inputs. The filter-choice question is the first post-import user gate; do not load post-lead registries or filter references before it. Message drafting starts after the filter-choice answer, must load get_subskill_prompt({ subskillName: "generate-messages" }), and must load every required message asset named by generate-messages Mode 0 through get_subskill_asset before drafting. Reference Asset Loading means loading the required pre-draft reference pack before drafting; return blocked/retry-needed if required assets cannot be loaded; load ai-tells.md because it is never optional. The branch or parent-thread fallback loads the full generate-messages prompt and every referenced asset through get_subskill_asset. After generating/revising the candidate and before returning ready, must load get_subskill_prompt({ subskillName: "create-campaign-v2-validation" }) as the final internal validation gate, must read live campaign table state through scoped MCP/product tools, and must reject mismatched selectedLeadListId/workflowTableId/campaign/workspace input. Do not block when filters were chosen but leadScoringRubrics are not yet visible in the branch read; the parent owns save_rubrics and filter approval in parallel, so Message Drafting should return status ready with basisStatus usable_initial when campaign/list/table identity and the non-empty execution slice match. Do not use any alternate, local-artifact, or examples-only message prompt. User copy feedback, message QA, or rewrite requests before approve-message must be routed back to Message Drafting with the current recommendation, lean campaign/table basis, and latest user text; the parent must not rewrite or QA the template from memory and must not call update_campaign_brief before approve-message. The worker validates internally and returns only templateRecommendation, tokenFillRules, renderedGoodSample, status, approveOrReviseRecommendation, validationStatus, outputAt, outputHash, and blocked/retry detail. Do not render renderedFallbackSample, risk notes, or a qaReceipt on the normal happy path. On the filter path, save_rubrics keeps the browser on Filter Rules after save_rubrics so the user can approve the saved criteria; after saved-filter approval, move to Filter Leads with currentStep=apply-icp-rubric whether Message Drafting is ready or still running. Wait there for message approval. Enrichment, filtering, Generate Message cells, sender setup, sequence attach, and launch wait for template approval on the Use Template path. On the skip path, move to Messages/message review after Message Drafting has started or is ready and wait for message approval before enrichment or Settings. Do not render message review from checklist or shortcut instructions; message review requires a messageDraftRecommendation whose basis proves the generate-messages prompt, required message assets, and validation gate ran for the current campaign/table execution slice. Do not automatically rerun Message Drafting after filters/enrichment finish; show the initial draft by default and offer an enriched rewrite only with explicit user opt-in. Handoff and recommendation output are Markdown with labeled fields, not raw JSON.',
376
- prepareMessagesRule: `Default create-campaign stays on the existing reviewBatchLimit:15 first campaign-table execution slice. For plain post-mint fill/load/refill requests, load get_subskill_prompt({ subskillName: "refill-sends-workflow" }), then call resolve_campaign_fill_route({ intent:"plain" }) and get_campaign_refill_state before any mutation. Route outcomes are route:"evergreen_horizon", route:"active_campaigns", and route:"ask_create"; stay in the same campaignOfferId/campaignId context after minting. Plain fill is not an alias for fill_campaign_horizon or campaign creation. fill_campaign_horizon is evergreen-only and is not the generic regular-campaign fill path. Campaign creation is allowed only after route:"ask_create" and explicit user selection; it is never the default response to plain fill. Treat "fill up/load sends" as capacity-fill preparation: calculate the bounded target from sender capacity when needed, then use the refill workflow to decide same-campaign source replenishment, enrichment/prep, approval/ready state, scheduler reread, and sender-health blockers. Do not create warm-post-engager side campaigns. Do not interpret checkedRows as enriched rows; it is only the table cursor. Prepared, approved, and ready_to_schedule rows are intermediate states; never call them scheduled unless a re-read proves scheduler-owned scheduled cells with non-null scheduledFor. Before source import, prep, or approval, require exact visible approval and a fresh get_campaign_refill_state reread; stop if freshness.stateHash or exact ids changed. For "approve X messages", use approvalMode:approve only when explicitly requested, but still do not launch. For "schedule X sends" or "fill sender sends", approve only when explicitly requested, then re-read campaign/table scheduled counts; if scheduler-owned scheduledFor cells are not present, report prepared/approved/ready - awaiting scheduler instead of success. Do not call start_campaign as part of fill/schedule horizon. Do not call start_campaign as part of refill sends. Launch/start is a separate explicit human action after the operator intentionally wants sends to go out, and it must still verify that the bounded cohort is the only approved cohort and must not broad approve-all. campaignId is CampaignOffer.id. If the user asks to stop preparation, the target is wrong, or status shows the wrong campaign/table, use cancel_campaign_message_preparation only for the exact active job. Low-level selectors are diagnostics and recovery only for this lane. start_campaign remains forbidden until explicit launch/start approval outside refill sends.`,
376
+ prepareMessagesRule: `Default create-campaign stays on the existing reviewBatchLimit:15 first campaign-table execution slice. For plain post-mint fill/load/refill requests, load get_subskill_prompt({ subskillName: "refill-sends-workflow" }), then call resolve_campaign_fill_route({ intent:"plain" }) and get_campaign_refill_state before any mutation. Route outcomes are route:"evergreen_horizon", route:"active_campaigns", and route:"ask_create"; stay in the same campaignOfferId/campaignId context after minting. Plain fill is not an alias for fill_campaign_horizon or campaign creation. fill_campaign_horizon is evergreen-only and is not the generic regular-campaign fill path. Campaign creation is allowed only after route:"ask_create" and explicit user selection; it is never the default response to plain fill. Treat "fill up/load sends" as capacity-fill preparation: calculate the bounded target from sender capacity when needed, then use the refill workflow to decide same-campaign source replenishment, enrichment/prep, approval/ready state, scheduler reread, and sender-health blockers. Do not create warm-post-engager side campaigns. For already-running regular campaigns that need Signal Discovery source replenishment, use the guarded currentStep clear with clearCurrentStepIfMatches:"running", campaign-scoped provider prompt/search/select, and import_leads with the existing sourceLeadListId when a newly approved selected-post scrape would otherwise return reusedExistingSourceList. After confirm_lead_list copies rows into an existing table, avoid fixed maxRowsToCheck:100; inspect reviewBatch/table selectors or use adaptive/wider bounded prep so appended rows are included. Do not interpret checkedRows as enriched rows; it is only the table cursor. Prepared, approved, and ready_to_schedule rows are intermediate states; never call them scheduled unless a re-read proves scheduler-owned scheduled cells with non-null scheduledFor. Before source import, prep, or approval, require exact visible approval and a fresh get_campaign_refill_state reread; stop if freshness.stateHash or exact ids changed. For "approve X messages", use approvalMode:approve only when explicitly requested, but still do not launch. For "schedule X sends" or "fill sender sends", approve only when explicitly requested, then re-read campaign/table scheduled counts; if scheduler-owned scheduledFor cells are not present, report prepared/approved/ready - awaiting scheduler instead of success. Do not call start_campaign as part of fill/schedule horizon. Do not call start_campaign as part of refill sends. Launch/start is a separate explicit human action after the operator intentionally wants sends to go out, and it must still verify that the bounded cohort is the only approved cohort and must not broad approve-all. campaignId is CampaignOffer.id. If the user asks to stop preparation, the target is wrong, or status shows the wrong campaign/table, use cancel_campaign_message_preparation only for the exact active job. Low-level selectors are diagnostics and recovery only for this lane. start_campaign remains forbidden until explicit launch/start approval outside refill sends.`,
377
377
  },
378
378
  };
379
379
  }
@@ -38,6 +38,7 @@ import { rubricToolDefinitions } from "./rubrics.js";
38
38
  import { senderRoutingToolDefinitions } from "./sender-routing.js";
39
39
  import { senderToolDefinitions } from "./senders.js";
40
40
  import { sequencerToolDefinitions } from "./sequencer.js";
41
+ import { setupEvergreenCampaignsToolDefinitions } from "./setup-evergreen-campaigns.js";
41
42
  import { tableToolDefinitions } from "./tables.js";
42
43
  import { verifyRowToolDefinitions } from "./verify-row.js";
43
44
  import { waterfallToolDefinitions } from "./waterfalls.js";
@@ -47,6 +48,7 @@ export const allTools = [
47
48
  ...campaignAbTestToolDefinitions,
48
49
  ...campaignFillRoutingToolDefinitions,
49
50
  ...campaignRefillStateToolDefinitions,
51
+ ...setupEvergreenCampaignsToolDefinitions,
50
52
  ...campaignHorizonFillToolDefinitions,
51
53
  ...campaignMessagePreparationToolDefinitions,
52
54
  ...campaignProcessingToolDefinitions,
@@ -0,0 +1,95 @@
1
+ type SetupEvergreenCampaignsInput = {
2
+ mode?: "plan" | "verify";
3
+ depth?: "structure_only" | "customer_visible";
4
+ yolo?: boolean;
5
+ allConnectedSenders?: boolean;
6
+ selectedSenderIds?: string[];
7
+ bindings?: Array<{
8
+ laneKey: string;
9
+ campaignId: string;
10
+ tableId: string;
11
+ }>;
12
+ planRevision?: string;
13
+ selectedActionIds?: string[];
14
+ receipts?: unknown[];
15
+ };
16
+ export declare const setupEvergreenCampaignsToolDefinitions: {
17
+ name: string;
18
+ description: string;
19
+ inputSchema: {
20
+ type: string;
21
+ properties: {
22
+ mode: {
23
+ type: string;
24
+ enum: string[];
25
+ description: string;
26
+ };
27
+ depth: {
28
+ type: string;
29
+ enum: string[];
30
+ description: string;
31
+ };
32
+ yolo: {
33
+ type: string;
34
+ description: string;
35
+ };
36
+ allConnectedSenders: {
37
+ type: string;
38
+ description: string;
39
+ };
40
+ selectedSenderIds: {
41
+ type: string;
42
+ items: {
43
+ type: string;
44
+ };
45
+ maxItems: number;
46
+ description: string;
47
+ };
48
+ bindings: {
49
+ type: string;
50
+ maxItems: number;
51
+ items: {
52
+ type: string;
53
+ properties: {
54
+ laneKey: {
55
+ type: string;
56
+ };
57
+ campaignId: {
58
+ type: string;
59
+ };
60
+ tableId: {
61
+ type: string;
62
+ };
63
+ };
64
+ required: string[];
65
+ additionalProperties: boolean;
66
+ };
67
+ description: string;
68
+ };
69
+ planRevision: {
70
+ type: string;
71
+ description: string;
72
+ };
73
+ selectedActionIds: {
74
+ type: string;
75
+ items: {
76
+ type: string;
77
+ };
78
+ maxItems: number;
79
+ description: string;
80
+ };
81
+ receipts: {
82
+ type: string;
83
+ maxItems: number;
84
+ items: {
85
+ type: string;
86
+ };
87
+ description: string;
88
+ };
89
+ };
90
+ required: never[];
91
+ additionalProperties: boolean;
92
+ };
93
+ }[];
94
+ export declare function setupEvergreenCampaigns(input: SetupEvergreenCampaignsInput): Promise<unknown>;
95
+ export {};
@@ -0,0 +1,86 @@
1
+ import { getApi } from "../api.js";
2
+ async function postSetupEvergreenCampaigns(body) {
3
+ const api = getApi();
4
+ return api.post("/api/v3/mcp/setup-evergreen-campaigns", body);
5
+ }
6
+ export const setupEvergreenCampaignsToolDefinitions = [
7
+ {
8
+ name: "setup_evergreen_campaigns",
9
+ description: "Evergreen campaign setup plan/verify command. Use plan mode first to inspect exact workspace/sender/campaign/table/source state and receive immutable lane packets for one Post Engagers lane per selected sender plus shared Signal Discovery and Shared Cold Fallback lanes. yolo is only a parent-skill auto-execution hint for safe lane packets; this backend command remains read-only in plan mode and verifies receipts in verify mode. Lane workers must execute creation, source import, create-campaign workflow steps, generate-messages, sequence attachment, and review readiness through existing create-campaign workflow/subskills, then return receipts here for verification. This command does not launch campaigns, does not schedule sends, does not assign scheduler-owned send fields, does not archive/delete cleanup targets, and does not spend paid credits.",
10
+ inputSchema: {
11
+ type: "object",
12
+ properties: {
13
+ mode: {
14
+ type: "string",
15
+ enum: ["plan", "verify"],
16
+ description: 'Defaults to "plan". Verify only validates worker receipts.',
17
+ },
18
+ depth: {
19
+ type: "string",
20
+ enum: ["structure_only", "customer_visible"],
21
+ description: 'Use "customer_visible" for full setup proof or "structure_only" when only ensuring lane shells/config.',
22
+ },
23
+ yolo: {
24
+ type: "boolean",
25
+ description: "plan mode only. Requests auto-executable lane packets when state is safe; never authorizes cleanup, launch, scheduling, sending, or ambiguous target choice.",
26
+ },
27
+ allConnectedSenders: {
28
+ type: "boolean",
29
+ description: "Plan sender-owned Post Engagers lanes for all eligible connected senders in the active workspace.",
30
+ },
31
+ selectedSenderIds: {
32
+ type: "array",
33
+ items: { type: "string" },
34
+ maxItems: 25,
35
+ description: "Exact OutboundSenderIdentity ids for sender-owned Post Engagers lanes and shared-lane sender set.",
36
+ },
37
+ bindings: {
38
+ type: "array",
39
+ maxItems: 20,
40
+ items: {
41
+ type: "object",
42
+ properties: {
43
+ laneKey: { type: "string" },
44
+ campaignId: { type: "string" },
45
+ tableId: { type: "string" },
46
+ },
47
+ required: ["laneKey", "campaignId", "tableId"],
48
+ additionalProperties: false,
49
+ },
50
+ description: "Exact existing campaign/table bindings to reuse for lane keys. Do not pass names.",
51
+ },
52
+ planRevision: {
53
+ type: "string",
54
+ description: "Required for verify. Copy from the immediately preceding plan.",
55
+ },
56
+ selectedActionIds: {
57
+ type: "array",
58
+ items: { type: "string" },
59
+ maxItems: 20,
60
+ description: "Required for verify. Immutable action ids selected from the current plan.",
61
+ },
62
+ receipts: {
63
+ type: "array",
64
+ maxItems: 20,
65
+ items: { type: "object" },
66
+ description: "Required for verify. Structured lane worker receipts from create-campaign/source/message/sequence execution.",
67
+ },
68
+ },
69
+ required: [],
70
+ additionalProperties: false,
71
+ },
72
+ },
73
+ ];
74
+ export function setupEvergreenCampaigns(input) {
75
+ return postSetupEvergreenCampaigns({
76
+ mode: input.mode,
77
+ yolo: input.yolo,
78
+ depth: input.depth,
79
+ allConnectedSenders: input.allConnectedSenders,
80
+ selectedSenderIds: input.selectedSenderIds,
81
+ bindings: input.bindings,
82
+ planRevision: input.planRevision,
83
+ selectedActionIds: input.selectedActionIds,
84
+ receipts: input.receipts,
85
+ });
86
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.341",
3
+ "version": "0.1.343",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code and Codex campaign workflows",
6
6
  "main": "dist/index.js",
@@ -142,6 +142,14 @@ Treat active fills as capacity-fill preparation: calculate the bounded target
142
142
  from sender capacity when needed, then use the refill workflow to decide source
143
143
  replenishment, enrichment/prep, approval policy, and scheduler proof. Mutation
144
144
  requires exact visible approval and a fresh `get_campaign_refill_state` reread.
145
+ For already-running regular campaigns that need Signal Discovery source
146
+ replenishment, the refill workflow owns the guarded recovery: clear
147
+ `currentStep` only with `clearCurrentStepIfMatches:"running"`, load the
148
+ campaign-scoped provider prompt, run campaign-scoped `search_signals`, select
149
+ posts with a capacity-target scrape plan, import into the same source path, and
150
+ restore Running through `confirm_lead_list`. If the copied rows append beyond
151
+ the first table page, inspect `reviewBatch` with table-schema/selector tools and
152
+ use adaptive or wider bounded message prep; do not rely on a fixed `maxRowsToCheck:100` pass after source copy.
145
153
  If the user says "prepare/generate X messages", use message-prep primitives with
146
154
  `targetPreparedMessages:X` and default `approvalMode:"mark_ready"`. If the user
147
155
  says "approve X messages", use `approvalMode:"approve"` only for the bounded
@@ -51,6 +51,58 @@ Default evergreen plan per workspace (override only if the prompt specifies diff
51
51
  3. **`<Workspace/Team> - Shared Cold Fallback`** — one shared cold/fallback campaign lane across senders
52
52
  </inputs>
53
53
 
54
+ <command_backed_workflow>
55
+ For full/customer-visible setup, the first operational command is always
56
+ `setup_evergreen_campaigns({ mode:"plan", yolo })`. Inventory can happen first
57
+ for operator understanding, but do not create/reuse/repair campaign shells,
58
+ source rows, messages, sequence, approvals, or cleanup before the command-backed
59
+ plan returns lane packets.
60
+
61
+ Plan shape:
62
+
63
+ - one Post Engagers lane per selected sender;
64
+ - one shared Signal Discovery lane;
65
+ - one shared Cold Fallback lane;
66
+ - explicit existing campaign/table bindings when the user points at a canonical
67
+ lane. Pass those exact ids to the plan and reuse/verify them instead of
68
+ creating duplicates.
69
+ - If a user supplies canonical ids, reuse/verify them instead of creating duplicates.
70
+
71
+ When senders are ambiguous, ask which sender ids need Post Engagers lanes before
72
+ planning. If the operator says all connected senders, pass `allConnectedSenders`
73
+ and let the command return exact selected sender ids or blockers.
74
+
75
+ `--yolo` is supported, but it is a safety-scoped execution mode, not a cleanup
76
+ or launch permission. With `--yolo`, pass `yolo:true` to
77
+ `setup_evergreen_campaigns({ mode:"plan", yolo })` and proceed without
78
+ intermediate approval only when every selected lane packet returns
79
+ `autoExecutable:true`. `--yolo` does not authorize archive/delete cleanup,
80
+ launch/start, schedule/send, broad approve-all, wrong workspace work, stale
81
+ plan execution, paid InMail spend, or ambiguous target choice. Stop on wrong
82
+ workspace, cleanup/archive/delete need, stale plan, disconnected sender,
83
+ duplicate candidate, unsafe side effect, missing source proof, or missing
84
+ message proof.
85
+
86
+ After approval or safe `--yolo`, fan out lane worker tasks only from the current
87
+ plan. Each worker receives the complete lane packet: workspace id, sender ids,
88
+ lane key/type, existing campaign/table binding or create intent, source hints,
89
+ caps, planRevision, actionId, allowed side effects, and postconditions. Workers
90
+ must use the create-campaign workflow and create-campaign workflow/subskills for
91
+ campaign creation/setup, source/import, filter choice, Message Drafting,
92
+ packaged `generate-messages`, sequence attachment, and send-review readiness.
93
+ Do not rebuild those steps ad hoc in the parent thread.
94
+
95
+ Workers return worker receipts. The parent then calls
96
+ `setup_evergreen_campaigns({ mode:"verify", planRevision, selectedActionIds,
97
+ receipts })` and report only verified completion. If verify blocks, report the
98
+ blocker and repair only the missing postconditions from the same current plan.
99
+
100
+ Message proof for every customer-visible lane must come from the current
101
+ campaign/table basis and include at least 3 generated review rows from the
102
+ packaged `generate-messages` path before completion is reported.
103
+ Parent-thread handwritten copy or setting `currentStep` is not proof.
104
+ </command_backed_workflow>
105
+
54
106
  <objective>
55
107
  1. **Inventory first**: `get_campaigns` + `list_tables` + `get_campaign_waterfall` in the active workspace. Treat `list_tables` and the managed waterfall as authoritative for older managed slots; `get_campaigns` is a recent campaign page and may miss canonical evergreen lanes. Match existing campaigns/tables/waterfall slots to the plan by name (case-insensitive, ignore suffixes like "(Copy)") and stored slot identity. `list_tables.campaignStatus` and `list_tables.dashboardBucket` are part of the identity check: a matching `ARCHIVED` table/campaign is not a plain `REUSE`. If it is the canonical prod slot and the invocation explicitly allows dashboard visibility repair, repair it to `PAUSED`; otherwise mark it `flagged`/`blocked` and do not create a duplicate. A matching non-archived campaign/table/waterfall slot = REUSE; record it and move on. Never create a second campaign for a slot that already has one in any of those inventories.
56
108
  2. **Create only the missing slots** with `create_on_demand_campaign({ name, senderIds, campaignBrief })`:
@@ -9,6 +9,9 @@ allowed-tools:
9
9
  - mcp__sellable__get_campaign_refill_state
10
10
  - mcp__sellable__fill_campaign_horizon
11
11
  - mcp__sellable__get_campaign
12
+ - mcp__sellable__get_campaign_context
13
+ - mcp__sellable__update_campaign
14
+ - mcp__sellable__get_provider_prompt
12
15
  - mcp__sellable__get_campaign_message_preparation_status
13
16
  - mcp__sellable__start_campaign_message_preparation
14
17
  - mcp__sellable__cancel_campaign_message_preparation
@@ -16,6 +19,7 @@ allowed-tools:
16
19
  - mcp__sellable__wait_for_lead_list_ready
17
20
  - mcp__sellable__confirm_lead_list
18
21
  - mcp__sellable__search_signals
22
+ - mcp__sellable__select_promising_posts
19
23
  - mcp__sellable__fetch_post_engagers
20
24
  - mcp__sellable__search_sales_nav
21
25
  - mcp__sellable__lookup_sales_nav_filter
@@ -29,6 +33,10 @@ allowed-tools:
29
33
  - mcp__sellable__get_rows
30
34
  - mcp__sellable__get_rows_minimal
31
35
  - mcp__sellable__get_table_rows
36
+ - mcp__sellable__get_campaign_table_schema
37
+ - mcp__sellable__select_campaign_cells
38
+ - mcp__sellable__wait_for_campaign_processing
39
+ - mcp__sellable__get_sender
32
40
  ---
33
41
 
34
42
  # Refill Sends
@@ -7,6 +7,9 @@ allowed-tools:
7
7
  - mcp__sellable__get_campaign_refill_state
8
8
  - mcp__sellable__fill_campaign_horizon
9
9
  - mcp__sellable__get_campaign
10
+ - mcp__sellable__get_campaign_context
11
+ - mcp__sellable__update_campaign
12
+ - mcp__sellable__get_provider_prompt
10
13
  - mcp__sellable__get_campaign_message_preparation_status
11
14
  - mcp__sellable__start_campaign_message_preparation
12
15
  - mcp__sellable__cancel_campaign_message_preparation
@@ -14,6 +17,7 @@ allowed-tools:
14
17
  - mcp__sellable__wait_for_lead_list_ready
15
18
  - mcp__sellable__confirm_lead_list
16
19
  - mcp__sellable__search_signals
20
+ - mcp__sellable__select_promising_posts
17
21
  - mcp__sellable__fetch_post_engagers
18
22
  - mcp__sellable__search_sales_nav
19
23
  - mcp__sellable__lookup_sales_nav_filter
@@ -27,6 +31,10 @@ allowed-tools:
27
31
  - mcp__sellable__get_rows
28
32
  - mcp__sellable__get_rows_minimal
29
33
  - mcp__sellable__get_table_rows
34
+ - mcp__sellable__get_campaign_table_schema
35
+ - mcp__sellable__select_campaign_cells
36
+ - mcp__sellable__wait_for_campaign_processing
37
+ - mcp__sellable__get_sender
30
38
  ---
31
39
 
32
40
  # Refill Sends Workflow
@@ -101,6 +109,42 @@ Source replenishment choices:
101
109
  source prospects into the same campaign/source-list path, then confirm
102
110
  readiness.
103
111
 
112
+ ### Running Campaign Signal Discovery Recovery
113
+
114
+ For an already-running regular campaign that needs same-campaign Signal
115
+ Discovery replenishment, treat the watch/current-step transition as a guarded
116
+ repair, not as normal create-campaign navigation.
117
+
118
+ Do not call `search_signals` with `currentStep:"signal-discovery"` directly from `currentStep:"running"`. The campaign step guard intentionally rejects that
119
+ backwards transition. After exact approval and a fresh refill-state reread, clear `currentStep` only if it still exactly matches `running`:
120
+
121
+ ```text
122
+ update_campaign({ campaignId, currentStep:null, clearCurrentStepIfMatches:"running" })
123
+ ```
124
+
125
+ Then register provider preflight and run a campaign-scoped `search_signals` so
126
+ post rows exist in the campaign's Signal Discovery state:
127
+
128
+ ```text
129
+ get_provider_prompt({ provider:"signal-discovery", campaignOfferId, confirmed:true })
130
+ search_signals({ campaignOfferId, currentStep:"signal-discovery", confirmed:true, ... })
131
+ ```
132
+
133
+ Use `select_promising_posts` before importing. For a fresh source refill, prefer
134
+ `selectionMode:"replace"` and `scrapePlanMode:"capacity-target"` with the
135
+ approved `targetEngagerCount` and `maxPostsToScrape`. If the approved post set cannot cover the target, do not knowingly run an under-capacity scrape; ask for approval to expand the selected post set or switch source.
136
+
137
+ If `import_leads` returns `reusedExistingSourceList` but the user explicitly
138
+ approved a different selected-post scrape, retry `import_leads` with the existing `sourceLeadListId` from that response or from refill state. For Signal
139
+ Discovery this bypasses the stale reuse guard and materializes the newly
140
+ selected campaign-scoped posts into a fresh source list.
141
+
142
+ After `wait_for_lead_list_ready`, call `confirm_lead_list` with the new
143
+ source-list id and same campaign id. Pass `currentStep:"running"` to `confirm_lead_list` for an ACTIVE already-running campaign so the watched state
144
+ returns to Running after same-campaign source rows are copied. Do not call
145
+ `update_campaign` to fake this after the copy; `confirm_lead_list` owns the
146
+ post-copy state transition.
147
+
104
148
  Before any source mutation, show exact approval evidence: workspace id,
105
149
  campaign id, workflow table id, source/provider id, source-list id when known,
106
150
  import caps, target dates/caps, dedupe/DNC/provider exclusion expectations, and
@@ -135,11 +179,28 @@ Before prep or approval mutation, reread `get_campaign_refill_state` and compare
135
179
  If they changed, stop. A second concurrent refill run must see the first run's
136
180
  import/prep state on reread and avoid duplicate work.
137
181
 
182
+ After same-campaign source copy, inspect the actual campaign-table position of
183
+ the copied rows before starting prep. Newly copied rows often land after the first 100 table rows. Use `get_campaign_table_schema` to read the `reviewBatch`,
184
+ then use `select_campaign_cells` diagnostics against
185
+ `rowSelector:{ type:"reviewBatch" }` for `enrich`, `generateMessage`, and
186
+ `approved` roles when needed.
187
+
188
+ If review-batch enrich cells are pending or Generate Message cells are
189
+ dependency-blocked, omit `maxRowsToCheck` so the adaptive prep job can cover the
190
+ bounded table scan, or set a bounded cap high enough to include appended rows
191
+ when row count evidence requires it. Do not run a fixed `maxRowsToCheck:100` prep pass after appending rows to a larger existing campaign table; it can spend
192
+ the whole budget on older rows and miss the refill batch.
193
+
138
194
  Scheduled success requires a post-action reread proving scheduler-owned cells
139
195
  with non-null `scheduledFor`. Prepared, approved, and ready-to-schedule rows are
140
196
  intermediate states; report them as awaiting scheduler unless scheduled cells
141
197
  are present.
142
198
 
199
+ preparedMessages can remain 0 while scheduler-ready state changes downstream.
200
+ After a prep job reaches a terminal state, run `wait_for_campaign_processing`
201
+ when generated/pass counts are still settling, then poll `get_campaign_refill_state` until `readyToSchedule` drops, scheduled counts increase, or the state clearly
202
+ remains awaiting scheduler. Do not force scheduler fields directly.
203
+
143
204
  ## Evergreen Campaign Discipline
144
205
 
145
206
  `fill_campaign_horizon` is a legacy evergreen-only lower-level primitive. Call it