Count the accounts, so Piggy stops counting deals instead
CI / verify (push) Successful in 7m9s
CI / publish (push) Has been skipped

Asked how many accounts were on the book, Piggy answered "7 demand deals
(accounts)". Production holds 17 accounts and 7 demand deals. The number was
real and the payload had scoped it correctly as deals; the prose relabelled
it on the way out.

This is the other half of the scope fix. That one stopped a filtered count
being read as a total. This one is a total that was simply absent being
filled from the nearest available noun: /accounts resolves to the workspace
summary, which carried commitments, deals, margin and idle capacity and no
count of accounts anywhere. The route's own label admitted it — "Piggy reads
the book here, not the account rows" — which named the gap without closing
it, and a model given a question about accounts and a payload with no
account figure will always find something else to count.

So the summary now counts accounts and contacts in SQL, and the headline
leads with them, because the defective answer was assembled from the first
countable thing in that sentence. Archived accounts are excluded to match
what /api/accounts returns — Piggy disagreeing with the list on screen is the
failure that costs the tool its credibility — but they are reported
separately so the difference stays reconcilable. The side breakdown ships
with a note saying the tabs do not partition, since supply and demand tabs
each include "both" and therefore do not sum to the total: that is the next
reconciliation bug, pre-empted.

Five routes that genuinely have no data tool now say so in their guide
rather than naming a subject they cannot reach. Proven live: /accounts
answers 23 of 23; a question about geography is refused rather than guessed;
/team refuses without substituting a nearby number.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
claude
2026-08-14 19:32:54 -07:00
parent f2ef403ee9
commit a3b1298257
5 changed files with 445 additions and 36 deletions
+4 -3
View File
@@ -13,9 +13,10 @@
*
* - Pages are grouped by tool, not by subject. /accounts and /facts get the
* same book questions as the dashboard because all three resolve to
* `pig_get_workspace_summary`, which knows nothing about accounts or facts.
* Asking "which account is at risk?" from /accounts reads beautifully and
* cannot be answered.
* `pig_get_workspace_summary`. That tool now counts accounts and contacts,
* so a total is answerable from /accounts; what it still does not return is
* account ROWS, so "which account is at risk?" reads beautifully from that
* page and cannot be answered. Facts it does not see at all.
* - No starter names a horizon in days. `pig_get_calendar_ahead` takes
* `withinDays` and defaults to 30, and a question phrased around a quarter
* is only answered if the model chooses to pass the argument. Everything