@sellable/mcp 0.1.413 → 0.1.415

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/README.md CHANGED
@@ -16,7 +16,7 @@ Each message gets 5+ minutes of Claude attention with deep research - no other t
16
16
 
17
17
  ### Prompt Source Of Truth
18
18
 
19
- There are six public Sellable entrypoints shared across hosts:
19
+ There are seven public Sellable entrypoints shared across hosts:
20
20
 
21
21
  - `sellable:create-campaign`
22
22
  - `sellable:create-ab-test`
@@ -24,6 +24,7 @@ There are six public Sellable entrypoints shared across hosts:
24
24
  - `sellable:foundation`
25
25
  - `sellable:content`
26
26
  - `sellable:create-post`
27
+ - `sellable:refill-sends`
27
28
 
28
29
  The create-campaign public wrapper at
29
30
  `mcp/sellable/skills/create-campaign/SKILL.md` handles auth/bootstrap and loads
@@ -63,6 +64,13 @@ reader value, validates proof/AI tells, and saves content artifacts under
63
64
 
64
65
  - `mcp/sellable/skills/create-post/SKILL.md`
65
66
 
67
+ The refill-sends public command wrapper plans and executes approval-gated send
68
+ refills. It supports `--yolo` and optional sender selectors such as
69
+ `--sender "Christian Reyes"` or typed MCP calls to `refill_sends({ yolo,
70
+ senders })` from:
71
+
72
+ - `mcp/sellable/skills/refill-sends/SKILL.md`
73
+
66
74
  Keep `create-campaign-v2` and `load-voice` internal. Do not advertise either as
67
75
  a public command. `load-voice` remains a direct MCP utility for generic writing
68
76
  surfaces that are not posts or campaigns.
@@ -186,10 +194,10 @@ The installer does the full local setup:
186
194
  After the installer passes, fully quit and reopen Codex Desktop. Start a new
187
195
  thread and select `Sellable Create Campaign`, `Sellable Create A/B Test`,
188
196
  `Sellable Create Evergreen Campaigns`, `Sellable Foundation`,
189
- `Sellable Content`, or `Sellable Create Post`; or invoke
197
+ `Sellable Content`, `Sellable Create Post`, or `Sellable Refill Sends`; or invoke
190
198
  `$sellable:create-campaign`, `$sellable:create-ab-test`,
191
199
  `$sellable:create-evergreen-campaigns`, `$sellable:foundation`,
192
- `$sellable:content`, or `$sellable:create-post`. If the app still says
200
+ `$sellable:content`, `$sellable:create-post`, or `$sellable:refill-sends`. If the app still says
193
201
  `mcp__sellable__*` tools are missing after the installer passes, check that
194
202
  `~/.codex/config.toml` contains both `[marketplaces.sellable]` and
195
203
  `[plugins."sellable@sellable"]`.
@@ -206,12 +214,14 @@ Use these names consistently:
206
214
  - Claude Code command: `/sellable:foundation`
207
215
  - Claude Code command: `/sellable:content`
208
216
  - Claude Code command: `/sellable:create-post`
217
+ - Claude Code command: `/sellable:refill-sends`
209
218
  - Codex command: `$sellable:create-campaign`
210
219
  - Codex command: `$sellable:create-ab-test`
211
220
  - Codex command: `$sellable:create-evergreen-campaigns`
212
221
  - Codex command: `$sellable:foundation`
213
222
  - Codex command: `$sellable:content`
214
223
  - Codex command: `$sellable:create-post`
224
+ - Codex command: `$sellable:refill-sends`
215
225
  - Codex Desktop plugin: `sellable@sellable`
216
226
  - Codex visible skill: `Sellable Create Campaign`
217
227
  - Codex visible skill: `Sellable Create A/B Test`
@@ -219,14 +229,17 @@ Use these names consistently:
219
229
  - Codex visible skill: `Sellable Foundation`
220
230
  - Codex visible skill: `Sellable Content`
221
231
  - Codex visible skill: `Sellable Create Post`
232
+ - Codex visible skill: `Sellable Refill Sends`
222
233
  - Codex skill frontmatter name: `create-campaign`
223
234
  - Codex skill frontmatter name: `create-ab-test`
224
235
  - Codex skill frontmatter name: `create-evergreen-campaigns`
225
236
  - Codex skill frontmatter name: `foundation`
226
237
  - Codex skill frontmatter name: `content`
227
238
  - Codex skill frontmatter name: `create-post`
239
+ - Codex skill frontmatter name: `refill-sends`
228
240
  - MCP server name: `sellable`
229
241
  - Internal workflow prompt: `create-campaign-v2`
242
+ - Internal workflow prompt: `refill-sends-workflow`
230
243
  - Internal/backward-compatible memory prompt: `interview`
231
244
 
232
245
  Never tell users to run `/sellable:create-campaign-v2`,
@@ -279,6 +292,13 @@ Use the create-campaign skill:
279
292
  /sellable:create-campaign
280
293
  ```
281
294
 
295
+ Use the refill command for sender send refills:
296
+
297
+ ```
298
+ /sellable:refill-sends --yolo
299
+ /sellable:refill-sends --sender "Christian Reyes" --sender "Thomas Nobbs"
300
+ ```
301
+
282
302
  Then describe intent naturally, for example:
283
303
 
284
304
  - "Let's make a campaign with sellable"
@@ -299,6 +319,13 @@ Use the Codex skill entrypoint:
299
319
  $sellable:create-campaign
300
320
  ```
301
321
 
322
+ Use the Codex refill command with the same flags:
323
+
324
+ ```
325
+ $sellable:refill-sends --yolo
326
+ $sellable:refill-sends --sender "Christian Reyes" --sender "Thomas Nobbs"
327
+ ```
328
+
302
329
  Installed skill package path:
303
330
 
304
331
  - `~/.codex/plugins/cache/sellable/sellable/<version>/skills/sellable-create-campaign/SKILL.md`
package/dist/server.js CHANGED
@@ -37,6 +37,7 @@ import { addOnDemandLeads, createOnDemandCampaign, createOnDemandTable, initOnDe
37
37
  import { upsertRubric } from "./tools/processing.js";
38
38
  import { completeSenderResearch, getPostFindLeadsScoutRegistry, getSourceScoutRegistry, getSubskillAsset, getSubskillPrompt, listSubskillPrompts, searchSubskillPrompts, } from "./tools/prompts.js";
39
39
  import { waitForCampaignTableReady, waitForLeadListReady, } from "./tools/readiness.js";
40
+ import { refillSendsCommand } from "./tools/refill-sends.js";
40
41
  import { allTools } from "./tools/registry.js";
41
42
  import { getRows, getTableRows, getTableRowsMinimal } from "./tools/rows.js";
42
43
  import { addRubricItem, checkRubric, deleteRubricItem, draftRubrics, saveRubrics, selectNecessaryRubrics, updateRubricItem, waitForRubricResults, } from "./tools/rubrics.js";
@@ -217,6 +218,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
217
218
  case "get_campaign_refill_state":
218
219
  result = await getCampaignRefillState(args);
219
220
  break;
221
+ case "refill_sends":
222
+ result = refillSendsCommand(args);
223
+ break;
220
224
  case "setup_evergreen_campaigns":
221
225
  result = await setupEvergreenCampaigns(args);
222
226
  markEvergreenSetupCampaignsDirty(args);
@@ -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. 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.`,
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" }), list_senders, and get_campaign_refill_state for enough candidate campaigns to identify the campaign that most recently had scheduler-owned sends for the relevant sender set 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, and treat "refill senders", "fill senders", "max out senders", and "load everyone up" as sender-scoped capacity-fill preparation. For sender-scoped requests with no named senders, --yolo means all eligible healthy senders enrolled in active campaign-backed sequence campaigns in the active workspace; without --yolo, ask which eligible enrolled senders to refill before choosing campaigns or mutating. In non-yolo interactive Codex or Claude Code sessions, the sender/campaign/action approval packet must be asked through request_user_input/AskUserQuestion with exactly Accept and Decline; do not use plain chat approval. The approval question body must show workspace, sender scope, a campaign-by-campaign table, exact ids/caps/dates, side effects, forbidden actions, and stop condition before mutation. Default --yolo horizon is two sender-local send days, skipping no-send-hour days. For campaign-scoped fill/refill, select the best recent-send campaign and calculate the bounded gap from healthy sender daily capacity minus future scheduler-owned scheduled sends and ready-to-schedule rows, then prepare only that gap. For sender-scoped fill/refill, calculate the bounded gap per eligible sender across active enrolled campaigns, counting future scheduled and ready-to-schedule rows across those campaigns, then choose the best same-sender campaign to fill each sender gap: prefer recent/future scheduler-owned sends for that sender, then strongest recent result evidence, then source health. Do not stop after filling only one sender when the request was sender-scoped. Use the refill workflow to decide whether to enrich/prep more rows in that same recent-send/best-result campaign, add/import more rows to that same campaign/source path, use a different existing campaign only when the selected same-sender lane is blocked/exhausted/already loaded while the sender still has a gap, or ask what to create. Do not create warm-post-engager side campaigns. Surface sender-health blockers separately from prepared/approved/scheduled counts. User-facing refill decisions must be campaign-name-first and sender-name-first, with ids as proof/execution targets only. 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; if confirm_lead_list returns USER_ADDED_ROWS_LIMIT_EXCEEDED, create a bounded same-source split from selectedLeadListId with get_rows_minimal/load_csv_linkedin_leads, confirm that smaller source list into the same campaign, and operate on the reviewBatch first; 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
  }
@@ -0,0 +1,113 @@
1
+ type RefillSendsIntent = "plain" | "active" | "evergreen";
2
+ type RefillSendsApprovalMode = "approve" | "mark_ready";
3
+ type RefillSendsCommandInput = {
4
+ yolo?: boolean;
5
+ senders?: string[];
6
+ senderIds?: string[];
7
+ senderNames?: string[];
8
+ horizonSendDays?: number;
9
+ campaignId?: string;
10
+ tableId?: string;
11
+ intent?: RefillSendsIntent;
12
+ approvalMode?: RefillSendsApprovalMode;
13
+ };
14
+ export declare const refillSendsToolDefinitions: {
15
+ name: string;
16
+ description: string;
17
+ inputSchema: {
18
+ type: string;
19
+ properties: {
20
+ yolo: {
21
+ type: string;
22
+ description: string;
23
+ };
24
+ senders: {
25
+ type: string;
26
+ items: {
27
+ type: string;
28
+ };
29
+ description: string;
30
+ };
31
+ senderIds: {
32
+ type: string;
33
+ items: {
34
+ type: string;
35
+ };
36
+ description: string;
37
+ };
38
+ senderNames: {
39
+ type: string;
40
+ items: {
41
+ type: string;
42
+ };
43
+ description: string;
44
+ };
45
+ horizonSendDays: {
46
+ type: string;
47
+ minimum: number;
48
+ maximum: number;
49
+ description: string;
50
+ };
51
+ campaignId: {
52
+ type: string;
53
+ description: string;
54
+ };
55
+ tableId: {
56
+ type: string;
57
+ description: string;
58
+ };
59
+ intent: {
60
+ type: string;
61
+ enum: string[];
62
+ description: string;
63
+ };
64
+ approvalMode: {
65
+ type: string;
66
+ enum: string[];
67
+ description: string;
68
+ };
69
+ };
70
+ required: never[];
71
+ additionalProperties: boolean;
72
+ };
73
+ }[];
74
+ export declare function refillSendsCommand(input?: RefillSendsCommandInput): {
75
+ command: string;
76
+ tool: string;
77
+ promptName: string;
78
+ workflowPromptName: string;
79
+ yolo: boolean;
80
+ intent: RefillSendsIntent;
81
+ horizonSendDays: number;
82
+ approvalMode: RefillSendsApprovalMode;
83
+ campaignId: string | null;
84
+ tableId: string | null;
85
+ senderScope: string;
86
+ senderSelectors: {
87
+ senders: string[];
88
+ senderIds: string[];
89
+ senderNames: string[];
90
+ };
91
+ firstOperationalSteps: string[];
92
+ approvalContract: string;
93
+ forbiddenActions: string[];
94
+ hostExamples: {
95
+ claude: string[];
96
+ codex: string[];
97
+ mcpTool: {
98
+ name: string;
99
+ arguments: {
100
+ yolo: boolean;
101
+ senders: string[];
102
+ senderIds: string[];
103
+ senderNames: string[];
104
+ horizonSendDays: number;
105
+ campaignId: string | undefined;
106
+ tableId: string | undefined;
107
+ intent: RefillSendsIntent;
108
+ approvalMode: RefillSendsApprovalMode;
109
+ };
110
+ };
111
+ };
112
+ };
113
+ export {};
@@ -0,0 +1,150 @@
1
+ const DEFAULT_HORIZON_SEND_DAYS = 2;
2
+ function normalizeStrings(values) {
3
+ if (!Array.isArray(values))
4
+ return [];
5
+ return [
6
+ ...new Set(values
7
+ .map((value) => (typeof value === "string" ? value.trim() : ""))
8
+ .filter(Boolean)),
9
+ ];
10
+ }
11
+ function normalizeHorizonSendDays(value) {
12
+ if (typeof value !== "number" || !Number.isFinite(value)) {
13
+ return DEFAULT_HORIZON_SEND_DAYS;
14
+ }
15
+ return Math.max(1, Math.min(7, Math.floor(value)));
16
+ }
17
+ export const refillSendsToolDefinitions = [
18
+ {
19
+ name: "refill_sends",
20
+ description: "Typed command entrypoint for Sellable refill sends. Accepts --yolo semantics and optional sender selectors, then returns the bounded execution contract for the skill-led refill workflow. This tool does not mutate campaigns, import leads, approve messages, schedule sends, launch, archive, delete, or write scheduler rows.",
21
+ inputSchema: {
22
+ type: "object",
23
+ properties: {
24
+ yolo: {
25
+ type: "boolean",
26
+ description: "When true, auto-accept the rendered bounded refill packet after the required fresh state reread. Without sender selectors, yolo means all eligible healthy senders enrolled in active campaign-backed sequence campaigns.",
27
+ },
28
+ senders: {
29
+ type: "array",
30
+ items: { type: "string" },
31
+ description: "Optional sender selectors as names or ids. Use this for command text like --sender 'Christian Reyes'. Exact resolution still happens through list_senders before mutation.",
32
+ },
33
+ senderIds: {
34
+ type: "array",
35
+ items: { type: "string" },
36
+ description: "Optional exact Sender.id values to scope refill work.",
37
+ },
38
+ senderNames: {
39
+ type: "array",
40
+ items: { type: "string" },
41
+ description: "Optional sender display names to resolve through list_senders before campaign selection.",
42
+ },
43
+ horizonSendDays: {
44
+ type: "number",
45
+ minimum: 1,
46
+ maximum: 7,
47
+ description: "Number of sender-local send days to fill. Defaults to 2.",
48
+ },
49
+ campaignId: {
50
+ type: "string",
51
+ description: "Optional exact CampaignOffer.id to narrow routing. Do not pass campaign names.",
52
+ },
53
+ tableId: {
54
+ type: "string",
55
+ description: "Optional exact WorkflowTable.id to narrow routing. Do not pass table names.",
56
+ },
57
+ intent: {
58
+ type: "string",
59
+ enum: ["plain", "active", "evergreen"],
60
+ description: 'Route intent. Use "plain" for normal refill/load requests unless the user explicitly says active or evergreen.',
61
+ },
62
+ approvalMode: {
63
+ type: "string",
64
+ enum: ["approve", "mark_ready"],
65
+ description: 'Preparation mode for the final packet. Use "approve" only when the user asked to fill/schedule sender sends; otherwise default to "mark_ready".',
66
+ },
67
+ },
68
+ required: [],
69
+ additionalProperties: false,
70
+ },
71
+ },
72
+ ];
73
+ export function refillSendsCommand(input = {}) {
74
+ const senders = normalizeStrings(input.senders);
75
+ const senderIds = normalizeStrings(input.senderIds);
76
+ const senderNames = normalizeStrings(input.senderNames);
77
+ const hasSenderSelectors = senders.length > 0 || senderIds.length > 0 || senderNames.length > 0;
78
+ const yolo = input.yolo === true;
79
+ const horizonSendDays = normalizeHorizonSendDays(input.horizonSendDays);
80
+ const intent = input.intent ?? "plain";
81
+ const approvalMode = input.approvalMode ?? (yolo ? "approve" : "mark_ready");
82
+ const senderScope = hasSenderSelectors
83
+ ? "selected_senders"
84
+ : yolo
85
+ ? "all_eligible_healthy_senders_enrolled_in_active_campaign_backed_sequences"
86
+ : "ask_user_for_eligible_enrolled_senders_before_mutation";
87
+ return {
88
+ command: "refill-sends",
89
+ tool: "refill_sends",
90
+ promptName: "refill-sends",
91
+ workflowPromptName: "refill-sends-workflow",
92
+ yolo,
93
+ intent,
94
+ horizonSendDays,
95
+ approvalMode,
96
+ campaignId: input.campaignId ?? null,
97
+ tableId: input.tableId ?? null,
98
+ senderScope,
99
+ senderSelectors: {
100
+ senders,
101
+ senderIds,
102
+ senderNames,
103
+ },
104
+ firstOperationalSteps: [
105
+ 'Load get_subskill_prompt({ subskillName: "refill-sends-workflow" }) before any product operation.',
106
+ `Resolve route with resolve_campaign_fill_route({ intent: "${intent}"${input.campaignId ? `, campaignId: "${input.campaignId}"` : ""}${input.tableId ? `, tableId: "${input.tableId}"` : ""} }).`,
107
+ "Call list_senders and get_sender_routing, then resolve sender selectors against active enrolled campaign-backed sequence senders.",
108
+ "Read get_campaign_refill_state for enough exact candidate campaigns to pick the best per-sender target by recent/future scheduler-owned sends, then recent result evidence, then source health.",
109
+ "Fresh reread get_campaign_refill_state immediately before any import, prep, approval, or horizon-fill mutation.",
110
+ ],
111
+ approvalContract: yolo
112
+ ? "Auto-accept only the rendered bounded refill packet after fresh reread. Stop if sender set, route, ids, caps, dates, blockers, or side-effect class drift."
113
+ : hasSenderSelectors
114
+ ? "Ask the final Accept/Decline structured approval question before mutation, including workspace, sender scope, campaign table, exact ids, caps/dates, side effects, forbidden actions, and stop condition."
115
+ : "Ask which eligible enrolled senders to refill first, then ask the final Accept/Decline structured approval question before mutation.",
116
+ forbiddenActions: [
117
+ "start_campaign",
118
+ "launch or send",
119
+ "archive or delete cleanup",
120
+ "direct scheduler writes",
121
+ "sender reassignment",
122
+ "campaigns outside the rendered eligible sender packet",
123
+ "on-demand or unrelated active-campaign fallback unless the refill workflow proves the selected same-sender lane is blocked or exhausted",
124
+ ],
125
+ hostExamples: {
126
+ claude: [
127
+ "/sellable:refill-sends --yolo",
128
+ '/sellable:refill-sends --sender "Christian Reyes" --sender "Thomas Nobbs"',
129
+ ],
130
+ codex: [
131
+ "$sellable:refill-sends --yolo",
132
+ '$sellable:refill-sends --sender "Christian Reyes" --sender "Thomas Nobbs"',
133
+ ],
134
+ mcpTool: {
135
+ name: "refill_sends",
136
+ arguments: {
137
+ yolo,
138
+ senders,
139
+ senderIds,
140
+ senderNames,
141
+ horizonSendDays,
142
+ campaignId: input.campaignId,
143
+ tableId: input.tableId,
144
+ intent,
145
+ approvalMode,
146
+ },
147
+ },
148
+ },
149
+ };
150
+ }
@@ -33,6 +33,7 @@ import { onDemandToolDefinitions } from "./one-off.js";
33
33
  import { processingToolDefinitions } from "./processing.js";
34
34
  import { promptToolDefinitions } from "./prompts.js";
35
35
  import { readinessToolDefinitions } from "./readiness.js";
36
+ import { refillSendsToolDefinitions } from "./refill-sends.js";
36
37
  import { rowToolDefinitions } from "./rows.js";
37
38
  import { rubricToolDefinitions } from "./rubrics.js";
38
39
  import { senderRoutingToolDefinitions } from "./sender-routing.js";
@@ -49,6 +50,7 @@ export const allTools = [
49
50
  ...campaignAbTestToolDefinitions,
50
51
  ...campaignFillRoutingToolDefinitions,
51
52
  ...campaignRefillStateToolDefinitions,
53
+ ...refillSendsToolDefinitions,
52
54
  ...setupEvergreenCampaignsToolDefinitions,
53
55
  ...campaignHorizonFillToolDefinitions,
54
56
  ...campaignMessagePreparationToolDefinitions,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sellable/mcp",
3
- "version": "0.1.413",
3
+ "version": "0.1.415",
4
4
  "type": "module",
5
5
  "description": "Sellable MCP server for Claude Code and Codex campaign workflows",
6
6
  "main": "dist/index.js",
@@ -123,6 +123,7 @@ such as "fill campaigns", "fill up", "refill sends", "max out sends", or
123
123
  ```text
124
124
  get_subskill_prompt({ subskillName: "refill-sends-workflow" })
125
125
  resolve_campaign_fill_route({ intent:"plain" })
126
+ list_senders
126
127
  get_campaign_refill_state
127
128
  ```
128
129
 
@@ -133,15 +134,27 @@ campaign refill. Route outcomes are `route:"evergreen_horizon"`,
133
134
  returns `route:"ask_create"`, ask whether to create a normal campaign or
134
135
  evergreen campaigns. Campaign creation is allowed only after this route and
135
136
  explicit user selection; it is never the default response to plain fill. When
136
- more leads are needed, the refill workflow must recommend same-campaign
137
- source-ladder replenishment; do not create warm-post-engager side campaigns,
138
- on-demand campaigns, or unrelated campaigns. Surface sender-health blockers
139
- separately from prepared/approved/scheduled counts.
137
+ choosing among active targets, use refill-state scheduled-count evidence to
138
+ continue the campaign that most recently had scheduler-owned sends for the
139
+ relevant sender set; do not treat every active campaign as a refill candidate.
140
+ In `--yolo` fill/refill mode, default to one best recent-send campaign and a
141
+ two-send-day horizon: subtract future scheduler-owned scheduled sends and
142
+ ready-to-schedule rows from healthy sender daily capacity, then prepare only
143
+ that bounded gap.
144
+ When more leads are needed, the refill workflow must recommend same-campaign
145
+ source-ladder replenishment first; do not create warm-post-engager side
146
+ campaigns, on-demand campaigns, or unrelated campaigns. If same-source copy hits
147
+ `USER_ADDED_ROWS_LIMIT_EXCEEDED`, split the current source into a bounded
148
+ same-source LinkedIn profile list, confirm that smaller list into the same
149
+ campaign, and operate on the copied review batch first. Surface sender-health
150
+ blockers separately from prepared/approved/scheduled counts.
140
151
 
141
152
  Treat active fills as capacity-fill preparation: calculate the bounded target
142
153
  from sender capacity when needed, then use the refill workflow to decide source
143
- replenishment, enrichment/prep, approval policy, and scheduler proof. Mutation
144
- requires exact visible approval and a fresh `get_campaign_refill_state` reread.
154
+ replenishment, enrichment/prep, approval policy, and scheduler proof. Present
155
+ operator decisions by campaign name and sender name first, with campaign/table
156
+ ids as proof only. Mutation requires exact visible approval and a fresh
157
+ `get_campaign_refill_state` reread.
145
158
  For already-running regular campaigns that need Signal Discovery source
146
159
  replenishment, the refill workflow owns the guarded recovery: clear
147
160
  `currentStep` only with `clearCurrentStepIfMatches:"running"`, load the
@@ -3,8 +3,18 @@ name: refill-sends
3
3
  description: Plan regular campaign and evergreen campaign send refill work through the skill-led refill workflow.
4
4
  visibility: public
5
5
  allowed-tools:
6
+ - mcp__sellable__refill_sends
7
+ - mcp__sellable__get_auth_status
8
+ - mcp__sellable__start_cli_login
9
+ - mcp__sellable__wait_for_cli_login
10
+ - mcp__sellable__get_active_workspace
11
+ - mcp__sellable__list_workspaces
12
+ - mcp__sellable__set_active_workspace
6
13
  - mcp__sellable__get_subskill_prompt
7
14
  - mcp__sellable__search_subskill_prompts
15
+ - mcp__sellable__list_senders
16
+ - mcp__sellable__get_sender_routing
17
+ - mcp__sellable__get_campaign_waterfall
8
18
  - mcp__sellable__resolve_campaign_fill_route
9
19
  - mcp__sellable__get_campaign_refill_state
10
20
  - mcp__sellable__fill_campaign_horizon
@@ -35,14 +45,50 @@ allowed-tools:
35
45
  - mcp__sellable__get_table_rows
36
46
  - mcp__sellable__get_campaign_table_schema
37
47
  - mcp__sellable__select_campaign_cells
48
+ - mcp__sellable__queue_campaign_cells
38
49
  - mcp__sellable__wait_for_campaign_processing
39
50
  - mcp__sellable__get_sender
40
51
  ---
41
52
 
42
53
  # Refill Sends
43
54
 
44
- Use this public wrapper for plain operator requests such as "fill", "refill sends",
45
- "max out sends", "load everyone up", or "fill horizon sends".
55
+ Use this public command wrapper for plain operator requests such as "fill",
56
+ "refill sends", "max out sends", "load everyone up", or "fill horizon sends".
57
+
58
+ Host command names:
59
+
60
+ - Claude Code: `/sellable:refill-sends`
61
+ - Codex: `$sellable:refill-sends`
62
+
63
+ Accepted invocation flags in the same user request:
64
+
65
+ - `--yolo`: auto-accept the rendered bounded refill packet after the required
66
+ fresh state reread.
67
+ - `--sender <name-or-id>`: scope to a specific sender; repeat for multiple
68
+ senders.
69
+ - `senderIds: <id>, <id>` or `senderNames: <name>, <name>`: explicit selector
70
+ alternatives when the host preserves natural-language arguments better than
71
+ shell-style flags.
72
+
73
+ When the host can call typed MCP tools, start with:
74
+
75
+ ```text
76
+ refill_sends({ yolo?: boolean, senders?: string[], senderIds?: string[], senderNames?: string[], horizonSendDays?: number })
77
+ ```
78
+
79
+ That command helper only normalizes arguments and returns the execution
80
+ contract. It does not mutate. Continue with the workflow below for route
81
+ selection, state rereads, approval gating, source import, preparation, and
82
+ bounded approval.
83
+
84
+ First call `get_auth_status({})`. If auth or active workspace is not OK, follow
85
+ the returned login/workspace guidance before route resolution. Do not run refill
86
+ research against an implicit or guessed workspace.
87
+
88
+ Treat "refill senders", "fill senders", "load everyone up", and "max out
89
+ senders" as sender-scoped requests. The target set is senders enrolled in active
90
+ campaign-backed sequence campaigns, not the first active campaign returned by a
91
+ resolver.
46
92
 
47
93
  Load the internal workflow prompt before taking any operational step:
48
94
 
@@ -51,10 +97,52 @@ get_subskill_prompt({ subskillName: "refill-sends-workflow" })
51
97
  ```
52
98
 
53
99
  Then follow that workflow exactly. The default path is read-only research:
54
- resolve the route, read target refill state, report the next safe step, and stop
55
- before mutation unless the user has explicitly approved the exact workspace,
56
- campaign/table/source ids, caps/dates, approval mode, expected side effects,
57
- and stop/rollback condition.
100
+ resolve the route, identify the sender-relevant campaign that most recently had
101
+ scheduler-owned sends, read refill state for that target, report the next safe
102
+ step using campaign names first, and stop before mutation unless the user has
103
+ explicitly approved the exact workspace, campaign/table/source ids, caps/dates,
104
+ approval mode, expected side effects, and stop/rollback condition.
105
+
106
+ For interactive Codex or Claude Code sessions, that approval must use the
107
+ host-native structured question gate, not plain chat:
108
+
109
+ - Codex: use `request_user_input`.
110
+ - Claude Code: use `AskUserQuestion`.
111
+
112
+ The approval question must present the final refill step with exactly two
113
+ choices: `Accept` and `Decline`. The question body must include the operator
114
+ output packet: workspace, sender scope, a campaign-by-campaign table with
115
+ campaign name, sender names, action, target count/cap, source/list, and
116
+ blocker/skip reason, then exact ids, expected side effects, forbidden actions,
117
+ and the stop condition. Treat `Accept` as permission for only the rendered
118
+ target, caps, mode, and side effects. Treat `Decline` as a hard stop with no
119
+ mutation.
120
+
121
+ If Christian includes `--yolo` in the same refill request, treat that flag as
122
+ auto-accept for the rendered bounded refill packet after the required fresh state
123
+ reread. For sender-scoped language with no named senders, `--yolo` means all
124
+ eligible healthy senders enrolled in active campaign-backed sequence campaigns in
125
+ the active workspace. Without `--yolo`, if Christian did not name senders, ask
126
+ which eligible enrolled senders to refill before choosing campaigns or mutating.
127
+
128
+ `--yolo` only covers the exact sender set, per-sender target campaigns, caps,
129
+ approval mode, and side effects in the packet. It does not authorize
130
+ launch/start, sending, archive or delete cleanup, direct scheduler writes, sender
131
+ reassignment, or campaigns outside those selected for the eligible sender set.
132
+ Stop and re-plan if the route, sender set, ids, caps, blockers, or side-effect
133
+ class drift before mutation.
134
+
135
+ In `--yolo`, the default two-day fill horizon is two send days. For each target
136
+ sender, compute the bounded gap from that sender's healthy daily capacity,
137
+ existing future scheduler-owned scheduled sends, and rows already ready to
138
+ schedule across active campaigns enrolled with that sender. Then pick the best
139
+ same-sender campaign to fill the gap: prefer recent/future scheduler-owned sends
140
+ for that sender, then strongest recent result evidence, then source health. Do
141
+ not stop after filling only one sender when the request was sender-scoped. If a
142
+ same-source copy hits the campaign-table row cap, split the current source into
143
+ a bounded LinkedIn profile source list, confirm only that smaller list into the
144
+ same campaign, and operate on the copied review batch. Do not fall back to
145
+ on-demand campaigns or unrelated active-campaign fills.
58
146
 
59
147
  Public concepts are regular campaign and evergreen campaign. Internal direct
60
148
  campaign types are unsupported refill targets. `fill_campaign_horizon` is only a
@@ -3,6 +3,9 @@ name: refill-sends-workflow
3
3
  description: Internal skill-led refill sends workflow for regular campaigns and evergreen campaigns.
4
4
  visibility: internal
5
5
  allowed-tools:
6
+ - mcp__sellable__list_senders
7
+ - mcp__sellable__get_sender_routing
8
+ - mcp__sellable__get_campaign_waterfall
6
9
  - mcp__sellable__resolve_campaign_fill_route
7
10
  - mcp__sellable__get_campaign_refill_state
8
11
  - mcp__sellable__fill_campaign_horizon
@@ -33,6 +36,7 @@ allowed-tools:
33
36
  - mcp__sellable__get_table_rows
34
37
  - mcp__sellable__get_campaign_table_schema
35
38
  - mcp__sellable__select_campaign_cells
39
+ - mcp__sellable__queue_campaign_cells
36
40
  - mcp__sellable__wait_for_campaign_processing
37
41
  - mcp__sellable__get_sender
38
42
  ---
@@ -48,15 +52,45 @@ prep, readiness, and evergreen primitives.
48
52
  Plain phrases that enter here include "fill", "refill sends", "max out sends",
49
53
  "load everyone up", and "fill horizon sends".
50
54
 
55
+ Sender-scoped phrases include "refill senders", "fill senders", "max out
56
+ senders", and "load everyone up". A sender-scoped request targets senders
57
+ enrolled in active campaign-backed sequence campaigns, not one arbitrary active
58
+ campaign.
59
+
51
60
  1. Call `resolve_campaign_fill_route` first. Use `intent:"plain"` for generic
52
61
  fill/load language, `intent:"active"` only when the user explicitly narrowed
53
62
  to active regular campaigns, and `intent:"evergreen"` only when the user
54
63
  explicitly asked for evergreen or horizon work.
55
- 2. Pick exact ids from the resolver result. Do not use campaign names or table
56
- names as target identifiers.
57
- 3. Call `get_campaign_refill_state` for the selected `campaignId` or `tableId`.
58
- This must be the next target-specific research primitive.
59
- 4. Classify the target from refill state:
64
+ 2. Resolve sender context before choosing a target. Call `list_senders`; when a
65
+ managed program is involved, also call `get_campaign_waterfall`, and call
66
+ `get_sender_routing` when territory rules may constrain sender eligibility.
67
+ If the user named senders, map those names to exact sender ids. If the user
68
+ did not name senders and the request is sender-scoped:
69
+ - in `--yolo`, target all eligible healthy senders enrolled in active
70
+ campaign-backed sequence campaigns returned by the route/state evidence;
71
+ - outside `--yolo`, ask which eligible enrolled senders to refill before
72
+ choosing campaigns or mutating.
73
+ If the request is campaign-scoped or ambiguous "fill sends" language, infer
74
+ the relevant senders from the most recent scheduler-owned sends in
75
+ refill-state readbacks and report that inference.
76
+ Short form: `--yolo refill senders` means all eligible enrolled senders; non-yolo asks which enrolled senders.
77
+ 3. Read `get_campaign_refill_state` for candidate campaigns from the resolver
78
+ result. For a broad `active_campaigns` route, inspect enough candidates to
79
+ identify the campaign or small campaign set that most recently had
80
+ scheduler-owned sends for the relevant sender set. Do not stop after the
81
+ first resolver target unless it is also the most recent sender-relevant send
82
+ lane.
83
+ Short form: Do not stop after the first resolver target unless recent-send evidence supports it.
84
+ In `--yolo` sender-scoped mode, selecting every active campaign is still a
85
+ scope error, but selecting one best refill campaign per eligible sender is
86
+ expected. Pick the single highest-ranked recent-send or best-result campaign
87
+ for each target sender unless the refill-state evidence proves that a sender
88
+ already has enough ready/scheduled rows across enrolled campaigns or that a
89
+ different same-sender campaign is needed because the best lane is blocked.
90
+ Short form: `--yolo refill senders` selects all eligible enrolled senders, then the best campaign per sender.
91
+ 4. Pick exact ids from the selected refill-state response. Do not use campaign
92
+ names or table names as target identifiers for tool calls.
93
+ 5. Classify the target from refill state:
60
94
  - regular campaign: campaign-backed workflow table with normal source,
61
95
  sequence, senders, and send/refill stages.
62
96
  - evergreen campaign: managed always-on lane with current source evidence.
@@ -77,7 +111,10 @@ Use the refill-state response as the current facts receipt:
77
111
  approved, ready to schedule, scheduled;
78
112
  - active message prep job;
79
113
  - scheduler-owned scheduled counts by date/action from cells with non-null
80
- `scheduledFor`;
114
+ `scheduledFor`; treat these as the last sends/continuation signal;
115
+ - latest scheduled send date, latest scheduled-cell update when present,
116
+ sender overlap with the requested or inferred sender set, and whether future
117
+ scheduled sends already exist;
81
118
  - `freshness.stateHash` and exact campaign/table/workspace ids.
82
119
 
83
120
  Empty or unsafe states stop with the blocker: no fillable target, missing or deleted campaign,
@@ -89,9 +126,76 @@ scheduler, or unsupported direct campaign type.
89
126
 
90
127
  For regular campaign workspaces, rank regular campaigns from route and
91
128
  `get_campaign_refill_state` evidence. Choose the best existing refill target.
129
+ The default campaign-scoped refill interpretation is "continue the campaign that
130
+ was actually sending most recently for the relevant available senders", not
131
+ "touch every active campaign". The default sender-scoped refill interpretation is
132
+ "fill every eligible target sender from the best enrolled active campaign for
133
+ that sender", not "fill only the first/best campaign globally".
134
+
135
+ Default `--yolo` horizon is two send days when the user asks to fill, refill,
136
+ load, or max sends without naming a different horizon. Send days are sender-local
137
+ days with configured sending hours; do not treat weekends or other no-send-hour
138
+ days as fillable capacity. If the user explicitly names a no-send calendar date,
139
+ report that date as unschedulable and continue only for the next valid send day
140
+ when the packet says "send days" or the user asked to max/refill senders broadly.
141
+
142
+ For campaign-scoped requests, compute the target from the selected campaign's
143
+ healthy sender daily capacity for the next two send days, minus already
144
+ scheduler-owned future scheduled sends for those days and minus rows already
145
+ ready to schedule. For sender-scoped requests, compute that gap per target sender
146
+ across all active enrolled campaigns for that sender; count future scheduled
147
+ cells and ready-to-schedule cells in any active enrolled campaign toward that
148
+ sender's gap before preparing more rows. If ready/scheduled rows already cover a
149
+ sender's gap, do not add rows or prep for that sender; report that the sender is
150
+ loaded and awaiting the scheduler. If the gap is positive, prepare only the gap
151
+ in the best same-sender campaign and keep all source-copy/prep caps tied to that
152
+ two-day packet.
153
+ Short form: default `--yolo refill senders` target is each eligible sender's two-send-day gap.
154
+
155
+ Rank candidates in this order:
156
+
157
+ 1. **Sender match**: campaigns whose healthy sender ids match the user-named
158
+ senders, or the inferred sender set when the user said only "fill sends" or
159
+ "load senders". Do not include campaigns merely because they are active when
160
+ their sender set is unrelated.
161
+ 2. **Recent sends**: campaigns with the newest scheduler-owned scheduled counts
162
+ and non-null `scheduledFor` cells for those senders. Future scheduled sends
163
+ are stronger continuation evidence than old historical sends; otherwise use
164
+ the latest scheduled send date / newest scheduled-cell update from refill
165
+ state.
166
+ 3. **Continuation capacity**: campaigns with healthy senders, remaining daily
167
+ capacity, and a gap between current ready-to-schedule rows and the desired
168
+ sender capacity.
169
+ 4. **Same-campaign source health**: prefer campaigns whose current source has
170
+ enough `sourceAvailable` inventory to prepare the gap. If source inventory
171
+ is low or exhausted, choose same-campaign row replenishment before switching
172
+ campaigns.
173
+ 5. **Campaign scope**: keep the selected set small. For campaign-scoped
174
+ requests, normally choose one campaign. For sender-scoped requests, choose at
175
+ most one best campaign per target sender unless evidence shows one sender
176
+ needs multiple same-sender campaigns because the first is blocked or already
177
+ loaded.
178
+
92
179
  Do not create side campaigns, warm-post-engager side campaigns, on-demand campaigns,
93
180
  or unrelated campaigns as the default answer to a fill request.
94
181
 
182
+ For each selected campaign, decide the next action by the smallest sufficient
183
+ step:
184
+
185
+ - **Enrich/prep more rows in the same campaign** when sender health is good,
186
+ recent sends point to this campaign, and `sourceAvailable` can cover the
187
+ ready-to-schedule gap.
188
+ - **Add/import more rows to the same campaign/source path** when the campaign is
189
+ the right recent-send lane but source inventory or viable rows cannot cover
190
+ the gap.
191
+ - **Use a different existing campaign** only when the recent-send/best-result
192
+ campaign for that sender is blocked, archived, missing sequence/source/senders,
193
+ disconnected, exhausted with no viable same-campaign replenishment path,
194
+ already loaded while the sender still has a gap, or the user explicitly asks
195
+ to move to another campaign.
196
+ - **Ask what to create** only after resolver/state evidence shows there is no
197
+ suitable existing campaign for the requested sender set.
198
+
95
199
  When the best regular campaign is source-exhausted, recommend same-campaign source-ladder replenishment.
96
200
  Keep `selectedLeadListId` source identity distinct
97
201
  from the campaign `workflowTableId`.
@@ -109,6 +213,30 @@ Source replenishment choices:
109
213
  source prospects into the same campaign/source-list path, then confirm
110
214
  readiness.
111
215
 
216
+ When reusing an existing source list on an already-large campaign, handle the
217
+ campaign-table row cap automatically in `--yolo` mode. If `confirm_lead_list`
218
+ fails with `USER_ADDED_ROWS_LIMIT_EXCEEDED`, parse `remainingRows`,
219
+ `currentRows`, `requestedRows`, and `maxRows`; do not stop just because the full
220
+ source list is too large. Instead, create a bounded same-source split:
221
+
222
+ 1. choose a split size no larger than `remainingRows`, the two-day refill row
223
+ budget, and the first-pass processing cap unless the packet named a higher
224
+ cap;
225
+ 2. read compact rows from the current `selectedLeadListId` with
226
+ `get_rows_minimal`;
227
+ 3. create a temporary bounded LinkedIn profile source list with
228
+ `load_csv_linkedin_leads`, preserving useful source columns such as post URL,
229
+ post author, engagement type/text, keyword, confidence, and why;
230
+ 4. call `confirm_lead_list` with that bounded source-list id, the same campaign
231
+ id, and `currentStep:"running"` for ACTIVE campaigns;
232
+ 5. verify the campaign table row count and review batch with
233
+ `get_campaign_table_schema` before any prep/approval.
234
+
235
+ Do not use `add_on_demand_leads` or create an on-demand table as the automatic
236
+ regular-campaign fallback. The fallback must stay same-campaign and
237
+ source-list-backed.
238
+ Short form: row-cap fallback means bounded same-source split, not stop or on-demand.
239
+
112
240
  ### Running Campaign Signal Discovery Recovery
113
241
 
114
242
  For an already-running regular campaign that needs same-campaign Signal
@@ -146,10 +274,10 @@ returns to Running after same-campaign source rows are copied. Do not call
146
274
  post-copy state transition.
147
275
 
148
276
  Before any source mutation, show exact approval evidence: workspace id,
149
- campaign id, workflow table id, source/provider id, source-list id when known,
150
- import caps, target dates/caps, dedupe/DNC/provider exclusion expectations, and
151
- expected row side effects. Then reread `get_campaign_refill_state`; if
152
- `freshness.stateHash` or exact ids changed, stop and ask for a fresh approval.
277
+ campaign name, campaign id, workflow table id, source/provider id, source-list
278
+ id when known, import caps, target dates/caps, dedupe/DNC/provider exclusion expectations, and expected row side effects. Present the campaign name and plain-English reason first; include ids only as proof and execution targets.
279
+ Then reread `get_campaign_refill_state`; if `freshness.stateHash` or exact ids
280
+ changed, stop and ask for a fresh approval.
153
281
 
154
282
  After source import, call `wait_for_lead_list_ready` and `confirm_lead_list`
155
283
  with the source-list id and campaign id. Imports append to the existing
@@ -179,18 +307,87 @@ Before prep or approval mutation, reread `get_campaign_refill_state` and compare
179
307
  If they changed, stop. A second concurrent refill run must see the first run's
180
308
  import/prep state on reread and avoid duplicate work.
181
309
 
310
+ After the final reread and before the first mutating refill primitive, render
311
+ one final approval packet in campaign-name-first language, then ask a
312
+ host-native structured question with exactly two choices: `Accept` and
313
+ `Decline`. The question is the execution boundary.
314
+ Short form: exactly two choices: `Accept` and `Decline`.
315
+
316
+ - In Codex interactive sessions, use `request_user_input`.
317
+ - In Claude Code interactive sessions, use `AskUserQuestion`.
318
+ - The question body must include this exact operator output packet shape before
319
+ the choices:
320
+ - workspace name/id and mode (`--yolo` or approval-required);
321
+ - sender scope, including selected sender names and skipped sender names with
322
+ health/enrollment reasons;
323
+ - a campaign-by-campaign plan table with campaign name, sender names, action,
324
+ target count/cap, source/list, and blocker/skip reason;
325
+ - exact workspace id, campaign id, workflow table id, source/action ids when
326
+ relevant, freshness/state hash, caps/dates, approval mode, and the next
327
+ MCP primitive to call;
328
+ - expected side effects, forbidden actions, and the stop/rollback condition.
329
+ - The `Accept` choice must name the exact campaign, workspace id, campaign id,
330
+ workflow table id, source/action ids when relevant, caps/dates, approval mode,
331
+ expected side effects, and stop/rollback condition.
332
+ - The `Decline` choice must stop with no mutation.
333
+ - Do not proceed from a plain chat "ok", "yes", "go", or "do it" when the
334
+ structured question tool is available. If the structured question tool is not
335
+ available in an interactive session, stop and tell the user the quick question
336
+ panel is required for refill approvals. In non-interactive exec/automation,
337
+ print the approval packet and stop before mutation.
338
+
339
+ `--yolo` mode is explicit auto-accept. If Christian includes `--yolo` in the
340
+ same refill request, do not ask the `Accept` / `Decline` question. Instead:
341
+
342
+ 1. render the same final approval packet;
343
+ 2. reread `get_campaign_refill_state`;
344
+ 3. verify the route, workspace id, campaign id, table id, source/action ids,
345
+ caps/dates, approval mode, blockers, and side-effect class still match the
346
+ packet;
347
+ 4. execute only the exact packet.
348
+
349
+ `--yolo` never authorizes launch/start, sending, archive/delete cleanup, raw
350
+ scheduler writes, sender reassignment, unrelated campaigns, extra senders beyond
351
+ the eligible sender set, or higher caps than the packet named. In sender-scoped
352
+ `--yolo`, a bounded packet containing all eligible enrolled senders and at most
353
+ one best campaign per sender is covered; arbitrary expanded campaign sets are
354
+ not. If any state or scope drifts, stop and re-plan instead of auto-accepting the
355
+ changed action.
356
+ Short form: all eligible enrolled senders are covered by sender-scoped `--yolo`; arbitrary expanded campaign sets are not.
357
+ Short form: direct scheduler writes are not covered by `--yolo`.
358
+ Short form: stop and re-plan instead of auto-accepting the changed action.
359
+
182
360
  After same-campaign source copy, inspect the actual campaign-table position of
183
361
  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
362
  then use `select_campaign_cells` diagnostics against
185
363
  `rowSelector:{ type:"reviewBatch" }` for `enrich`, `generateMessage`, and
186
364
  `approved` roles when needed.
187
365
 
366
+ For bounded split refills, operate on the review batch first. Queue
367
+ `queue_campaign_cells` for `columnRole:"enrich"` on
368
+ `rowSelector:{ type:"reviewBatch" }`, wait for campaign processing, then queue
369
+ `columnRole:"generateMessage"` for the same review batch or
370
+ `needsGeneratedMessage` rows. If the bounded packet explicitly uses
371
+ `approvalMode:"approve"` because the user asked to fill/schedule sends or
372
+ provided `--yolo` for a two-day send fill, approve only the bounded review-batch
373
+ cohort after current generated messages exist. Do not broad approve existing
374
+ table rows.
375
+
188
376
  If review-batch enrich cells are pending or Generate Message cells are
189
377
  dependency-blocked, omit `maxRowsToCheck` so the adaptive prep job can cover the
190
378
  bounded table scan, or set a bounded cap high enough to include appended rows
191
379
  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
380
  the whole budget on older rows and miss the refill batch.
193
381
 
382
+ Bound `targetPreparedMessages` to the actual ready-to-schedule gap for the
383
+ selected campaign and sender set. In sender-scoped mode, compute and report the
384
+ gap per sender. If ready/scheduled rows across active enrolled campaigns already
385
+ cover a sender's gap, do not start prep for that sender; report that the sender
386
+ is already loaded and awaiting the scheduler. If source inventory is available
387
+ and the gap is small, prepare only the sender gap instead of filling every active
388
+ campaign.
389
+ Short form: prepare only the per-sender gap instead of filling every active campaign.
390
+
194
391
  Scheduled success requires a post-action reread proving scheduler-owned cells
195
392
  with non-null `scheduledFor`. Prepared, approved, and ready-to-schedule rows are
196
393
  intermediate states; report them as awaiting scheduler unless scheduled cells
@@ -225,9 +422,24 @@ the current source or ask for more research instead of walking the ladder.
225
422
  - No mutation in production unless Christian explicitly approves exact
226
423
  workspace, campaign/table ids, source/action ids, caps/dates, approval mode,
227
424
  expected side effects, and rollback/stop condition.
425
+ - In interactive Codex or Claude Code, that explicit approval must be collected
426
+ through the host-native `Accept` / `Decline` question gate.
427
+ - `--yolo` in the current refill request is explicit auto-accept for the
428
+ rendered bounded refill packet only; it does not loosen the launch/send,
429
+ scheduler-write, archive/delete, or drift rules above.
228
430
 
229
431
  ## Report
230
432
 
231
- Report the selected target, target type, source state, blockers, exact next
232
- primitive, approval required, and the freshness hash used. Say explicitly that
233
- nothing was launched and nothing was sent.
433
+ Report in campaign-name-first language:
434
+
435
+ - selected campaign name(s), target type, and sender names;
436
+ - why they were selected, including last scheduled send date/future scheduled
437
+ send evidence and sender overlap;
438
+ - whether the smallest next step is enrich/prep more in that campaign, add rows
439
+ to that campaign/source, use a different existing campaign, or ask what to
440
+ create;
441
+ - source state, blockers, exact next primitive, approval required, and the
442
+ freshness hash used.
443
+
444
+ Keep ids visible but secondary: show them under "Exact target" or "Proof", not
445
+ as the main decision text. Say explicitly: nothing was launched and nothing was sent.