marketing-mindset 1.11.0 → 1.12.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 (3) hide show
  1. package/README.md +23 -0
  2. package/bin/cli.js +109 -0
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -177,3 +177,26 @@ npx marketing-mindset cost --cost 0.02 --daily 500 --budget 5000
177
177
  assumed. The floor uses the same formula as `sample`, so a budget planned here, a queue planned with `queue` and a
178
178
  test read with `verdict` stay consistent. Two things it refuses to hide: stopping before the floor buys a sample
179
179
  rather than a result, and money buys tests while volume limits how many can run at once.
180
+
181
+ ## `unit` — which step of your funnel can fund a verdict
182
+
183
+ A funnel is a list of counted events per month. `unit` answers the only question that decides whether a
184
+ channel can be judged: which of those steps happens often enough to reach a test floor, and how many
185
+ months it needs.
186
+
187
+ ```bash
188
+ npx marketing-mindset unit --steps visits:12000,signups:900,activations:270,paid:40
189
+ ```
190
+ ```
191
+ unit visits -> signups: rate 7.50%, floor 5,280 per arm, 6,000 events per arm a month -> 1 month(s) to read
192
+ unit signups -> activations: rate 30.00%, floor 963 per arm, 450 events per arm a month -> 3 month(s) to read
193
+ unit activations -> paid: rate 14.81%, floor 2,438 per arm, 135 events per arm a month -> 19 month(s) to read
194
+ readable at this volume: visits -> signups in 1 month(s)
195
+ ```
196
+
197
+ `--json` returns the same object: one entry per consecutive pair with `rate`, `floor_per_arm`,
198
+ `arm_events_per_month` and `months_to_read`, plus `readable_unit`, `unreadable_units` and three gates.
199
+ The floor comes from the same formula as `sample`, and the arms split the earlier step's volume in half,
200
+ so a unit chosen here, a queue planned with `queue` and a result read with `verdict` stay consistent.
201
+ Two things it refuses to hide: the earliest step reads soonest and owns the least, and money always reads
202
+ one step behind whatever unit you chose.
package/bin/cli.js CHANGED
@@ -7,6 +7,7 @@
7
7
  * marketing-mindset verdict read a finished test: interval, floor, honest verdict
8
8
  * marketing-mindset queue volume into a queue of honest tests with read-out dates
9
9
  * marketing-mindset cost the cost of one readable verdict, and funded tests per budget
10
+ * marketing-mindset unit which funnel step can fund a verdict, and in how many months
10
11
  * marketing-mindset sections list every section of SKILL.md
11
12
  * marketing-mindset read <text> print one section by fuzzy title match
12
13
  * marketing-mindset install copy the skill into your agent's skills directory
@@ -625,6 +626,110 @@ function runCost(opts) {
625
626
  return 0;
626
627
  }
627
628
 
629
+ var UN_ZA = { "0.05": 1.9599639845, "0.01": 2.5758293036, "0.1": 1.6448536270 };
630
+ var UN_ZB = { "0.8": 0.8416212336, "0.9": 1.2815515655 };
631
+ function unRound6(x) { return Math.round(x * 1000000) / 1000000; }
632
+ function unSampleSize(rate, lift, power, alpha) {
633
+ const p1 = Math.min(Math.max(rate, 0.000001), 0.999999);
634
+ const p2 = Math.min(p1 * (1 + lift), 0.999999);
635
+ const pbar = (p1 + p2) / 2;
636
+ const za = UN_ZA[String(alpha)] || UN_ZA["0.05"];
637
+ const zb = UN_ZB[String(power)] || UN_ZB["0.8"];
638
+ const num = Math.pow(za * Math.sqrt(2 * pbar * (1 - pbar)) + zb * Math.sqrt(p1 * (1 - p1) + p2 * (1 - p2)), 2);
639
+ return Math.ceil(num / Math.pow(p2 - p1, 2));
640
+ }
641
+ function planUnits(input) {
642
+ const steps = input.steps || [];
643
+ const lift = Number(input.lift !== undefined ? input.lift : 0.2);
644
+ const power = Number(input.power !== undefined ? input.power : 0.8);
645
+ const alpha = Number(input.alpha !== undefined ? input.alpha : 0.05);
646
+ const horizon = Number(input.horizon !== undefined ? input.horizon : 6);
647
+ const problems = [];
648
+ if (steps.length < 2) { problems.push("steps: pass at least two steps, e.g. visits:12000,signups:900"); }
649
+ steps.forEach(function (s) {
650
+ if (!s || !s.name) { problems.push("steps: every step needs a name"); }
651
+ if (!(Number(s.count) > 0)) { problems.push("steps: count for '" + ((s && s.name) || "?") + "' must be a positive number of events per month"); }
652
+ });
653
+ if (!(lift > 0) || !(lift < 5)) { problems.push("lift worth detecting: a fraction, 0.2 = +20% relative"); }
654
+ if (!UN_ZB[String(power)]) { problems.push("power must be 0.8 or 0.9"); }
655
+ if (!UN_ZA[String(alpha)]) { problems.push("alpha must be 0.05, 0.01 or 0.1"); }
656
+ if (!(horizon > 0)) { problems.push("horizon: months you are willing to wait, a positive number"); }
657
+ if (problems.length) { return { problems: problems }; }
658
+
659
+ const units = [];
660
+ for (let i = 0; i < steps.length - 1; i++) {
661
+ const a = steps[i], b = steps[i + 1];
662
+ const rate = Number(b.count) / Number(a.count);
663
+ const per_arm = unSampleSize(rate, lift, power, alpha);
664
+ const arm_events_per_month = Number(a.count) / 2;
665
+ const months = Math.ceil(per_arm / arm_events_per_month);
666
+ units.push({
667
+ unit: a.name + " -> " + b.name, from: a.name, to: b.name, rate: unRound6(rate),
668
+ floor_per_arm: per_arm, months_to_read: months,
669
+ arm_events_per_month: arm_events_per_month
670
+ });
671
+ }
672
+ let chosen = null;
673
+ units.forEach(function (u) { if (!chosen && u.months_to_read <= horizon) { chosen = u; } });
674
+ const unreadable = units.filter(function (u) { return u.months_to_read > horizon; }).map(function (u) { return u.unit; });
675
+ const last = units[units.length - 1];
676
+ const gates = [
677
+ "the earliest step is the cheapest to read and the least able to own the outcome: " + units[0].unit +
678
+ " reads in " + units[0].months_to_read + " month(s), which is why it is usually the number already in the dashboard",
679
+ "the money step has no next step at this volume: " + last.unit + " is the last pair in this funnel, so money always reads one step behind the unit you chose",
680
+ chosen
681
+ ? "readable at this volume: " + chosen.unit + " in " + chosen.months_to_read + " month(s) - fund that one test and set the read-out date before it starts"
682
+ : "nothing in this funnel is readable within " + horizon + " month(s): pick a more frequent unit or write down that the month produces a progress report"
683
+ ];
684
+ return {
685
+ steps: steps.length, lift: lift, power: power, alpha: alpha, horizon_months: horizon,
686
+ units: units,
687
+ readable_unit: chosen ? chosen.unit : "",
688
+ readable_months: chosen ? chosen.months_to_read : 0,
689
+ unreadable_units: unreadable,
690
+ gates: gates
691
+ };
692
+ }
693
+
694
+ function runUnit(opts) {
695
+ const spec = opts.steps;
696
+ const lift = Number(opts.lift !== undefined ? opts.lift : 0.2);
697
+ const power = Number(opts.power !== undefined ? opts.power : 0.8);
698
+ const alpha = Number(opts.alpha !== undefined ? opts.alpha : 0.05);
699
+ const horizon = Number(opts.horizon !== undefined ? opts.horizon : 6);
700
+ const problems = [];
701
+ let steps = [];
702
+ if (typeof spec !== "string" || spec.length === 0) {
703
+ problems.push("steps: pass --steps visits:12000,signups:900,activations:270,paid:40");
704
+ } else {
705
+ spec.split(",").forEach(function (part) {
706
+ const bits = part.split(":");
707
+ if (bits.length !== 2 || !bits[0] || !(Number(bits[1]) > 0)) {
708
+ problems.push("steps: '" + part.trim() + "' must look like name:events_per_month");
709
+ } else {
710
+ steps.push({ name: bits[0].trim(), count: Number(bits[1]) });
711
+ }
712
+ });
713
+ }
714
+ if (problems.length) { console.error("unit: " + problems.join("; ")); return 1; }
715
+ const out = planUnits({ steps: steps, lift: lift, power: power, alpha: alpha, horizon: horizon });
716
+ if (out.problems) { console.error("unit: " + out.problems.join("; ")); return 1; }
717
+ if (opts.json) { console.log(JSON.stringify(out, null, 2)); } else {
718
+ out.units.forEach(function (u) {
719
+ console.log("unit " + u.unit + ": rate " + (u.rate * 100).toFixed(2) + "%, floor " + fmtNum(u.floor_per_arm) +
720
+ " per arm, " + fmtNum(u.arm_events_per_month) + " events per arm a month -> " + u.months_to_read + " month(s) to read");
721
+ });
722
+ if (out.readable_unit) {
723
+ console.log("readable at this volume: " + out.readable_unit + " in " + out.readable_months + " month(s)");
724
+ } else {
725
+ console.log("readable at this volume: nothing within " + horizon + " month(s)");
726
+ }
727
+ if (out.unreadable_units.length) { console.log("out of reach: " + out.unreadable_units.join(", ")); }
728
+ out.gates.forEach(function (g) { console.log("gate: " + g); });
729
+ }
730
+ return 0;
731
+ }
732
+
628
733
  function fmtNum(n) {
629
734
  return String(n).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
630
735
  }
@@ -759,6 +864,8 @@ if (cmd === "sample") {
759
864
  process.exit(runVerdict(flags(rest)));
760
865
  } else if (cmd === "queue") {
761
866
  process.exit(runQueue(flags(rest)));
867
+ } else if (cmd === "unit") {
868
+ process.exit(runUnit(flags(rest)));
762
869
  } else if (cmd === "cost") {
763
870
  process.exit(runCost(flags(rest)));
764
871
  } else if (cmd === "aeo") {
@@ -806,6 +913,8 @@ Usage:
806
913
  npx marketing-mindset verdict was the difference real, and was the volume ever enough?
807
914
  npx marketing-mindset queue how many honest tests your volume can finish, and when each reads
808
915
  npx marketing-mindset cost what one readable verdict costs to finish, and how many a budget funds
916
+ npx marketing-mindset unit which step of your funnel can fund a verdict, and how many months it needs
917
+ --steps visits:12000,signups:900,activations:270,paid:40 [--lift 0.2] [--power 0.8] [--alpha 0.05] [--horizon 6]
809
918
  --cost 0.02 --daily 500 [--budget 5000] [--base 0.03] [--lift 0.2] [--power 0.8] [--alpha 0.05]
810
919
  --daily 500 --days 90 --start 2026-09-21 [--base 0.03] [--lift 0.2] [--power 0.8] [--alpha 0.05]
811
920
  --a 120/4000 --b 168/4000 [--alpha 0.05] [--json]
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "marketing-mindset",
3
- "version": "1.11.0",
4
- "description": "A marketer's operating mindset as an installable agent skill and CLI: test-size floors, kill rules, honest verdicts on finished tests, the lift a volume can read, a queue of readable tests with read-out dates, the cost of one readable verdict, agent-readiness checklist, marketing-engineer job description. npx marketing-mindset sample|kill|verdict|queue|cost|mde|budget|brief|plan|warmup|aeo|jd|sections|read|install.",
3
+ "version": "1.12.0",
4
+ "description": "A marketer's operating mindset as an installable agent skill and CLI: test-size floors, kill rules, honest verdicts on finished tests, which funnel step can fund a verdict, the lift a volume can read, a queue of readable tests with read-out dates, the cost of one readable verdict. npx marketing-mindset sample|kill|verdict|unit|queue|cost|mde|budget|brief|plan|warmup|aeo|jd|sections|read|install.",
5
5
  "keywords": [
6
6
  "agent-skill",
7
7
  "skill",
@@ -15,6 +15,7 @@
15
15
  "sample-size",
16
16
  "test-queue",
17
17
  "cost-per-verdict",
18
+ "funnel-unit",
18
19
  "ab-test-verdict",
19
20
  "minimum-detectable-effect",
20
21
  "job-description",