Scaffold PIG and model the compute-GTM ontology

PIG is an agent-native CRM for two-sided AI-compute companies: businesses
that buy GPU capacity from providers and resell it. Their business is the
spread between two pipelines, which is precisely what a generic CRM cannot
represent.

The load-bearing decision is the `allocations` table, joining a
capacity_commitment (what we bought, at a known cost) to a demand_deal
(what we sold, at a known price). Margin, utilisation and idle capacity all
fall out of that one join. Cost is charged against the full commitment
rather than only the hours that sold, because unsold hours are already paid
for and any other treatment flatters a block that is losing money.

Domain decisions worth noting, each grounded in how this market operates:

- Demand stages put `legal` second, not last. Customers do not hand
  workloads to an infrastructure provider before paper is executed.
- Supply qualification splits technical from financial diligence, recorded
  attributably. Accepting capacity is a two-key decision.
- Capacity carries a time SHAPE (intervals + quantities), not a window.
  Commitments ramp and step down; a rectangle reports availability that
  does not exist in the month someone wants it.
- SLAs model three distinct shapes: none, a reliability tier plus credits
  policy, and a negotiated agreement. Aggregators generally cannot promise
  uptime on resold capacity, but negotiate heavyweight paper upstream.
  Remedies include fee abatement, which is materially better than a capped
  credit and is not expressible as one.
- Export control is a predicate on the allocation edge, evaluated against
  the ULTIMATE parent's jurisdiction. Country of incorporation is not a
  valid key, so this cannot live as a flag on an account.
- Agent-derived claims land in `facts` with a confidence band and evidence.
  Only verified claims self-apply; weaker ones await review.
- The API never calls the agent. It writes to a leased queue, guarded by a
  partial unique index on unfinished work.

Verified: typechecks clean, migration generates and applies to Postgres 16
(31 tables, 24 enums, 117 indexes).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-12 18:41:41 -07:00
commit d36762f264
33 changed files with 12342 additions and 0 deletions
+47
View File
@@ -0,0 +1,47 @@
PIG — Prime Intellect Growth
Copyright 2026 The PIG Authors
This product includes software developed by The PIG Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
---
ACKNOWLEDGEMENTS
Several architectural ideas in this project were studied from, and are
gratefully credited to, the following open-source projects. No source code
was copied from them; the debt is one of design.
Comp AI CRM (https://github.com/trycompai/crm) — MIT License.
The evidence-banded fact model, the leased database-backed agent task
queue, the agent-brief pattern on user-defined fields, and the
"intelligence never lives in the API" separation.
Buzz (https://github.com/block/buzz) — Apache License 2.0.
The agent-as-workspace-member model that informed PIG's treatment of
agents as first-class principals with their own identity and audit trail.
---
DATA PROVENANCE
PIG ships with seed data describing publicly documented people and companies.
Every seeded person record carries a `confidence` grade and a `source_url`
citing where the claim came from. No email addresses are included, inferred,
or generated: none were published by the subjects, and guessing them would be
both unreliable and inappropriate.
Seed data reflects public sources as of August 2026 and will go stale. It is
provided to make the application legible on first run, not as an assertion of
fact about any individual. See docs/seed-data.md.