# ravenveil/shadowflow architecture

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

- Interactive diagram: https://gitdiagram.com/ravenveil/shadowflow
- Repository: https://github.com/ravenveil/shadowflow

## Overview

ShadowFlow is a contract-first platform for coordinating AI-agent teams with human-reviewable policies, approvals, rejection/retry loops, and checkpoint rollback. The documented workflow starts in the editor, dispatches a task to a team of agent runtimes, applies policy and review gates, then presents run progress and artifacts. The Node tree also exposes a Skill Studio, memory/knowledge services, and scheduling. The README documents the broader runtime and Python backend, but those implementations are not in this tree; their connections are shown only where documented.

Main entry points: [`backend/node/src/index.ts`](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/index.ts) (Node API gateway), [`backend/node/src/application/memory-bank/routes.ts`](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/routes.ts) (Knowledge service), [`backend/node/src/application/schedules/engine/engine.ts`](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/schedules/engine/engine.ts) (Schedule engine), [`frontend/app/ProductApp.tsx`](https://github.com/ravenveil/shadowflow/blob/main/frontend/app/ProductApp.tsx) (Workflow editor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_editor["Workflow editor<br/>[ProductApp.tsx]"]
  node_legacy_app["Chat experience<br/>[NeoApp.tsx]"]
  node_group_chat["Team live view<br/>[NeoGroupChat.tsx]"]
  node_run_session_ui["Run timeline<br/>[useRunSession.ts]"]
end

subgraph group_coordination["Workflow coordination"]
  node_node_gateway["Node API gateway<br/>[index.ts]"]
  node_python_runtime["Runtime engine"]
  node_team_coordination["Team coordination"]
  node_runtime_policy["Policy and approvals"]
  node_run_records[("Runs and checkpoints")]
end

subgraph group_execution["Agent execution"]
  node_agent_transports["Agent transports"]
  node_runtime_tools["Agent tools"]
  node_skills["Skill Studio"]
  node_agent_runtime["Agent providers"]
end

subgraph group_services["Platform services"]
  node_memory_bank_api["Knowledge service<br/>[routes.ts]"]
  node_memory_ingest["Knowledge ingestion<br/>[ingest.ts]"]
  node_memory_search["Knowledge retrieval<br/>[retrieve.ts]"]
  node_memory_storage[("Knowledge pack store<br/>[db.ts]")]
  node_agent_memory[("Agent handoffs")]
  node_schedule_engine["Schedule engine<br/>[engine.ts]"]
  node_schedule_store[("Schedule records<br/>[store.ts]")]
end

node_human(("User / reviewer"))

node_human -->|"defines task"| node_editor
node_editor -->|"submits workflow"| node_python_runtime
node_human -.->|"reviews runs"| node_legacy_app
node_legacy_app -->|"opens team view"| node_group_chat
node_python_runtime -.->|"coordinates agents"| node_team_coordination
node_python_runtime -->|"checks policy"| node_runtime_policy
node_runtime_policy -->|"rejects or gates"| node_python_runtime
node_python_runtime -->|"dispatches work"| node_agent_transports
node_agent_transports -->|"invokes runtime"| node_agent_runtime
node_python_runtime -.->|"runs tools"| node_runtime_tools
node_python_runtime -->|"records execution"| node_run_records
node_run_records -.->|"streams progress"| node_run_session_ui
node_run_session_ui -.->|"shows results"| node_human
node_node_gateway -->|"serves Skill Studio"| node_skills
node_node_gateway -->|"serves knowledge routes"| node_memory_bank_api
node_memory_bank_api -->|"ingests sources"| node_memory_ingest
node_memory_bank_api -->|"retrieves matches"| node_memory_search
node_memory_ingest -->|"writes pack data"| node_memory_storage
node_memory_search -.->|"reads pack data"| node_memory_storage
node_agent_memory -.->|"supports handoffs"| node_human
node_node_gateway -.->|"serves schedules"| node_schedule_engine
node_schedule_engine -->|"loads and saves"| node_schedule_store
node_schedule_engine -.->|"executes scheduled work"| node_python_runtime

click node_editor "https://github.com/ravenveil/shadowflow/blob/main/frontend/app/ProductApp.tsx"
click node_legacy_app "https://github.com/ravenveil/shadowflow/blob/main/frontend/legacy/src/neo/NeoApp.tsx"
click node_group_chat "https://github.com/ravenveil/shadowflow/blob/main/frontend/legacy/src/neo/NeoGroupChat.tsx"
click node_run_session_ui "https://github.com/ravenveil/shadowflow/blob/main/frontend/legacy/src/core/hooks/useRunSession.ts"
click node_node_gateway "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/index.ts"
click node_team_coordination "https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/teams"
click node_runtime_policy "https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/runtime"
click node_run_records "https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/runs"
click node_agent_transports "https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/adapters/transport"
click node_runtime_tools "https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/runtime/tools"
click node_skills "https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/skills"
click node_memory_bank_api "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/routes.ts"
click node_memory_ingest "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/ingest.ts"
click node_memory_search "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/retrieve.ts"
click node_memory_storage "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/db.ts"
click node_agent_memory "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory/infra/storage-memory-handoff.ts"
click node_schedule_engine "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/schedules/engine/engine.ts"
click node_schedule_store "https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/schedules/engine/store.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_editor,node_legacy_app,node_group_chat,node_run_session_ui,node_human toneBlue
class node_node_gateway,node_python_runtime,node_team_coordination,node_runtime_policy,node_run_records toneAmber
class node_agent_transports,node_runtime_tools,node_skills,node_agent_runtime toneMint
class node_memory_bank_api,node_memory_ingest,node_memory_search,node_memory_storage,node_agent_memory,node_schedule_engine,node_schedule_store toneRose
```

## Components

### User experience

- [Workflow editor](https://github.com/ravenveil/shadowflow/blob/main/frontend/app/ProductApp.tsx): `frontend/app/ProductApp.tsx`
- [Chat experience](https://github.com/ravenveil/shadowflow/blob/main/frontend/legacy/src/neo/NeoApp.tsx): `frontend/legacy/src/neo/NeoApp.tsx`
- [Team live view](https://github.com/ravenveil/shadowflow/blob/main/frontend/legacy/src/neo/NeoGroupChat.tsx): `frontend/legacy/src/neo/NeoGroupChat.tsx`
- [Run timeline](https://github.com/ravenveil/shadowflow/blob/main/frontend/legacy/src/core/hooks/useRunSession.ts): `frontend/legacy/src/core/hooks/useRunSession.ts`

### Workflow coordination

- [Node API gateway](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/index.ts): `backend/node/src/index.ts`
- **Runtime engine**
- [Team coordination](https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/teams): `backend/node/src/application/teams`
- [Policy and approvals](https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/runtime): `backend/node/src/application/runtime`
- [Runs and checkpoints](https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/runs): `backend/node/src/application/runs`

### Agent execution

- [Agent transports](https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/adapters/transport): `backend/node/src/application/adapters/transport`
- [Agent tools](https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/runtime/tools): `backend/node/src/application/runtime/tools`
- [Skill Studio](https://github.com/ravenveil/shadowflow/tree/main/backend/node/src/application/skills): `backend/node/src/application/skills`
- **Agent providers**

### Platform services

- [Knowledge service](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/routes.ts): `backend/node/src/application/memory-bank/routes.ts`
- [Knowledge ingestion](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/ingest.ts): `backend/node/src/application/memory-bank/ingest.ts`
- [Knowledge retrieval](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/retrieve.ts): `backend/node/src/application/memory-bank/retrieve.ts`
- [Knowledge pack store](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory-bank/db.ts): `backend/node/src/application/memory-bank/db.ts`
- [Agent handoffs](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/memory/infra/storage-memory-handoff.ts): `backend/node/src/application/memory/infra/storage-memory-handoff.ts`
- [Schedule engine](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/schedules/engine/engine.ts): `backend/node/src/application/schedules/engine/engine.ts`
- [Schedule records](https://github.com/ravenveil/shadowflow/blob/main/backend/node/src/application/schedules/engine/store.ts): `backend/node/src/application/schedules/engine/store.ts`

### Other components

- **User / reviewer**

## Connections

- User / reviewer → Workflow editor: defines task (evidence: `README.md`)
- Workflow editor → Runtime engine: submits workflow (evidence: `README.md`)
- User / reviewer → Chat experience: reviews runs
- Chat experience → Team live view: opens team view (evidence: `frontend/legacy/src/AppRoutes.tsx`)
- Runtime engine → Team coordination: coordinates agents
- Runtime engine → Policy and approvals: checks policy (evidence: `README.md`)
- Policy and approvals → Runtime engine: rejects or gates (evidence: `README.md`)
- Runtime engine → Agent transports: dispatches work (evidence: `README.md`)
- Agent transports → Agent providers: invokes runtime (evidence: `README.md`)
- Runtime engine → Agent tools: runs tools
- Runtime engine → Runs and checkpoints: records execution (evidence: `README.md`)
- Runs and checkpoints → Run timeline: streams progress
- Run timeline → User / reviewer: shows results
- Node API gateway → Skill Studio: serves Skill Studio (evidence: `README.md`)
- Node API gateway → Knowledge service: serves knowledge routes (evidence: `backend/node/src/application/memory-bank/routes.ts`)
- Knowledge service → Knowledge ingestion: ingests sources
- Knowledge service → Knowledge retrieval: retrieves matches
- Knowledge ingestion → Knowledge pack store: writes pack data (evidence: `backend/node/src/application/memory-bank/ingest.ts`)
- Knowledge retrieval → Knowledge pack store: reads pack data
- Agent handoffs → User / reviewer: supports handoffs
- Node API gateway → Schedule engine: serves schedules
- Schedule engine → Schedule records: loads and saves (evidence: `backend/node/src/application/schedules/engine/engine.ts`)
- Schedule engine → Runtime engine: executes scheduled work
