# spookynetwork/krakenos architecture

> Architecture diagram of the GitHub repository spookynetwork/krakenos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/spookynetwork/krakenos
- Repository: https://github.com/spookynetwork/krakenos

## Overview

Kraken is a modular Rust operating-system kernel for controlling a distributed event DAG under adversarial conditions. Its principal loop ingests telemetry, estimates system risk in the PSC, routes proposed signals and agent requests through control-plane policy, verifies and gates transitions, then executes mutations. Agents and memory provide a parallel cognitive and persistence branch; mesh, proof, and recovery crates support distributed operation. The README documents several integrations whose implementation wiring was not sampled, so those links are shown only where explicitly described.

Main entry points: [`krk-control-plane/src/arbitration.rs`](https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/arbitration.rs) (Policy arbitration), [`krk-sandbox/src/manager.rs`](https://github.com/spookynetwork/krakenos/blob/main/krk-sandbox/src/manager.rs) (Execution envelope), [`krk-agent-swarm/src/lib.rs`](https://github.com/spookynetwork/krakenos/blob/main/krk-agent-swarm/src/lib.rs) (Swarm orchestration), [`krk-memory-plane/src/store.rs`](https://github.com/spookynetwork/krakenos/blob/main/krk-memory-plane/src/store.rs) (Dual-channel store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Control and observability"]
  node_attention["Signal ingestion<br/>[ingestion.rs]"]
  node_observability["Telemetry<br/>[lib.rs]"]
  node_pressure["Collapse pressure<br/>[lib.rs]"]
  node_psc["Phase controller<br/>[lib.rs]"]
  node_control_policy["Policy arbitration<br/>[arbitration.rs]"]
  node_control_authority["Authority<br/>[authority.rs]"]
  node_control_constraints["Constraints<br/>[constraints.rs]"]
  node_control_policy_stack["Policy stack<br/>[policy.rs]"]
  node_control_router["Signal routing<br/>[router.rs]"]
  node_control_scheduler["Scheduling<br/>[scheduler.rs]"]
end

subgraph group_cognition["Agents and memory"]
  node_swarm["Swarm orchestration<br/>[lib.rs]"]
  node_agents["Specialist agents<br/>[agents.rs]"]
  node_coordination["Action coordination<br/>[coordination.rs]"]
  node_memory_store["Dual-channel store<br/>[store.rs]"]
  node_memarch[("Raw capture<br/>[memarch.rs]")]
  node_hermes[("Canonical memory<br/>[hermes.rs]")]
end

subgraph group_execution["Execution and verification"]
  node_sandbox["Execution envelope<br/>[manager.rs]"]
  node_doctrine["Doctrine policy<br/>[bindings.rs]"]
  node_sat["SMT transition checks<br/>[lib.rs]"]
  node_safety["Safe transitions<br/>[lib.rs]"]
  node_kernel["State mutation<br/>[transition.rs]"]
  node_state[("Merkle DAG state<br/>[lib.rs]")]
  node_wasm["WASM executor<br/>[lib.rs]"]
end

subgraph group_distributed["Distributed integrity"]
  node_mesh["Gossip mesh<br/>[lib.rs]"]
  node_algebra["Effect equivalence<br/>[properties.rs]"]
  node_lattice["Semantic lattice<br/>[lib.rs]"]
  node_byzantine["Byzantine recovery<br/>[lib.rs]"]
  node_proof_graph["Proof lineage<br/>[lib.rs]"]
  node_pbft["Consensus quorum<br/>[lib.rs]"]
end

node_operator(("Operator or signals"))
node_z3["Z3 solver"]

node_operator -.->|"provides signals"| node_attention
node_attention -->|"maps signals"| node_observability
node_observability -->|"supplies telemetry"| node_psc
node_pressure -.->|"informs control"| node_psc
node_psc -->|"proposes signals"| node_control_policy
node_swarm -.->|"requests authorization"| node_control_policy
node_control_policy -.->|"evaluates policies"| node_control_policy_stack
node_control_policy -.->|"escalates authority"| node_control_authority
node_control_policy -.->|"checks constraints"| node_control_constraints
node_control_policy -.->|"routes decisions"| node_control_router
node_control_policy -.->|"schedules actions"| node_control_scheduler
node_control_router -.->|"authorizes execution"| node_sandbox
node_sandbox -->|"validates actions"| node_doctrine
node_sandbox -->|"bounds agent actions"| node_agents
node_swarm -->|"ticks agents"| node_agents
node_swarm -.->|"filters actions"| node_coordination
node_agents -.->|"records actions"| node_memory_store
node_memory_store -->|"appends events"| node_memarch
node_memory_store -->|"compresses facts"| node_hermes
node_sandbox -.->|"gates transitions"| node_sat
node_sat -->|"runs SMT queries"| node_z3
node_sat -.->|"verifies transitions"| node_safety
node_safety -.->|"executes transitions"| node_kernel
node_kernel -.->|"mutates state"| node_state
node_kernel -.->|"dispatches execution"| node_wasm
node_mesh -.->|"replicates DAG"| node_state
node_algebra -.->|"supports equivalence"| node_lattice
node_byzantine -.->|"recovers consensus"| node_mesh
node_pbft -.->|"verifies quorum"| node_control_policy
node_proof_graph -.->|"tracks proof lineage"| node_state

click node_attention "https://github.com/spookynetwork/krakenos/blob/main/krk-attention/src/ingestion.rs"
click node_observability "https://github.com/spookynetwork/krakenos/blob/main/krk-obs/src/lib.rs"
click node_pressure "https://github.com/spookynetwork/krakenos/blob/main/krk-pressure/src/lib.rs"
click node_psc "https://github.com/spookynetwork/krakenos/blob/main/krk-psc/src/lib.rs"
click node_control_policy "https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/arbitration.rs"
click node_control_authority "https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/authority.rs"
click node_control_constraints "https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/constraints.rs"
click node_control_policy_stack "https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/policy.rs"
click node_control_router "https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/router.rs"
click node_control_scheduler "https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/scheduler.rs"
click node_swarm "https://github.com/spookynetwork/krakenos/blob/main/krk-agent-swarm/src/lib.rs"
click node_agents "https://github.com/spookynetwork/krakenos/blob/main/krk-agent-swarm/src/agents.rs"
click node_coordination "https://github.com/spookynetwork/krakenos/blob/main/krk-agent-swarm/src/coordination.rs"
click node_memory_store "https://github.com/spookynetwork/krakenos/blob/main/krk-memory-plane/src/store.rs"
click node_memarch "https://github.com/spookynetwork/krakenos/blob/main/krk-memory-plane/src/memarch.rs"
click node_hermes "https://github.com/spookynetwork/krakenos/blob/main/krk-memory-plane/src/hermes.rs"
click node_sandbox "https://github.com/spookynetwork/krakenos/blob/main/krk-sandbox/src/manager.rs"
click node_doctrine "https://github.com/spookynetwork/krakenos/blob/main/krk-doctrine/src/runtime/bindings.rs"
click node_sat "https://github.com/spookynetwork/krakenos/blob/main/krk-sat/src/lib.rs"
click node_safety "https://github.com/spookynetwork/krakenos/blob/main/krk-safety-kernel/src/lib.rs"
click node_kernel "https://github.com/spookynetwork/krakenos/blob/main/krk-kernel/src/transition.rs"
click node_state "https://github.com/spookynetwork/krakenos/blob/main/krk-state/src/lib.rs"
click node_mesh "https://github.com/spookynetwork/krakenos/blob/main/krk-dcmp/src/lib.rs"
click node_algebra "https://github.com/spookynetwork/krakenos/blob/main/krk-algebra/src/properties.rs"
click node_lattice "https://github.com/spookynetwork/krakenos/blob/main/krk-lattice/src/lib.rs"
click node_byzantine "https://github.com/spookynetwork/krakenos/blob/main/krk-byzantine/src/lib.rs"
click node_proof_graph "https://github.com/spookynetwork/krakenos/blob/main/krk-proof-graph/src/lib.rs"
click node_pbft "https://github.com/spookynetwork/krakenos/blob/main/krk-pbft/src/lib.rs"
click node_wasm "https://github.com/spookynetwork/krakenos/blob/main/krk-wasm/src/lib.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_attention,node_observability,node_pressure,node_psc,node_control_policy,node_control_authority,node_control_constraints,node_control_policy_stack,node_control_router,node_control_scheduler toneBlue
class node_swarm,node_agents,node_coordination,node_memory_store,node_memarch,node_hermes toneAmber
class node_sandbox,node_doctrine,node_sat,node_safety,node_kernel,node_state,node_wasm toneMint
class node_mesh,node_algebra,node_lattice,node_byzantine,node_proof_graph,node_pbft toneRose
class node_operator,node_z3 toneIndigo
```

## Components

### Control and observability

- [Signal ingestion](https://github.com/spookynetwork/krakenos/blob/main/krk-attention/src/ingestion.rs): `krk-attention/src/ingestion.rs`
- [Telemetry](https://github.com/spookynetwork/krakenos/blob/main/krk-obs/src/lib.rs): `krk-obs/src/lib.rs`
- [Collapse pressure](https://github.com/spookynetwork/krakenos/blob/main/krk-pressure/src/lib.rs): `krk-pressure/src/lib.rs`
- [Phase controller](https://github.com/spookynetwork/krakenos/blob/main/krk-psc/src/lib.rs): `krk-psc/src/lib.rs`
- [Policy arbitration](https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/arbitration.rs): `krk-control-plane/src/arbitration.rs`
- [Authority](https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/authority.rs): `krk-control-plane/src/authority.rs`
- [Constraints](https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/constraints.rs): `krk-control-plane/src/constraints.rs`
- [Policy stack](https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/policy.rs): `krk-control-plane/src/policy.rs`
- [Signal routing](https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/router.rs): `krk-control-plane/src/router.rs`
- [Scheduling](https://github.com/spookynetwork/krakenos/blob/main/krk-control-plane/src/scheduler.rs): `krk-control-plane/src/scheduler.rs`

### Agents and memory

- [Swarm orchestration](https://github.com/spookynetwork/krakenos/blob/main/krk-agent-swarm/src/lib.rs): `krk-agent-swarm/src/lib.rs`
- [Specialist agents](https://github.com/spookynetwork/krakenos/blob/main/krk-agent-swarm/src/agents.rs): `krk-agent-swarm/src/agents.rs`
- [Action coordination](https://github.com/spookynetwork/krakenos/blob/main/krk-agent-swarm/src/coordination.rs): `krk-agent-swarm/src/coordination.rs`
- [Dual-channel store](https://github.com/spookynetwork/krakenos/blob/main/krk-memory-plane/src/store.rs): `krk-memory-plane/src/store.rs`
- [Raw capture](https://github.com/spookynetwork/krakenos/blob/main/krk-memory-plane/src/memarch.rs): `krk-memory-plane/src/memarch.rs`
- [Canonical memory](https://github.com/spookynetwork/krakenos/blob/main/krk-memory-plane/src/hermes.rs): `krk-memory-plane/src/hermes.rs`

### Execution and verification

- [Execution envelope](https://github.com/spookynetwork/krakenos/blob/main/krk-sandbox/src/manager.rs): `krk-sandbox/src/manager.rs`
- [Doctrine policy](https://github.com/spookynetwork/krakenos/blob/main/krk-doctrine/src/runtime/bindings.rs): `krk-doctrine/src/runtime/bindings.rs`
- [SMT transition checks](https://github.com/spookynetwork/krakenos/blob/main/krk-sat/src/lib.rs): `krk-sat/src/lib.rs`
- [Safe transitions](https://github.com/spookynetwork/krakenos/blob/main/krk-safety-kernel/src/lib.rs): `krk-safety-kernel/src/lib.rs`
- [State mutation](https://github.com/spookynetwork/krakenos/blob/main/krk-kernel/src/transition.rs): `krk-kernel/src/transition.rs`
- [Merkle DAG state](https://github.com/spookynetwork/krakenos/blob/main/krk-state/src/lib.rs): `krk-state/src/lib.rs`
- [WASM executor](https://github.com/spookynetwork/krakenos/blob/main/krk-wasm/src/lib.rs): `krk-wasm/src/lib.rs`

### Distributed integrity

- [Gossip mesh](https://github.com/spookynetwork/krakenos/blob/main/krk-dcmp/src/lib.rs): `krk-dcmp/src/lib.rs`
- [Effect equivalence](https://github.com/spookynetwork/krakenos/blob/main/krk-algebra/src/properties.rs): `krk-algebra/src/properties.rs`
- [Semantic lattice](https://github.com/spookynetwork/krakenos/blob/main/krk-lattice/src/lib.rs): `krk-lattice/src/lib.rs`
- [Byzantine recovery](https://github.com/spookynetwork/krakenos/blob/main/krk-byzantine/src/lib.rs): `krk-byzantine/src/lib.rs`
- [Proof lineage](https://github.com/spookynetwork/krakenos/blob/main/krk-proof-graph/src/lib.rs): `krk-proof-graph/src/lib.rs`
- [Consensus quorum](https://github.com/spookynetwork/krakenos/blob/main/krk-pbft/src/lib.rs): `krk-pbft/src/lib.rs`

### Other components

- **Operator or signals**
- **Z3 solver**

## Connections

- Operator or signals → Signal ingestion: provides signals
- Signal ingestion → Telemetry: maps signals
- Telemetry → Phase controller: supplies telemetry
- Collapse pressure → Phase controller: informs control
- Phase controller → Policy arbitration: proposes signals
- Swarm orchestration → Policy arbitration: requests authorization
- Policy arbitration → Policy stack: evaluates policies (evidence: `krk-control-plane/src/lib.rs`)
- Policy arbitration → Authority: escalates authority (evidence: `krk-control-plane/src/lib.rs`)
- Policy arbitration → Constraints: checks constraints (evidence: `krk-control-plane/src/lib.rs`)
- Policy arbitration → Signal routing: routes decisions (evidence: `krk-control-plane/src/lib.rs`)
- Policy arbitration → Scheduling: schedules actions (evidence: `krk-control-plane/src/lib.rs`)
- Signal routing → Execution envelope: authorizes execution
- Execution envelope → Doctrine policy: validates actions (evidence: `krk-sandbox/src/manager.rs`)
- Execution envelope → Specialist agents: bounds agent actions (evidence: `krk-agent-swarm/src/agents.rs`)
- Swarm orchestration → Specialist agents: ticks agents (evidence: `krk-agent-swarm/src/lib.rs`)
- Swarm orchestration → Action coordination: filters actions (evidence: `krk-agent-swarm/src/lib.rs`)
- Specialist agents → Dual-channel store: records actions
- Dual-channel store → Raw capture: appends events (evidence: `krk-memory-plane/src/store.rs`)
- Dual-channel store → Canonical memory: compresses facts (evidence: `krk-memory-plane/src/store.rs`)
- Execution envelope → SMT transition checks: gates transitions
- SMT transition checks → Z3 solver: runs SMT queries (evidence: `krk-sat/src/lib.rs`)
- SMT transition checks → Safe transitions: verifies transitions
- Safe transitions → State mutation: executes transitions
- State mutation → Merkle DAG state: mutates state
- State mutation → WASM executor: dispatches execution
- Gossip mesh → Merkle DAG state: replicates DAG
- Effect equivalence → Semantic lattice: supports equivalence
- Byzantine recovery → Gossip mesh: recovers consensus
- Consensus quorum → Policy arbitration: verifies quorum
- Proof lineage → Merkle DAG state: tracks proof lineage
