Record pass 10 and close step 6 of the plan

The consumer-api doc is the live contract for the landed ingress; the
ontology's Current mechanism runs through pass 10 and its follow-ups;
the mvp doc names the live authority answer; the plan's step 6 is
complete with the outbound consumer response as the next seam; the map
and handoff carry the series-complete state, the world-v3 generation,
and the decisions the operator owns; one evidence record distils the
ten passes.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-05 04:31:40 +02:00
commit 842b5af4ee
10 changed files with 336 additions and 232 deletions

View file

@ -78,10 +78,15 @@ The only mutation input is a `CommandEnvelope` containing:
- one closed command body;
- exact evidence references where the command depends on source material.
The caller supplies identity evidence, not an authority verdict. The kernel
derives a `MutationAuthorityEnvelope` from canonical membership, lifecycle,
subject authority, external-owner grants, and the command kind. Callers cannot
grant themselves scope by serializing a persuasive envelope.
The caller supplies identity evidence, not an authority verdict. For a patch
command the kernel derives the caller's authority itself:
`require_patch_author` reads the caller and committed state to decide who may
submit `AdmitPatch` and what ground it holds (the world owner unconfined, an
elaborator confined to a jurisdiction, or a consumer confined to the subjects
it controls), and `confine_to_ground` checks every declaration and operation
in the candidate patch against that ground before it is admitted. Callers
cannot grant themselves scope by serializing a persuasive envelope; the
kernel derives it from state it already committed.
Interpreters and operational agents submit the same typed commands through
narrower schemas. Narrative Personas never see those schemas or tools. No
@ -189,8 +194,13 @@ A subject is a stable identity with a declared kind:
- person;
- institution;
- autonomous population;
- external subject mirror.
- autonomous population.
An externally controlled mirror is not a fourth kind. It is an ordinary
subject of one of these three whose `ControllerAssignment` is
`ExternallyControlled { consumer }`: no controller ID, no controller mode, no
decision opportunity, and no affordance, mutable only through its own
consumer and the world owner.
Demographic descriptors and statistical aggregates are not automatically
subjects. A canonical action owner is derived structurally from an active
@ -250,7 +260,8 @@ The reducer validates only structural promises:
- knowledge additions cite an existing accessible fact or a newly admitted
evidenced fact;
- population slices are disjoint beneath their declared parent;
- external-owned components can change only through their admitted owner;
- an externally controlled subject's components can change only through its
own consumer, confined by `PatchGround::Consumer`;
- a batch either reduces completely or not at all.
Interestingness, novelty, ideological distribution, prose style, and counts do

View file

@ -1,123 +1,189 @@
# Ghostlight World Consumer API
Status: drift. Names `CampaignRegistry`, `WorldSeed`, and `publish_session_zero`,
which do not exist in the sealed kernel. Pending rewrite against
`docs/architecture/ghostlight-world-ontology.md`; read for consumer-boundary
intent only. Pass 10 owns the rewrite and carries four debts the ingress must
settle before a consumer patch can reach `AdmitPatch`: caller authority (which
`CallerId` a consumer lowers to), decode-time size bounds on the patch,
phase (Draft seed versus Active elaboration), and boundary answering (an
Active consumer patch that declares must answer a derived boundary like any
other author). The transport is one typed inbound document over a second loopback route
beside `POST /cultnet/snapshot`, carrying the patch as a nested
canonical-msgpack byte frame bounded before any item deserializes; it is
not a fifth `execute_world` operation literal and not an organ of the
outbound mesh publisher.
Status: this describes the landed pass-10 consumer ingress — a world's third
patch author, reaching `AdmitPatch` through one loopback-bound typed document.
## Objective
Let a consumer supply and observe one persistent Ghostlight world without
becoming part of Ghostlight's runtime. Session Zero compilation and external
world authoring are two producers of the same admitted seed. Delvehold is the
first demanding consumer; no Delvehold identifier, schema, or policy is core
authority.
Let an external consumer author and observe the exact subjects a Ghostlight
world has admitted as its mirrors, without becoming part of Ghostlight's
runtime and without the world learning the consumer's vocabulary. A
consumer-authored seed and a compiled seed are the same `AdmitPatch`; there is
no separate seed type, registry, or publication handoff. Delvehold is the
first consumer; no Delvehold identifier, schema, or policy is core authority
(`docs/architecture/delvehold-forced-ontology-integration.md` names the
profile-side binding).
## Authority map
- **Seed admission owner:** `CampaignRegistry` validates one `WorldSeed` and
commits it with one `WorldSeedAdmission` and receipt. Producer-specific
documents may join that transaction but cannot create another publication
path.
- **World owner:** `WorldKernel` owns every admitted campaign revision and all
simulation state.
- **External-subject owner:** `ExternalSubjectAuthority` binds one exact
consumer owner to one exact subject. The subject remains a visible target but
receives no Ghostlight Persona turn and cannot act through a strategic cell.
- **Consumer owner:** the consumer decides whether a Ghostlight proposal changes
its own domain. Its acknowledgement records admission or refusal but cannot
rewrite Ghostlight state.
- **Inputs:** a consumer-neutral seed, producer and payload digests, exact
authority descriptors, normalized external-institution snapshots, and
proposal acknowledgements.
- **Outputs:** seed-admission receipts, revisioned snapshot receipts, attributed
external proposals, and immutable proposal acknowledgements.
- **Derived state:** Session Zero publication documents, consumer bindings,
network messages, schema catalogs, and UI projections own no canonical world
state.
- **Forbidden writers:** seed producers, adapters, models, arenas, transport,
and acknowledgements cannot write a campaign row directly.
- **Shared paths:** compiler and consumer seeds lower to one registry/store
transaction. Strategic waves continue through the existing WorldKernel
command and atomic commit path.
- **Cut line:** `publish_session_zero` no longer owns campaign creation. It is a
producer-specific wrapper around generic seed admission. Ghostlight never
switches on `greathold` or a `delvehold.*` schema.
- **Admission owner:** `require_patch_author` (`world/mod.rs`) decides which
caller may submit `AdmitPatch` and returns that caller's `PatchGround`;
`confine_to_ground` decides what a confined ground may write. Both run in
`reduce`'s `AdmitPatch` arm and again in `apply_effect`'s `PatchAdmitted`
arm — there is no second confinement function and no way for a patch to
commit without being re-decided.
- **Consumer ground:** `PatchGround::Consumer(ConsumerId)` is derived, never
carried. The set of subjects a consumer may write is
`{ s | controller_assignments[s] == ExternallyControlled { consumer } }`,
read from committed state at decision time. A consumer cannot name its own
scope on the wire, and revoking a binding in a later commit shrinks its
authority with no ingress change.
- **Caller minting:** `WorldMailbox::submit_consumer` (`world/mailbox.rs`) is
the only constructor of `AuthenticatedCaller::verified_system(SystemCapability::Consumer { consumer })`.
- **Ingress owner:** `world/consumer.rs` owns decoding a document, bounding
it, authenticating the consumer, one port call, and one receipt
projection. It owns no world truth, holds no opinion about a patch's
content, and does not pre-validate — a second reducer here could disagree
with the kernel's, so structure is decided once, by `resolve_patch`.
- **Port:** `ConsumerPort` (`world/mailbox.rs`) has one method,
`submit_consumer`. It cannot read the world: it does not select an answer,
does not pre-validate, and returns a receipt rather than state.
## Typed flow
```text
producer seed
-> WorldSeed + WorldSeedAdmission
-> CampaignRegistry validation
-> one empty-store CultCache transaction
-> WorldKernel runtime
consumer-owned state
-> consumer adapter
-> ExternalSubjectSnapshot (institution or Gestalt projection)
-> authority, digest, revision, and idempotency validation
-> WorldKernel atomic campaign commit
-> ExternalSnapshotReceipt
strategic action directed at an external subject
-> WorldKernel strategic-wave validation
-> attributed ExternalWorldProposal persisted with the wave
-> consumer reads proposal and decides locally
-> ExternalProposalReceipt records accept, partial accept, or reject
-> any realized consumer change returns later as a fresh snapshot
ConsumerPatchDocument (canonical MessagePack)
-> ConsumerRegistry: name -> ConsumerId, secret verified against a
stored SHA-256 digest in constant time
-> patch::decode_patch, bounded by MAX_PATCH_BYTES / _DECLARATIONS /
_OPERATIONS / _EVIDENCE
-> WorldMailbox::submit_consumer(world_id, expected_revision, command_id,
consumer, answers, patch)
-> reduce / apply_effect: require_patch_author, the answer rule,
confine_to_ground
-> ConsumerReceiptDocument: one atomic verdict — a commit reference or
the complete mismatch set
```
`command_id` and `world_id` on the receipt are `Option`: a frame that fails to
decode or names an unregistered consumer never derives a command key or reads
a world, so the receipt has none to report. The outbound half of this
contract — a consumer reading its own projection, or receiving an
attributed proposal — is not part of this pass; see "Not in this pass" below.
## Transport
The API uses typed CultNet operation requests over Ghostlight's existing RUDP
server. Seed admission, external snapshots, proposal reads, and proposal
acknowledgements use MessagePack payloads and typed receipts. The service is
loopback-only until CultMesh authority leases and secure remote admission are
implemented. HTTP and Eve remain player/product projections, not the world
consumer boundary.
`POST /cultnet/world-patch`, declared beside `/cultnet/snapshot` in
`api_router` (`runtime.rs`). The handler gates loopback and content type
(`application/msgpack`) exactly as the snapshot route does, then hands the
body to `world::consumer::admit_document`; everything past those two gates is
`world/consumer.rs`'s to decide. The body limit is
`CONSUMER_BODY_LIMIT = patch::MAX_PATCH_BYTES + CONSUMER_ENVELOPE_SLACK` (an
8 KiB envelope allowance over the 256 KiB patch cap), so the transport guard
cannot become a second opinion about how big a patch may be.
## Invariants
The document and receipt are Ghostlight-owned typed records in canonical
MessagePack, not CultNet control messages, pinned to two schema constants:
- The public seed shape excludes runtime revision, transcript, pending work,
cover state, and other already-authoritative campaign fields.
- The seed digest binds the exact normalized seed. A campaign ID cannot be
republished from another digest.
- An external authority names one existing institution or Gestalt subject and
one owner. Its secret is persisted only as SHA-256.
- External subjects are active graph targets but never simulation-eligible.
- A snapshot replaces only the exact externally owned institution or Gestalt projection.
It cannot create subjects, routes, actors, Gestalts, relations, or private
knowledge.
- Source revisions increase monotonically. Exact idempotent replay returns the
original receipt; conflicting replay changes nothing.
- Outbound proposals remain attributed to an exact Ghostlight subject and exact
target. An arena never becomes the proposer.
- Proposal acknowledgement is not a Ghostlight world mutation. Realized effects
return through a later snapshot.
- Dungeon campaigns keep their player actor, membership, contract, and Session
Zero documents. Their adversarial play path does not depend on a consumer.
```text
CONSUMER_PATCH_SCHEMA = "ghostlight.consumer_patch.v0"
CONSUMER_RECEIPT_SCHEMA = "ghostlight.consumer_receipt.v0"
```
## First acceptance
`ConsumerPatchDocument` carries `schema`, `world_id`, `consumer` (a
configured name, lowered to a `ConsumerId` by the registry and never carried
further), `secret`, `idempotency_key`, `expected_revision`, `answers:
Option<PatchAnswer>`, and `patch: Vec<u8>` — the encoded `WorldPatch` as a
nested canonical-MessagePack byte frame rather than an inline value, so
`MAX_PATCH_BYTES` is checked against the patch itself before any of its items
deserializes. The outer document is decoded first, is tiny, and is bounded by
the route's derived limit.
1. Session Zero and a consumer-authored fixture persist the same generic seed
admission and receipt types.
2. A configured external institution never receives a strategic cell or
Persona action.
3. Wrong owner, wrong secret, stale source revision, digest conflict, and stale
world revision leave campaign state unchanged.
4. A valid snapshot advances the campaign once and returns an idempotent typed
receipt.
5. A strategic action aimed at the external institution emits one attributed
proposal in the same atomic wave commit.
6. Consumer acknowledgement cannot mutate the campaign and can be replayed
idempotently.
`mesh.rs`'s advertisement gains the two schema constants and nothing else:
this door is loopback-bound, so it is not a remotely reachable surface and
advertising it as one would claim availability the binary does not have.
## Idempotency and staleness
`expected_revision` is required; the port submits through
`submit_authenticated`, not the stamped path, because a caller that cannot
name the revision it built against cannot be told its batch is stale. The
idempotency ledger is checked before the revision, so an exact resubmission
still returns the original receipt (`AlreadyApplied`) even after the world has
moved; a stale document is `RevisionMismatch { expected, actual }`, and the
receipt carries the live revision so the consumer knows what to build against
next. `CommandId::derived` computes the command key from `(world, consumer,
idempotency_key)`; the same key with a different body is
`CommandIdConflict`, and nothing commits.
There is no receipt-probe request and no separate mailbox `Request` variant
for it. A consumer's document is byte-identical on retry and its `CommandId`
is derived, so resubmission is the probe and the ledger answers it directly.
## The externally controlled subject
A subject declared `NewController::External { consumer }` receives
`ControllerAssignment::ExternallyControlled { consumer }`. It mints no
controller ID and no controller mode — both accessors return `Option` for it,
and every reader fails closed rather than assuming a default. Concretely:
- it derives no decision opportunity and mints no turn;
- it is excluded from `agency_graph` and so from the cover;
- it is visible in the snapshot as an ordinary subject, related to, targeted,
and counted like any other, with `controller_id: None` and
`controller_mode: None`;
- it may hold no affordance — declaring it with a non-empty affordance grant
set is `Mismatch::ControllerGrantMismatch`, and the pairing is checked both
ways (an ordinary subject with an empty grant set is the same mismatch);
- its components change through exactly two callers: its own consumer, and
the world owner, who is unconfined and always could write it — that is the
owner's standing authority, not a leak in the consumer boundary.
## Confinement
A consumer writes only the subjects bound to it and operations grounded on
those subjects (`confine_to_ground`, the `PatchGround::Consumer` arm):
- a declared subject is admitted only if its controller names the same
consumer; position is unconfined;
- a declared place, a declared route, `Relocate`, `OpenRoute`, `CloseRoute`,
and `AlterCost` are always refused — they carry a place or a route, and a
consumer's ground names no place;
- a `Claimed { by }` fact must name a bound subject; a `Canonical` fact
declaration is refused outright — a consumer's evidence buys an `Admit`
into its own custody and a `Claimed` fact, never a canonization;
- a channel's reach and controller must all be bound subjects;
- every operation's ground subjects must be bound, and its place and route
lists must be empty — `Transfer` therefore requires both endpoints bound,
so a consumer cannot push custody into a Ghostlight subject; `Admit` and
`Consume` work inside its own custody.
In Active phase a consumer patch that declares answers nothing except a
`CausalBoundary::MissingStructure { subject }` derived on one of its own
mirrors — the world noticing that a subject it can see has structure it
cannot account for. Every other Active declaration is refused by the answer
rule plus this confinement, not by a separate phase gate: a consumer cannot
answer a boundary on a foreign subject (not covered), cannot answer a
`Deficit` row (deficits are jurisdictional; a consumer holds no
jurisdiction), and cannot declare without an answer. A component-only batch —
the overwhelming majority of consumer traffic — answers nothing and commits
through the same `require_answer` path as any other author.
## Operator configuration
`ConsumerRegistry` is loaded once at startup from the file named by
`GHOSTLIGHT_CONSUMER_CREDENTIALS`: one `name = <64 hex digits>` line per
consumer (the SHA-256 of that consumer's shared secret), blank lines and `#`
comments ignored. A missing file means no consumers, and every document is
`Unauthenticated`, the fail-closed default that lets this route exist before
an operator configures anything. A file that exists but does not parse is
fatal at startup, so a mistyped credential can never read as "no consumers". The registry holds only digests; the
plaintext secret never enters the process image beyond the hash and never
enters a log, a receipt, or the journal.
## Deployment
The consumer capability's tag is part of the commit digest and the
externally controlled assignment is part of the state shape, so both bump the
schema: state schema `ghostlight.world_state.consumer.v1` (state-schema
generation `world-v3`), commit schema `ghostlight.world_commit.consumer.v1`.
A store written under an earlier schema is refused, not migrated.
## Not in this pass
- The outbound consumer response — a consumer reading its own projection, or
receiving an attributed proposal about a Ghostlight subject acting toward
its mirror. This is the next seam; building it prematurely would grow a
second projection owner ahead of its use.
- A CultMesh authority lease for a non-loopback consumer. Until that exists,
this route is loopback-only and offers a consumer no remote door.

View file

@ -35,9 +35,9 @@ not from a model agreeing that the world is deep.
## Current mechanism
Passes 1 through 9 of the widening are landed (`5e53beb`, `e99af63`,
Passes 1 through 10 of the widening are landed (`5e53beb`, `e99af63`,
`d2805fe`, `0f21a49`, `dbe176d`, `cb6a126`, `1852ddd`, `3ed3868`,
`8aebfb6`). The sealed kernel holds subjects with a label and a
`8aebfb6`, `b4d1943`). The sealed kernel holds subjects with a label and a
kind (`Person | Institution | Population`); a `positions` partition with
`Position`; entities with `container` under containment acyclicity; `Route`
as an `EdgeRecord` variant carrying `AccessKind { Public, Restricted }`, a
@ -172,7 +172,7 @@ head, rotates the remaining subjects through singleton cells by debt, and
packs the rest into grouped cells by connected component of the agency graph
(scheduler-only; reachable from no prompt builder). `Cell`, `Cover`,
`CellId`, `Resolution`, `TickIndex`, and `AgencyGraph` are derived and
disposable; the only durable trace of a tick is the `controller_work.v8` row
disposable; the only durable trace of a tick is the `controller_work.v9` row
(`ControllerWork::Grouped`), custody-separate from world custody. A grouped
cell is one inference over partitioned per-constituent views returning zero
or one attributed proposal per constituent; declines are submitted first and
@ -183,16 +183,44 @@ Cell and constituent command ids are sha256-derived. The runtime's
the bounded concurrency permit pool, the quarantine flag, and the clock,
which advances after the cells so every cell in a tick shares one `now`.
`AdmitPatch` has a third author: `CallerId::System(SystemCapability::Consumer
{ consumer })`, minted only by `WorldMailbox::submit_consumer` after the
consumer ingress (`world/consumer.rs`) has authenticated a document against a
configured secret digest. `require_patch_author` and `confine_to_ground`
widen from jurisdiction-only to `PatchGround { Jurisdiction(JurisdictionKey),
Consumer(ConsumerId) }`; a consumer's ground is derived from
`controller_assignments` at decision time, never carried on the wire, and
confines it to the subjects it controls, with no place, route, or `Canonical`
fact ever inside that ground. A subject declared
`NewController::External { consumer }` receives
`ControllerAssignment::ExternallyControlled { consumer }`: it mints no
controller ID or mode (both accessors are `Option`), derives no opportunity,
is excluded from `agency_graph` and the cover, and may hold no affordance
(`admit_resolved`'s controller-shaped pairing rejects a non-empty grant set as
`Mismatch::ControllerGrantMismatch`). It remains an ordinary subject in the
snapshot, related to and targeted like any other, mutable only through its
own consumer and the always-unconfined world owner. `patch::decode_patch` is
the one decode bound for both the elaboration lane and the consumer lane,
under four caps — `MAX_PATCH_BYTES`, `MAX_PATCH_DECLARATIONS`,
`MAX_PATCH_OPERATIONS`, `MAX_PATCH_EVIDENCE` — and the consumer document
travels over two wire schema constants, `CONSUMER_PATCH_SCHEMA` and
`CONSUMER_RECEIPT_SCHEMA`, both `.v0`. The state and commit schemas bump to
`ghostlight.world_state.consumer.v1` and `ghostlight.world_commit.consumer.v1`
(state-schema generation `world-v3`); a store written under an earlier schema
is refused, not migrated.
Opportunities bind to a `ScopeDigest` over one `scope_components` owner
(controller assignment, grants, delegated grants, own authority, position,
incident routes, own holdings, own dependencies, known fact ids, controlled
channels, own commitments; never `now`, occupancy, forum state, or another
subject's knowledge); a proposal commits at any later revision with unchanged scope and is
rejected with `KernelError::ScopeChanged` otherwise. State schema is
`world_state.elaboration.v1`, commit schema `world_commit.elaboration.v1`,
controller work `controller_work.v8`; earlier stores are refused. Ghostlight owns a conserved narrative ledger;
`ghostlight.world_state.consumer.v1`, commit schema
`ghostlight.world_commit.consumer.v1`, controller work `controller_work.v9`;
earlier stores are refused. Ghostlight owns a conserved narrative ledger;
Delvehold owns the economy (`delvehold-forced-ontology-integration.md`).
Pass 10 adds the consumer ingress.
Step 6 of the plan is complete; the outbound consumer response is the next
seam.
## The failure this vocabulary is designed against
@ -265,12 +293,15 @@ resolver, or reconciler is needed.
Three namespaces, three newtypes, issued only by the reducer.
```text
SubjectId person, institution, population, external mirror — can decide
SubjectId person, institution, population — can decide
EntityId place, resource, fact, channel — cannot decide
EdgeId route, relation, commitment, pressure — connects the above
```
Display names are labels. They never resolve a reference or bind structure.
An externally controlled mirror is an ordinary subject of one of these three
kinds; what is external is its `ControllerAssignment`
(`ExternallyControlled { consumer }`), not a fourth `SubjectKind`.
## Components
@ -373,7 +404,8 @@ The reducer checks only these:
- knowledge additions cite an accessible or newly evidenced fact;
- communication reaches only subjects inside the channel's reach set;
- population slices are disjoint beneath their declared parent;
- externally owned components change only through their admitted owner;
- an externally controlled subject's components change only through its own
consumer, confined by `PatchGround::Consumer`;
- the patch produces at least one canonical change.
Interestingness, novelty, political diversity, name quality, prose quality, and