Framework by wheelbase ai · v0.1 · open source

Canonical

A recursive, self-improving knowledge base for analytics, built for humans and AI agents. One Git repo that gives product, data science, finance, and operations a shared foundation, so AI agents and humans alike get the same accurate results.

Who this is for

Teams that want a design and execution blueprint for unlocking agent-powered efficiency and accuracy in their knowledge work.

  • Finance

    Board-grade definitions with certified queries and an audit trail. Forecast comparison and month-end flux become skills, not scrambles.

  • BizOps

    Shared frameworks and analytical processes. For questions like:

    • What tables and filters should we use to report D7 retention, ARR and Sessions per User?
    • What % of growth came from volume versus price?
  • Product

    Engagement mappings at the right grain, consistent funnel metrics, and every experiment readout where the next team will find it.

  • Data science

    Known issues written down once, not rediscovered every quarter. Every governed metric tied to certified SQL.

  • Operations

    Offer letters drafted consistent with your compensation policy, and the cap table updated as equity grants are approved.

01 · The problem

Analytics knowledge lives in people's heads. AI can't ask around.

Metric definitions live in a BI tool. Caveats live in an analyst's memory. The validated ARR query is in someone's personal folder. The right way to compare two forecast versions exists only as muscle memory.

Point a model at your warehouse and it will compute "churn" four defensible ways, none of them yours. What limits AI in analytics isn't model capability. It's context. And even once you write that context down, it goes stale within weeks.

“Why is my Claude giving me a different ARR than yours?”

Same question, one right answer

Live Demos: Same model. Same data. Different answer.

Two runs of the same model get the same question and the same read-only warehouse. One also gets Lumen's knowledge base. Watch where they split.

The CFO asks

“Two things for the board deck. First, did we beat plan on ARR at the end of October 2026? Use the latest forecast version. Second, what was our NRR for October 2026, and what drove the change from September?”

Without Canonical

Warehouse access only

Waiting to run

  1. TablesList warehouse tables
  2. SQL
    select version_id, version_name, scenario, min(month), max(month), count(*), max(exported_…
    select version_id, version_name, scenario, min(month), max(month), count(*), max(exported_at), listagg(distinct line, ',') from raw_pigment.plan_lines group by 1,2,3 order by 7
    Exit code 1
    #!/usr/bin/env python3
    """Read-only SQL against Lumen's demo warehouse (built by build.py).
    
        python3 query.py "select * from analytics.fct_nrr_monthly_v2 order by month desc limit 3"
        python3 query.py --tables          list every table with its columns and row count
    
    Schemas work as in Snowflake (`analytics.fct_arr_daily`, `raw_stripe.invoices`, ...). A few Snowflake
    functions are emulated so certified SQL runs as written: last_day(d), dateadd(part, n, d),
    datediff(part, a, b) and date_trunc(part, d). Results print as an aligned table, at most 200 rows.
    """
    from __future__ import annotations
    
    import datetime as dt
    … 68 more lines
  3. Thinks

    SQLite underneath.

  4. SQL
    select version_id, version_name, scenario, min(month), max(month), count(*), max(exported_…
    select version_id, version_name, scenario, min(month), max(month), count(*), max(exported_at), group_concat(distinct line) from raw_pigment.plan_lines group by 1,2,3 order by 7
    
    select * from raw_pigment.plan_lines where month like '2026-10%' order by exported_at
    version_id | version_name | scenario | min(month) | max(month) | count(*) | max(exported_at)     | group_concat(distinct line)                                  
    -----------+--------------+----------+------------+------------+----------+----------------------+--------------------------------------------------------------
    ver_7c3d1e | Budget FY26  | Base     | 2026-01-01 | 2026-12-01 | 72       | 2026-11-27T05:00:00Z | ARR,Implementation fees,New ARR,Expansion ARR,Churned ARR,Cus
    ver_8f21a0 | Board        | Base     | 2026-01-01 | 2026-12-01 | 72       | 2026-11-27T05:00:00Z | ARR,Implementation fees,New ARR,Expansion ARR,Churned ARR,Cus
    ver_9a07c4 | Latest       | Base     | 2026-01-01 | 2026-12-01 | 72       | 2026-11-27T05:00:00Z | ARR,Implementation fees,New ARR,Expansion ARR,Churned ARR,Cus
    (3 rows)
    version_id | version_name | scenario | month      | line                | amount_usd   | exported_at         
    -----------+--------------+----------+------------+---------------------+--------------+---------------------
    ver_7c3d1e | Budget FY26  | Base     | 2026-10-01 | ARR                 | 8,175,000.00 | 2026-11-27T05:00:00Z
    ver_7c3d1e | Budget FY26  | Base     | 2026-10-01 | Implementation fees | 32,500.00    | 2026-11-27T05:00:00Z
    ver_7c3d1e | Budget FY26  | Base     | 2026-10-01 | New ARR             | 241,300.00   | 2026-11-27T05:00:00Z
    ver_7c3d1e | Budget FY26  | Base     | 2026-10-01 | Expansion ARR       | 93,400.00    | 2026-11-27T05:00:00Z
    ver_7c3d1e | Budget FY26  | Base     | 2026-10-01 | Churned ARR         | -147,900.00  | 2026-11-27T05:00:00Z
    ver_7c3d1e | Budget FY26  | Base     | 2026-10-01 | Customers           | 1,494.00     | 2026-11-27T05:00:00Z
    … 13 more lines
  5. Readquery.py
  6. Readquery.py
  7. SQL
    select snapshot_date, count(*), count(distinct stripe_customer_id), sum(arr_usd) from anal…
    select snapshot_date, count(*), count(distinct stripe_customer_id), sum(arr_usd) from analytics.fct_arr_daily where snapshot_date in ('2026-08-31','2026-09-30','2026-10-31','2026-11-01','2026-11-27') group by 1
    
    select max(snapshot_date), min(snapshot_date) from analytics.fct_arr_daily
    
    select * from analytics.fct_nrr_monthly_v2 order by month
    snapshot_date | count(*) | count(distinct stripe_customer_id) | sum(arr_usd)
    --------------+----------+------------------------------------+-------------
    2026-08-31    | 1425     | 1425                               | 7,669,015.00
    2026-09-30    | 1446     | 1446                               | 7,838,900.00
    2026-10-31    | 1455     | 1455                               | 8,133,005.00
    2026-11-01    | 1456     | 1456                               | 8,192,565.00
    2026-11-27    | 1464     | 1464                               | 8,219,925.00
    (5 rows)
    max(snapshot_date) | min(snapshot_date)
    -------------------+-------------------
    2026-11-27         | 2024-10-01        
    (1 rows)
    month      | nrr   
    -----------+-------
    … 14 more lines
  8. SQL
    with b as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snaps…
    with b as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snapshot_date=dateadd(month,-12,'2026-10-31')), e as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snapshot_date='2026-10-31') select sum(b.a), sum(coalesce(e.a,0)), sum(coalesce(e.a,0))/sum(b.a) from b left join e using(c)
    
    with b as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snapshot_date=dateadd(month,-12,'2026-09-30')), e as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snapshot_date='2026-09-30') select sum(b.a), sum(coalesce(e.a,0)), sum(coalesce(e.a,0))/sum(b.a) from b left join e using(c)
    sum(b.a)     | sum(coalesce(e.a,0)) | sum(coalesce(e.a,0))/sum(b.a)
    -------------+----------------------+------------------------------
    6,486,160.00 | 6,865,810.00         | 1.05853                      
    (1 rows)
    sum(b.a)     | sum(coalesce(e.a,0)) | sum(coalesce(e.a,0))/sum(b.a)
    -------------+----------------------+------------------------------
    6,415,520.00 | 6,587,110.00         | 1.02675                      
    (1 rows)
  9. SQL
    with s as (select stripe_customer_id c, arr_usd a, plan_tier t from analytics.fct_arr_dail…
    with s as (select stripe_customer_id c, arr_usd a, plan_tier t from analytics.fct_arr_daily where snapshot_date='2026-09-30'), o as (select stripe_customer_id c, arr_usd a, plan_tier t from analytics.fct_arr_daily where snapshot_date='2026-10-31') select coalesce(s.c,o.c) c, s.a, o.a, coalesce(o.a,0)-coalesce(s.a,0) d, s.t, o.t, cu.name, cu.created, cu.livemode from s full outer join o on s.c=o.c left join raw_stripe.customers cu on cu.id=coalesce(s.c,o.c) where coalesce(o.a,0)<>coalesce(s.a,0) order by abs(d) desc limit 30
    c                  | a          | a          | d          | t        | t        | name                        | created    | livemode
    -------------------+------------+------------+------------+----------+----------+-----------------------------+------------+---------
    cus_DhU4XgaOzyx7J3 | 128,000.00 | 344,000.00 | 216,000.00 | business | business | Acme Logistics              | 2023-03-15 | 1       
    cus_9IhetLGnvAdyVY | NULL       | 9,900.00   | 9,900.00   | NULL     | pro      | Highlandport Retail         | 2026-10-08 | 1       
    cus_9uLSkHOmxc3HEZ | NULL       | 9,600.00   | 9,600.00   | NULL     | business | Lakebrook Dental            | 2026-10-16 | 1       
    cus_Aw0ClsVLzWMoOc | 9,405.00   | NULL       | -9,405.00  | pro      | NULL     | Mapleline Manufacturing     | 2022-08-12 | 1       
    cus_raZLsv15IIZ6ob | 7,425.00   | NULL       | -7,425.00  | pro      | NULL     | Bluemark Labs               | 2021-03-28 | 1       
    cus_5wPCFcvyyg5xjP | 6,435.00   | NULL       | -6,435.00  | pro      | NULL     | Northline Builders          | 2025-04-12 | 1       
    cus_FsAPpdz6Si1gZm | 6,435.00   | NULL       | -6,435.00  | pro      | NULL     | Embercrest Outfitters       | 2021-02-02 | 1       
    cus_CIVwQack8iIjUQ | NULL       | 6,000.00   | 6,000.00   | NULL     | business | Maplecrest Pharmacy         | 2026-10-23 | 1       
    cus_wvPe3Mllp2Ov3o | 5,940.00   | NULL       | -5,940.00  | pro      | NULL     | Goldenstone Outfitters      | 2021-08-13 | 1       
    cus_CfdsklQ7D0pNX0 | NULL       | 5,940.00   | 5,940.00   | NULL     | pro      | Coppergate Pharmacy         | 2026-10-06 | 1       
    cus_2gWozpOO8i2Crx | NULL       | 5,600.00   | 5,600.00   | NULL     | business | Coastalstead Logistics      | 2026-10-17 | 1       
    cus_Jw8iuuFqOYO0gZ | 5,445.00   | NULL       | -5,445.00  | pro      | NULL     | Meridianmere Learning       | 2022-11-08 | 1       
    … 19 more lines
  10. Thinks

    Quick status: I've reproduced both NRR figures. October's jump traces mostly to one account, Acme Logistics, whose ARR went up $216K. Now I'm checking whether that increase is real.

  11. SQL
    select snapshot_date, arr_usd, plan_tier from analytics.fct_arr_daily where stripe_custome…
    select snapshot_date, arr_usd, plan_tier from analytics.fct_arr_daily where stripe_customer_id='cus_DhU4XgaOzyx7J3' and (snapshot_date like '%-01' or snapshot_date >= '2026-09-25') and snapshot_date>='2026-06-01' order by 1
    
    select * from analytics.stg_stripe__subscriptions_daily where stripe_customer_id='cus_DhU4XgaOzyx7J3' and snapshot_date in ('2026-09-30','2026-10-31','2026-11-27')
    
    select s.*, i.* from raw_stripe.subscriptions s join raw_stripe.subscription_items i on i.subscription=s.id where s.customer='cus_DhU4XgaOzyx7J3'
    
    select * from raw_stripe.discounts where subscription in (select id from raw_stripe.subscriptions where customer='cus_DhU4XgaOzyx7J3')
    
    select o.* from raw_salesforce.opportunities o join raw_salesforce.accounts a on a.id=o.account_id where a.stripe_customer_id__c='cus_DhU4XgaOzyx7J3' order by close_date
    snapshot_date | arr_usd    | plan_tier
    --------------+------------+----------
    2026-06-01    | 128,000.00 | business 
    2026-07-01    | 128,000.00 | business 
    2026-08-01    | 128,000.00 | business 
    2026-09-01    | 128,000.00 | business 
    2026-09-25    | 128,000.00 | business 
    2026-09-26    | 128,000.00 | business 
    2026-09-27    | 128,000.00 | business 
    2026-09-28    | 128,000.00 | business 
    2026-09-29    | 128,000.00 | business 
    2026-09-30    | 128,000.00 | business 
    2026-10-01    | 128,000.00 | business 
    2026-10-02    | 128,000.00 | business 
    … 83 more lines
  12. SQL
    select * from raw_stripe.invoices where customer='cus_DhU4XgaOzyx7J3' and created>='2026-0…
    select * from raw_stripe.invoices where customer='cus_DhU4XgaOzyx7J3' and created>='2026-01-01' order by created
    
    select contract_type__c, count(*), sum(amount) from raw_salesforce.opportunities group by 1
    
    select special_terms__c, count(*) from raw_salesforce.opportunities where special_terms__c is not null group by 1 order by 2 desc limit 40
    
    select coupon_id, percent_off, duration, duration_in_months, count(*), min(start_date), max(start_date) from raw_stripe.discounts group by 1,2,3,4
    id                | customer           | subscription       | created    | period_start | period_end | amount_due | amount_paid | status | line_type   
    ------------------+--------------------+--------------------+------------+--------------+------------+------------+-------------+--------+-------------
    in_Me2S8gjLPnapVz | cus_DhU4XgaOzyx7J3 | sub_SdoVwgP4FmErxT | 2026-03-15 | 2026-03-15   | 2027-03-15 | 12800000   | 12800000    | paid   | subscription
    in_CqtAkaWSX9iUh3 | cus_DhU4XgaOzyx7J3 | sub_RDeagiwM0qkDsz | 2026-10-15 | 2026-10-15   | 2026-11-15 | 0          | 0           | paid   | subscription
    in_duZfa7D8AlvjC8 | cus_DhU4XgaOzyx7J3 | sub_RDeagiwM0qkDsz | 2026-11-15 | 2026-11-15   | 2026-12-15 | 0          | 0           | paid   | subscription
    (3 rows)
    contract_type__c | count(*) | sum(amount) 
    -----------------+----------+-------------
    Launch Program   | 1        | 216,000.00  
    Standard Annual  | 2075     | 9,522,000.00
    (2 rows)
    special_terms__c                                                                       | count(*)
    ---------------------------------------------------------------------------------------+---------
    Co-termed with renewal.                                                                | 491     
    … 26 more lines
  13. SQL
    select d.coupon_id, s.subscription_id, s.unit_amount_net, i.unit_amount, s.quantity, s.bil…
    select d.coupon_id, s.subscription_id, s.unit_amount_net, i.unit_amount, s.quantity, s.billing_interval, f.arr_usd from raw_stripe.discounts d join analytics.stg_stripe__subscriptions_daily s on s.subscription_id=d.subscription and s.snapshot_date='2026-10-31' join raw_stripe.subscription_items i on i.subscription=d.subscription join analytics.fct_arr_daily f on f.stripe_customer_id=s.stripe_customer_id and f.snapshot_date=s.snapshot_date where d.start_date<='2026-10-31' and (d.end_date is null or d.end_date>'2026-10-31') group by d.coupon_id limit 10
    
    select stripe_customer_id, count(*) from analytics.stg_stripe__subscriptions_daily where snapshot_date='2026-10-31' group by 1 having count(*)>1 limit 5
    
    select status, is_paid_plan, count(*) from analytics.stg_stripe__subscriptions_daily where snapshot_date='2026-10-31' group by 1,2
    
    select livemode, count(*) from raw_stripe.customers group by 1
    coupon_id  | subscription_id    | unit_amount_net | unit_amount | quantity | billing_interval | arr_usd   
    -----------+--------------------+-----------------+-------------+----------+------------------+-----------
    ANNUAL10   | sub_pZhIDeAg3jDc6M | 40000           | 40000       | 6        | year             | 2,400.00  
    LAUNCH100  | sub_RDeagiwM0qkDsz | 5625            | 5625        | 320      | month            | 344,000.00
    PROMO20_3M | sub_pQ5anY5Tbg5YZ4 | 4125            | 4125        | 6        | month            | 2,970.00  
    (3 rows)
    stripe_customer_id | count(*)
    -------------------+---------
    cus_DhU4XgaOzyx7J3 | 2       
    (1 rows)
    status | is_paid_plan | count(*)
    -------+--------------+---------
    active | 1            | 1458    
    paused | 1            | 2       
    … 6 more lines
  14. SQL
    select c.id, c.name, c.livemode, f.arr_usd from raw_stripe.customers c left join analytics…
    select c.id, c.name, c.livemode, f.arr_usd from raw_stripe.customers c left join analytics.fct_arr_daily f on f.stripe_customer_id=c.id and f.snapshot_date='2026-10-31' where c.livemode=0
    
    select s.stripe_customer_id, s.status, f.arr_usd from analytics.stg_stripe__subscriptions_daily s left join analytics.fct_arr_daily f on f.stripe_customer_id=s.stripe_customer_id and f.snapshot_date=s.snapshot_date where s.snapshot_date='2026-10-31' and s.status='paused'
    
    select d.coupon_id, count(*), sum(s.unit_amount_net*s.quantity/100.0*(case s.billing_interval when 'month' then 12 else 1 end)*d.percent_off/100.0) disc_arr from raw_stripe.discounts d join analytics.stg_stripe__subscriptions_daily s on s.subscription_id=d.subscription and s.snapshot_date='2026-10-31' where d.start_date<='2026-10-31' and (d.end_date is null or d.end_date>'2026-10-31') group by 1
    
    select count(*), sum(arr_usd) from analytics.fct_arr_daily where snapshot_date='2026-10-31' and stripe_customer_id not in (select id from raw_stripe.customers)
    id               | name                        | livemode | arr_usd
    -----------------+-----------------------------+----------+--------
    cus_TEST4kQ2nV8p | Test Account (do not use)   | 0        | NULL   
    cus_TESTm81ZqLw3 | Test Account 2 (do not use) | 0        | NULL   
    (2 rows)
    stripe_customer_id | status | arr_usd
    -------------------+--------+--------
    cus_No9uW8oVMDn7KT | paused | NULL   
    cus_wvPe3Mllp2Ov3o | paused | NULL   
    (2 rows)
    coupon_id  | count(*) | disc_arr  
    -----------+----------+-----------
    ANNUAL10   | 124      | 78,600.00 
    LAUNCH100  | 1        | 216,000.00
    … 6 more lines
  15. SQL
    select d.coupon_id, i.subscription, si.unit_amount*si.quantity gross, i.amount_due, i.peri…
    select d.coupon_id, i.subscription, si.unit_amount*si.quantity gross, i.amount_due, i.period_start from raw_stripe.discounts d join raw_stripe.invoices i on i.subscription=d.subscription join raw_stripe.subscription_items si on si.subscription=d.subscription where d.coupon_id in ('ANNUAL10','PROMO20_3M') and i.created>='2026-09-01' order by i.created desc limit 8
    coupon_id | subscription       | gross  | amount_due | period_start
    ----------+--------------------+--------+------------+-------------
    ANNUAL10  | sub_HjmUTCsdXUj7Im | 240000 | 240000     | 2026-11-25  
    ANNUAL10  | sub_ZzQvyUvPesM1LE | 400000 | 400000     | 2026-11-24  
    ANNUAL10  | sub_ZqO4UK5kjjHwJn | 280000 | 250000     | 2026-11-22  
    ANNUAL10  | sub_ZqO4UK5kjjHwJn | 280000 | 280000     | 2026-11-22  
    ANNUAL10  | sub_TJXjfxp1Kxsmrf | 760000 | 760000     | 2026-11-21  
    ANNUAL10  | sub_HQGetaw6pUUhw0 | 720000 | 720000     | 2026-11-20  
    ANNUAL10  | sub_HZzSDMuKoYdYXp | 240000 | 240000     | 2026-11-16  
    ANNUAL10  | sub_HZzSDMuKoYdYXp | 240000 | 250000     | 2026-11-16  
    (8 rows)
  16. SQL
    with s as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snaps…
    with s as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snapshot_date='2026-09-30'), o as (select stripe_customer_id c, arr_usd a from analytics.fct_arr_daily where snapshot_date='2026-10-31'), j as (select coalesce(s.a,0) sa, coalesce(o.a,0) oa from s full outer join o on s.c=o.c) select sum(case when sa=0 then oa end) new, sum(case when sa>0 and oa>sa then oa-sa end) exp, sum(case when sa>0 and oa>0 and oa<sa then oa-sa end) contr, sum(case when oa=0 then -sa end) churn from j
    
    select 6649810.0/6486160
    new        | exp        | contr      | churn     
    -----------+------------+------------+-----------
    103,270.00 | 281,175.00 | -16,640.00 | -73,700.00
    (1 rows)
    6649810.0/6486160
    -----------------
    1.02523          
    (1 rows)

Answer✗ Wrong

  • Missed plan: October ARR $8,133,005 vs. $8,285,600 "Latest" plan, $152.6K (1.8%) below; excluding Acme's $216K, 4.4% below.
  • NRR 105.9%, up from 102.7%: nearly all of the rise is Acme Logistics' $216K expansion; without it, 102.5%.
  • Acme isn't billing yet: 100% discounted until Jan 15, 2027; Finance/Legal must review LP-0007 section 4 before board use.
Full answer

1. ARR vs. plan, end of October 2026: we missed plan.

  • Actual ARR on Oct 31: $8,133,005. Plan in the "Latest" forecast version was $8,285,600, so we were $152.6K (1.8%) below plan. We also came in below the Board version ($8,251,500) and Budget FY26 ($8,175,000).
  • Even that $8.13M flatters October. It includes $216K of ARR from Acme Logistics that isn't paying yet (explained below). Without it, ARR is $7,917,005, which is $368.6K (4.4%) below plan.
  • New-customer ARR was the main shortfall. Ignoring Acme, net new ARR was about $78K against plan's $189K. New ARR was $103K against a plan of $244K. Expansion was $65K against $94K. Churn and downgrades were better than plan at about $90K against $150K.

2. NRR for October 2026: 105.9%, up from 102.7% in September. Nearly all of the rise is one deal.

  • I reproduced both figures from the reported NRR table. NRR here is: ARR today from customers we had 12 months ago, divided by their ARR back then.
  • What drove the change: On Oct 15, Acme Logistics (an existing customer, previously $128K ARR) added the Automations add-on for 320 seats. That took their ARR to $344K. The $216K increase accounts for about 3.3 of the 3.2-point rise.
  • Without that deal, October NRR is 102.5%, slightly down from September's 102.7%. Day-to-day retention and expansion were flat to a bit softer.

Why the Acme $216K needs a caveat before it goes in a board deck:

  • It's the only "Launch Program" contract in Salesforce. Every other deal uses the standard annual contract. Its terms point to "Order Form LP-0007, section 4", which isn't in the warehouse, so I can't tell whether it's a firm commitment or something they can cancel.
  • In Stripe it carries a 100%-off discount for 3 months (Oct 15, 2026 to Jan 15, 2027). Both invoices so far, for October and November, were $0.
  • Our ARR calculation counts it at full list price because it ignores this discount.

Suggested board language: "October ARR was $8.13M, 1.8% below forecast. Reported NRR rose to 105.9%, driven by a single launch-program expansion at Acme Logistics that doesn't start billing until January 2027. Excluding it, NRR was 102.5%, roughly flat with September, and ARR was 4.4% below forecast."

Before this goes out:

  • Finance or Legal should read section 4 of LP-0007 to decide whether the $216K counts as committed ARR now or only once billing starts.
  • "Latest forecast version" is my reading of the Pigment version literally named "Latest". All three versions were exported at the same time, so the timestamps don't tell you which is newest.
  • The ARR calculation also doesn't subtract the other active discounts: about $79K from a permanent 10%-off annual coupon and about $8K from a 20%-off 3-month promo. That should be checked separately. If those discounts are real, actual ARR is overstated in every month, but it doesn't change the direction of either answer.

16 steps · 1:27 · claude-opus-5-5

With Canonical

Warehouse access + the knowledge base

Waiting to run

  1. ReadREADME.md, INDEX.md, execution/skills/answer-metric-question/SKILL.md and 4 more
  2. Readmetrics/arr.md, metrics/net-revenue-retention.md, data/certified-queries/*.md and 2 more
  3. Readdata/sources/*.md, data/entities/*.md, history/decisions/2026-10-annual-plan-discount.md and 1 more
  4. TablesList warehouse tables
  5. SQL
    select version_id, version_name, scenario, min(month), max(month), count(*), min(exported_…
    select version_id, version_name, scenario, min(month), max(month), count(*), min(exported_at), max(exported_at) from raw_pigment.plan_lines group by 1,2,3 order by 7
    
    select distinct line from raw_pigment.plan_lines
    
    select * from raw_pigment.plan_lines where month like '2026-10%' order by version_id, scenario, line
    version_id | version_name | scenario | min(month) | max(month) | count(*) | min(exported_at)     | max(exported_at)    
    -----------+--------------+----------+------------+------------+----------+----------------------+---------------------
    ver_7c3d1e | Budget FY26  | Base     | 2026-01-01 | 2026-12-01 | 72       | 2026-11-27T05:00:00Z | 2026-11-27T05:00:00Z
    ver_8f21a0 | Board        | Base     | 2026-01-01 | 2026-12-01 | 72       | 2026-11-27T05:00:00Z | 2026-11-27T05:00:00Z
    ver_9a07c4 | Latest       | Base     | 2026-01-01 | 2026-12-01 | 72       | 2026-11-27T05:00:00Z | 2026-11-27T05:00:00Z
    (3 rows)
    line               
    -------------------
    ARR                
    Implementation fees
    New ARR            
    Expansion ARR      
    Churned ARR        
    Customers          
    … 22 more lines
  6. SQL
    with q as ( select s.snapshot_date, s.stripe_customer_id, sum( s.unit_amount_net / 100.0 *…
    with q as (
    select
      s.snapshot_date,
      s.stripe_customer_id,
      sum(
        s.unit_amount_net / 100.0
        * s.quantity
        * case s.billing_interval when 'year' then 1.0 / 12 else 1 end
      ) * 12 as arr_usd
    from analytics.stg_stripe__subscriptions_daily s
    left join raw_stripe.discounts d
      on d.subscription = s.subscription_id
     and d.percent_off = 100
     and s.snapshot_date >= d.start_date
     and (d.end_date is null or s.snapshot_date < d.end_date)
    where s.status = 'active'
      and s.is_paid_plan
      and s.stripe_customer_id not like 'cus_TEST%'
      and d.id is null
    group by 1, 2)
    select snapshot_date, sum(arr_usd), count(*) from q where snapshot_date in ('2026-08-31','2026-09-30','2026-10-31','2026-11-27') group by 1 order by 1
    
    select snapshot_date, sum(arr_usd), count(*) from analytics.fct_arr_daily where snapshot_date in ('2026-09-30','2026-10-31') group by 1
    
    select max(snapshot_date) from analytics.stg_stripe__subscriptions_daily
    
    select * from analytics.fct_nrr_monthly_v2 order by month
    snapshot_date | sum(arr_usd) | count(*)
    --------------+--------------+---------
    2026-08-31    | 7,669,015.00 | 1425    
    2026-09-30    | 7,838,900.00 | 1446    
    2026-10-31    | 7,917,005.00 | 1455    
    2026-11-27    | 8,003,925.00 | 1464    
    (4 rows)
    snapshot_date | sum(arr_usd) | count(*)
    --------------+--------------+---------
    2026-09-30    | 7,838,900.00 | 1446    
    2026-10-31    | 8,133,005.00 | 1455    
    (2 rows)
    max(snapshot_date)
    ------------------
    … 18 more lines
  7. SQL
    with month_end as ( select s.snapshot_date as month_end, s.stripe_customer_id, sum(s.unit_…
    with month_end as (
      select s.snapshot_date as month_end, s.stripe_customer_id,
             sum(s.unit_amount_net / 100.0 * s.quantity
                 * case s.billing_interval when 'year' then 1.0 / 12 else 1 end) * 12 as arr_usd
      from analytics.stg_stripe__subscriptions_daily s
      left join raw_stripe.discounts d
        on d.subscription = s.subscription_id
       and d.percent_off = 100
       and s.snapshot_date >= d.start_date
       and (d.end_date is null or s.snapshot_date < d.end_date)
      where s.status = 'active'
        and s.is_paid_plan
        and s.stripe_customer_id not like 'cus_TEST%'
        and d.id is null
        and s.snapshot_date = last_day(s.snapshot_date)
      group by 1, 2
    ),
    cohort as (
      select m.month_end, b.stripe_customer_id, b.arr_usd as arr_start
      from (select distinct month_end from month_end) m
      join month_end b
        on b.month_end = last_day(dateadd(month, -12, m.month_end))
      where b.arr_usd > 0
    )
    select
      c.month_end as month,
      sum(coalesce(t.arr_usd, 0)) / sum(c.arr_start) as nrr
    from cohort c
    left join month_end t
      on t.stripe_customer_id = c.stripe_customer_id
     and t.month_end = c.month_end
    group by 1
    order by 1
    Quoted text in this command can't be checked before it runs
  8. SQL
    with month_end as ( select s.snapshot_date as month_end, s.stripe_customer_id, sum(s.unit_…
    with month_end as (
      select s.snapshot_date as month_end, s.stripe_customer_id,
             sum(s.unit_amount_net / 100.0 * s.quantity
                 * case s.billing_interval when 'year' then 1.0 / 12 else 1 end) * 12 as arr_usd
      from analytics.stg_stripe__subscriptions_daily s
      left join raw_stripe.discounts d
        on d.subscription = s.subscription_id
       and d.percent_off = 100
       and s.snapshot_date >= d.start_date
       and (d.end_date is null or s.snapshot_date < d.end_date)
      where s.status = 'active'
        and s.is_paid_plan
        and s.stripe_customer_id not like 'cus_TEST%'
        and d.id is null
        and s.snapshot_date = last_day(s.snapshot_date)
      group by 1, 2
    ),
    cohort as (
      select m.month_end, b.stripe_customer_id, b.arr_usd as arr_start
      from (select distinct month_end from month_end) m
      join month_end b
        on b.month_end = last_day(dateadd(month, -12, m.month_end))
      where b.arr_usd > 0
    )
    select
      c.month_end as month,
      sum(coalesce(t.arr_usd, 0)) / sum(c.arr_start) as nrr
    from cohort c
    left join month_end t
      on t.stripe_customer_id = c.stripe_customer_id
     and t.month_end = c.month_end
    group by 1
    order by 1
    month      | nrr     
    -----------+---------
    2025-10-31 | 0.975105
    2025-11-30 | 0.982747
    2025-12-31 | 0.977437
    2026-01-31 | 0.983949
    2026-02-28 | 0.999175
    2026-03-31 | 0.998693
    2026-04-30 | 1.02269 
    2026-05-31 | 1.02313 
    2026-06-30 | 1.02186 
    2026-07-31 | 1.02384 
    2026-08-31 | 1.02574 
    2026-09-30 | 1.02675 
    … 2 more lines
  9. SQL
    with month_end as ( select s.snapshot_date as month_end, s.stripe_customer_id, sum(s.unit_…
    with month_end as (
      select s.snapshot_date as month_end, s.stripe_customer_id,
             sum(s.unit_amount_net / 100.0 * s.quantity
                 * case s.billing_interval when 'year' then 1.0 / 12 else 1 end) * 12 as arr_usd
      from analytics.stg_stripe__subscriptions_daily s
      left join raw_stripe.discounts d
        on d.subscription = s.subscription_id
       and d.percent_off = 100
       and s.snapshot_date >= d.start_date
       and (d.end_date is null or s.snapshot_date < d.end_date)
      where s.status = 'active'
        and s.is_paid_plan
        and s.stripe_customer_id not like 'cus_TEST%'
        and d.id is null
        and s.snapshot_date = last_day(s.snapshot_date)
      group by 1, 2
    ),
    cohort as (
      select m.month_end, b.stripe_customer_id, b.arr_usd as arr_start
      from (select distinct month_end from month_end) m
      join month_end b
        on b.month_end = last_day(dateadd(month, -12, m.month_end))
      where b.arr_usd > 0
    ),
    x as (
    select c.month_end, c.stripe_customer_id, c.arr_start, coalesce(t.arr_usd,0) as arr_end
    from cohort c left join month_end t on t.stripe_customer_id = c.stripe_customer_id and t.month_end = c.month_end
    where c.month_end in ('2026-08-31','2026-09-30','2026-10-31'))
    select month_end, count(*) as cohort_n, sum(arr_start) start_arr, sum(arr_end) end_arr,
     sum(case when arr_end>arr_start then arr_end-arr_start else 0 end) as expansion,
     sum(case when arr_end<arr_start and arr_end>0 then arr_end-arr_start else 0 end) as contraction,
     sum(case when arr_end=0 then -arr_start else 0 end) as churn,
     sum(case when arr_end=0 then 1 else 0 end) as churned_n,
     sum(case when arr_end>arr_start then 1 else 0 end) as expanded_n,
     sum(case when arr_end<arr_start and arr_end>0 then 1 else 0 end) as contracted_n
    from x group by 1 order by 1
    month_end  | cohort_n | start_arr    | end_arr      | expansion  | contraction | churn       | churned_n | expanded_n | contracted_n
    -----------+----------+--------------+--------------+------------+-------------+-------------+-----------+------------+-------------
    2026-08-31 | 1263     | 6,317,360.00 | 6,479,980.00 | 830,100.00 | -80,840.00  | -586,640.00 | 135       | 858        | 146         
    2026-09-30 | 1278     | 6,415,520.00 | 6,587,110.00 | 838,135.00 | -83,265.00  | -583,280.00 | 133       | 866        | 153         
    2026-10-31 | 1292     | 6,486,160.00 | 6,649,810.00 | 834,930.00 | -79,520.00  | -591,760.00 | 136       | 882        | 145         
    (3 rows)
  10. SQL
    select d.*, s.customer from raw_stripe.discounts d join raw_stripe.subscriptions s on s.id…
    select d.*, s.customer from raw_stripe.discounts d join raw_stripe.subscriptions s on s.id=d.subscription where percent_off=100
    
    select month, line, amount_usd from raw_pigment.plan_lines where version_id='ver_9a07c4' and line in ('ARR','Implementation fees') and month between '2026-08-01' and '2026-11-01' order by 1,2
    id                | subscription       | coupon_id | percent_off | duration  | duration_in_months | start_date | end_date   | customer          
    ------------------+--------------------+-----------+-------------+-----------+--------------------+------------+------------+-------------------
    di_YVmz80XvoWw8Er | sub_RDeagiwM0qkDsz | LAUNCH100 | 100         | repeating | 3                  | 2026-10-15 | 2027-01-15 | cus_DhU4XgaOzyx7J3
    (1 rows)
    month      | line                | amount_usd  
    -----------+---------------------+-------------
    2026-08-01 | ARR                 | 7,982,900.00
    2026-08-01 | Implementation fees | 30,300.00   
    2026-09-01 | ARR                 | 8,442,800.00
    2026-09-01 | Implementation fees | 54,000.00   
    2026-10-01 | ARR                 | 8,285,600.00
    2026-10-01 | Implementation fees | 34,800.00   
    2026-11-01 | ARR                 | 8,354,800.00
    2026-11-01 | Implementation fees | 31,400.00   
    … 1 more lines

Answer✓ Right

  • Beat plan by $49K (+0.6%): October ARR $7,917,005 vs. $7,868,000 plan (latest version ver_9a07c4, excluding implementation fees). Customers trail plan: 1,455 vs. 1,494. Confirm version id with FP&A.
  • NRR 102.5%, down 0.15 points from September's 102.7%, mostly from softer expansion.
  • Don't use 105.9%: that table counts the free Acme add-on as expansion.
Full answer

Short version: Yes, we beat the latest plan on October ARR, by about $49K (+0.6%). October NRR was 102.5%, down 0.15 points from September's 102.7%. That is essentially flat, and most of the small dip came from a bit less expansion.

1. ARR vs. plan, as of 2026-10-31

Actual ARR$7,917,005 (1,455 customers)
Plan: latest version ver_9a07c4, Base scenario, "ARR" line$8,285,600
Less 12 × October implementation fees (12 × $34,800)−$417,600
Plan on the same basis as actual ARR$7,868,000
Beat+$49,005 (+0.6%)
  • The raw plan line isn't comparable to actual ARR. The plan's "ARR" line includes one-time implementation fees. Our ARR definition (metric.arr) excludes them, so tooling.planning-mcp says to subtract them first. If we compare the raw numbers, it looks like we missed plan by $369K. We didn't.
  • Use $7.917M, not $8.133M. The warehouse table analytics.fct_arr_daily shows $8.133M. That table still counts the $216K Acme Logistics Launch Program add-on (contract LP-0007), which is free until 2027-01-15. Free months aren't ARR (metric.arr, source.salesforce). The $7.917M comes from the certified query query.fct-arr-daily.
  • Customer count is behind plan. We have 1,455 customers against 1,494 in the plan. The ARR beat came from revenue per customer, not from more customers. The board may ask about this.

2. NRR for October 2026

102.5% trailing 12 months, vs. 102.7% in September (−0.15 points). This is from the certified query query.fct-nrr-monthly. September matches the 102.67% already reported.

What moved, as a share of each month's starting ARR from customers active 12 months earlier:

SepOctEffect on NRR
Expansion+13.06%+12.87%−0.19 pt
Contraction−1.30%−1.23%+0.07 pt
Churn−9.09%−9.12%−0.03 pt
NRR102.7%102.5%−0.15 pt

Wording for the board: "NRR held at about 102.5%, in line with the 102–103% range since April. Expansion was slightly softer, partly offset by less contraction, and churn was flat."

Watch out for a 105.9% October NRR. analytics.fct_nrr_monthly_v2 shows 105.85%. That table counts the free Acme add-on as expansion, which adds about 3.3 points. The certified definition counts Acme's expansion only from its first paid month, so it should show up in NRR from January 2027 (metric.net-revenue-retention). If 105.9% has already gone around, please correct it before it reaches the deck.

Confidence

  • NRR: high. I used the certified SQL. September ties to the previously reported number, and the gap to the v2 table is fully explained by the Acme contract.
  • ARR vs. plan: medium-high. Actual ARR comes from the certified query.
  • The planning-tool guidance on implementation fees is still a draft (tooling.planning-mcp).
  • I read the plan from the nightly warehouse export, not from Pigment itself.
  • The export has no publish date. I took ver_9a07c4 as the latest version because it's labelled "Latest", but those names get reused. Please confirm the version id with FP&A before this goes in the deck.
  • The beat is only 0.6%. A different plan version, or a change in how implementation fees are treated, could change the answer.

Finance should sign off before these numbers go into the deck (skill.board-prep-pivot).

11 steps · 1:15 · claude-opus-5-5

How Canonical avoided a mistake

The mistake
Acme Logistics signed a $216K-a-year add-on with the first 3 months free. Every table in the warehouse counts it from day one, so October NRR reads 105.9%, not 102.5%. The plan's "ARR" line also includes one-time implementation fees, so Lumen looks $153K behind plan when it's $49K ahead.
Where Canonical knew it from
On Oct 14 the deal desk posted in Slack that Acme's first 3 months are free. Canonical's weekly enrichment check read the thread and proposed a fix. Finance accepted it: metric.arr now excludes free months, and the certified ARR and NRR queries were re-certified. A note on the planning tool says to remove implementation fees before comparing with plan.
Why a general model couldn't know
The free months are written only in the signed order form. Stripe shows an active subscription and Salesforce shows the full amount. Whether free months count as ARR is Lumen's policy, not a fact in the data. The model without Canonical found the coupon and still couldn't say which number Lumen reports.

Real recorded runs on Lumen, the fictional company in the repo, sped up on one shared clock so each side's pace is real. Same model, same prompt, same read-only warehouse. Only the knowledge base differs. Each short answer is the same model's own summary of its full answer, written from that answer alone. Reproduce them with python3 demo/record.py.

02 · The architecture

One repo. Three functions. Five loops.

analytics-reference/ holds what the company knows. execution/ holds the skills and tooling an agent follows to do the work. system/ holds the jobs and checks that keep everything current.

The five loops are the five automated checks in system/. They are what make it recursive: every check, like every analysis, writes what it learned back into the reference, so the knowledge base gets more accurate the more it's used.

Define once, reference everywhere, and let every use make it more accurate.
Fig. 1 · One repo, three functions, five loopsA diagram of the three folders. Execution reads definitions from analytics-reference. System runs five loops, the five automated checks, on a schedule. Each loop, like every analysis, writes what it learns back into analytics-reference. Execution produces the outputs: answers, variance sheets, forecasts, and decks.
Inside the folders: what's in the reference, and what a skill looks like
  • Metrics

    Governed definitions for ARR, NRR, cohort retention, funnel conversion. Each has an owner, caveats, and a history.

    metric.arr
  • Certified queries

    SQL validated against an independent source. Edit one and it has to be re-certified.

    query.fct-arr-daily
  • Sources & entities

    Every system of record and its known issues. What one "customer" row actually means.

    source.stripe
  • Finance

    Vendors, billing cycles, AP and AR conventions: everything needed to calculate financial metrics.

    register.vendors
  • Product

    How engagement data maps to product concepts: active, activated, power user, seat utilization.

    entity.engagement-event
  • Models

    How the financial model is built and how metrics drive each other. The ARR bridge, driver trees.

    model.arr-bridge
  • Frameworks

    Horizontal methods that apply everywhere: growth accounting, mix shift, cohort methods.

    framework.mix-shift
  • History

    Analyses with a confidence level; decisions with an expected outcome and a date to check.

    decision.2026-10-…
execution/skills/compare-forecast-versions/SKILL.md

Compare the latest forecast with the version from three weeks ago, attribute the deltas, and produce the standard variance output.

  1. Pull both versions from Pigment via its MCP. Same scenario, same cut
  2. Compute deltas line × period
  3. Attribute ARR deltas with the ARR bridge; blended rates with mix shift
  4. Reconcile any change to actuals against the certified ARR query
  5. Write the standard variance sheet: summary, detail, bridge
  6. Draft five bullets of commentary, each with a citation

Ids are from the worked example in the repo: Lumen, a fictional B2B SaaS company.

03 · The five checks

Knowledge bases go stale. This one checks itself.

Connecting AI to your warehouse, GitHub, and Drive lets it read a snapshot. It doesn't keep the snapshot true. Every week products launch, tables get deprecated, and pipelines get re-architected.

system/ runs five checks on a schedule. Checks 1 to 3 protect what's already there. Checks 4 and 5 bring new knowledge in.

Fig. 2 · The five checks over one week

Protect what's there

  • 1

    Schema integrity deterministic

    Tables and columns the knowledge base mentions that no longer exist; key-table columns nobody documented.

    Runs daily, 06:00.

  • 2

    Semantic integrity code + agent

    Two definitions of ARR; any part of the knowledge base that contradicts another.

    Runs weekly, Tuesday.

  • 3

    Cohesion & redundancy code + agent

    Knowledge an agent can't find fast; the same fact stored in three places.

    Runs weekly, Tuesday.

Bring new knowledge in

  • 4

    Proactive enrichment agent

    Merged PRs, tracked live documents, launches, and Slack decisions the knowledge base doesn't reflect yet.

    Runs weekly, Friday.

  • 5

    Analytical gaps agent

    Analysis people keep doing that isn't captured as a metric or skill.

    Runs weekly, Friday.

11 runs a week. Schema drift breaks things today, so that check runs daily. Definitions and new knowledge move slower, so the rest run weekly.

04 · The runtime

From a timer to a decision.

Every run happens in a fresh sandbox with only the read-only access that check needs. The agent runs cheap, exact code first and uses the LLM only where judgment is needed.

Nothing changes on its own. Each finding arrives with a recommended accept, refine, or reject, and a person makes the call. Every layer is replaceable: swap GitHub Actions for Airflow, or Slack for email.

Fig. 3 · One check run, start to finishA vertical flow of seven layers. The scheduler starts a run. A fresh sandbox checks out the knowledge base. Inside it, an agent runs the check prompt and deterministic code, with read-only MCP connections to the warehouse, GitHub, Slack, and Drive. The run writes a report of findings, each with a recommended action. A summary goes to Slack. A reviewer accepts, refines, or rejects each finding. Accepted fixes merge as pull requests, refined findings go back to the agent, and every decision is recorded in the review ledger.

05 · The autonomy ladder

Human in the loop, then it earns its way up.

The review ledger measures, for each type of finding, how often the system's recommendation matched what the person decided. Types with a strong record graduate. Some never do: changing a metric's definition, certifying a query, and anything high severity with low confidence always go to the owner.

Fig. 4 · The autonomy ladder
  1. Level 0

    Human in the loop

    A person reviews every finding.

    Where every check starts.

  2. Level 1

    Agent pre-review

    A separate reviewer agent recommends too; the person confirms.

    After a check has run a few weeks.

  3. Level 2

    Auto-accept

    When both agents agree with high confidence, the fix applies. People spot-check.

    ≥ 95% agreement over ≥ 30 findings of that type.

  4. Level 3

    Self-maintaining

    People see only escalations.

    Every remaining type meets the Level 2 bar.

Agreement between the system's recommendation and the human's decision, by finding type

Illustrative numbers, to show how graduation works. A type graduates at ≥ 95% agreement over ≥ 30 findings.

  • schema-integrity / undocumented_column

    98% agreement over 42 findings. Level 2: auto-accept

  • schema-integrity / renamed_table

    97% agreement over 18 findings. Needs more findings (18 of 30)

  • cohesion-redundancy / duplicate_fact

    91% agreement over 35 findings. Below the 95% bar

  • proactive-enrichment / missing_launch

    84% agreement over 22 findings. Below the 95% bar

  • semantic-integrity / definition_change

    97% agreement over 31 findings. Never graduates: definitions stay human-approved

If a type's agreement drops (the business changed in a way the check doesn't understand), it falls back a level on its own.

Start for free

No migration. A repo and a habit.

  1. [01] 1 week

    Interview and audit

    We talk to the people doing the work, map how knowledge work gets done today, and find the lowest-hanging fruit.

  2. [02] 1–2 weeks

    Free MVP

    A working version on one problem from the audit, at no cost, so you see results before you commit.

  3. [03] 3–4 weeks

    Build the scaled system

    The source of truth and agents across the workflows that matter, on your own systems and in your own repository.

  4. [04] 4–6 weeks, lightweight

    Train

    The system learns from your team’s feedback, and your team learns how to work with it.