# mapleprivacylabs/maple architecture

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

- Interactive diagram: https://gitdiagram.com/mapleprivacylabs/maple
- Repository: https://github.com/mapleprivacylabs/maple

## Overview

Maple is a monorepo of related but independently operated products: the shipped Research client, SDKs, hosted sign-in, desktop Agent prototype, local proxy, and updater. A principal user workflow is using Research chat through the frontend and Maple SDK to reach OpenSecret services; the Agent prototype also offers desktop and ACP entry points to task-oriented agent sessions. The graph preserves documented product boundaries and major capabilities. Some subsystems are represented from the README and file tree rather than sampled implementation; those relationships are labeled as documented or left unlinked where wiring is not shown.

Main entry points: [`sdk/src/lib/main.tsx`](https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/main.tsx) (TypeScript SDK), [`apps/maple-research/frontend/src/app.tsx`](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-research/frontend/src/app.tsx) (Research frontend), [`apps/maple-agent/app/src/desktop.rs`](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/desktop.rs) (Agent desktop), [`sdk/src/lib/transportV2/client.ts`](https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/transportV2/client.ts) (Encrypted transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_research["Research client"]
  node_researchapp["Research frontend<br/>[app.tsx]"]
  node_researchtauri["Research native app<br/>[lib.rs]"]
end

subgraph group_agent["Agent prototype"]
  node_agentdesktop["Agent desktop<br/>[desktop.rs]"]
  node_agententry["Agent process modes<br/>[main.rs]"]
  node_agenttasks["Agent task service<br/>[tasks.rs]"]
  node_agentruntime["Agent runtime<br/>[runtime.rs]"]
  node_pisession["Pi coding session<br/>[agent_session.rs]"]
  node_sessionstore[("Agent session store<br/>[store.rs]")]
  node_agenthost["Shared local host<br/>[host.rs]"]
  node_backendfacade["Backend facade<br/>[backend.rs]"]
end

subgraph group_platform["SDK and services"]
  node_sdkts["TypeScript SDK<br/>[main.tsx]"]
  node_sdkrust["Rust SDK<br/>[client.rs]"]
  node_attestation["Attestation and PCR<br/>[attestation.ts]"]
  node_transport["Encrypted transport<br/>[client.ts]"]
  node_opensecret[("OpenSecret services")]
  node_proxy["OpenAI-compatible proxy<br/>[proxy.rs]"]
  node_updater["Updater service<br/>[worker.ts]"]
end

subgraph group_auth["Hosted authentication"]
  node_authsite["Hosted sign-in site<br/>[main.tsx]"]
  node_oauth["Desktop OAuth transport"]
end

node_user(("Maple user"))

node_user -->|"uses"| node_researchapp
node_researchapp -->|"initializes SDK"| node_sdkts
node_sdkts -->|"authenticates"| node_attestation
node_sdkts -->|"uses transport"| node_transport
node_transport -->|"verifies peer"| node_attestation
node_sdkts -.->|"calls services"| node_opensecret
node_researchapp -.->|"runs natively"| node_researchtauri
node_user -->|"signs in"| node_authsite
node_authsite -.->|"uses OAuth flow"| node_oauth
node_user -->|"uses agent"| node_agentdesktop
node_agentdesktop -->|"calls backend"| node_backendfacade
node_backendfacade -->|"connects IPC"| node_agenthost
node_agententry -->|"starts desktop"| node_agentdesktop
node_agententry -->|"starts proxy"| node_proxy
node_agenttasks -->|"uses runtime"| node_agentruntime
node_pisession -->|"persists session"| node_sessionstore
node_user -->|"gets updates"| node_updater
node_sdkrust -.->|"uses transport"| node_transport

click node_researchapp "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-research/frontend/src/app.tsx"
click node_researchtauri "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-research/frontend/src-tauri/src/lib.rs"
click node_sdkts "https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/main.tsx"
click node_sdkrust "https://github.com/mapleprivacylabs/maple/blob/master/sdk/rust/src/client.rs"
click node_attestation "https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/attestation.ts"
click node_transport "https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/transportV2/client.ts"
click node_authsite "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-auth/src/auth-site/main.tsx"
click node_oauth "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-auth/src/services/desktopOAuthTransport.ts"
click node_agentdesktop "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/desktop.rs"
click node_agententry "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/main.rs"
click node_agenttasks "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/maple-agent/src/agent/tasks.rs"
click node_agentruntime "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/maple-agent/src/agent/runtime.rs"
click node_pisession "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/pi-coding-agent/src/agent_session.rs"
click node_sessionstore "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/pi-coding-agent/src/store.rs"
click node_agenthost "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/host.rs"
click node_backendfacade "https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/backend.rs"
click node_proxy "https://github.com/mapleprivacylabs/maple/blob/master/proxy/src/proxy.rs"
click node_updater "https://github.com/mapleprivacylabs/maple/blob/master/services/updates/src/worker.ts"

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_researchapp,node_researchtauri,node_user toneBlue
class node_agentdesktop,node_agententry,node_agenttasks,node_agentruntime,node_pisession,node_sessionstore,node_agenthost,node_backendfacade toneAmber
class node_sdkts,node_sdkrust,node_attestation,node_transport,node_opensecret,node_proxy,node_updater toneMint
class node_authsite,node_oauth toneRose
```

## Components

### Research client

- [Research frontend](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-research/frontend/src/app.tsx): `apps/maple-research/frontend/src/app.tsx`
- [Research native app](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-research/frontend/src-tauri/src/lib.rs): `apps/maple-research/frontend/src-tauri/src/lib.rs`

### Agent prototype

- [Agent desktop](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/desktop.rs): `apps/maple-agent/app/src/desktop.rs`
- [Agent process modes](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/main.rs): `apps/maple-agent/app/src/main.rs`
- [Agent task service](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/maple-agent/src/agent/tasks.rs): `apps/maple-agent/crates/maple-agent/src/agent/tasks.rs`
- [Agent runtime](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/maple-agent/src/agent/runtime.rs): `apps/maple-agent/crates/maple-agent/src/agent/runtime.rs`
- [Pi coding session](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/pi-coding-agent/src/agent_session.rs): `apps/maple-agent/crates/pi-coding-agent/src/agent_session.rs`
- [Agent session store](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/crates/pi-coding-agent/src/store.rs): `apps/maple-agent/crates/pi-coding-agent/src/store.rs`
- [Shared local host](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/host.rs): `apps/maple-agent/app/src/host.rs`
- [Backend facade](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-agent/app/src/backend.rs): `apps/maple-agent/app/src/backend.rs`

### SDK and services

- [TypeScript SDK](https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/main.tsx): `sdk/src/lib/main.tsx`
- [Rust SDK](https://github.com/mapleprivacylabs/maple/blob/master/sdk/rust/src/client.rs): `sdk/rust/src/client.rs`
- [Attestation and PCR](https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/attestation.ts): `sdk/src/lib/attestation.ts`
- [Encrypted transport](https://github.com/mapleprivacylabs/maple/blob/master/sdk/src/lib/transportV2/client.ts): `sdk/src/lib/transportV2/client.ts`
- **OpenSecret services**
- [OpenAI-compatible proxy](https://github.com/mapleprivacylabs/maple/blob/master/proxy/src/proxy.rs): `proxy/src/proxy.rs`
- [Updater service](https://github.com/mapleprivacylabs/maple/blob/master/services/updates/src/worker.ts): `services/updates/src/worker.ts`

### Hosted authentication

- [Hosted sign-in site](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-auth/src/auth-site/main.tsx): `apps/maple-auth/src/auth-site/main.tsx`
- [Desktop OAuth transport](https://github.com/mapleprivacylabs/maple/blob/master/apps/maple-auth/src/services/desktopOAuthTransport.ts): `apps/maple-auth/src/services/desktopOAuthTransport.ts`

### Other components

- **Maple user**

## Connections

- Maple user → Research frontend: uses (evidence: `README.md`)
- Research frontend → TypeScript SDK: initializes SDK (evidence: `apps/maple-research/frontend/src/app.tsx`)
- TypeScript SDK → Attestation and PCR: authenticates (evidence: `sdk/src/lib/main.tsx`)
- TypeScript SDK → Encrypted transport: uses transport (evidence: `sdk/src/lib/main.tsx`)
- Encrypted transport → Attestation and PCR: verifies peer (evidence: `sdk/src/lib/transportV2/client.ts`)
- TypeScript SDK → OpenSecret services: calls services (evidence: `README.md`)
- Research frontend → Research native app: runs natively (evidence: `README.md`)
- Maple user → Hosted sign-in site: signs in (evidence: `README.md`)
- Hosted sign-in site → Desktop OAuth transport: uses OAuth flow (evidence: `apps/maple-auth/src/auth-site/main.tsx`)
- Maple user → Agent desktop: uses agent (evidence: `README.md`)
- Agent desktop → Backend facade: calls backend (evidence: `apps/maple-agent/app/src/desktop.rs`)
- Backend facade → Shared local host: connects IPC (evidence: `apps/maple-agent/app/src/backend.rs`)
- Agent process modes → Agent desktop: starts desktop (evidence: `apps/maple-agent/app/src/main.rs`)
- Agent process modes → OpenAI-compatible proxy: starts proxy (evidence: `apps/maple-agent/app/src/main.rs`)
- Agent task service → Agent runtime: uses runtime (evidence: `apps/maple-agent/crates/maple-agent/src/agent/tasks.rs`)
- Pi coding session → Agent session store: persists session (evidence: `apps/maple-agent/crates/pi-coding-agent/src/agent_session.rs`)
- Maple user → Updater service: gets updates (evidence: `README.md`)
- Rust SDK → Encrypted transport: uses transport (evidence: `sdk/rust/src/client.rs`)
