@tidyfactor/marketing 1.3.0 → 1.6.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 (40) hide show
  1. package/.tidyfactor +53 -52
  2. package/CHANGELOG.md +47 -0
  3. package/README.ar.md +20 -9
  4. package/README.md +20 -9
  5. package/SKILL.md +46 -30
  6. package/bin/add-skill.js +65 -50
  7. package/brand.json +67 -67
  8. package/brand.yaml +55 -0
  9. package/manifest.json +256 -0
  10. package/package.json +5 -1
  11. package/references/commands/audit.md +34 -0
  12. package/references/commands/brief.md +7 -5
  13. package/references/memory/20-brain-baas-integration.md +89 -0
  14. package/references/memory/ad-copy-templates.md +94 -93
  15. package/references/memory/arabic-writing.md +1 -1
  16. package/references/memory/campaign-mindmap.md +85 -0
  17. package/references/memory/decision-points.md +74 -73
  18. package/references/memory/frameworks.md +87 -86
  19. package/references/memory/lifecycle-flows.md +107 -106
  20. package/references/memory/metrics-benchmarks.md +71 -70
  21. package/references/memory/naming-conventions.md +75 -0
  22. package/references/memory/philosophy.md +2 -0
  23. package/references/memory/platform-specs.md +76 -75
  24. package/references/memory/promotions-math.md +57 -56
  25. package/references/memory/quality-bar.md +56 -55
  26. package/references/workflows/brief.md +74 -35
  27. package/references/workflows/campaign-launch.md +1 -1
  28. package/references/workflows/content-engine.md +1 -1
  29. package/references/workflows/email-lifecycle.md +1 -1
  30. package/references/workflows/paid-acquisition.md +1 -1
  31. package/references/workflows/promo-conversion.md +1 -1
  32. package/references/workflows/social-growth.md +1 -1
  33. package/references/workflows/viral-retention.md +1 -1
  34. package/scripts/audit_copy.py +112 -0
  35. package/scripts/calc_promo_math.py +69 -0
  36. package/scripts/clean_orphaned_assets.py +108 -0
  37. package/tests/scenarios.md +87 -0
  38. package/tools/build-skill.js +4 -0
  39. package/tools/validate_skill.py +265 -112
  40. package/assets/og-default.png +0 -0
package/brand.yaml ADDED
@@ -0,0 +1,55 @@
1
+ name: "TidyFactor Marketing"
2
+ version: "1.6.0"
3
+ schemaVersion: "brand-core-v2"
4
+ meta:
5
+ product: "TidyFactor Marketing Engine"
6
+ tagline: "AI Direct Response & 360° Growth Marketing Engine"
7
+ description: "A production-grade, AI-native marketing and growth engine following TidyFactor Skill architecture. Handles 7 pillars and 28 capabilities with zero fluff, data-backed metrics, quantitative benchmarks, and platform-native direct-response conversion frameworks."
8
+ version: "1.6.0"
9
+ lastUpdated: "2026-09-09"
10
+ identity:
11
+ logo:
12
+ full: "assets/logo.svg"
13
+ fullDark: "assets/logo-dark.svg"
14
+ mark: "assets/logo-mark.svg"
15
+ favicon: "assets/favicon.svg"
16
+ minClearSpace: "1x logo-mark height on all sides"
17
+ minSizePx: 24
18
+ socialPreview:
19
+ ogImage: "assets/hero-banner.png"
20
+ ogDimensions: "1200x630"
21
+ voice:
22
+ tone: "direct, evidence-first, quantitative, authentic, teacher-practitioner"
23
+ vocabulary:
24
+ preferred:
25
+ - "direct response"
26
+ - "conversion rate"
27
+ - "margin protection"
28
+ - "CAC payback"
29
+ - "LTV:CAC"
30
+ - "ROAS"
31
+ - "anti-cliché"
32
+ - "pillar-cluster"
33
+ - "search intent"
34
+ - "retention loop"
35
+ banned:
36
+ - "cutting-edge"
37
+ - "seamless experience"
38
+ - "innovative solutions"
39
+ - "take your business to the next level"
40
+ - "one-stop shop"
41
+ - "نسعى دائماً لتقديم الأفضل"
42
+ - "فريق من الخبراء"
43
+ - "حلول متكاملة ومبتكرة"
44
+ principles:
45
+ - "Every sentence must carry a mechanism, a concrete number, or a verifiable proof point."
46
+ - "Never price cut without calculating unit gross margin impact."
47
+ - "Respect audience attention with high-signal, zero-throat-clearing direct copy."
48
+ pillars:
49
+ 1_strategy: "Brand Voice, Positioning Statement, Competitive Differentiation, Phased Launch (T-30 to T+14)"
50
+ 2_content: "Pillar + Cluster SEO, Multi-Platform Posts, Publishing Grids, Newsletters"
51
+ 3_social: "LinkedIn B2B & Founder Personal Branding, Instagram/TikTok 0-3s Hooks, 0-1k Roadmap"
52
+ 4_email: "Lead Magnet Mechanics, 5-Email Welcome Flow, 3-Stage Cart Recovery, Win-Back Sequences"
53
+ 5_advertising: "3-Angle Ad Copy Matrices, 7-Dimension CRO Landing Page Wireframes, Meta & Google Ads"
54
+ 6_promotions: "72-Hour Flash Sales, Decoy Pricing Architecture, Viral Contests, Margin-Safe Coupons"
55
+ 7_growth: "2-Sided Viral Referral Loops, Influencer Vetting & Cold Outreach, Retention & Churn Diagnosis"
package/manifest.json ADDED
@@ -0,0 +1,256 @@
1
+ {
2
+ "manifest_schema_version": "1.1.0",
3
+ "skill_id": "tidyfactor-marketing",
4
+ "skill_root_anchor": "self",
5
+ "tools": [
6
+ {
7
+ "name": "audit_copy",
8
+ "description": "Audits direct-response marketing copy against AI anti-patterns, banned cliches, tone rules, and 7-axis critique stamps.",
9
+ "entrypoint": {
10
+ "runtime": "python3",
11
+ "script": "scripts/audit_copy.py"
12
+ },
13
+ "invocation": {
14
+ "cli_pattern": "{runtime} {skill_root}/{script} {target_path} {flags}",
15
+ "args": [
16
+ {
17
+ "name": "target",
18
+ "type": "path",
19
+ "required": true,
20
+ "description": "Path to marketing copy file or markdown file to audit"
21
+ },
22
+ {
23
+ "name": "json",
24
+ "type": "boolean",
25
+ "required": false,
26
+ "default": false,
27
+ "flag": "--json",
28
+ "description": "Output structured JSON report"
29
+ }
30
+ ]
31
+ },
32
+ "output": {
33
+ "format": "json",
34
+ "channel": "stdout"
35
+ },
36
+ "runtime_requirements": {
37
+ "isolation_recommended": false,
38
+ "dependencies": []
39
+ },
40
+ "invoked_by_commands": ["content", "advertising", "email", "audit"]
41
+ },
42
+ {
43
+ "name": "calc_promo_math",
44
+ "description": "Calculates unit economics, gross margins, break-even ROAS targets, and discount safety thresholds.",
45
+ "entrypoint": {
46
+ "runtime": "python3",
47
+ "script": "scripts/calc_promo_math.py"
48
+ },
49
+ "invocation": {
50
+ "cli_pattern": "{runtime} {skill_root}/{script} {flags}",
51
+ "args": [
52
+ {
53
+ "name": "price",
54
+ "type": "number",
55
+ "required": true,
56
+ "flag": "--price",
57
+ "description": "Original retail product price"
58
+ },
59
+ {
60
+ "name": "cogs",
61
+ "type": "number",
62
+ "required": true,
63
+ "flag": "--cogs",
64
+ "description": "Cost of Goods Sold (COGS)"
65
+ },
66
+ {
67
+ "name": "discount",
68
+ "type": "number",
69
+ "required": false,
70
+ "flag": "--discount",
71
+ "description": "Discount percentage"
72
+ },
73
+ {
74
+ "name": "cac",
75
+ "type": "number",
76
+ "required": false,
77
+ "flag": "--cac",
78
+ "description": "Estimated Customer Acquisition Cost (CAC)"
79
+ },
80
+ {
81
+ "name": "json",
82
+ "type": "boolean",
83
+ "required": false,
84
+ "default": true,
85
+ "flag": "--json",
86
+ "description": "Output structured JSON metrics"
87
+ }
88
+ ]
89
+ },
90
+ "output": {
91
+ "format": "json",
92
+ "channel": "stdout"
93
+ },
94
+ "runtime_requirements": {
95
+ "isolation_recommended": false,
96
+ "dependencies": []
97
+ },
98
+ "invoked_by_commands": ["promotions", "growth"]
99
+ },
100
+ {
101
+ "name": "clean_orphaned_assets",
102
+ "description": "Scans image assets for SHA-256 binary duplicates, unreferenced orphan files, and compression opportunities.",
103
+ "entrypoint": {
104
+ "runtime": "python3",
105
+ "script": "scripts/clean_orphaned_assets.py"
106
+ },
107
+ "invocation": {
108
+ "cli_pattern": "{runtime} {skill_root}/{script} {flags}",
109
+ "args": [
110
+ {
111
+ "name": "check",
112
+ "type": "boolean",
113
+ "required": false,
114
+ "default": false,
115
+ "flag": "--check",
116
+ "description": "Run check mode returning non-zero if issues exist"
117
+ }
118
+ ]
119
+ },
120
+ "output": {
121
+ "format": "text",
122
+ "channel": "stdout"
123
+ },
124
+ "runtime_requirements": {
125
+ "isolation_recommended": false,
126
+ "dependencies": []
127
+ },
128
+ "invoked_by_commands": ["audit"]
129
+ }
130
+ ],
131
+ "decision_gates": [
132
+ {
133
+ "command": "brief",
134
+ "description": "Decision gate evaluating market context, audience register, brand voice, and offer model before marketing copy generation.",
135
+ "decisions": [
136
+ {
137
+ "key": "target_market",
138
+ "description": "Target regional market and cultural calibration",
139
+ "type": "enum",
140
+ "options": ["gcc", "egypt_levant", "global_saas", "bilingual_mena"],
141
+ "default": "bilingual_mena",
142
+ "priority": 1,
143
+ "discovery": [
144
+ {
145
+ "source": "local_file",
146
+ "path": "brand.yaml",
147
+ "json_path": "$.targetMarket",
148
+ "track_staleness": true
149
+ },
150
+ {
151
+ "source": "local_file",
152
+ "path": "brand.json",
153
+ "json_path": "$.targetMarket",
154
+ "track_staleness": true
155
+ },
156
+ {
157
+ "source": "local_file",
158
+ "path": "BRAND-GUIDELINES.md",
159
+ "track_staleness": true
160
+ },
161
+ {
162
+ "source": "brain_ki",
163
+ "ki_type": "project"
164
+ }
165
+ ],
166
+ "persist_to": {
167
+ "local": { "path": ".tidyfactor/marketing-brief.snapshot.yaml" },
168
+ "brain_ki": {
169
+ "sync_direction": "outbound_push_only",
170
+ "requires_flag": "--sync-brain"
171
+ }
172
+ }
173
+ },
174
+ {
175
+ "key": "brand_voice",
176
+ "description": "Brand voice archetype and tone register",
177
+ "type": "enum",
178
+ "options": ["authoritative_challenger", "empathetic_guide", "elite_luxury", "high_energy_direct_response"],
179
+ "default": "authoritative_challenger",
180
+ "priority": 2,
181
+ "discovery": [
182
+ {
183
+ "source": "local_file",
184
+ "path": "brand.yaml",
185
+ "json_path": "$.voice.archetype",
186
+ "track_staleness": true
187
+ },
188
+ {
189
+ "source": "local_file",
190
+ "path": "brand.json",
191
+ "json_path": "$.voice.archetype",
192
+ "track_staleness": true
193
+ },
194
+ {
195
+ "source": "local_file",
196
+ "path": "BRAND-GUIDELINES.md",
197
+ "track_staleness": true
198
+ },
199
+ {
200
+ "source": "brain_ki",
201
+ "ki_type": "project"
202
+ }
203
+ ],
204
+ "persist_to": {
205
+ "local": { "path": ".tidyfactor/marketing-brief.snapshot.yaml" },
206
+ "brain_ki": {
207
+ "sync_direction": "outbound_push_only",
208
+ "requires_flag": "--sync-brain"
209
+ }
210
+ }
211
+ },
212
+ {
213
+ "key": "funnel_stage",
214
+ "description": "Primary conversion funnel focus",
215
+ "type": "enum",
216
+ "options": ["tofu_lead_magnet", "mofu_trial_demo", "bofu_direct_sale"],
217
+ "default": "bofu_direct_sale",
218
+ "priority": 3,
219
+ "discovery": [
220
+ {
221
+ "source": "local_file",
222
+ "path": ".tidyfactor/marketing-brief.md"
223
+ }
224
+ ],
225
+ "persist_to": {
226
+ "local": { "path": ".tidyfactor/marketing-brief.snapshot.yaml" }
227
+ }
228
+ },
229
+ {
230
+ "key": "core_offer",
231
+ "description": "Value proposition and main transaction vehicle",
232
+ "type": "string",
233
+ "default": "Direct Product Offer",
234
+ "priority": 4,
235
+ "discovery": [
236
+ {
237
+ "source": "local_file",
238
+ "path": "brand.yaml",
239
+ "json_path": "$.offer.headline",
240
+ "track_staleness": true
241
+ },
242
+ {
243
+ "source": "local_file",
244
+ "path": "brand.json",
245
+ "json_path": "$.offer.headline",
246
+ "track_staleness": true
247
+ }
248
+ ],
249
+ "persist_to": {
250
+ "local": { "path": ".tidyfactor/marketing-brief.snapshot.yaml" }
251
+ }
252
+ }
253
+ ]
254
+ }
255
+ ]
256
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidyfactor/marketing",
3
- "version": "1.3.0",
3
+ "version": "1.6.0",
4
4
  "description": "TidyFactor Marketing — AI Direct-Response Marketing, Pillar-Cluster SEO & Multi-Channel Growth Engine with Contextual Decision Layer (CDL)",
5
5
  "main": "SKILL.md",
6
6
  "bin": {
@@ -66,8 +66,12 @@
66
66
  "VISION.md",
67
67
  "assets",
68
68
  "bin",
69
+ "brand.yaml",
69
70
  "brand.json",
71
+ "manifest.json",
70
72
  "references",
73
+ "scripts",
74
+ "tests",
71
75
  "tools"
72
76
  ]
73
77
  }
@@ -0,0 +1,34 @@
1
+ # Command: audit
2
+
3
+ Audits marketing copy, ad headlines, landing pages, and email drafts for AI clichés, banned fluff, and compliance with the 7-axis pre-emit critique stamp (`P5 H5 E5 S5 R5 V5 D5`).
4
+
5
+ ---
6
+
7
+ ## What It Loads
8
+
9
+ - **Script**: `scripts/audit_copy.py`
10
+ - **Memory**: `references/memory/quality-bar.md`
11
+ - **Memory**: `references/memory/arabic-writing.md`
12
+
13
+ ---
14
+
15
+ ## Execution Pattern
16
+
17
+ ### 1. Direct Target File Audit
18
+ ```bash
19
+ python scripts/audit_copy.py path/to/marketing-copy.md --json
20
+ ```
21
+
22
+ ### 2. Inline Copy String Audit
23
+ ```bash
24
+ python scripts/audit_copy.py --text "Unleash your business with our game-changing platform" --json
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Validation checklist
30
+
31
+ - [ ] Command routes deterministically to `scripts/audit_copy.py`.
32
+ - [ ] Returns structured JSON with line numbers, severity, and matched patterns.
33
+ - [ ] Validates 7-axis pre-emit critique stamp presence.
34
+ - [ ] Reports zero false positives on clean technical copy.
@@ -6,12 +6,14 @@
6
6
  ---
7
7
 
8
8
  ## 🎯 Command Intent
9
- Conducts a rapid, structured 3-question marketing discovery interview to establish strategic parameters (Market, Voice, Funnel Stage, Offer) and writes `.tidyfactor/marketing-brief.md` as the authoritative baseline for all subsequent campaigns, ads, emails, and content generation.
9
+ Conducts a rapid, structured discovery protocol to establish strategic parameters (Market, Voice, Funnel Stage, Offer) and writes `.tidyfactor/marketing-brief.md` as the authoritative baseline for all subsequent campaigns, ads, emails, and content generation.
10
10
 
11
11
  ---
12
12
 
13
13
  ## ⚡ Execution Protocol
14
- 1. Load `references/memory/decision-points.md`.
15
- 2. Execute `references/workflows/brief.md`.
16
- 3. Save resulting decisions into `.tidyfactor/marketing-brief.md`.
17
- 4. Conclude with a clear brief summary.
14
+ 1. **Delta Auto-Sensing**: Inspect `brand.yaml` and `.tidyfactor/` before prompting the user.
15
+ 2. **Interactive Modal Wizard (CDL v2.0)**: Present genuine Unknowns exclusively via the native interactive modal tool (`ask_question`). Never dump static chat questionnaires.
16
+ 3. **Dual Operational Modes**:
17
+ - **Mode A (Smart 3-Round Protocol)**: R1 Market & ICP → R2 Voice & Mechanism → R3 Funnel & Margin Guardrails.
18
+ - **Mode B (Debate Mode — `/debate`)**: Relentlessly stress-tests marketing claims, price elasticity, CAC payback, and competitive moat until explicit user sign-off.
19
+ 4. **SSOT Persistence**: Save resulting decisions into `.tidyfactor/marketing-brief.md` and `.tidyfactor/marketing-brief.snapshot.yaml`.
@@ -0,0 +1,89 @@
1
+ <!-- last-verified: 2026-09-02 -->
2
+ # Brain MCP & Sovereign BaaS Marketing Integration Contract
3
+
4
+ Authoritative operational specification governing how `tidyfactor-marketing` integrates with self-hosted `tidyfactor-brain` MCP instances and sovereign agency nodes without creating hard dependencies or blocking offline workflows.
5
+
6
+ ---
7
+
8
+ ## 🏛️ 1. Sovereign Architecture Model (Self-Hosted Primacy)
9
+
10
+ TidyFactor Marketing operates on a **Sovereign, Self-Hosted Architecture**:
11
+ - **Zero Centralized SaaS Dependency**: `tidyfactor-brain` and its MCP server run locally on the developer's machine or on an agency's self-hosted server instance.
12
+ - **Tenant Definition**: A `tenant` represents an isolated client or brand workspace (e.g. `tenant_alwkala`, `tenant_client_a`) mapped to a dedicated SQLite file (`data/tenants/{tenant_id}_brain.sqlite`) or scoped local knowledge directory (`~/.gemini/knowledge/projects/{project_id}/`).
13
+ - **No Global Auth Overhead**: Local stdio connections run authentication-free. Remote self-hosted nodes use static bearer tokens configured in `mcp_config.json`.
14
+
15
+ ---
16
+
17
+ ## ⚡ 2. The Deterministic Fail-Open Contract
18
+
19
+ Brain MCP is strictly an **optional acceleration layer**, NEVER a required runtime dependency.
20
+
21
+ ### Strict Resolution Algorithm:
22
+
23
+ ```
24
+ Step 1: Check Local Disk Workspace
25
+ ├── IF `BRAND-GUIDELINES.md` or `.tidyfactor/marketing-brief.md` exists:
26
+ │ └── LOAD directly from disk without asking questions. Done.
27
+ └── ELSE: Proceed to Step 2.
28
+
29
+ Step 2: Check Active MCP Toolset Availability
30
+ ├── IF tool `search_knowledge_base` is present in agent's active tool list:
31
+ │ ├── Execute: `search_knowledge_base(query="marketing persona brand voice", scope="project", project_id=CURRENT_PROJECT)`
32
+ │ ├── IF valid marketing KI returned:
33
+ │ │ └── POPULATE context baseline immediately. Done.
34
+ │ └── ELSE (Empty/Error):
35
+ │ └── Silent fallback (0ms delay) to Step 3.
36
+ └── ELSE (Tool not registered / Standalone environment / Offline):
37
+ └── Silent fallback (0ms delay) to Step 3.
38
+
39
+ Step 3: Interactive Micro-Discovery (CDL 3-Question Dialogue)
40
+ └── Present concise, structured A/B/C/D choices to the user. Zero conversational preamble. Done.
41
+ ```
42
+
43
+ ### Invariants:
44
+ 1. **Zero Robotic Preamble**: Never output introductory greetings like *"أهلاً بك بصفتي محرك التسويق..."* or ask the user whether a brief exists on disk.
45
+ 2. **Instant Silent Bypass**: If MCP is unavailable or errors, proceed immediately to the 3-question interview without delay or error messages.
46
+
47
+ ---
48
+
49
+ ## 📦 3. Marketing Strategy Knowledge Item (KI) Contract
50
+
51
+ When exporting marketing baselines via explicit `--sync-brain` flag on `/brief` or `/strategy`, the deliverable formats as an Atomic KI conforming to the following JSON payload:
52
+
53
+ ```json
54
+ {
55
+ "schema_version": "1.0.0",
56
+ "ki_type": "marketing_strategy_baseline",
57
+ "project_id": "current-project-slug",
58
+ "timestamp": "2026-09-02T06:00:00Z",
59
+ "persona": {
60
+ "target_market": "GCC|Egypt|Levant|Global_B2B|Bilingual_MENA",
61
+ "voice_archetype": "authoritative_challenger|empathetic_guide|elite_luxury|direct_response",
62
+ "funnel_stage": "top_of_funnel|middle_of_funnel|bottom_of_funnel",
63
+ "core_offer": "lead_magnet|trial_demo|direct_sale",
64
+ "primary_conversion_channel": "whatsapp|direct_checkout|strategy_call|instapay"
65
+ },
66
+ "trust_signals": [
67
+ "cash_on_delivery",
68
+ "installments_tabby_tamara",
69
+ "official_cr_tax_id"
70
+ ],
71
+ "artifacts": [
72
+ ".tidyfactor/marketing-brief.md",
73
+ "copy/campaign-strategy.md"
74
+ ]
75
+ }
76
+ ```
77
+
78
+ ---
79
+
80
+ ## 🛠️ 4. Tooling Execution Bridge (`run_skill_tool`)
81
+
82
+ When `tidyfactor-brain` executes `tidyfactor-marketing` scripts via `manifest.json`:
83
+
84
+ | Tool Name | Script Entrypoint | Latency Class | Execution Mode |
85
+ |---|---|---|---|
86
+ | `audit_copy` | `scripts/audit_copy.py` | Sub-second (<100ms) | Direct CLI / Text AST & Cliché Linter |
87
+ | `calc_promo_math` | `scripts/calc_promo_math.py` | Sub-second (<50ms) | Deterministic Profit & ROAS Calculator |
88
+
89
+ ---