taketomarket 0.1.0

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.
Files changed (123) hide show
  1. package/.claude-plugin/plugin.json +10 -0
  2. package/LICENSE +21 -0
  3. package/README.md +419 -0
  4. package/agents/ttm-producer.md +53 -0
  5. package/bin/lib/campaign.cjs +553 -0
  6. package/bin/lib/commit.cjs +105 -0
  7. package/bin/lib/core.cjs +172 -0
  8. package/bin/lib/deviation.cjs +149 -0
  9. package/bin/lib/drift-log.cjs +219 -0
  10. package/bin/lib/health.cjs +438 -0
  11. package/bin/lib/slug.cjs +59 -0
  12. package/bin/lib/state.cjs +96 -0
  13. package/bin/ttm-tools.cjs +157 -0
  14. package/gates/base-gates.md +266 -0
  15. package/gates/discipline/.gitkeep +0 -0
  16. package/gates/gate-evaluation.md +341 -0
  17. package/gates/meta-gates.md +19 -0
  18. package/install.js +307 -0
  19. package/package.json +53 -0
  20. package/playbooks/.gitkeep +0 -0
  21. package/playbooks/aeo.md +223 -0
  22. package/playbooks/affiliate.md +272 -0
  23. package/playbooks/base.md +110 -0
  24. package/playbooks/email.md +306 -0
  25. package/playbooks/events.md +320 -0
  26. package/playbooks/linkedin.md +263 -0
  27. package/playbooks/paid-ads.md +318 -0
  28. package/playbooks/pr-media.md +296 -0
  29. package/playbooks/seo.md +284 -0
  30. package/playbooks/social.md +305 -0
  31. package/playbooks/youtube.md +325 -0
  32. package/references/context-loading.md +107 -0
  33. package/references/learnings-extraction.md +94 -0
  34. package/references/measurement-template.md +48 -0
  35. package/references/meta-gate-evaluation.md +169 -0
  36. package/references/positioning-check-report.md +197 -0
  37. package/references/review-checklist.md +78 -0
  38. package/references/ship-checklist-items.md +94 -0
  39. package/settings.json +4 -0
  40. package/skills/ttm-aeo-check/SKILL.md +20 -0
  41. package/skills/ttm-affiliate-kit/SKILL.md +19 -0
  42. package/skills/ttm-archive/SKILL.md +13 -0
  43. package/skills/ttm-brand-refresh/SKILL.md +19 -0
  44. package/skills/ttm-brief/SKILL.md +14 -0
  45. package/skills/ttm-competitor-scan/SKILL.md +19 -0
  46. package/skills/ttm-email-preflight/SKILL.md +19 -0
  47. package/skills/ttm-fix/SKILL.md +13 -0
  48. package/skills/ttm-health/SKILL.md +12 -0
  49. package/skills/ttm-icp-refresh/SKILL.md +19 -0
  50. package/skills/ttm-init/SKILL.md +12 -0
  51. package/skills/ttm-keyword-map/SKILL.md +19 -0
  52. package/skills/ttm-learn/SKILL.md +14 -0
  53. package/skills/ttm-measure/SKILL.md +14 -0
  54. package/skills/ttm-new-campaign/SKILL.md +13 -0
  55. package/skills/ttm-next/SKILL.md +12 -0
  56. package/skills/ttm-positioning-check/SKILL.md +19 -0
  57. package/skills/ttm-positioning-shift/SKILL.md +19 -0
  58. package/skills/ttm-produce/SKILL.md +14 -0
  59. package/skills/ttm-repurpose/SKILL.md +20 -0
  60. package/skills/ttm-research/SKILL.md +13 -0
  61. package/skills/ttm-resume/SKILL.md +13 -0
  62. package/skills/ttm-review/SKILL.md +13 -0
  63. package/skills/ttm-seo-audit/SKILL.md +20 -0
  64. package/skills/ttm-ship/SKILL.md +13 -0
  65. package/skills/ttm-state/SKILL.md +13 -0
  66. package/skills/ttm-verify/SKILL.md +14 -0
  67. package/templates/agents-md.md +65 -0
  68. package/templates/campaign-brief.md +74 -0
  69. package/templates/campaign-research.md +39 -0
  70. package/templates/campaign-state.md +40 -0
  71. package/templates/claude-md.md +65 -0
  72. package/templates/deviation-log.md +12 -0
  73. package/templates/drift-log.md +17 -0
  74. package/templates/fix-brief.md +59 -0
  75. package/templates/fix-log.md +22 -0
  76. package/templates/measurement-report.md +75 -0
  77. package/templates/migration-plan.md +24 -0
  78. package/templates/production-manifest.json +20 -0
  79. package/templates/reference-files/brand.md +45 -0
  80. package/templates/reference-files/calendar.md +30 -0
  81. package/templates/reference-files/channels.md +40 -0
  82. package/templates/reference-files/competitors.md +40 -0
  83. package/templates/reference-files/icp.md +50 -0
  84. package/templates/reference-files/learnings.md +40 -0
  85. package/templates/reference-files/metrics.md +42 -0
  86. package/templates/reference-files/positioning.md +38 -0
  87. package/templates/reference-files/state.md +27 -0
  88. package/templates/verification-report.md +59 -0
  89. package/workflows/discipline/.gitkeep +0 -0
  90. package/workflows/discipline/aeo-check.md +180 -0
  91. package/workflows/discipline/affiliate-kit.md +147 -0
  92. package/workflows/discipline/email-preflight.md +150 -0
  93. package/workflows/discipline/keyword-map.md +125 -0
  94. package/workflows/discipline/repurpose.md +329 -0
  95. package/workflows/discipline/seo-audit.md +169 -0
  96. package/workflows/lifecycle/.gitkeep +0 -0
  97. package/workflows/lifecycle/brief-positioning-check.md +90 -0
  98. package/workflows/lifecycle/brief.md +355 -0
  99. package/workflows/lifecycle/fix.md +495 -0
  100. package/workflows/lifecycle/learn.md +405 -0
  101. package/workflows/lifecycle/measure.md +379 -0
  102. package/workflows/lifecycle/produce.md +383 -0
  103. package/workflows/lifecycle/research.md +264 -0
  104. package/workflows/lifecycle/review.md +432 -0
  105. package/workflows/lifecycle/ship.md +521 -0
  106. package/workflows/lifecycle/verify.md +507 -0
  107. package/workflows/reference-mgmt/.gitkeep +0 -0
  108. package/workflows/reference-mgmt/brand-refresh.md +193 -0
  109. package/workflows/reference-mgmt/competitor-scan.md +228 -0
  110. package/workflows/reference-mgmt/icp-refresh.md +200 -0
  111. package/workflows/reference-mgmt/positioning-check.md +339 -0
  112. package/workflows/reference-mgmt/positioning-shift.md +368 -0
  113. package/workflows/setup/.gitkeep +0 -0
  114. package/workflows/setup/init-questions.md +225 -0
  115. package/workflows/setup/init-validation.md +155 -0
  116. package/workflows/setup/init.md +449 -0
  117. package/workflows/setup/new-campaign.md +134 -0
  118. package/workflows/utility/.gitkeep +0 -0
  119. package/workflows/utility/archive.md +334 -0
  120. package/workflows/utility/health.md +166 -0
  121. package/workflows/utility/next.md +187 -0
  122. package/workflows/utility/resume.md +249 -0
  123. package/workflows/utility/state.md +207 -0
@@ -0,0 +1,334 @@
1
+ <purpose>
2
+ Archive workflow for /ttm-archive. Validates campaign is shipped or learned (only
3
+ shipped or learned campaigns can be archived per D-08), extracts structured learnings from campaign
4
+ artifacts (D-09), moves campaign to ARCHIVE/ directory (D-07), and updates
5
+ LEARNINGS.md with extracted lessons.
6
+
7
+ Archive is irreversible (D-10). Once archived, a campaign cannot be un-archived
8
+ via this command. Cancelled campaigns cannot be archived -- they stay in CAMPAIGNS/
9
+ as cautionary records (D-08).
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @${CLAUDE_PLUGIN_ROOT}/references/context-loading.md
14
+ @${CLAUDE_PLUGIN_ROOT}/references/learnings-extraction.md
15
+ </required_reading>
16
+
17
+ <constraints>
18
+ ## POSITIONING.md is READ-ONLY
19
+
20
+ **Do NOT modify `.marketing/POSITIONING.md` during this workflow.**
21
+
22
+ POSITIONING.md is an architectural invariant. If you detect positioning drift:
23
+ - In verify: use the Escalate option to launch /ttm-positioning-shift
24
+ - In other workflows: flag the issue and recommend running /ttm-positioning-check
25
+
26
+ Only /ttm-positioning-shift and /ttm-init may modify POSITIONING.md.
27
+
28
+ ## Archive is Irreversible
29
+
30
+ Once archived, a campaign cannot be un-archived via this command. The user must
31
+ be informed and must confirm before the archive operation executes. This is a
32
+ destructive operation that moves files to ARCHIVE/ permanently.
33
+
34
+ ## Shipped or Learned Validation
35
+
36
+ Only campaigns with phase = "shipped" or phase = "learned" can be archived.
37
+ Campaigns in any other phase (including "cancelled") must be rejected with a
38
+ clear explanation of why and what to do instead.
39
+ </constraints>
40
+
41
+ <process>
42
+
43
+ ## Text-Mode Detection
44
+
45
+ **Text mode (`--text` flag):** Set `TEXT_MODE=true` if `--text` is present in `$ARGUMENTS`
46
+ or if the runtime is not Claude Code. When TEXT_MODE is active, replace every
47
+ `AskUserQuestion` call with a plain-text numbered list.
48
+
49
+ Detection:
50
+ ```bash
51
+ if echo "$ARGUMENTS" | grep -q -- '--text'; then TEXT_MODE=true; fi
52
+ ```
53
+
54
+ If `AskUserQuestion` tool is not available in the current runtime, set `TEXT_MODE=true`.
55
+
56
+ When TEXT_MODE is active, replace each AskUserQuestion with a plain-text numbered list:
57
+ ```
58
+ [HEADER]
59
+ [QUESTION]
60
+ 1. [OPTION_1_LABEL] -- [OPTION_1_DESCRIPTION]
61
+ 2. [OPTION_2_LABEL] -- [OPTION_2_DESCRIPTION]
62
+ ...
63
+ Type the number of your choice:
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Step 1: Load Context
69
+
70
+ ```
71
+ takeToMarket > LOADING CONTEXT
72
+ ```
73
+
74
+ Extract SLUG from $ARGUMENTS (strip `--text` flag if present):
75
+ ```bash
76
+ SLUG=$(echo "$ARGUMENTS" | sed 's/--text//g' | xargs)
77
+ ```
78
+
79
+ If SLUG is empty, error:
80
+ "Usage: /ttm-archive [campaign-slug]. Provide a campaign slug."
81
+ Exit.
82
+
83
+ ---
84
+
85
+ ## Step 2: Validate Campaign
86
+
87
+ ```
88
+ takeToMarket > VALIDATING CAMPAIGN
89
+ ```
90
+
91
+ Run:
92
+ ```bash
93
+ node "${CLAUDE_PLUGIN_ROOT}/bin/ttm-tools.cjs" campaign state "${SLUG}" --raw
94
+ ```
95
+
96
+ Parse output and validate:
97
+
98
+ - If `exists: false`: tell user campaign not found. Exit.
99
+ - If `phase` equals `'archived'`: tell user campaign is already archived. Exit.
100
+ - If `phase` equals `'cancelled'`: tell user cancelled campaigns cannot be archived
101
+ per policy. They stay in CAMPAIGNS/ as cautionary records for future reference.
102
+ Exit.
103
+ - If `phase` is NOT one of `'shipped'` or `'learned'`: tell user only shipped or learned campaigns can be
104
+ archived. Display current phase and suggest completing remaining phases:
105
+ "Campaign '${SLUG}' is in phase '${phase}'. Only shipped or learned campaigns can be
106
+ archived. Complete the remaining phases first."
107
+ Exit.
108
+
109
+ ---
110
+
111
+ ## Step 3: Extract Learnings
112
+
113
+ **Skip check:** If campaign `phase` is `"learned"` (meaning `/ttm-learn` already ran), skip this step entirely:
114
+ ```
115
+ takeToMarket > Learnings already extracted via /ttm-learn. Skipping re-extraction.
116
+ ```
117
+ Proceed directly to Step 4.
118
+
119
+ ```
120
+ takeToMarket > EXTRACTING LEARNINGS
121
+ ```
122
+
123
+ Following the learnings-extraction.md reference guide, scan campaign artifacts.
124
+
125
+ **Read these files from the campaign directory:**
126
+
127
+ 1. `.marketing/CAMPAIGNS/${SLUG}/STATE.md` (full file -- frontmatter and body)
128
+ 2. `.marketing/CAMPAIGNS/${SLUG}/MANIFEST.json` (if exists -- per-asset gate results)
129
+ 3. `.marketing/CAMPAIGNS/${SLUG}/BRIEF.md` (if exists -- original strategy)
130
+ 4. `VERIFICATION.md` in the campaign directory (gate details)
131
+ 5. Any `FIX-BRIEF-*.md` files (fix attempts and outcomes)
132
+ 6. Any `REVIEW-FEEDBACK-*.md` files (human review feedback)
133
+
134
+ **Extract structured learnings in three categories:**
135
+
136
+ ### 1. What worked
137
+ Identify successes from the campaign:
138
+ - First-attempt gate passes (verify.run_count = 1 AND verify.overall_result = pass)
139
+ - High review scores (review.overall_result = approved without fix loops)
140
+ - Assets shipped without fix loops (fix.run_count = 0 or null)
141
+ - Any asset with review_status = "approved" on first submission in MANIFEST.json
142
+
143
+ For each success, identify the specific pattern or approach that drove it.
144
+
145
+ ### 2. What didn't work
146
+ Identify failures or friction:
147
+ - Gate failures (verify.overall_result = fail on any run)
148
+ - Fix loops (fix.run_count > 0) -- check FIX-BRIEF-*.md for root cause
149
+ - Review rejections in REVIEW-FEEDBACK-*.md
150
+ - Multiple verification runs (verify.run_count > 1)
151
+
152
+ Categorize each using the root-cause taxonomy from learnings-extraction.md:
153
+ - positioning-drift
154
+ - weak-hook
155
+ - wrong-channel
156
+ - bad-timing
157
+ - unverifiable-claim
158
+ - broken-funnel
159
+ - creative-fatigue
160
+
161
+ ### 3. Campaign-level decisions
162
+ Extract key strategic decisions:
163
+ - Positioning anchor chosen (from BRIEF.md)
164
+ - Channel mix rationale
165
+ - Hook strategy used
166
+ - ICP targeting decisions
167
+ - Any deviations accepted during verify
168
+
169
+ **Format each learning as a LEARNINGS.md table row:**
170
+ ```
171
+ | ${today} | ${SLUG} | ${category} | ${lesson} | ${action_taken} |
172
+ ```
173
+
174
+ Where:
175
+ - `today` = current ISO date (YYYY-MM-DD)
176
+ - `category` = one of: success, positioning-drift, weak-hook, wrong-channel,
177
+ bad-timing, unverifiable-claim, broken-funnel, creative-fatigue
178
+ - `lesson` = one-sentence specific summary of what happened and why
179
+ - `action_taken` = recommended reference file update, or "none" if no systemic fix
180
+
181
+ ---
182
+
183
+ ## Step 4: Confirm Archive
184
+
185
+ ```
186
+ takeToMarket > CONFIRM ARCHIVE
187
+ ```
188
+
189
+ Display the extracted learnings to the user in a readable format:
190
+
191
+ ```markdown
192
+ ## Learnings Extracted from ${SLUG}
193
+
194
+ ### What Worked
195
+ ${for each success lesson: bullet point with category and lesson text}
196
+
197
+ ### What Didn't Work
198
+ ${for each failure lesson: bullet point with category and lesson text}
199
+
200
+ ### Campaign-Level Decisions
201
+ ${for each decision lesson: bullet point with description}
202
+
203
+ **Total lessons to record:** ${N}
204
+ ```
205
+
206
+ Ask for confirmation using AskUserQuestion (or text-mode numbered list):
207
+
208
+ ```
209
+ Archive campaign '${SLUG}'? This will:
210
+ 1. Move campaign to CAMPAIGNS/ARCHIVE/${SLUG}/
211
+ 2. Add ${N} lessons to LEARNINGS.md
212
+ 3. Set campaign state to 'archived'
213
+
214
+ This action is irreversible.
215
+
216
+ Options:
217
+ 1. Confirm archive -- proceed with archive and learnings extraction
218
+ 2. Cancel -- keep campaign in current state
219
+ ```
220
+
221
+ If user selects Cancel, exit without making any changes.
222
+
223
+ ---
224
+
225
+ ## Step 5: Execute Archive
226
+
227
+ ```
228
+ takeToMarket > ARCHIVING CAMPAIGN
229
+ ```
230
+
231
+ Run the archive CLI command:
232
+ ```bash
233
+ node "${CLAUDE_PLUGIN_ROOT}/bin/ttm-tools.cjs" campaign archive "${SLUG}" --raw
234
+ ```
235
+
236
+ Parse output and verify `archived: true`.
237
+
238
+ If the command returns an error:
239
+ - Display the error message to the user
240
+ - Do NOT attempt to manually move files (the CLI handles all filesystem operations)
241
+ - Do NOT update LEARNINGS.md -- the archive did not succeed
242
+ - Exit with the error context
243
+
244
+ The CLI command handles:
245
+ - Moving the campaign directory to `.marketing/CAMPAIGNS/ARCHIVE/${SLUG}/`
246
+ - Updating the campaign state to "archived"
247
+ - Validating the campaign is in "shipped" or "learned" phase before allowing archive
248
+
249
+ ---
250
+
251
+ ## Step 6: Update LEARNINGS.md
252
+
253
+ ```
254
+ takeToMarket > UPDATING LEARNINGS
255
+ ```
256
+
257
+ **Important:** This step runs only after the archive CLI command succeeds in Step 5.
258
+ The campaign is now in ARCHIVE/ with phase set to "archived". Writing learnings after
259
+ archive confirmation prevents data-loss on retry (duplicate rows) if archive were to fail.
260
+
261
+ Read `.marketing/LEARNINGS.md`.
262
+
263
+ **Duplicate guard:** Before inserting rows, scan existing LEARNINGS.md content for
264
+ any row containing `| ${SLUG} |` with today's date. If matching rows already exist
265
+ for this campaign slug and today's date, skip insertion and log:
266
+ "Learnings for ${SLUG} already present in LEARNINGS.md -- skipping duplicate write."
267
+ This prevents duplicate lesson rows if the workflow is retried after a partial failure.
268
+
269
+ Find the marker line: `<!-- LESSONS BELOW THIS LINE -->`
270
+
271
+ **Marker validation (T-07-10 mitigation):**
272
+ - Count occurrences of the marker in the file
273
+ - If exactly 1 marker found: insert all extracted lesson rows immediately AFTER
274
+ the marker line (one row per line, each on its own line)
275
+ - If 0 markers found: fall back to appending rows after the last table row in the
276
+ Lessons Log table section (look for the last line starting with `|`)
277
+ - If >1 markers found: fall back to appending rows after the FIRST marker only.
278
+ Log a warning about duplicate markers.
279
+
280
+ Write the updated LEARNINGS.md back to disk.
281
+
282
+ Also update the Summary section at the top of LEARNINGS.md:
283
+ - Increment "Total lessons" count by the number of new rows added
284
+ - Update "Last lesson date" to today's date
285
+
286
+ ---
287
+
288
+ ## Step 7: Confirm Completion
289
+
290
+ ```
291
+ takeToMarket > ARCHIVE COMPLETE
292
+ ```
293
+
294
+ Display completion summary:
295
+
296
+ ```markdown
297
+ ## Archive Complete: ${SLUG}
298
+
299
+ **Campaign:** ${name}
300
+ **Archived at:** ${timestamp}
301
+ **Lessons extracted:** ${N}
302
+
303
+ ### Lessons Added to LEARNINGS.md
304
+ | Date | Campaign | Category | Lesson | Action Taken |
305
+ |------|----------|----------|--------|-------------|
306
+ ${extracted_rows}
307
+
308
+ Campaign directory moved to `.marketing/CAMPAIGNS/ARCHIVE/${SLUG}/`
309
+
310
+ ### Next Steps
311
+ - Lessons are now available in LEARNINGS.md for future campaigns
312
+ - Run /ttm-health to verify system consistency
313
+ - Start a new campaign with /ttm-new-campaign when ready
314
+ ```
315
+
316
+ </process>
317
+
318
+ <success_criteria>
319
+ - [ ] Campaign validated as shipped or learned before archive (D-08)
320
+ - [ ] Cancelled campaigns rejected with explanation (D-08)
321
+ - [ ] Learnings extracted from campaign artifacts using extraction guide (D-09)
322
+ - [ ] Root-cause taxonomy applied to failure categorization (D-09)
323
+ - [ ] User confirmed before destructive archive action (D-10)
324
+ - [ ] LEARNINGS.md marker validated (exactly 1 occurrence) before append (T-07-10)
325
+ - [ ] LEARNINGS.md updated with new lesson rows via marker-based append
326
+ - [ ] Campaign directory moved to ARCHIVE/ via CLI command (D-07)
327
+ - [ ] Campaign state set to archived
328
+ - [ ] Completion summary displayed with all extracted lessons
329
+ </success_criteria>
330
+
331
+ <output>
332
+ - `.marketing/LEARNINGS.md` (updated with extracted lessons)
333
+ - `.marketing/CAMPAIGNS/ARCHIVE/${SLUG}/STATE.md` (phase set to archived, via CLI)
334
+ </output>
@@ -0,0 +1,166 @@
1
+ <purpose>
2
+ Health audit workflow for /ttm-health. Validates .marketing/ directory integrity,
3
+ reference file completeness, per-campaign state consistency, reference file staleness,
4
+ campaign velocity, DRIFT-LOG integrity, and gate result consistency. Reports text
5
+ output with pass/warn/fail per check category. Does NOT self-heal -- only reports.
6
+ </purpose>
7
+
8
+ <required_reading>
9
+ @${CLAUDE_PLUGIN_ROOT}/references/context-loading.md
10
+ </required_reading>
11
+
12
+ <constraints>
13
+ ## POSITIONING.md is READ-ONLY
14
+
15
+ **Do NOT modify `.marketing/POSITIONING.md` during this workflow.**
16
+
17
+ POSITIONING.md is an architectural invariant. If you detect positioning drift:
18
+ - In verify: use the Escalate option to launch /ttm-positioning-shift
19
+ - In other workflows: flag the issue and recommend running /ttm-positioning-check
20
+
21
+ Only /ttm-positioning-shift and /ttm-init may modify POSITIONING.md.
22
+
23
+ ## Diagnostic Only -- No Self-Healing
24
+
25
+ This workflow reports problems. It does NOT fix them. Never modify any file during
26
+ this workflow. All output is informational. If issues are found, recommend specific
27
+ commands or manual actions the user should take.
28
+ </constraints>
29
+
30
+ <process>
31
+
32
+ ## Step 1: Run Health Audit
33
+
34
+ ```
35
+ takeToMarket > RUNNING HEALTH AUDIT
36
+ ```
37
+
38
+ Run the full health audit via CLI:
39
+ ```bash
40
+ HEALTH_JSON=$(node "${CLAUDE_PLUGIN_ROOT}/bin/ttm-tools.cjs" health --full --raw)
41
+ ```
42
+
43
+ Parse the JSON output. Expected shape:
44
+ ```json
45
+ {
46
+ "healthy": true/false,
47
+ "checks": [
48
+ { "name": "...", "status": "pass|fail|warn|missing", "path": "...", "detail": "..." }
49
+ ],
50
+ "summary": "N/M checks passed"
51
+ }
52
+ ```
53
+
54
+ If the CLI command fails (non-zero exit or invalid JSON), display:
55
+ "Health audit CLI failed. This may indicate a broken installation. Try running
56
+ `node \"${CLAUDE_PLUGIN_ROOT}/bin/ttm-tools.cjs\" health --full --raw` manually
57
+ to see the error."
58
+ Exit.
59
+
60
+ ---
61
+
62
+ ## Step 2: Format Report
63
+
64
+ ```
65
+ takeToMarket > HEALTH REPORT
66
+ ```
67
+
68
+ Group checks by category based on their `name` prefix or type:
69
+ - **Structural Integrity** -- directory existence, required structure
70
+ - **Reference Files** -- POSITIONING.md, BRAND.md, ICP.md, etc.
71
+ - **Campaign State Consistency** -- per-campaign phase validity, field integrity
72
+ - **Staleness** -- files not updated within expected timeframes
73
+ - **Velocity** -- campaign progress rate checks
74
+ - **Drift Log** -- DRIFT-LOG.md integrity and format
75
+ - **Gate Consistency** -- review/verification result coherence
76
+
77
+ ### Output Format
78
+
79
+ ```
80
+ ## Health Report
81
+
82
+ ### Structural Integrity
83
+ [PASS] .marketing/ directory exists
84
+ [PASS] CAMPAIGNS/ directory exists
85
+ [PASS] Required subdirectories present
86
+
87
+ ### Reference Files
88
+ [PASS] POSITIONING.md exists and has content
89
+ [PASS] BRAND.md exists and has content
90
+ [WARN] ICP.md -- not updated in 90+ days (staleness warning)
91
+ [PASS] CHANNELS.md exists and has content
92
+ [PASS] STATE.md exists and has content
93
+ [PASS] CALENDAR.md exists and has content
94
+ [PASS] COMPETITORS.md exists and has content
95
+ [PASS] METRICS.md exists and has content
96
+ [PASS] LEARNINGS.md exists and has content
97
+
98
+ ### Campaign State Consistency
99
+ [PASS] spring-launch -- phase: shipped (valid)
100
+ [FAIL] test-campaign -- invalid phase: bogus
101
+ [PASS] summer-promo -- phase: briefed (valid)
102
+
103
+ ### Staleness
104
+ [WARN] BRAND.md -- last modified 95 days ago
105
+ [PASS] POSITIONING.md -- last modified 12 days ago
106
+
107
+ ### Velocity
108
+ [PASS] Campaign throughput: 2 shipped in last 30 days
109
+ [WARN] No campaigns advanced in 14+ days
110
+
111
+ ### Drift Log
112
+ [PASS] DRIFT-LOG.md format valid
113
+ [PASS] All drift entries have required fields
114
+
115
+ ### Gate Consistency
116
+ [PASS] All reviewed campaigns have verification reports
117
+ [PASS] Fix counts consistent with review results
118
+
119
+ ---
120
+
121
+ ### Overall: HEALTHY (12/14 passed, 2 warnings)
122
+ ```
123
+
124
+ **Status determination:**
125
+ - If `healthy` is `true` in CLI output: "HEALTHY"
126
+ - If `healthy` is `false`: "UNHEALTHY"
127
+ - Include total pass count and warning count
128
+
129
+ ---
130
+
131
+ ## Step 3: Recommendations (If Issues Found)
132
+
133
+ If any checks have `warn` or `fail` status, add a Recommendations section:
134
+
135
+ ```
136
+ ### Recommendations
137
+
138
+ **Failures (must fix):**
139
+ - <check name>: <specific fix suggestion>
140
+ Run: <suggested command or manual action>
141
+
142
+ **Warnings (should address):**
143
+ - <check name>: <specific suggestion>
144
+ Consider: <suggested action>
145
+ ```
146
+
147
+ Recommendations are advisory only. This workflow does NOT execute any fixes.
148
+
149
+ If all checks pass with no warnings:
150
+ ```
151
+ All systems healthy. No action needed.
152
+ ```
153
+
154
+ </process>
155
+
156
+ <success_criteria>
157
+ - [ ] Health audit run via CLI (`health --full --raw`)
158
+ - [ ] Results grouped by category with clear pass/warn/fail indicators
159
+ - [ ] Overall healthy/unhealthy status displayed
160
+ - [ ] Recommendations provided for any issues found
161
+ - [ ] No files modified (diagnostic command)
162
+ </success_criteria>
163
+
164
+ <output>
165
+ No files modified (diagnostic command).
166
+ </output>
@@ -0,0 +1,187 @@
1
+ <purpose>
2
+ Next-command routing workflow for /ttm-next. Looks across ALL active campaigns,
3
+ prioritizes which needs attention most, and suggests the specific /ttm-* command
4
+ to run. Outputs a prioritized list with a top recommendation and up to 3
5
+ alternatives. Uses unfiltered campaign list (not --active) to include campaigns
6
+ in created and researched phases.
7
+ </purpose>
8
+
9
+ <required_reading>
10
+ @${CLAUDE_PLUGIN_ROOT}/references/context-loading.md
11
+ </required_reading>
12
+
13
+ <constraints>
14
+ ## POSITIONING.md is READ-ONLY
15
+
16
+ **Do NOT modify `.marketing/POSITIONING.md` during this workflow.**
17
+
18
+ POSITIONING.md is an architectural invariant. If you detect positioning drift:
19
+ - In verify: use the Escalate option to launch /ttm-positioning-shift
20
+ - In other workflows: flag the issue and recommend running /ttm-positioning-check
21
+
22
+ Only /ttm-positioning-shift and /ttm-init may modify POSITIONING.md.
23
+
24
+ ## Read-Only Command
25
+
26
+ This workflow does NOT modify any files. It only reads and displays information.
27
+ </constraints>
28
+
29
+ <process>
30
+
31
+ ## Step 1: Load All Campaigns
32
+
33
+ ```
34
+ takeToMarket > SCANNING CAMPAIGNS
35
+ ```
36
+
37
+ Get the unfiltered campaign list:
38
+ ```bash
39
+ CAMPAIGNS_JSON=$(node "${CLAUDE_PLUGIN_ROOT}/bin/ttm-tools.cjs" campaign list --raw)
40
+ ```
41
+
42
+ **IMPORTANT:** Do NOT use `--active` flag. The `--active` flag excludes campaigns in
43
+ `created` and `researched` phases (per Pitfall 2). Use the unfiltered list and apply
44
+ filtering in this workflow instead.
45
+
46
+ Parse JSON output. Filter out campaigns with phase `archived` or `cancelled`.
47
+ Keep all other campaigns regardless of phase.
48
+
49
+ If no campaigns remain after filtering:
50
+ ```
51
+ takeToMarket > NO ACTIVE CAMPAIGNS
52
+
53
+ No active campaigns found. Run `/ttm-new-campaign <slug>` to start one.
54
+ ```
55
+ Exit.
56
+
57
+ ---
58
+
59
+ ## Step 2: Determine Next Command Per Campaign
60
+
61
+ ```
62
+ takeToMarket > ANALYZING PRIORITIES
63
+ ```
64
+
65
+ For each non-archived, non-cancelled campaign, determine the next command using
66
+ the phase-to-command mapping:
67
+
68
+ | Current Phase | Next Command | Notes |
69
+ |---------------|--------------|-------|
70
+ | `created` | `/ttm-research <slug>` | New campaign needs research |
71
+ | `researched` | `/ttm-brief <slug>` | Research done, needs brief |
72
+ | `briefed` | `/ttm-produce <slug>` | Brief ready, produce content |
73
+ | `produced` | `/ttm-verify <slug>` | Content ready, verify quality |
74
+ | `verified` | `/ttm-review <slug>` | Verified, needs human review |
75
+ | `reviewed` | See review result logic below | |
76
+ | `fixed` | `/ttm-review <slug>` | Re-review after fix |
77
+ | `shipped` | `/ttm-measure <slug>` | Awaiting measurement (Phase 9) |
78
+ | `measured` | `/ttm-learn <slug>` | Extract learnings (Phase 9) |
79
+ | `learned` | `/ttm-archive <slug>` | Ready to archive |
80
+
81
+ **Review result logic** (for campaigns in `reviewed` phase):
82
+ - Read `review.overall_result` from the campaign state
83
+ - If `review.overall_result` is `'revise'` or `'needs-fix'`: `/ttm-fix <slug>`
84
+ - If `review.overall_result` is `'approved'` or `'ship-ready'`: `/ttm-ship <slug>`
85
+ - If `review.overall_result` is null/unknown: `/ttm-review <slug>` (re-review)
86
+
87
+ **Fix loop detection** (per D-05):
88
+ - If `fix.run_count` > 0 AND `review.overall_result` is `'revise'`:
89
+ Suggest `/ttm-fix <slug>` with note about continuing the fix loop
90
+ Include fix attempt count in the reason (e.g., "attempt 2 of 3")
91
+
92
+ For each campaign, also get detailed state if needed for review/fix decisions:
93
+ ```bash
94
+ node "${CLAUDE_PLUGIN_ROOT}/bin/ttm-tools.cjs" campaign state "${SLUG}" --raw
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Step 3: Apply Priority Algorithm
100
+
101
+ Sort campaigns by priority using this algorithm:
102
+
103
+ **Priority 1 (Highest):** Campaigns with `review.overall_result = 'approved'`
104
+ - These are pending human action to ship -- closest to delivering value.
105
+
106
+ **Priority 2:** Campaigns with fix loops in progress
107
+ - `fix.run_count > 0` AND `review.overall_result = 'revise'`
108
+ - Active work in progress that should be completed before starting new work.
109
+
110
+ **Priority 3:** Campaigns at earlier lifecycle phases
111
+ - Use phase order index for sorting:
112
+ - created = 0
113
+ - researched = 1
114
+ - briefed = 2
115
+ - produced = 3
116
+ - verified = 4
117
+ - reviewed = 5
118
+ - fixed = 6
119
+ - shipped = 7
120
+ - measured = 8
121
+ - learned = 9
122
+ - Lower index = earlier phase = higher priority (move campaigns forward)
123
+
124
+ **Priority 4:** Most recently active
125
+ - Sort by `last_updated` timestamp (most recent first)
126
+
127
+ **Tie-break:** Campaign creation date (oldest campaign first -- finish what you
128
+ started before starting new work).
129
+
130
+ ---
131
+
132
+ ## Step 4: Display Recommendations
133
+
134
+ ```
135
+ takeToMarket > NEXT ACTIONS
136
+ ```
137
+
138
+ Display the top recommendation prominently, then show up to 3 alternatives
139
+ in a table.
140
+
141
+ ### Output Format
142
+
143
+ ```
144
+ ## Recommended Next Action
145
+
146
+ **Run:** `/ttm-<command> <slug>`
147
+ **Why:** <Concise reason based on priority algorithm>
148
+
149
+ ---
150
+
151
+ ### Other Active Campaigns
152
+
153
+ | Priority | Campaign | Phase | Suggested Command | Reason |
154
+ |----------|----------|-------|-------------------|--------|
155
+ | 2 | <slug> | <phase> | /ttm-<cmd> <slug> | <brief reason> |
156
+ | 3 | <slug> | <phase> | /ttm-<cmd> <slug> | <brief reason> |
157
+ | 4 | <slug> | <phase> | /ttm-<cmd> <slug> | <brief reason> |
158
+ ```
159
+
160
+ **Reason examples by priority:**
161
+ - Priority 1: "Approved and ready to ship"
162
+ - Priority 2: "Fix loop in progress (attempt 2 of 3). Review found positioning drift."
163
+ - Priority 3: "Ready for content production" / "New campaign, needs research"
164
+ - Priority 4: "Recently active, awaiting measurement"
165
+
166
+ If only one campaign exists, show only the primary recommendation without the
167
+ alternatives table.
168
+
169
+ **Commands not yet implemented:**
170
+ If the suggested next command is `/ttm-measure` or `/ttm-learn` (Phase 9),
171
+ append a note: "(Note: this command is not yet available -- coming in Phase 9)"
172
+
173
+ </process>
174
+
175
+ <success_criteria>
176
+ - [ ] All campaigns loaded via CLI (`campaign list --raw` without --active flag)
177
+ - [ ] Phase-to-command mapping applied correctly for each campaign
178
+ - [ ] Fix loop detection working (fix.run_count + review.overall_result check)
179
+ - [ ] Priority algorithm applied (approved > fix-loop > earlier-phase > recent)
180
+ - [ ] Primary recommendation displayed with reasoning
181
+ - [ ] Up to 3 alternatives shown in table format
182
+ - [ ] No files modified (read-only command)
183
+ </success_criteria>
184
+
185
+ <output>
186
+ No files modified (read-only command).
187
+ </output>