โˆ 
๐ŸŒธ WateringHole Zola/Hugo (Live Rust + petalTongue)
Engine:markdown ยท petalTongue:true ยท loamSpine:true ยท coralReef:true

Composition Contract โ€” projectNUCLEUS

Composition Contract โ€” projectNUCLEUSCNS/PNS Sovereign Index: 3.9 ratio1.0-1.2-1.0-0.8-0.6-0.4-0.2-0.00.20.40.60.81.01.2-0.50.00.51.01.52.02.5CNS/PNS Sovereign Index: 3.9 ratioLiving Document Structure-0.20.00.20.40.60.81.01.21.41.61.82.02.2-1000100200300400500600700800Living Document Structure

Composition Contract โ€” projectNUCLEUS

Generation: gen4 โ€” composition and deployment

Upstream: primalSpring DESKTOP_SESSION_MODEL.md, MIXED_COMPOSITION_PATTERNS.md

Scope: How deploy graphs compose, how applications layer over the substrate

---

Principle

The deploy graph is the source of truth for what a composition needs.

Graphs declare capabilities, not implementations. The substrate

resolves providers at runtime. Applications are graphs that attach to an

already-running substrate โ€” they never re-declare NUCLEUS primals.

Graph Structure

Every deploy graph follows the DeployGraph schema from primalSpring:

[graph]
name = \"composition_name\"
version = \"2.0.0\"
coordination = \"sequential\"      # or \"parallel\"
bonding_policy = \"btsp_required\" # graph-level BTSP enforcement

[graph.metadata]
security_model = \"btsp_enforced\"
transport = \"uds_preferred\"      # uds_only | uds_preferred | tcp_only
composition_model = \"nucleated\"  # nucleated | cellular | pure
fragments = [\"tower_atomic\", \"node_atomic\"]

[graph.bonding_policy]
tower_internal = \"covalent\"
tower_to_nucleus = \"metallic\"
encryption_tiers.tower = \"full\"
encryption_tiers.nucleus = \"hmac_plain\"

[[graph.nodes]]
name = \"primal_name\"
binary = \"primal_binary\"
order = 1
required = true
depends_on = [\"other_primal\"]
health_method = \"health.liveness\"
by_capability = \"domain\"           # capability-first discovery
security_model = \"btsp\"
tcp_fallback_port = 9100           # Tier 5 discovery
capabilities = [\"domain.method1\", \"domain.method2\"]

Node Rules

Required Fields

Every primal-spawn node must have:

  • by_capability โ€” the capability domain this primal provides
  • health_method โ€” must be \"health.liveness\" (Wire Standard L3)
  • security_model โ€” \"btsp\" for all domain primals (Phase 59)
  • tcp_fallback_port โ€” canonical Tier 5 port from the port table

Operation Nodes

Nodes that perform RPC operations (mesh init, NAT traversal, health checks)

rather than spawning primals use the [graph.nodes.operation] sub-table

pattern. These are exempt from by_capability requirements in guidestone

validation.

Capability-Based vs Identity-Based

Prefer by_capability over name for provider resolution:

# Good: portable across gates
by_capability = \"tensor\"

# Acceptable: sequencing dependency (topological ordering)
depends_on = [\"beardog\"]

# Avoid: identity-based provider hardcoding
# (use only when multi-family graphs need disambiguation)
name = \"barracuda\"

Substrate vs Application

The substrate is the always-on NUCLEUS โ€” primals running as shared

infrastructure. Applications are deploy graphs that consume the substrate

without redeclaring its primals.

Substrate Graphs

Declare [[graph.nodes]] for each primal. Used by deploy.sh and

biomeOS to bring up the capability plane.

Application Graphs

Declare only application-specific nodes. Reference substrate capabilities

via by_capability. Add [graph.metadata.application] to mark as an app:

[graph]
name = \"my_app\"
coordination = \"sequential\"

[graph.metadata]
application = true   # this is an app, not substrate
substrate = \"nucleus_complete\"

[[graph.nodes]]
name = \"app_logic\"
by_capability = \"compute\"
# ... app-specific dispatch

Fragment Composition

Fragments are reusable building blocks with [fragment] instead of

[graph]. They declare includes for nesting:

FragmentParticleIncludes
tower_atomicElectronโ€”
node_atomicProtontower_atomic
nest_atomicNeutrontower_atomic, provenance_trio
nucleusFull atomtower_atomic, node_atomic, nest_atomic

Graphs reference fragments via [graph.metadata] fragments = [...].

primalSpring's resolve_fragments merges fragment nodes into the graph

when resolve = true.

Graph Merge

merge_graphs(base, overlay) composes a base graph with an overlay.

Use for Nest Atomic + extension patterns (e.g., adding compute to a

storage gate).

Discovery โ€” 5-Tier Escalation

Compositions use CompositionContext::discover() with five tiers:

TierMechanismTransportWhen
1Songbird ipc.resolveAnyFull NUCLEUS, cross-gate
2biomeOS capability.discoverUDSLocal orchestration
3UDS filesystem conventionUDSLocal, no orchestrator
4Socket registry / manifestsUDS/TCPSelf-registered
5TCP probing on well-known portsTCPContainers, no UDS

Graph transport metadata drives which tiers are attempted:

  • uds_only โ†’ tiers 1-4
  • uds_preferred โ†’ tiers 1-5 (TCP as fallback)
  • tcp_only โ†’ tier 5 only

Validation

Structural (guidestone)

primalspring validate --graph checks:

  • Graph parses as valid TOML
  • Nodes with security_model = \"btsp\" have bonding_policy at graph level
  • UDS transport graphs have by_capability on primal nodes
  • Fragment references resolve
  • Checksums match (source integrity)

Deployment Readiness

validate_deployment_readiness() adds runtime checks:

  • Binaries discoverable in plasmidBin
  • Required env vars set
  • Bonding policy consistency

References

  • gen3: ECOSYSTEM_ARCHITECTURE.md ยง3 (atomics), ยง4 (bonding)
  • gen4: architecture/COMPOSITION_PATTERNS.md (PrimalBridge, degradation)
  • primalSpring: specs/DESKTOP_SESSION_MODEL.md (app lifecycle)
  • primalSpring: specs/MIXED_COMPOSITION_PATTERNS.md (L0-L3 validation)
  • primalSpring: deploy/mod.rs (DeployGraph, GraphNode, merge_graphs)