Spec the GameCult economy daemon

Dimensions, materials, lots with provenance, recipes as roles, products as
property vectors; markets as Ghostlight mirrors; prices as a pure function
of committed state; both directions through the consumer contract. The
economy owner is the consumer that owns a world's market mirrors.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-11 15:04:28 +02:00
commit 6133461d8e
3 changed files with 247 additions and 2 deletions

View file

@ -43,7 +43,7 @@ switches on those names or that ID.
cannot repair either canonical domain after rejection.
- **Forbidden writers:** Ghostlight Personas and strategic cells cannot mutate `greathold`; Delvehold cannot mutate foreign private state; the adapter cannot repair either owner after rejection.
Ghostlight owns a narrative-scale conserved quantity for the subjects it simulates: `Custody` holds a unitless `Quantity` per subject and resource, `Transfer`/`Consume`/`Transform` conserve it, and `Admit` creates it only with evidence (`docs/architecture/ghostlight-world-ontology.md`, Invariant 5). That is a ledger, not an economy. `Transform` is one-to-one with no unit, rate, yield, facility, or capacity field anywhere on a Ghostlight type, so prices, production, orders, and contracts are unrepresentable in Ghostlight rather than merely unwritten; they remain Delvehold-owned, and any resource an external mirror holds changes only through its admitted owner.
The economy owner is the consumer that owns a world's market mirrors: for Delvehold today its own adapter, and for both games in the target design the GameCult economy daemon (`gamecult-economy-daemon.md`), which is itself a Ghostlight consumer. Ghostlight owns a narrative-scale conserved quantity for the subjects it simulates: `Custody` holds a unitless `Quantity` per subject and resource, `Transfer`/`Consume`/`Transform` conserve it, and `Admit` creates it only with evidence (`docs/architecture/ghostlight-world-ontology.md`, Invariant 5). That is a ledger, not an economy. `Transform` is one-to-one with no unit, rate, yield, facility, or capacity field anywhere on a Ghostlight type, so prices, production, orders, and contracts are unrepresentable in Ghostlight rather than merely unwritten; they remain Delvehold-owned, and any resource an external mirror holds changes only through its admitted owner.
## Greathold boundary subject

View file

@ -0,0 +1,242 @@
# The GameCult economy daemon
Status: specification, 2026-09-11. Nothing is built. The daemon's repository
name is the operator's to choose; this document calls it "the daemon".
## Objective
One economy organ serving Aetheria and Delvehold, in which every item is the
product of a supply chain, materials are interchangeable within a role at
different trade-offs, prices are a pure function of committed state, and the
economy both produces from player choices and reacts to them. Consequences
authored in Ghostlight (a closed route, a defaulted promise, a witnessed
collapse) reach players as prices; player choices (what was crafted from
what, where it was sold) reach Ghostlight's people as facts and pressures.
## What the two games already hold
Aetheria's shared model (`Assets/Scripts/ServerShared/ItemData.cs`,
`ItemInstance.cs`, `ItemManager.cs`) carries a scalar `Quality` on every
crafted instance, a `Price` integer on the item datum, and stats evaluated as
`lerp(min, max, quality^exponent)`. The legacy model kept the better idea and
lost it to a breach: a crafted instance remembered every ingredient instance,
and a stat named the ingredient whose quality it read
(`Aetheria-legacy/Assets/Scripts/Item.cs` line 385). Delvehold's design
(`Game Design/HOLD/Production and Logistics.md`) already states the target
rule: "Every transformation records recipe or method, consumed and produced
lots, operator or automation, facility, time, quality-relevant conditions,
and provenance," and "players specialize sites, trade, commission, use
institutional services, or accept less efficient substitutes." The daemon is
the single owner of that rule for both games.
Ghostlight keeps a unitless conserved ledger and no prices, by construction
(`Quantity` has no unit "because a unit is where prices enter"). That stance
does not change. The daemon is where units, properties, and prices live, and
it reaches Ghostlight only through the consumer contract
(`ghostlight-world-consumer-api.md`) as one more consumer that owns market
mirrors.
## The model
Five nouns. Everything else is derived.
**Dimension.** A named property axis with a unit tag, authored per world:
`thermal_conductivity (W/m·K)`, `density (kg/m³)`, `tensile_strength`,
`corrosion_resistance`, and in other worlds `aether_conductance`,
`mana_capacity`, `hex_resistance`. The daemon is genre-neutral because a
dimension is data. A world declares its dimensions once; nothing in the
daemon names one.
**Material.** A class of stuff with a property vector over the world's
dimensions and a base extraction or synthesis source. Copper, aluminium, gold
are three materials sharing most dimensions with different values. A
material may itself be the product of a recipe (an alloy, a refined ore, a
grown culture), in which case its property vector is derived from its lot,
not authored.
**Lot.** A quantity of one material at one place with one provenance:
extracted at a site, or produced by one recipe run from named input lots. A
lot's property vector is its material's for an authored material, or the
recipe's output function applied to its inputs for a produced one. Lots are
conserved: a recipe run consumes input lots and produces output lots, a
transfer moves a lot between holders and places, and nothing else creates or
destroys quantity except an extraction with a source and a consumption with a
sink. Provenance is the DAG of lot ids through recipe runs, acyclic by
construction because a run's outputs are minted after its inputs are
consumed. This is the legacy "remembers every ingredient," made durable and
queryable rather than carried on the instance.
**Recipe.** A transformation stated as roles, not ingredients. Each role names
a functional requirement over dimensions (`conductor: thermal_conductivity ≥
200`, `spreader: thermal_conductivity ≥ 100 and density ≤ 3000`), a quantity,
and how the output's properties read the material filling the role. A
recipe also names a **process** role: the facility, tool, and practice that
run it, which carry their own dimensions (`precision`, `throughput`,
`contamination`) and are filled by the workshop's actual station and
operator. Substitution is therefore not a special case: any material meeting
the role's requirement fills it, and the trade-off is visible in the output's
derived properties and in the price paid. A heat spreader with a vapour
chamber and one without are two recipes for one product class, or one recipe
with an optional role, and the market prices the difference.
**Product.** A produced lot with a property vector, a product class, and its
provenance. There is no scalar quality on the product. Game stats read the
product's properties by dimension the way the legacy stat read a named
ingredient's quality: a thruster's output reads its conductor's
`thermal_conductivity`, its housing's `density`, and its process's
`precision`. Rarity tiers, star ratings, and "quality" are projections a game
computes for display from the vector, never inputs. A scalar quality on the
instance is what the breach left; it does not come back.
Two consequences of the model that the games asked for:
- An exceptional item is a product of a well-managed supply chain by
construction. Its properties are its inputs' properties through the
recipe's output function, and its provenance names every choice that made
it so.
- "Functionally interchangeable with different trade-offs" is the recipe's
role requirement plus the market's price. The daemon never ranks materials;
the dimensions and the prices do.
## Markets and prices
A **market** is a place-bound institution with a liquidity reserve per
material class and a demand profile. In Ghostlight terms a market is an
externally controlled mirror subject the daemon owns: Ghostlight's people may
stand in it, transact toward it, witness facts in it, and never mutate it.
Several markets exist per world, one configured mirror each.
A **price** is a pure function of committed daemon state at a revision: the
market's reserve of the class, its demand profile, the route cost to the
nearest markets holding the class, and a liquidity parameter. Use the
standard mechanism rather than a bespoke one: a per-market, per-class
automated market maker (a logarithmic scoring rule or constant-function
curve, chosen at build for its bounded loss) quoting against the reserve,
with tatonnement between markets carried by trade, not by the daemon: a
price gap across a route is an opportunity for a Ghostlight subject or a
player to move a lot, and the move is what closes the gap. The daemon owns no
trader.
**Demand** enters three ways and is typed the same way: a Delvehold Hold's
ratified policy (mandates, reserves, rationing) as a demand profile on its
markets; a Ghostlight population's needs as pressure and dependency deltas
through the outbound batch; a player's or a workshop's standing orders. All
three are demand rows on a market at a revision. None is privileged.
**Quotes.** A proposed trade is quoted against a named revision and honoured
only against that revision; a stale quote is refused, never repriced
silently. This is the same idempotency and staleness rule the Ghostlight
consumer contract uses, and it is what makes a price replayable: replaying
the committed lot and demand events reproduces every price ever quoted.
## The two directions
**Ghostlight to prices.** The outbound consumer batch (next on Ghostlight's
map) is designed as this daemon's signal surface: custody deltas by holder,
resource, and place; pressure and dependency deltas by subject; route open,
close, and cost changes; witnessed events by place subtree. The daemon lowers
custody deltas onto its lots for Ghostlight-owned holders, pressure and
dependency deltas onto demand profiles, route changes onto its route-cost
table, and events onto shocks. A collapsed grate above a basin town is a
route closure and a witnessed event; its price consequence is derived, not
authored.
**Prices to Ghostlight.** The daemon writes back through consumer patches: a
price at a market is a fact witnessed at the market place, landing as
knowledge on everyone standing there and reaching a Persona as prose; a
shortage is a pressure on the holders who depend on the class; a realized
trade is a custody change on the Ghostlight subject, with the daemon's
receipt as evidence. A Ghostlight person's intent to buy exits as an
attributed proposal, the daemon quotes and executes it against its revision,
and the realized custody returns through the receipt. One tick of latency
between wanting and holding is the design, and the Projector renders a
pending intent as "asked, not yet answered".
**Players to prices.** A game host submits lot events as typed CultMesh
commands with receipts: extract, run recipe, transfer, consume, sell, buy.
The daemon validates against the recipe catalog and the lot ledger, commits
atomically, and the market maker's next quote reflects the new reserve. A
player who floods a market with aluminium spreaders lowers their price and
raises copper's relative standing; a workshop that buys every lot of a scarce
conductor raises its price in every market a route reaches.
## Authority map
- Owner: the daemon owns dimensions, materials, lots, recipes, products,
markets, demand rows, and prices for every world it serves. One process,
one CultCache store per world, one revision counter per world.
- Inputs: authored catalogs (dimensions, materials, recipes, facilities) per
world; lot and trade commands from game hosts; the Ghostlight outbound
batch; policy demand documents from Delvehold's civic organs.
- Outputs: price and reserve projections per market as CultMesh state
lowered to Eve; quotes and receipts; consumer patches to Ghostlight;
provenance and property queries for any lot.
- Derived state: every price, every product property vector, every rarity
projection, every "quality". None is stored as truth; all are recomputed
from lots, recipes, demand, and routes at a revision.
- Forbidden writers: a game host writes no price; Ghostlight writes no lot;
the daemon writes no Ghostlight component except through a consumer patch
the kernel validates; no client, projection, cache, or Eve surface commits
anything; no material carries a scalar quality; no recipe names a material
where a role will do.
- Shared paths: player trades, Ghostlight-subject trades, institutional
procurement, and replay all pass through the one lot ledger and the one
quote function. There is no second price path for NPCs.
- Deletion line: Aetheria's `ItemData.Price`, `CraftedItemInstance.Quality`,
and `ItemManager.GetPrice` become projections read from the daemon or are
cut; the commented-out `Ingredients` and `Blueprint` fields are not
restored, because provenance lives on the lot.
## Why a daemon
An organ earns a process only when independent lifecycle, privilege,
resource, or failure isolation protects a named invariant. The invariants
here are lot conservation and price determinism across two game hosts that
start, stop, and fail independently of each other and of Ghostlight's world
ticks. A price computed inside either game host would fork the ledger the
moment the other host wrote; a price computed inside Ghostlight would put
units into a kernel built to have none. The daemon is the one place both
hosts and Ghostlight can agree a lot moved.
## Substrate
CultCache `.cc` state, one store per world; CultNet typed documents for
commands, receipts, and projections; CultMesh for discovery and the Eve
composition graph (price boards, reserve gauges, provenance views, TUI
tables). Rust, matching Odin-class doctrine, with the market maker and the
property-derivation functions as pure, testable crates and the daemon as a
thin lifecycle shell. Clocks, transports, the Ghostlight port, and the game
host port are traits so a partial pipeline smoke can price a market from a
fixture ledger without the whole daemon.
## Verification
Unit: lot conservation under every command; provenance acyclic; a recipe
refuses a material that fails its role; output properties are a pure
function of input properties and process; the quote function is
deterministic and its loss is bounded; a stale quote is refused.
Pipeline: a fixture world with copper, aluminium, and gold conductors, one
spreader recipe with an optional vapour-chamber role, two markets on one
route; flooding one market moves both prices in the direction the route cost
predicts; closing the route decouples them.
End to end: a Ghostlight world with a market mirror; a witnessed route
closure in Ghostlight arrives as a shock and moves a price; the price arrives
in Ghostlight as a fact witnessed at the market; a person's buy intent exits,
is executed, and returns as custody with a receipt; replay of the daemon's
journal reproduces every quote.
## Decisions the operator owns
1. The daemon's name and repository.
2. Whether Delvehold's civic economy (recipes, facilities, orders, policy)
migrates into the daemon or stays Delvehold-owned with the daemon as its
market and price authority only. The model above works either way; the
authority map assumes the daemon owns lots and recipes for both games.
3. The market maker: logarithmic scoring rule versus constant-function curve.
Recommend the scoring rule for its bounded loss and single liquidity
parameter per market.
4. Whether process roles (facility, tool, operator) are dimensions like
materials (recommended) or a separate quality scalar (the thing the breach
took, and not worth restoring).

View file

@ -386,7 +386,10 @@ current_status:
commit 855727f, run 12). Next, in the
operator's order:
(b) the outbound consumer response batch with a non-loopback CultMesh
lease; (c) the deployment gate (world-v3, Idunn/Odin as recorded in the
lease, shaped as the economy daemon's signal surface (custody, pressure
and dependency, route, event deltas; spec docs/architecture/
gamecult-economy-daemon.md, written 2026-09-11, four operator decisions
open); (c) the deployment gate (world-v3, Idunn/Odin as recorded in the
handoff); (d) decision on Eve world.run_tick authority and the Eve
owner's fourth command-result state for an overtaken turn. Constraints:
the operator's Claude subscription, inherited by the sidecar from the