@sellable/mcp 0.1.512 → 0.1.514

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.
@@ -0,0 +1,138 @@
1
+ ---
2
+ name: refill-sends-v2-workflow
3
+ description: Internal execution workflow for refill sends v2 fenced runs.
4
+ visibility: internal
5
+ allowed-tools:
6
+ - mcp__sellable__refill_sends_v2
7
+ - mcp__sellable__get_refill_plan_v2
8
+ - mcp__sellable__get_subskill_prompt
9
+ - mcp__sellable__get_subskill_asset
10
+ - mcp__sellable__get_auth_status
11
+ - mcp__sellable__get_active_workspace
12
+ - mcp__sellable__list_workspaces
13
+ - mcp__sellable__get_workspace
14
+ ---
15
+
16
+ # Refill Sends V2 Workflow
17
+
18
+ This internal workflow mirrors the run-record gates enforced by
19
+ `refill_sends_v2`: bootstrap, plan, execute, verify, and report. Dry runs stay
20
+ read-only. Real runs execute only packet-named bounded work under a fenced run
21
+ lease and return terminal, blocked, or in-progress results.
22
+
23
+ Runtime flow asset: after loading this prompt, load
24
+ `get_subskill_asset({ subskillName: "refill-sends-v2-workflow", assetPath: "core/flow.v1.json" })`
25
+ through MCP, continue chunks until `hasMore:false`, parse the JSON, and verify
26
+ `workflow:"refill-sends-v2-workflow"` with a `v1` version before driving the
27
+ loop. If the asset cannot load or parse, stop with
28
+ `blocked:refill_sends_v2_workflow_asset_unavailable`; do not emulate it from
29
+ local files or memory.
30
+
31
+ ## G0 Bootstrap
32
+
33
+ Resolve request-scoped `workspaceId` using read-only auth and workspace tools.
34
+ Scheduled or autonomous runs must not rely on implicit workspace state.
35
+
36
+ Start or resume the execution loop:
37
+
38
+ ```text
39
+ refill_sends_v2({ workspaceId, intent:"auto", senderIds?, approvalMode?, runId?, fence? })
40
+ ```
41
+
42
+ Use `dryRun:true` only when the user asked for read-only inspection. A dry run
43
+ writes a journal only. A real run creates or resumes a run record, refreshes
44
+ paid-credit trust only when packet facts require it, and returns a resume handle
45
+ when the current invocation must pause.
46
+
47
+ ## G1 Plan
48
+
49
+ The loop reads `get_refill_plan_v2` with runState fed back from the run record.
50
+ It captures `planRevision`, `stateRevision`, and `targetShapeRevision`, then
51
+ validates the packet before dispatch. Packet coherence is required: fingerprint
52
+ shape, tool input completeness, lane-chain membership, census-vs-rung
53
+ consistency, and terminal/action exclusivity. An incoherent packet is replanned
54
+ once, then blocked as `packet_incoherent`.
55
+
56
+ The packet's `supplyCensus`, `censusReason`, and `pipelineDiagnosis` checklist
57
+ are the reason for the next rung. Repair is replan-driven: the planner names
58
+ the repair rung, such as re-run errored enrichment/message cells
59
+ (`rerun_errored_cells`), approve generated messages that are ready for review
60
+ (`approve_messages`), or start the paused campaign so ready rows can schedule
61
+ (`start_campaign`). The loop bounds and refuses repair loops; it never invents
62
+ a fix list.
63
+
64
+ Use plain-language labels first and tokens second, for example "copy leads
65
+ already found into the campaign table (`reconcile_source_copy`)".
66
+
67
+ ## G2 Execute
68
+
69
+ The loop executes only the packet head action whose fingerprint was captured at
70
+ G1. Stale packets are refused and replanned.
71
+
72
+ Allowed packet-named work:
73
+
74
+ 1. start the paused campaign so ready rows can schedule (`start_campaign`) when
75
+ the campaign is in the pinned lane chain;
76
+ 2. approve generated messages that are ready for review (`approve_messages`);
77
+ 3. enrich the next batch of unenriched rows (`enrich_more`);
78
+ 4. copy leads already found into the campaign table (`reconcile_source_copy`);
79
+ 5. re-run errored enrichment/message cells (`rerun_errored_cells`);
80
+ 6. find more leads via this campaign's original source
81
+ (`add_leads_same_source`) for mechanical same-source continuations;
82
+ 7. wait for the scheduler to pick up ready rows (`wait_for_scheduler`).
83
+
84
+ Never create campaigns, switch providers, lower thresholds, write scheduler
85
+ fields, send/archive/delete, or mutate brief/filter/message/sequence/sender
86
+ config inside refill.
87
+
88
+ Sales Nav and Prospeo continuations that need human source work are blocked as
89
+ scoped handoffs:
90
+
91
+ ```text
92
+ $sellable:create-campaign [campaignId]
93
+ ```
94
+
95
+ The handoff scope is source work only: same saved-search identity, import mode
96
+ `add` into the same source list, no new campaign, no provider-family switch, and
97
+ no brief/rubric/message/sequence/sender changes without a separate approval
98
+ packet.
99
+
100
+ ## G3 Verify
101
+
102
+ Verification is whole-row and bounded. The loop records planned -> did ->
103
+ outcome, then verifies before replanning.
104
+
105
+ - Own active prep jobs are reattached by `requestSource` and `requestHash`; do
106
+ not re-dispatch prep while the job is active.
107
+ - Foreign prep jobs are waited out or blocked as `foreign_prep_active`; their
108
+ outcomes are not adopted.
109
+ - Active enrichment/import work is handled by bounded packet rereads.
110
+ - The conversion verdict after the first prep batch is journaled from packet
111
+ facts. The plan gate withholds a second unproven prep batch when
112
+ `censusReason` is `conversion_blocked`.
113
+ - Honest rubric failure means a human updates the rubric or changes lead source.
114
+ - Capped scheduler capacity is complete.
115
+
116
+ Scheduler wait is cross-invocation. If the tool returns `in_progress` with
117
+ sweep guidance, re-invoke `refill_sends_v2` with `{runId, fence}`. The scheduler
118
+ budget is cumulative at the run level. Zero pickup after a confirmed sweep is
119
+ debugged from `pipelineDiagnosis`; it is not waited out forever.
120
+
121
+ ## G4 Report
122
+
123
+ Completion proof is the run record at `g4_terminal` with a named doneReason and
124
+ journal evidence showing planned -> did -> outcome plus a terminal block and
125
+ index line. A plan packet alone is not completion proof.
126
+
127
+ Terminal reasons are `complete`, `capped_by_scheduler`,
128
+ `loaded_awaiting_scheduler`, `lanes_exhausted`, `blocked`,
129
+ `no_refillable_campaigns`, and `not_an_evergreen_workspace`.
130
+
131
+ `loaded_awaiting_scheduler` remains the run-record token, but report copy must
132
+ include remaining-ready count, exact expected pickup time, and the resume
133
+ handle. Do not render bare "loaded, awaiting scheduler" as a final answer.
134
+
135
+ Report campaign names and sender names first, ids second. Include lane source,
136
+ lane chain, chosen label with token secondary, plan revision, terminal reason or
137
+ resume handle, journal path, blocked continuation packets, and firstFailing
138
+ checklist when present.
@@ -0,0 +1,372 @@
1
+ {
2
+ "version": "v1.0",
3
+ "workflow": "refill-sends-v2-workflow",
4
+ "principle": "Execute refill sends v2 through a fenced run record: bootstrap, plan, execute, verify, and report. Dry runs stay read-only; real runs execute only packet-named bounded work.",
5
+ "laneSources": [
6
+ "managed_waterfall",
7
+ "dashboard_evergreen",
8
+ "active_campaign"
9
+ ],
10
+ "terminalReasons": [
11
+ "complete",
12
+ "capped_by_scheduler",
13
+ "loaded_awaiting_scheduler",
14
+ "lanes_exhausted",
15
+ "blocked",
16
+ "no_refillable_campaigns",
17
+ "not_an_evergreen_workspace"
18
+ ],
19
+ "blockers": ["workspace_access"],
20
+ "enumeratedRungs": [
21
+ "start_campaign",
22
+ "approve_messages",
23
+ "wait_for_active_work",
24
+ "enrich_more",
25
+ "reconcile_source_copy",
26
+ "rerun_errored_cells",
27
+ "add_leads_same_source",
28
+ "paid_lane_fallback",
29
+ "next_campaign",
30
+ "wait_for_scheduler",
31
+ "done"
32
+ ],
33
+ "rungLabels": {
34
+ "start_campaign": "start the paused campaign so ready rows can schedule",
35
+ "approve_messages": "approve generated messages that are ready for review",
36
+ "wait_for_active_work": "wait for active campaign work to finish",
37
+ "enrich_more": "enrich the next batch of unenriched rows",
38
+ "reconcile_source_copy": "copy leads already found into the campaign table",
39
+ "add_leads_same_source": "find more leads via this campaign's original source",
40
+ "paid_lane_fallback": "move paid InMail demand to the connection fallback lane",
41
+ "next_campaign": "move to the next campaign in the lane",
42
+ "wait_for_scheduler": "wait for the scheduler to pick up ready rows",
43
+ "done": "finish the refill run",
44
+ "rerun_errored_cells": "re-run errored enrichment/message cells"
45
+ },
46
+ "hardRules": [
47
+ "dry-runs write journals only and never create run records",
48
+ "execute only the packet fingerprint captured at the last plan gate",
49
+ "validate packet coherence before dispatch; replan once, then block packet_incoherent",
50
+ "repair rungs come from the plan packet; the loop bounds and refuses, never self-emits repair actions",
51
+ "capped_by_scheduler is complete, never poll",
52
+ "awaiting scheduler is not an end state; window-closed reports name remaining-ready, expected pickup time, and resume handle",
53
+ "honest-rubric-fail means a human updates the rubric or changes lead source",
54
+ "source replenishment beyond same-source-automatic is a scoped create-campaign handoff, never refill-owned provider search",
55
+ "no campaign creation, provider-family switch, threshold lowering, scheduler writes, sends, archives, deletes, or brief/filter/message/sequence/sender mutation without a separate approval packet"
56
+ ],
57
+ "requiredBootstrap": [
58
+ {
59
+ "tool": "get_auth_status",
60
+ "purpose": "Confirm MCP auth before reading workspace or starting a refill run."
61
+ },
62
+ {
63
+ "tool": "get_active_workspace",
64
+ "purpose": "Resolve explicit workspace evidence when the request did not provide workspaceId."
65
+ },
66
+ {
67
+ "tool": "refill_sends_v2",
68
+ "requiredValues": {
69
+ "workspaceId": "{workspaceId}"
70
+ },
71
+ "requiredOutput": [
72
+ "terminal, in_progress, blocked, or dry_run status",
73
+ "resume handle {runId, fence, gate} when in_progress"
74
+ ]
75
+ },
76
+ {
77
+ "tool": "get_subskill_prompt",
78
+ "requiredValues": {
79
+ "subskillName": "refill-sends-v2-workflow"
80
+ },
81
+ "mustReadUntil": {
82
+ "hasMore": false
83
+ }
84
+ },
85
+ {
86
+ "tool": "get_subskill_asset",
87
+ "requiredValues": {
88
+ "subskillName": "refill-sends-v2-workflow",
89
+ "assetPath": "core/flow.v1.json"
90
+ },
91
+ "mustReadUntil": {
92
+ "hasMore": false
93
+ },
94
+ "validation": {
95
+ "workflow": "refill-sends-v2-workflow",
96
+ "versionPrefix": "v1",
97
+ "requiredTopLevelKeys": [
98
+ "states",
99
+ "gateOrder",
100
+ "enumeratedRungs",
101
+ "rungLabels",
102
+ "verification",
103
+ "laneSources",
104
+ "terminalReasons",
105
+ "blockers",
106
+ "hardRules"
107
+ ]
108
+ }
109
+ },
110
+ {
111
+ "tool": "get_refill_plan_v2",
112
+ "requiredValues": {
113
+ "workspaceId": "{workspaceId}",
114
+ "intent": "auto"
115
+ },
116
+ "requiredOutput": [
117
+ "planRevision or workspace_access blocker",
118
+ "stateRevision",
119
+ "packet with supplyCensus/censusReason when available",
120
+ "pipelineDiagnosis checklist when blocked",
121
+ "sideEffects"
122
+ ]
123
+ }
124
+ ],
125
+ "gateOrder": ["bootstrap", "plan", "execute", "verify", "report"],
126
+ "states": [
127
+ {
128
+ "id": "bootstrap",
129
+ "description": "Load the command contract, workflow prompt, flow asset, and workspace facts. A real run starts or resumes a fenced run record; dryRun:true stays read-only and journal-only.",
130
+ "allowedTools": [
131
+ "get_auth_status",
132
+ "get_active_workspace",
133
+ "list_workspaces",
134
+ "get_workspace",
135
+ "refill_sends_v2",
136
+ "get_subskill_prompt",
137
+ "get_subskill_asset",
138
+ "get_refill_plan_v2"
139
+ ],
140
+ "onEnter": [
141
+ {
142
+ "tool": "get_auth_status"
143
+ },
144
+ {
145
+ "tool": "refill_sends_v2",
146
+ "requiredFields": ["workspaceId"]
147
+ },
148
+ {
149
+ "tool": "get_subskill_prompt",
150
+ "requiredValues": {
151
+ "subskillName": "refill-sends-v2-workflow"
152
+ }
153
+ },
154
+ {
155
+ "tool": "get_subskill_asset",
156
+ "requiredValues": {
157
+ "subskillName": "refill-sends-v2-workflow",
158
+ "assetPath": "core/flow.v1.json"
159
+ }
160
+ }
161
+ ],
162
+ "transitions": {
163
+ "contract_loaded": "plan",
164
+ "resume_handle_loaded": "verify",
165
+ "dry_run_requested": "report"
166
+ }
167
+ },
168
+ {
169
+ "id": "plan",
170
+ "description": "Read a fresh get_refill_plan_v2 packet with runState fed back from the run record. The loop captures planRevision, stateRevision, and targetShapeRevision, then validates packet coherence before dispatch. The packet's supplyCensus, censusReason, and pipelineDiagnosis checklist explain the rung choice. If packet_incoherent appears, replan once; a second incoherent packet blocks.",
171
+ "allowedTools": ["get_refill_plan_v2"],
172
+ "onEnter": [
173
+ {
174
+ "tool": "get_refill_plan_v2",
175
+ "requiredFields": ["workspaceId"],
176
+ "optionalFields": [
177
+ "intent",
178
+ "senderIds",
179
+ "runState",
180
+ "journal",
181
+ "journalNote"
182
+ ]
183
+ }
184
+ ],
185
+ "requiredOutput": [
186
+ "planRevision starts with pr1: unless blocker is workspace_access",
187
+ "stateRevision and targetShapeRevision captured",
188
+ "chosen label (evergreenRung token) is in enumeratedRungs",
189
+ "supplyCensus and censusReason justify prep/source/repair choices",
190
+ "pipelineDiagnosis checklist names firstFailing when blocked",
191
+ "terminal doneReason maps to terminalReasons"
192
+ ],
193
+ "allowedRungsSource": "enumeratedRungs",
194
+ "doNotAllow": [
195
+ "add_column",
196
+ "add_on_demand_leads",
197
+ "add_rubric_item",
198
+ "add_teammate",
199
+ "add_to_comment_campaign",
200
+ "add_to_connection_campaign",
201
+ "add_to_inmail_campaign",
202
+ "archive_campaign",
203
+ "attach_recommended_sequence",
204
+ "attach_sequence",
205
+ "bulk_enrich_with_prospeo",
206
+ "cancel_campaign_message_preparation",
207
+ "cancel_lead_import",
208
+ "capture_post_idea",
209
+ "check_rubric",
210
+ "commit_blueprint",
211
+ "confirm_harvest_job_companies",
212
+ "confirm_lead_list",
213
+ "confirm_prospeo_company_accounts",
214
+ "copy_sender_config",
215
+ "create_campaign",
216
+ "create_on_demand_campaign",
217
+ "create_on_demand_table",
218
+ "create_workspace",
219
+ "create_workflow_table",
220
+ "delete_column",
221
+ "delete_rubric_item",
222
+ "duplicate_campaign",
223
+ "enrich_with_prospeo",
224
+ "fill_campaign_horizon",
225
+ "get_or_create_direct_campaign_table",
226
+ "import_leads",
227
+ "load_csv_dnc_entries",
228
+ "load_csv_domains",
229
+ "load_csv_linkedin_leads",
230
+ "mark_post_published",
231
+ "migrate_flat_configs",
232
+ "pause_campaign",
233
+ "pause_direct_campaign",
234
+ "pause_on_demand_campaign",
235
+ "prepare_campaign_ab_test",
236
+ "queue_campaign_cells",
237
+ "queue_cells",
238
+ "record_campaign_review_batch",
239
+ "record_engage_proven_search",
240
+ "refill_sends",
241
+ "refresh_paid_inmail_credits",
242
+ "revise_message_template_and_rerun",
243
+ "save_domain_filters",
244
+ "save_hook_research",
245
+ "save_post_draft",
246
+ "save_rubrics",
247
+ "send_inbox_draft",
248
+ "send_inbox_manual_reply",
249
+ "set_active_workspace",
250
+ "set_campaign_waterfall_order",
251
+ "set_company_info",
252
+ "set_engage_state",
253
+ "set_engage_style_guide",
254
+ "set_headline_icp_criteria",
255
+ "set_sender_routing",
256
+ "setup_evergreen_campaigns",
257
+ "start_campaign",
258
+ "start_campaign_message_preparation",
259
+ "start_direct_campaign",
260
+ "start_on_demand_campaign",
261
+ "update_campaign",
262
+ "update_campaign_brief",
263
+ "update_cell",
264
+ "update_column",
265
+ "update_inbox_draft",
266
+ "update_post_draft",
267
+ "update_published_post_metrics",
268
+ "update_rubric_item",
269
+ "upsert_engage_tracked_person",
270
+ "upsert_rubric"
271
+ ],
272
+ "transitions": {
273
+ "work_named": "execute",
274
+ "terminal_doneReason": "report",
275
+ "workspace_access": "report",
276
+ "packet_incoherent_replan": "plan",
277
+ "packet_incoherent_blocked": "report"
278
+ }
279
+ },
280
+ {
281
+ "id": "execute",
282
+ "description": "Execute exactly the packet head action through refill_sends_v2 internals. Bounded approvals, message preparation, same-source copies, rerun_errored_cells, saved signal continuations, paid-credit refreshes, and pinned-lane starts are allowed only when named by the packet. Execute only the fingerprint captured at the last plan gate; stale packets refuse and return to plan.",
283
+ "allowedTools": [
284
+ "refill_sends_v2",
285
+ "start_campaign_message_preparation",
286
+ "confirm_lead_list",
287
+ "import_leads",
288
+ "search_signals",
289
+ "select_promising_posts",
290
+ "start_campaign",
291
+ "queue_campaign_cells"
292
+ ],
293
+ "doNotAllow": [
294
+ "create_campaign",
295
+ "create_on_demand_campaign",
296
+ "setup_evergreen_campaigns",
297
+ "set_campaign_waterfall_order",
298
+ "refresh_paid_inmail_credits",
299
+ "send_inbox_draft",
300
+ "send_inbox_manual_reply",
301
+ "update_campaign_brief",
302
+ "set_headline_icp_criteria",
303
+ "set_sender_routing"
304
+ ],
305
+ "transitions": {
306
+ "planned_recorded": "verify",
307
+ "stale_packet": "plan",
308
+ "non_yolo_continuation": "report",
309
+ "lease_lost": "report"
310
+ }
311
+ },
312
+ {
313
+ "id": "verify",
314
+ "description": "Verify whole-row outcomes before another plan read. Reattach to an own active prep job by requestSource/requestHash; never re-dispatch prep while a matching job is active. Foreign prep waits until clear or blocks foreign_prep_active. wait_for_active_work and wait_for_source_import reread the plan on bounded cadence. wait_for_scheduler is cross-invocation: each tool call polls briefly under the host guard, heartbeats the lease, and returns in_progress sweep guidance so the agent re-invokes refill_sends_v2 with {runId,fence}. The approximately five minute scheduler budget is cumulative at the run level.",
315
+ "allowedTools": ["refill_sends_v2", "get_refill_plan_v2"],
316
+ "onEnter": [
317
+ {
318
+ "tool": "refill_sends_v2",
319
+ "requiredFields": ["workspaceId", "runId", "fence"]
320
+ }
321
+ ],
322
+ "hardRules": [
323
+ "do not re-dispatch prep when an own active job exists; reattach and poll status",
324
+ "capped_by_scheduler is complete",
325
+ "replan-driven repair: the planner names rerun_errored_cells, approve_messages, start_campaign, or source work; the loop bounds and refuses",
326
+ "conversion verdict is journaled from packet facts after the first prep batch; the plan gate withholds a second unproven prep batch",
327
+ "zero pickup after a confirmed sweep is debugged from pipelineDiagnosis, not waited out forever",
328
+ "Sales Nav and Prospeo continuation packets render a scoped $sellable:create-campaign [campaignId] handoff for same saved-search identity, import mode add into the same source list, source work only"
329
+ ],
330
+ "transitions": {
331
+ "verify_poll": "verify",
332
+ "verified": "plan",
333
+ "in_progress_resume": "verify",
334
+ "terminal": "report",
335
+ "blocked": "report"
336
+ },
337
+ "repeatUntil": "terminal_or_in_progress_resume_or_blocked"
338
+ },
339
+ {
340
+ "id": "report",
341
+ "description": "Present the terminal or blocked report. Terminal proof is the run record at g4_terminal with a doneReason plus journal planned->did->outcome lines and a terminal block. loaded_awaiting_scheduler keeps the token for run-record compatibility, but report copy must include remaining-ready count, exact expected pickup time, and the resume handle; never render bare loaded, awaiting scheduler copy. Blocked Sales Nav and Prospeo packets reprint the scoped $sellable:create-campaign [campaignId] handoff text.",
342
+ "allowedTools": [],
343
+ "onEnter": [
344
+ {
345
+ "action": "present_run_terminal_or_resume_report"
346
+ }
347
+ ],
348
+ "terminal": true
349
+ }
350
+ ],
351
+ "verification": {
352
+ "requiredProof": [
353
+ "run record reached g4_terminal with a named doneReason",
354
+ "journal contains planned -> did -> outcome lines",
355
+ "journal contains terminal block and index line",
356
+ "planRevision has pr1: prefix unless blocker is workspace_access",
357
+ "chosen evergreenRung belongs to enumeratedRungs and has a plain-language rungLabels entry",
358
+ "managed_waterfall, dashboard_evergreen, or active_campaign lane source recorded",
359
+ "laneChain recorded when active_campaign chain is selected",
360
+ "supplyCensus/censusReason and pipelineDiagnosis checklist reviewed when present",
361
+ "in_progress results include runId, fence, gate, and sweep or wait guidance"
362
+ ],
363
+ "notCompletionProof": [
364
+ "called get_refill_plan_v2 alone",
365
+ "plan packet alone",
366
+ "action queue exists but no planned/did/outcome journal evidence",
367
+ "in_progress continuation without {runId,fence,gate}",
368
+ "journal absence",
369
+ "bare loaded awaiting scheduler report without expected pickup time"
370
+ ]
371
+ }
372
+ }