# V7 — Systems Deep Dive

> The `apps/v7/` area: the nine deployable services and tools of the V7 "Mawu"
> UGC-realm platform — a server-authoritative creator-world runtime, its
> meshing/persistence/gateway substrate, a malware-and-child-safety scanner, and
> the marketplace and governance services that sit on top.

## What this area is

`apps/v7/` is one Nx-tracked app cluster: nine `application`-type projects, all
tagged `scope:v7`, that together implement the backend of a hosted
user-generated "realm" platform (the V7 / Mawu universe). It is a polyglot area
by design. Seven of the nine are Rust crates that live in a single Cargo
workspace (`apps/v7/Cargo.toml`, `resolver = "2"`, members listed there) and
form the latency-sensitive game substrate; the other two are TypeScript services
(`@v7/abundantia-market-service`, `@v7/eunomia-governance-service`) that own the
business-logic surfaces — marketplace and governance — where rich domain schemas
matter more than per-tick performance. This split follows the repo's stack rule:
Rust for the realm/network/runtime kernels, TypeScript for orchestration and
business services.

Every service shares one health/identity convention. The Rust crates each
`#[path = "../../service_contract.rs"]` in the shared
`apps/v7/service_contract.rs` module, which defines a `ServiceDescriptor` (name,
owner, port, purpose, capabilities) plus a minimal `std::net::TcpListener` HTTP
server (`run_health_server`, `render_health_json`) and a worktree-aware
port-override scheme (`V7_<NAME>_PORT` / `V7_PORT_OFFSET`). The two TypeScript
services mirror the same shape with a `V7ServiceDescriptor` / `V7HealthDocument`
pair and a `createHealthDocument` / `renderHealthJson` exported from their
`service.ts`, served over `node:http` in `main.ts`. The result is a uniform
`/health` contract across both languages, and a stable per-service port map:
Moremi 47201, Danu 47202, Nephthys 47203, Mawu 47204, Sekhmet 47205, Hera 47206
(Rust), Abundantia 47301, Eunomia 47302 (TypeScript).

The services are layered. `v7-moremi-realm-server` is the authoritative realm
runtime and the densest crate in the area; it composes `v7-danu-mesh-cluster`
(authority meshing) and the `libs/v7/*` crates (`v7-nana` character/economy,
`v7-realm-protocol` wire protocol, `v7-substrate-bridge` identity firewall). The
gateway (`v7-mawu-gateway`) fronts it for attested clients,
`v7-nephthys-replica-service` persists its event-sourced state,
`v7-sekhmet-scanner` gates the content that flows through it, and
`v7-hera-social-service` carries the cross-realm social graph.
`@v7/abundantia-market-service` and `@v7/eunomia-governance-service` are the
creator-economy and self-governance layers above the runtime, and
`v7-dev-hygiene` is the local-dev tooling that allocates per-worktree ports and
emits Agones manifests so several of these services can run side by side.

## How it fits the wider system

These nine projects are the V7 server tier. The Rust crates depend "downward"
into `libs/v7/*` (realm protocol, substrate bridge, nana) rather than on each
other, except the deliberate `moremi → danu` edge for authority handoff; the two
TypeScript services are self-contained domain services whose `service.ts`
carries the full implementation and whose `main.ts` is only the HTTP shell.
Cross-service coupling is expressed through shared schema-version constants
(e.g. the `v7.moremi.*`, `v7.mawu.*`, `v7.sekhmet.*`, `v7.abundantia.*`,
`v7.eunomia.*` namespaced strings) and named integration points — Sekhmet scan
reports gate Abundantia catalog publication and Eunomia's Maya "Verified" realm
gate; Nephthys is the handoff ledger Danu writes to; Mawu is the sole client
ingress in front of Moremi. Boundaries to other Oshun versions are explicit:
Mawu bridges V6 transport, and the substrate bridge projects V6 Ori identity.
Walk the dependency edges on each node below for the exact wiring.

## Entity reference

### v7-moremi-realm-server

The server-authoritative realm runtime and the core of the area
(`apps/v7/moremi-realm-server/src/lib.rs`, ~14.9k lines — by far the largest
crate here; `main.rs` is just `moremi_realm_server::run_service()`). Its
`DESCRIPTOR` (owner "Moremi", port 47201) advertises a fixed-timestep
deterministic sim with a dual-tick loop (`MOREMI_FIXED_TIMESTEP_HZ = 30`,
`MOREMI_COMBAT_TICK_HZ = 60`), a WASM-sandboxed resource lifecycle ("Ixchel")
that runs creator gameplay logic through real `wasmtime` component-model
instances under hard fuel/memory/table limits
(`MOREMI_IXCHEL_DETERMINISTIC_FUEL_PER_TICK`,
`MOREMI_IXCHEL_MEMORY_LIMIT_BYTES`), golden-replay CI gating, and a content
"forge" resolver built on `pubgrub` + `semver` version resolution and `sha2`
content hashing. It composes `danu-mesh-cluster` for authority handoff and the
`libs/v7` crates `v7-nana` (character/economy/civic records),
`v7-realm-protocol` (event-tamper eval), and `v7-substrate-bridge` (identity
firewall, trust-boundary secret isolation, Ori projection). Fully implemented
Rust, not a scaffold.

### v7-danu-mesh-cluster

The realm-authority meshing control plane for dense regions
(`apps/v7/danu-mesh-cluster/src/lib.rs`, ~3.5k lines; owner "Danu", port 47202,
no external crate dependencies — pure `std`). It implements two-phase authority
handoff with a Nephthys-backed ledger and mid-handoff node-death recovery, grid
area-of-interest culling with a bounded client working set (`DANU_AOI_*`
constants), density-triggered dynamic split/merge meshing, a time-dilation
overload valve, and Agones fleet/allocation modelling (`DanuAgonesScheduling`,
`DanuAgonesGameServerState`, buffer autoscaler). The capability list and the
named eval constants (`DANU_HANDOFF_EVAL_ENTITY_COUNT`,
`DANU_OVERLOAD_EVAL_TICKS`, …) show these are concrete simulated evaluations
rather than placeholders. Moremi depends on this crate by path. Fully
implemented.

### v7-nephthys-replica-service

Event-sourced persistence and replication for realm state
(`apps/v7/nephthys-replica-service/src/lib.rs`, ~3.1k lines; owner "Nephthys",
port 47203, pure `std`). It models aggregates by `NephthysAggregateKind` (Realm
/ Character) and `NephthysAggregateKey`, with snapshot checkpoints at a fixed
interval (`NEPHTHYS_CHECKPOINT_INTERVAL = 3`), single-writer replication,
ledger-diff rehydration, an authority-lease broker, read-only replica views, and
byte-verified restart — the capabilities the descriptor lists and that the
schema-version constants (`NEPHTHYS_STATE_STORE_SCHEMA_VERSION`,
`…SINGLE_WRITER…`, `…PERSISTENCE_API…`) key. This is the durable state tier
Danu's handoff and Moremi's runtime write through. Fully implemented Rust.

### v7-mawu-gateway

Attested client ingress and the V6 transport bridge in front of the realm tier
(`apps/v7/mawu-gateway/src/lib.rs`, ~3.4k lines; owner "Mawu", port 47204; deps
`hmac`, `sha2`, plus the `v7-realm-protocol` and `v7-substrate-bridge` libs). It
implements GSP "bring-your-own-compute" creator registration that is restricted
to sandboxed realm logic only — `MAWU_GSP_FORBIDDEN_CREATOR_HOSTED_CAPABILITIES`
hard-bans platform identity/economy/safety/payout, native host process, host
networking, and direct client ingress via the `MawuGspRuntimeCapability` enum —
plus DDoS scrubbing/rate-limiting, a platform voice-safety tap, HMAC-signed
client attestation join-gating (tampered/unsigned/operator-patched clients
denied), and streamer-mode privacy redaction with an anti-stream-sniping join
delay. Reuses the realm wire-protocol conformance and web-view-escape evals from
the substrate libs. Fully implemented.

### v7-sekhmet-scanner

The malware and supply-chain scanner, and the platform's child-safety gate
(`apps/v7/sekhmet-scanner/src/lib.rs`, ~6.0k lines; owner "Sekhmet", port 47205;
deps `hmac`, `sha2`). It produces a `ScanReport` with a three-state
`ScanVerdict` (Clean / NeedsReview / Blocked) from static-signature, heuristic,
and dynamic WASM-capability findings, runs a malware-corpus detection-rate eval,
and enforces a clean-scan distribution gate with content-addressed manifests and
signed lock-file pinning (republish step-up "Fractureiser" defense). Beyond
malware it implements a large trust-and-safety surface: CSAM perceptual-hash /
PDQ-NCMEC matching, NCII 48h-takedown SLA (`NCII_TAKEDOWN_SLA_MS`), facial age
estimation with immediate biometric deletion
(`AGE_ASSURANCE_BIOMETRIC_DELETION_SLA_MS`), minor-protection defaults, a
Sentinel longitudinal child-endangerment detector, and a three-layer moderation
pipeline with DSA appeal paths and threshold constants
(`SEKHMET_ML_PRESCREEN_*`, `SEKHMET_KUANYIN_REMOVE_THRESHOLD…`). Its clean
verdicts gate Abundantia publication and Eunomia's Verified-realm decision.
Fully implemented.

### v7-hera-social-service

The crew-graph, presence, and reputation substrate
(`apps/v7/hera-social-service/src/lib.rs`, ~1.1k lines; owner "Hera", port
47206, pure `std`). It models `PlatformBan` and `RealmJoinAttempt` with
active-window logic and a 5-second ban-propagation SLA
(`V7_BAN_PROPAGATION_SLA_MS`), device-attestation ban-evasion evaluation, crew /
guild / org role-gated permissions, an Aje-backed group treasury with a
shared-asset audit ledger, cross-realm group reputation, and Ori-passport group
presence with an Aye V2 group-roster bridge. The eval schema-version constants
(`V7_BAN_EVASION_EVAL_SCHEMA_VERSION`, `V7_HERA_GROUPS_EVAL_SCHEMA_VERSION`,
`V7_HERA_CROSS_VERSION_GROUP_PRESENCE_SCHEMA_VERSION`) anchor its evaluation
surfaces. Fully implemented Rust, smaller in scope than the runtime crates but
real.

### @v7/abundantia-market-service

The marketplace and creator-economy service (TypeScript; logic in
`apps/v7/abundantia-market-service/src/service.ts`, ~4.5k lines, with `main.ts`
serving `/health` over `node:http`; owner "Abundantia", port 47301). It is a
dense domain implementation — content-addressed catalog publication with a
SHA-256 content hasher (`computeAbundantiaContentHash`) and CDN object builder,
cross-platform install sync and one-click atomic collection installs gated on
Sekhmet-cleared fetch, a publishing lifecycle with semver linting and pinned-
version retention, and a full creator-payout engine: an engagement pool,
direct-sale/subscription rails, dependency-revenue chains, Aje settlement,
compliance hold gates, a currency firewall that blocks real-money/play-currency
leakage, retention-weighted payout eligibility, and a fraud-graph eval that
flags self-dealing and one-directional RMT flows. Schema versions are namespaced
`v7.abundantia.*` and the `abundantiaMarketServiceDescriptor` carries ~50
capabilities. Fully implemented; many helper functions referenced here continue
past the read window but the public API and its delegates are concrete domain
logic, not CRUD.

### @v7/eunomia-governance-service

The realm-governance and self-authoring-content service (TypeScript;
`apps/v7/eunomia-governance-service/src/service.ts`, ~1.6k lines; `main.ts`
serves `/health`; owner "Eunomia", port 47302). It implements five-tier
sovereign rule spaces (platform/game/realm/server/guild) with parent-override
consent and a safety-floor evaluator that can never be overridden
(`EunomiaSafetyFloorPolicy` covers minor-protection, CSAM-blocking, real-money
firewall, …), a proposal lifecycle state machine (draft → deliberation → vote →
execution → appeal), six plural-voting models with real per-model weight
formulas (`pluralVotingBallotWeight`: token, reputation,
`sqrt(quadratic_credits)`, conviction stake×age, delegated, capped
time-weighted), and Themis appeal routing. It also owns the "Maya"
creator-variant system: fork publication with attribution/revenue-link chains,
canonical-variant voting, and a **Maya Crucible** economy verifier that actually
simulates baseline-worker vs exploit-seeker agents tick-by-tick
(`simulateCrucibleAgent`, `detectCrucibleFindings`) to block excessive-mint /
runaway-growth / infinite-currency-cycle realms before the Verified gate. Fully
implemented; deterministic simulation, not stubbed.

### v7-dev-hygiene

The local-development tooling crate (`apps/v7/dev-hygiene/src/lib.rs`, 257 lines
incl. tests; tag `layer:tooling`; the only non-`layer:service` project here). It
turns a worktree path into a deterministic, collision-free port plan:
`derive_worktree_slot` hashes the path into one of `V7_WORKTREE_SLOT_COUNT = 64`
slots, each slot reserving a `V7_WORKTREE_PORT_BLOCK_SIZE = 256` port block, and
`build_worktree_port_plan_for_slot` allocates the Moremi-realm and Mawu-gateway
dev ports from that offset with `validate_unique_ports` /
`validate_cross_worktree_ports` guards. It renders shell `export` lines
(`render_env_exports`) and a complete resource-bounded Agones local Fleet +
FleetAutoscaler manifest (`render_agones_local_fleet_manifest`, with
`V7_DEV_REALM_MEMORY_LIMIT_MIB`/ `…GATEWAY…` limits), and ships four unit tests
asserting concrete derived ports and namespaces. `main.rs` prints the env
exports and manifest for the current directory. Small but fully real, directly
enacting the repo's unique-ports-per- worktree hygiene rule.
