# thesongzhu/friday architecture

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

- Interactive diagram: https://gitdiagram.com/thesongzhu/friday
- Repository: https://github.com/thesongzhu/friday

## Overview

Friday is a local-first, BYOK control plane that coordinates AI agents while keeping approval, verification, memory, and audit under operator control. Its documented loop routes work, executes it under governance, verifies completion with evidence, and proposes memories for human confirmation. The graph combines that documented product flow with the sampled executor, context, rules, and API modules. Several README capabilities—including channels, schedules, skills, and desktop/mobile surfaces—are included as documented subsystems; their internal wiring is not inferred where source was not sampled.

Main entry points: [`src/engine/friday-engine-run-executor.ts`](https://github.com/thesongzhu/friday/blob/main/src/engine/friday-engine-run-executor.ts) (Run executor), [`src/agent/runtime`](https://github.com/thesongzhu/friday/tree/main/src/agent/runtime) (Agent runtime), [`src/learning/services/friday-self-learning-pipeline-service.ts`](https://github.com/thesongzhu/friday/blob/main/src/learning/services/friday-self-learning-pipeline-service.ts) (Learning pipeline), [`src/rules/engine/rule-engine.ts`](https://github.com/thesongzhu/friday/blob/main/src/rules/engine/rule-engine.ts) (Policy rules)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_orchestration["Work orchestration"]
  node_api["Pipeline API"]
  node_executor["Run executor"]
  node_workflow["Workflow engine"]
  node_node_runner["Node runner"]
  node_channels_schedules["Channels and schedules<br/>[channels.rs]"]
end

subgraph group_governance["Safety and evidence"]
  node_rules["Policy rules<br/>[rule-engine.ts]"]
  node_acceptance["Work verification"]
  node_approval["Operator approval<br/>[gate.rs]"]
  node_audit[("Audit and receipts<br/>[ledger.rs]")]
  node_skills["Governed skills<br/>[skill_executor.rs]"]
end

subgraph group_agent["Agent runtime"]
  node_agent_runtime["Agent runtime"]
  node_agent_contracts["Agent contracts"]
  node_context_engine["Context engine"]
  node_workspace_context["Workspace context"]
  node_providers["AI providers"]
end

subgraph group_memory["Learning and memory"]
  node_sessions["Sessions"]
  node_learning["Learning pipeline"]
  node_memory_store[("Memory storage")]
end

subgraph group_surfaces["Product surfaces"]
  node_desktop["Desktop surfaces"]
  node_mobile["Mobile surfaces"]
end

node_operator(("Operator"))

node_operator -->|"sets goal"| node_executor
node_executor -->|"dispatches run"| node_agent_runtime
node_executor -->|"records turns"| node_sessions
node_agent_runtime -->|"routes work"| node_providers
node_agent_runtime -->|"assembles context"| node_context_engine
node_context_engine -->|"loads context"| node_workspace_context
node_executor -.->|"governs steps"| node_rules
node_rules -->|"requires sign-off"| node_approval
node_operator -->|"approves risk"| node_approval
node_executor -->|"dispatches node"| node_node_runner
node_workflow -.->|"runs nodes"| node_node_runner
node_executor -->|"requests proof"| node_acceptance
node_acceptance -->|"records receipts"| node_audit
node_agent_runtime -->|"records turns"| node_audit
node_sessions -.->|"yields candidates"| node_learning
node_learning -.->|"stores confirmed memory"| node_memory_store
node_operator -->|"confirms memory"| node_learning
node_executor -->|"runs approved skills"| node_skills
node_operator -->|"submits work"| node_channels_schedules
node_desktop -.->|"submits goals"| node_executor
node_mobile -.->|"submits goals"| node_executor

click node_api "https://github.com/thesongzhu/friday/blob/main/src/api/http/routes/friday-deterministic-pipeline-routes.ts"
click node_executor "https://github.com/thesongzhu/friday/blob/main/src/engine/friday-engine-run-executor.ts"
click node_workflow "https://github.com/thesongzhu/friday/tree/main/src/workflows/engine"
click node_node_runner "https://github.com/thesongzhu/friday/blob/main/src/node-runner/engine/node-runner-pipeline.ts"
click node_agent_runtime "https://github.com/thesongzhu/friday/tree/main/src/agent/runtime"
click node_agent_contracts "https://github.com/thesongzhu/friday/blob/main/src/agent/model/friday-agent.types.ts"
click node_context_engine "https://github.com/thesongzhu/friday/blob/main/src/agent/runtime/friday-agent-context-engine.ts"
click node_workspace_context "https://github.com/thesongzhu/friday/blob/main/src/agent/runtime/friday-agent-workspace-context.ts"
click node_providers "https://github.com/thesongzhu/friday/tree/main/src/providers"
click node_rules "https://github.com/thesongzhu/friday/blob/main/src/rules/engine/rule-engine.ts"
click node_acceptance "https://github.com/thesongzhu/friday/blob/main/src/acceptance/engine/assertion-engine.ts"
click node_approval "https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-core/src/gate.rs"
click node_audit "https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-core/src/ledger.rs"
click node_sessions "https://github.com/thesongzhu/friday/blob/main/src/sessions/model/friday-session.types.ts"
click node_learning "https://github.com/thesongzhu/friday/blob/main/src/learning/services/friday-self-learning-pipeline-service.ts"
click node_memory_store "https://github.com/thesongzhu/friday/blob/main/src/memory/persistence/friday-memory-embedding-repository.ts"
click node_skills "https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-hub/src/skill_executor.rs"
click node_channels_schedules "https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-hub/src/channels.rs"
click node_desktop "https://github.com/thesongzhu/friday/tree/main/apps/macos/FridayHubConsole/Sources/FridayHubConsole"
click node_mobile "https://github.com/thesongzhu/friday/tree/main/apps/friday-ios/Sources/FridayMobileShell"

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_api,node_executor,node_workflow,node_node_runner,node_channels_schedules toneBlue
class node_rules,node_acceptance,node_approval,node_audit,node_skills toneAmber
class node_agent_runtime,node_agent_contracts,node_context_engine,node_workspace_context,node_providers toneMint
class node_sessions,node_learning,node_memory_store toneRose
class node_desktop,node_mobile,node_operator toneIndigo
```

## Components

### Work orchestration

- [Pipeline API](https://github.com/thesongzhu/friday/blob/main/src/api/http/routes/friday-deterministic-pipeline-routes.ts): `src/api/http/routes/friday-deterministic-pipeline-routes.ts`
- [Run executor](https://github.com/thesongzhu/friday/blob/main/src/engine/friday-engine-run-executor.ts): `src/engine/friday-engine-run-executor.ts`
- [Workflow engine](https://github.com/thesongzhu/friday/tree/main/src/workflows/engine): `src/workflows/engine`
- [Node runner](https://github.com/thesongzhu/friday/blob/main/src/node-runner/engine/node-runner-pipeline.ts): `src/node-runner/engine/node-runner-pipeline.ts`
- [Channels and schedules](https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-hub/src/channels.rs): `rust-core/crates/friday-hub/src/channels.rs`

### Safety and evidence

- [Policy rules](https://github.com/thesongzhu/friday/blob/main/src/rules/engine/rule-engine.ts): `src/rules/engine/rule-engine.ts`
- [Work verification](https://github.com/thesongzhu/friday/blob/main/src/acceptance/engine/assertion-engine.ts): `src/acceptance/engine/assertion-engine.ts`
- [Operator approval](https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-core/src/gate.rs): `rust-core/crates/friday-core/src/gate.rs`
- [Audit and receipts](https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-core/src/ledger.rs): `rust-core/crates/friday-core/src/ledger.rs`
- [Governed skills](https://github.com/thesongzhu/friday/blob/main/rust-core/crates/friday-hub/src/skill_executor.rs): `rust-core/crates/friday-hub/src/skill_executor.rs`

### Agent runtime

- [Agent runtime](https://github.com/thesongzhu/friday/tree/main/src/agent/runtime): `src/agent/runtime`
- [Agent contracts](https://github.com/thesongzhu/friday/blob/main/src/agent/model/friday-agent.types.ts): `src/agent/model/friday-agent.types.ts`
- [Context engine](https://github.com/thesongzhu/friday/blob/main/src/agent/runtime/friday-agent-context-engine.ts): `src/agent/runtime/friday-agent-context-engine.ts`
- [Workspace context](https://github.com/thesongzhu/friday/blob/main/src/agent/runtime/friday-agent-workspace-context.ts): `src/agent/runtime/friday-agent-workspace-context.ts`
- [AI providers](https://github.com/thesongzhu/friday/tree/main/src/providers): `src/providers`

### Learning and memory

- [Sessions](https://github.com/thesongzhu/friday/blob/main/src/sessions/model/friday-session.types.ts): `src/sessions/model/friday-session.types.ts`
- [Learning pipeline](https://github.com/thesongzhu/friday/blob/main/src/learning/services/friday-self-learning-pipeline-service.ts): `src/learning/services/friday-self-learning-pipeline-service.ts`
- [Memory storage](https://github.com/thesongzhu/friday/blob/main/src/memory/persistence/friday-memory-embedding-repository.ts): `src/memory/persistence/friday-memory-embedding-repository.ts`

### Product surfaces

- [Desktop surfaces](https://github.com/thesongzhu/friday/tree/main/apps/macos/FridayHubConsole/Sources/FridayHubConsole): `apps/macos/FridayHubConsole/Sources/FridayHubConsole`
- [Mobile surfaces](https://github.com/thesongzhu/friday/tree/main/apps/friday-ios/Sources/FridayMobileShell): `apps/friday-ios/Sources/FridayMobileShell`

### Other components

- **Operator**

## Connections

- Operator → Run executor: sets goal (evidence: `README.md`)
- Run executor → Agent runtime: dispatches run (evidence: `src/engine/friday-engine-run-executor.ts`)
- Run executor → Sessions: records turns (evidence: `src/engine/friday-engine-run-executor.ts`)
- Agent runtime → AI providers: routes work (evidence: `README.md`)
- Agent runtime → Context engine: assembles context (evidence: `src/agent/runtime/friday-agent-context-engine.ts`)
- Context engine → Workspace context: loads context (evidence: `src/agent/runtime/friday-agent-context-engine.ts`)
- Run executor → Policy rules: governs steps
- Policy rules → Operator approval: requires sign-off (evidence: `README.md`)
- Operator → Operator approval: approves risk (evidence: `README.md`)
- Run executor → Node runner: dispatches node
- Workflow engine → Node runner: runs nodes
- Run executor → Work verification: requests proof (evidence: `README.md`)
- Work verification → Audit and receipts: records receipts (evidence: `README.md`)
- Agent runtime → Audit and receipts: records turns (evidence: `README.md`)
- Sessions → Learning pipeline: yields candidates
- Learning pipeline → Memory storage: stores confirmed memory
- Operator → Learning pipeline: confirms memory (evidence: `README.md`)
- Run executor → Governed skills: runs approved skills (evidence: `README.md`)
- Operator → Channels and schedules: submits work (evidence: `README.md`)
- Desktop surfaces → Run executor: submits goals
- Mobile surfaces → Run executor: submits goals
