diff --git a/.gitignore b/.gitignore index e00d486..880b74e 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ node_modules/ bun.lockb .html-kit/_archive/ .playwright-cli/ +.eval/ diff --git a/.html-kit/00_index.html b/.html-kit/00_index.html index ccccb1e..1233e1d 100644 --- a/.html-kit/00_index.html +++ b/.html-kit/00_index.html @@ -140,7 +140,7 @@
dockblocks-ops/.insight-kit (48 runs, Apr–May 2026)
is a hand-sequenced exploratory loop with heavy boilerplate. Hamilton is a
DAG framework with native lifecycle hooks, tags, materialisers, caching, and a notebook→prod story.
- A prior memory already records the decision to build growth_insights v2 on Hamilton — this artifact
+ A prior memory already records the decision to build consumer-repo v2 on Hamilton — this artifact
is the architecture-level how, what to keep, what to drop, what's the lift.
Free emission to OpenLineage / Marquez / OpenMetadata if you ever need an external lineage catalog (already noted in prior decision memory).
@save_to.parquet / @load_from.parquet + @save_to.duckdb: build_duckdb_views.py mostly disappears.
@subdag + @parameterize = "critic-of(claim_X) across 5 angles" as a one-liner. Today this is 5 scripts.
Hamilton's hello-world story is "write functions in .py, iterate in notebook, ship the same module". Matches insight-kit's "5 exploratory .py + 1 final annotated module" pattern documented for growth_insights.
Hamilton's hello-world story is "write functions in .py, iterate in notebook, ship the same module". Matches insight-kit's "5 exploratory .py + 1 final annotated module" pattern documented for consumer-repo.
Pivot. The integration's value isn't a faster council megabatch. It's a closed-loop intervention
engine. The pattern is already half-built in
-nairomarket/growth_insights/data/initiatives_log.jsonl — every record is an intervention
+your-business/consumer-repo/data/initiatives_log.jsonl — every record is an intervention
(G4-2026-05-04, F7-2026-05-05, DIAG-DISMISS-2026-05-05) that was
executed (Meta Marketing API POST, customer-file hash + upload, Events-Manager kebab-click)
and is now waiting for a checkpoint date to be re-measured.
@@ -725,7 +725,7 @@
nairomarket/growth_insights/interventions/g4_exclusion.py holds: baseline fn, execute fn, post fn, delta fn, critic fn. All five share upstream meta_insights(adset_ids, window).your-business/consumer-repo/interventions/g4_exclusion.py holds: baseline fn, execute fn, post fn, delta fn, critic fn. All five share upstream meta_insights(adset_ids, window).@tag(side_effect="meta_api", idempotency_key=…). The hook records the request + response into the run dir. A second execute() with the same idempotency key cache-hits and refuses to re-POST.ik checkpoint <initiative_id> calls Driver.execute([compute_post_cpa, measure_intervention, critic_intervention_verdict]) with window="14d_post". The cache holds the baseline; only post + delta + critic compute.InitiativeLogSaver appends one record per execute, updates the same record on checkpoint.04b_post_meeting_actions_2026-04-30.md) becomes
Ten greenlit actions, each one a candidate intervention module: Verify Meta CAPI, Wire customer-file exclusions on 9 unsuppressed adsets, Lock pre-Google-relaunch baseline, Build 25-34 male adset with +30% ramp, 24h post-purchase nudge, Re-frame G5 CSR-attribution, Verify Apr-2025 AOV anomaly, Send rev-share framework, Top-100-SKU concentration, COD-to-delivered rate.
-Each becomes a module under growth_insights/interventions/ with the same 5-node shape.
+Each becomes a module under consumer-repo/interventions/ with the same 5-node shape.
The founder review meeting then has a single artifact: the delta dashboard in Evidence.dev that reads initiatives_log + claims and answers "what did we do, what moved, what didn't" — generated, not assembled.
ik run <module> CLIsrc/insight_kit/cli/insight_kit/hamilton/materializers.pyRunScopedParquetSaver that resolves output paths to .insight-kit/runs/<id>/output/<layer>/.insight_kit/patterns/council.pynairomarket/growth_insights/interventions/g4_exclusion.py, f7_audience_refresh.pyinitiatives_log.jsonl.your-business/consumer-repo/interventions/g4_exclusion.py, f7_audience_refresh.pyinitiatives_log.jsonl.InitiativeLogSaver materializerinsight_kit/hamilton/materializers.pyinitiatives_log.jsonl records on execute / checkpoint.ik checkpoint <initiative_id> CLIsrc/insight_kit/cli/src/insight_kit/hamilton/sideeffect.py@tag(side_effect=…, idempotency_key=…); hook records request+response; cache refuses double-POST.InsightKitHook already exists at adapter.py:67 — promote it from optional to default.script.py with one declarative Hamilton module per analysis topic. Spikes remain free-form in spikes/.@tag, @parameterize, @subdag, @check_output, lifecycle hooks, HamiltonCacheAdapter, materialisers. Skip: Ray/Dask/Spark, h_openlineage, h_mlflow — re-evaluate when there is a real catalog or distributed need.G4-2026-05-04 and F7-2026-05-05 from initiatives_log.jsonl as Hamilton modules under growth_insights/interventions/. Frozen baselines become claims; checkpoint dates (2026-05-19, 2026-05-12) trigger automatic post-metric + delta + critic claims. Closes the loop on intervention records already on the calendar — no new analysis, just makes the system measure itself. Ship signal: by 2026-05-19, initiatives_log.jsonl shows post_metric_value + delta_pct + status="DONE" filled in by a Driver run, not a human edit; the founder-comms email at 2026-05-19_founder_g4_f7_update.md renders from those claims, not from a hand-curated markdown.G4-2026-05-04 and F7-2026-05-05 from initiatives_log.jsonl as Hamilton modules under consumer-repo/interventions/. Frozen baselines become claims; checkpoint dates (2026-05-19, 2026-05-12) trigger automatic post-metric + delta + critic claims. Closes the loop on intervention records already on the calendar — no new analysis, just makes the system measure itself. Ship signal: by 2026-05-19, initiatives_log.jsonl shows post_metric_value + delta_pct + status="DONE" filled in by a Driver run, not a human edit; the founder-comms email at 2026-05-19_founder_g4_f7_update.md renders from those claims, not from a hand-curated markdown.docs/sprint3/04b_post_meeting_actions_2026-04-30.md each become an intervention module. Evidence.dev renders a single delta dashboard reading initiatives_log + claims: what was done, when, what moved, what didn't, what's still measuring. The product becomes the closed loop, not the analysis.Real growth_insights bugs (sign flip, 5160% vs 51.6%, partial-month MER). Six-layer defense: <ClaimNum>, <ClaimChart>, L6 preflight, post-render diff, inline critiques[].
Real consumer-repo bugs (sign flip, 5160% vs 51.6%, partial-month MER). Six-layer defense: <ClaimNum>, <ClaimChart>, L6 preflight, post-render diff, inline critiques[].
Run.emit_metric() calls; the materializer owns the I/O.nairomarket/growth_insights/data/initiatives_log.jsonl. Each record is one founder-greenlit intervention with baseline metric, checkpoint date, and (eventually) post-metric + delta filled by a Driver run.your-business/consumer-repo/data/initiatives_log.jsonl. Each record is one founder-greenlit intervention with baseline metric, checkpoint date, and (eventually) post-metric + delta filled by a Driver run.raw-tier claim emitted at T0 of an intervention, locking the pre-action metric value. Content-addressed by the cache adapter so it cannot drift even if the measurement code is re-run later.Driver.execute() completes. In the deep-refactor path, this writes manifest.json instead of Run.__exit__.nairomarket/growth_insights/ analysis package. v2 is being built on Hamilton. Contains interventions/ (per-lever Hamilton modules), data/initiatives_log.jsonl, and the Evidence.dev delta dashboard.your-business/consumer-repo/ analysis package. v2 is being built on Hamilton. Contains interventions/ (per-lever Hamilton modules), data/initiatives_log.jsonl, and the Evidence.dev delta dashboard.@save_to.parquet writes artifacts → build_duckdb_views.py mounts them as DuckDB views → Evidence SQL pages query those views → markdown pages render charts and claim badges.
Before the Hamilton refactor: what does an analyst loop look like on disk? This page walks
the lifecycle, then peels open 6 real runs from
- nairomarket/growth_insights/data/agent_runs/ — Shopify ingest, Meta worker, analyst
+ your-business/consumer-repo/data/agent_runs/ — Shopify ingest, Meta worker, analyst
council, critic, initiative wiring — so a newcomer can read one page and understand the shape
insight-kit is asking Hamilton to compose with.
-insight-kit lives at nairomarket/growth_insights/src/growth_insights/provenance/. The
+insight-kit lives at your-business/consumer-repo/src/consumer-repo/provenance/. The
unit of work is a Run: a topic + agent + timestamped directory under
data/agent_runs/<run_id>/. Inside one Run, the analyst (a) imports
Run, (b) opens a context, (c) ingests inputs, (d) computes, (e) emits parquet artifacts,
@@ -182,7 +182,7 @@
# the canonical idiom (paraphrased from real scripts)
- from growth_insights.provenance import Run
+ from consumer-repo.provenance import Run
with Run(topic="shopify_orders_bulk", agent="human") as run:
orders_df = run.ingest_jsonl("data/raw/shopify/orders_bulk.jsonl")
@@ -295,7 +295,7 @@ Layer 1 – 6 (preflight)
§4Walking 6 real runs
The runs below all live under
-nairomarket/growth_insights/data/agent_runs/. Open any one for a complete worked
+your-business/consumer-repo/data/agent_runs/. Open any one for a complete worked
example.
@@ -495,15 +495,15 @@ §6Anchor files — copy these paths
| Concern | Path |
|---|---|
| Run / Claim impl | nairomarket/growth_insights/src/growth_insights/provenance/ |
| Goal catalog | nairomarket/growth_insights/.insight-kit/goals/ (via kit-root walk) |
| All runs | nairomarket/growth_insights/data/agent_runs/ (45 runs as of 2026-05-14) |
| Initiatives log | nairomarket/growth_insights/data/initiatives_log.jsonl |
| DuckDB views builder | nairomarket/growth_insights/scripts/build_duckdb_views.py |
| Preflight (Layer 1–6) | nairomarket/growth_insights/scripts/preflight_check.py |
| Analyst/critic runner | nairomarket/growth_insights/scripts/run_analyst_critic.py |
| Evidence pages | nairomarket/growth_insights/reports/pages/{levers,initiatives,funnel,metrics,insights}/ |
| DuckDB warehouse | nairomarket/growth_insights/data/warehouse.duckdb |
| Run / Claim impl | your-business/consumer-repo/src/consumer-repo/provenance/ |
| Goal catalog | your-business/consumer-repo/.insight-kit/goals/ (via kit-root walk) |
| All runs | your-business/consumer-repo/data/agent_runs/ (45 runs as of 2026-05-14) |
| Initiatives log | your-business/consumer-repo/data/initiatives_log.jsonl |
| DuckDB views builder | your-business/consumer-repo/scripts/build_duckdb_views.py |
| Preflight (Layer 1–6) | your-business/consumer-repo/scripts/preflight_check.py |
| Analyst/critic runner | your-business/consumer-repo/scripts/run_analyst_critic.py |
| Evidence pages | your-business/consumer-repo/reports/pages/{levers,initiatives,funnel,metrics,insights}/ |
| DuckDB warehouse | your-business/consumer-repo/data/warehouse.duckdb |
data/agent_runs/<run_id>/ that records a topic, agent, all inputs, all outputs, and all claims produced in one execution context.nairomarket/growth_insights/data/agent_runs/. 45 runs as of 2026-05-14; Evidence.dev and DuckDB treat this as a single queryable timeline.your-business/consumer-repo/data/agent_runs/. 45 runs as of 2026-05-14; Evidence.dev and DuckDB treat this as a single queryable timeline.InputRecord[], OutputRecord[], ApiCall[], code SHA, git state, and runtime telemetry. The authoritative record of what a Run did.Narwhals is a thin compatibility layer over pandas/polars/modin/cudf/pyarrow. One node body, swap engine at Driver.Builder() time. Useful when you don't know which engine wins, or when analysts work in pandas + production runs polars.
For growth_insights: keeps analysts in pandas (notebooks) while letting prod ingest go polars without rewriting cohort logic.
+For consumer-repo: keeps analysts in pandas (notebooks) while letting prod ingest go polars without rewriting cohort logic.
import narwhals as nw from narwhals.typing import IntoDataFrame diff --git a/.html-kit/04_pandera-fit.html b/.html-kit/04_pandera-fit.html index 5a41f66..41dabc7 100644 --- a/.html-kit/04_pandera-fit.html +++ b/.html-kit/04_pandera-fit.html @@ -574,7 +574,7 @@Decision criterion
-For insight-kit pilot (1–3 analysts on growth_insights): start with local fs. Bump to S3 the first time analyst-B says "wait, I'm waiting on Shopify API again, didn't analyst-A run this 2 hours ago?".
+For insight-kit pilot (1–3 analysts on consumer-repo): start with local fs. Bump to S3 the first time analyst-B says "wait, I'm waiting on Shopify API again, didn't analyst-A run this 2 hours ago?".
diff --git a/.html-kit/05_feature-platform-and-claim-bundle.html b/.html-kit/05_feature-platform-and-claim-bundle.html index 550a139..98afbdc 100644 --- a/.html-kit/05_feature-platform-and-claim-bundle.html +++ b/.html-kit/05_feature-platform-and-claim-bundle.html @@ -807,7 +807,7 @@ @@ -604,7 +604,7 @@§7Effort + sequencing
Verdict · 2026-05-14Ship bundle + features as v0. Layer the rest behind feature flags.
-
- Week 1. Claim bundle on disk (
+claims/{id}/dir). Three fingerprints. Page-import syntax in renderer. Migrate 5 existing growth_insights claims as smoke test.- Week 1. Claim bundle on disk (
claims/{id}/dir). Three fingerprints. Page-import syntax in renderer. Migrate 5 existing consumer-repo claims as smoke test.- Week 2-3. Feature catalog (
features/). Naming-lint hook. Analyst getslist_features/describe_feature/find_claimstools. data_eng owns merges.- Week 3-4. Altair plumbing:
<VegaLite>wrapper (~30 LoC Svelte),vl-convertin critic tool surface, Playwright page-screenshot. Vision critic catches axis-flip / wrong-series.- Week 4. Linked claims:
diff --git a/.html-kit/06_provenance-loop.html b/.html-kit/06_provenance-loop.html index 55b2d9b..8fcd2ff 100644 --- a/.html-kit/06_provenance-loop.html +++ b/.html-kit/06_provenance-loop.html @@ -146,7 +146,7 @@parameterize_from_claim, claim registry, supersession banner. Cross-claim Pandera invariants (annual = sum of monthly).decision brief · 2026-05-14Closing the text + charts hallucination loop
- Real growth_insights bugs:
health.mdshowed +115,070 KES when the truth was −11,079 KES — sign flipped.g4_retargeting_leak.mdrendered 5160% for what should have been 51.6%.monthly_pldisplayed MER 9.26x built on partial-month spend. Each cost a revision sprint. This page proposes a closed loop:<ClaimNum>· ProvenanceRail · L6 preflight · post-render diff. + Real consumer-repo bugs:health.mdshowed +115,070 KES when the truth was −11,079 KES — sign flipped.g4_retargeting_leak.mdrendered 5160% for what should have been 51.6%.monthly_pldisplayed MER 9.26x built on partial-month spend. Each cost a revision sprint. This page proposes a closed loop:<ClaimNum>· ProvenanceRail · L6 preflight · post-render diff.Two layers, six gates, zero literal numbers in narrative prose.
diff --git a/.html-kit/07_cache-walkthrough.html b/.html-kit/07_cache-walkthrough.html index c1a00de..db898cb 100644 --- a/.html-kit/07_cache-walkthrough.html +++ b/.html-kit/07_cache-walkthrough.html @@ -3,7 +3,7 @@ -Hamilton cache — walkthrough on a growth_insights pipeline +Hamilton cache — walkthrough on a consumer-repo pipeline