# joeydd032995-pixel/sharecompute architecture

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

- Interactive diagram: https://gitdiagram.com/joeydd032995-pixel/sharecompute
- Repository: https://github.com/joeydd032995-pixel/sharecompute

## Overview

ShareCompute combines a native laptop-and-phone model-split worker kit with an InferRing distributed-inference app and a platform-neutral membership core. The active workflow pairs workers, establishes authenticated tunnels, and places model layers across device budgets; the broader repository also includes ring membership/recovery and documented pool and inference simulations. Several app and host subsystems are represented by their exact tree directories because their implementation was not sampled; edges are limited to source references or README statements.

Main entry points: [`Apps/InferRing/InferRing/Services/RingCoordinator.swift`](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/RingCoordinator.swift) (Ring coordinator), [`scripts`](https://github.com/joeydd032995-pixel/sharecompute/tree/main/scripts) (Laptop split host), [`Apps/InferRing/InferRing/Services/RingHealthMonitor.swift`](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/RingHealthMonitor.swift) (Ring health), [`scripts/inference_pipeline_hub.py`](https://github.com/joeydd032995-pixel/sharecompute/blob/main/scripts/inference_pipeline_hub.py) (Inference hub)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workers["Compute workers"]
  node_laptop["Laptop split host"]
  node_androidapp["Android worker app<br/>[MainActivity.java]"]
  node_androidsession["Android session<br/>[WorkerSession.java]"]
  node_iosapp["iOS worker app"]
  node_iosworker["iOS worker runtime<br/>[WorkerModel.swift]"]
  node_nativeworker["Native compute worker<br/>[worker.cpp]"]
  node_workerapi["Worker C API<br/>[worker.h]"]
end

subgraph group_infer["InferRing app"]
  node_chatui["Chat experience"]
  node_modelmanager["Model orchestration<br/>[ModelManager.swift]"]
  node_mlxmanager["MLX model runtime<br/>[Manager.swift]"]
  node_discovery["Bonjour discovery"]
  node_ringcoord["Ring coordinator"]
  node_health["Ring health"]
  node_dataclient["Peer data client<br/>[DataClient.swift]"]
end

subgraph group_membership["Membership core"]
  node_membershipsvc["Membership service"]
  node_capability["Device capabilities"]
  node_stageplanner["Stage planner<br/>[StagePlanner.swift]"]
  node_pool["Cross-platform pool"]
  node_watchdog["Ring watchdog<br/>[RingWatchdog.swift]"]
end

subgraph group_sim["Pool simulations"]
  node_pooldemo["Four-platform demo<br/>[main.swift]"]
  node_pipelinehub["Inference hub"]
  node_pipelinepeer["Inference peer"]
  node_pipelineruntime["Pipeline protocol"]
end

node_operator(("Operator"))

node_operator -->|"starts worker host"| node_laptop
node_operator -->|"pairs worker"| node_androidapp
node_operator -->|"pairs worker"| node_iosapp
node_androidapp -->|"starts session"| node_androidsession
node_androidsession -->|"queries runtime"| node_workerapi
node_iosapp -->|"uses worker model"| node_iosworker
node_iosworker -->|"bridges native API"| node_workerapi
node_workerapi -->|"declares interface"| node_nativeworker
node_laptop -.->|"opens authenticated tunnels"| node_androidsession
node_laptop -.->|"opens authenticated tunnels"| node_iosworker
node_chatui -.->|"submits chat"| node_modelmanager
node_modelmanager -->|"loads model"| node_mlxmanager
node_ringcoord -->|"manages search"| node_discovery
node_ringcoord -->|"coordinates health"| node_health
node_ringcoord -->|"uses peer client"| node_dataclient
node_health -->|"tracks membership"| node_membershipsvc
node_health -->|"monitors generation"| node_watchdog
node_membershipsvc -->|"records profiles"| node_capability
node_pool -->|"owns membership"| node_membershipsvc
node_pool -->|"plans RAM pool"| node_stageplanner
node_pooldemo -->|"connects simulated peers"| node_pool
node_pipelinehub -->|"uses protocol helpers"| node_pipelineruntime
node_pipelinepeer -->|"uses protocol helpers"| node_pipelineruntime
node_operator -->|"runs pipeline simulation"| node_pipelinehub
node_pipelinehub -.->|"dispatches activation work"| node_pipelinepeer

click node_laptop "https://github.com/joeydd032995-pixel/sharecompute/tree/main/scripts"
click node_androidapp "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/MainActivity.java"
click node_androidsession "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/WorkerSession.java"
click node_iosapp "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/ComputeWorker/Sources/ComputeWorkerApp.swift"
click node_iosworker "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/ComputeWorker/Sources/WorkerModel.swift"
click node_nativeworker "https://github.com/joeydd032995-pixel/sharecompute/blob/main/native/split/worker.cpp"
click node_workerapi "https://github.com/joeydd032995-pixel/sharecompute/blob/main/native/split/worker.h"
click node_chatui "https://github.com/joeydd032995-pixel/sharecompute/tree/main/Apps/InferRing/InferRing/Screens/Chat"
click node_modelmanager "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/ModelManager.swift"
click node_mlxmanager "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/Ring/Manager.swift"
click node_discovery "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/BonjourClient.swift"
click node_ringcoord "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/RingCoordinator.swift"
click node_health "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/RingHealthMonitor.swift"
click node_dataclient "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/DataClient.swift"
click node_membershipsvc "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/MembershipService.swift"
click node_capability "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/CapabilityProfile.swift"
click node_stageplanner "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/StagePlanner.swift"
click node_pool "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/CrossPlatformPool.swift"
click node_watchdog "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/RingWatchdog.swift"
click node_pooldemo "https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/FourPlatformDemo/main.swift"
click node_pipelinehub "https://github.com/joeydd032995-pixel/sharecompute/blob/main/scripts/inference_pipeline_hub.py"
click node_pipelinepeer "https://github.com/joeydd032995-pixel/sharecompute/blob/main/scripts/inference_pipeline_peer.py"
click node_pipelineruntime "https://github.com/joeydd032995-pixel/sharecompute/blob/main/scripts/inference_pipeline_lib.py"

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_laptop,node_androidapp,node_androidsession,node_iosapp,node_iosworker,node_nativeworker,node_workerapi toneBlue
class node_chatui,node_modelmanager,node_mlxmanager,node_discovery,node_ringcoord,node_health,node_dataclient toneAmber
class node_membershipsvc,node_capability,node_stageplanner,node_pool,node_watchdog toneMint
class node_pooldemo,node_pipelinehub,node_pipelinepeer,node_pipelineruntime toneRose
class node_operator toneIndigo
```

## Components

### Compute workers

- [Laptop split host](https://github.com/joeydd032995-pixel/sharecompute/tree/main/scripts): `scripts`
- [Android worker app](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/MainActivity.java): `Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/MainActivity.java`
- [Android session](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/WorkerSession.java): `Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/WorkerSession.java`
- [iOS worker app](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/ComputeWorker/Sources/ComputeWorkerApp.swift): `Apps/ComputeWorker/Sources/ComputeWorkerApp.swift`
- [iOS worker runtime](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/ComputeWorker/Sources/WorkerModel.swift): `Apps/ComputeWorker/Sources/WorkerModel.swift`
- [Native compute worker](https://github.com/joeydd032995-pixel/sharecompute/blob/main/native/split/worker.cpp): `native/split/worker.cpp`
- [Worker C API](https://github.com/joeydd032995-pixel/sharecompute/blob/main/native/split/worker.h): `native/split/worker.h`

### InferRing app

- [Chat experience](https://github.com/joeydd032995-pixel/sharecompute/tree/main/Apps/InferRing/InferRing/Screens/Chat): `Apps/InferRing/InferRing/Screens/Chat`
- [Model orchestration](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/ModelManager.swift): `Apps/InferRing/InferRing/Services/ModelManager.swift`
- [MLX model runtime](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/Ring/Manager.swift): `Apps/InferRing/Ring/Manager.swift`
- [Bonjour discovery](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/BonjourClient.swift): `Apps/InferRing/InferRing/Services/BonjourClient.swift`
- [Ring coordinator](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/RingCoordinator.swift): `Apps/InferRing/InferRing/Services/RingCoordinator.swift`
- [Ring health](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/RingHealthMonitor.swift): `Apps/InferRing/InferRing/Services/RingHealthMonitor.swift`
- [Peer data client](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Apps/InferRing/InferRing/Services/DataClient.swift): `Apps/InferRing/InferRing/Services/DataClient.swift`

### Membership core

- [Membership service](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/MembershipService.swift): `Sources/ShareComputeCore/MembershipService.swift`
- [Device capabilities](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/CapabilityProfile.swift): `Sources/ShareComputeCore/CapabilityProfile.swift`
- [Stage planner](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/StagePlanner.swift): `Sources/ShareComputeCore/StagePlanner.swift`
- [Cross-platform pool](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/CrossPlatformPool.swift): `Sources/ShareComputeCore/CrossPlatformPool.swift`
- [Ring watchdog](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/ShareComputeCore/RingWatchdog.swift): `Sources/ShareComputeCore/RingWatchdog.swift`

### Pool simulations

- [Four-platform demo](https://github.com/joeydd032995-pixel/sharecompute/blob/main/Sources/FourPlatformDemo/main.swift): `Sources/FourPlatformDemo/main.swift`
- [Inference hub](https://github.com/joeydd032995-pixel/sharecompute/blob/main/scripts/inference_pipeline_hub.py): `scripts/inference_pipeline_hub.py`
- [Inference peer](https://github.com/joeydd032995-pixel/sharecompute/blob/main/scripts/inference_pipeline_peer.py): `scripts/inference_pipeline_peer.py`
- [Pipeline protocol](https://github.com/joeydd032995-pixel/sharecompute/blob/main/scripts/inference_pipeline_lib.py): `scripts/inference_pipeline_lib.py`

### Other components

- **Operator**

## Connections

- Operator → Laptop split host: starts worker host (evidence: `README.md`)
- Operator → Android worker app: pairs worker (evidence: `README.md`)
- Operator → iOS worker app: pairs worker (evidence: `README.md`)
- Android worker app → Android session: starts session (evidence: `Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/MainActivity.java`)
- Android session → Worker C API: queries runtime (evidence: `Apps/AndroidWorker/app/src/main/java/com/sharecompute/worker/WorkerSession.java`)
- iOS worker app → iOS worker runtime: uses worker model (evidence: `Apps/ComputeWorker/Sources/ComputeWorkerApp.swift`)
- iOS worker runtime → Worker C API: bridges native API
- Worker C API → Native compute worker: declares interface (evidence: `native/split/worker.h`)
- Laptop split host → Android session: opens authenticated tunnels (evidence: `README.md`)
- Laptop split host → iOS worker runtime: opens authenticated tunnels (evidence: `README.md`)
- Chat experience → Model orchestration: submits chat
- Model orchestration → MLX model runtime: loads model (evidence: `Apps/InferRing/InferRing/Services/ModelManager.swift`)
- Ring coordinator → Bonjour discovery: manages search (evidence: `Apps/InferRing/InferRing/Services/RingCoordinator.swift`)
- Ring coordinator → Ring health: coordinates health (evidence: `Apps/InferRing/InferRing/Services/RingCoordinator.swift`)
- Ring coordinator → Peer data client: uses peer client (evidence: `Apps/InferRing/InferRing/Services/RingCoordinator.swift`)
- Ring health → Membership service: tracks membership (evidence: `Apps/InferRing/InferRing/Services/RingHealthMonitor.swift`)
- Ring health → Ring watchdog: monitors generation (evidence: `Apps/InferRing/InferRing/Services/RingHealthMonitor.swift`)
- Membership service → Device capabilities: records profiles (evidence: `Sources/ShareComputeCore/MembershipService.swift`)
- Cross-platform pool → Membership service: owns membership (evidence: `Sources/ShareComputeCore/CrossPlatformPool.swift`)
- Cross-platform pool → Stage planner: plans RAM pool (evidence: `Sources/ShareComputeCore/CrossPlatformPool.swift`)
- Four-platform demo → Cross-platform pool: connects simulated peers (evidence: `Sources/FourPlatformDemo/main.swift`)
- Inference hub → Pipeline protocol: uses protocol helpers (evidence: `scripts/inference_pipeline_hub.py`)
- Inference peer → Pipeline protocol: uses protocol helpers (evidence: `scripts/inference_pipeline_peer.py`)
- Operator → Inference hub: runs pipeline simulation (evidence: `README.md`)
- Inference hub → Inference peer: dispatches activation work (evidence: `README.md`)
