# ren-pillai30/chronofork architecture

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

- Interactive diagram: https://gitdiagram.com/ren-pillai30/chronofork
- Repository: https://github.com/ren-pillai30/chronofork

## Overview

ChronoFork is a persistent, branchable ReAct agent runtime with a web workspace for starting and inspecting runs. The main workflow streams a prompt through provider reasoning and tool execution, storing each step in a parent-pointer DAG; users can fork trajectories, resume human-approved tool calls, and compare branches. The graph also preserves the documented LCA-diff and fault-injection capabilities. Some frontend and API wiring is represented from README descriptions because the relevant source excerpts are incomplete; unsampled tool modules are included without inferred call links.

Main entry points: [`backend/app/main.py`](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/main.py) (Session API), [`backend/app/agents/stream_runner.py`](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/stream_runner.py) (Streaming ReAct Runner), [`backend/app/agents/llm_router.py`](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/llm_router.py) (LLM Router), [`backend/app/db/tree_store.py`](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/db/tree_store.py) (Tree Store and LCA Diff)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Web Workspace"]
  node_frontend["Canvas Workspace<br/>[App.jsx]"]
end

subgraph group_runtime["Execution Runtime"]
  node_api["Session API<br/>[main.py]"]
  node_runner["Streaming ReAct Runner<br/>[stream_runner.py]"]
  node_cli["CLI ReAct Runner<br/>[cli_react.py]"]
end

subgraph group_persistence["DAG Persistence"]
  node_sessions[("Session Records<br/>[models.py]")]
  node_tree["Tree Store and LCA Diff<br/>[tree_store.py]"]
end

subgraph group_tools["Tooling"]
  node_live["Live Tools<br/>[live_tools.py]"]
  node_basic["Basic Tools<br/>[basic_tools.py]"]
  node_webgeo["Web and Geo Tools<br/>[web_and_geo.py]"]
end

subgraph group_providers["Model Providers"]
  node_router["LLM Router<br/>[llm_router.py]"]
end

node_operator(("Operator"))
node_groq{{"Groq"}}
node_gemini{{"Gemini"}}
node_live_services{{"Live Data Services"}}

node_operator -->|"uses"| node_frontend
node_frontend -->|"streams requests"| node_api
node_api -->|"starts or resumes"| node_runner
node_api -->|"reads and diffs"| node_tree
node_api -->|"queries records"| node_sessions
node_runner -->|"requests steps"| node_router
node_runner -->|"reconstructs and appends"| node_tree
node_runner -->|"dispatches tools"| node_live
node_router -->|"requests completions"| node_groq
node_router -->|"requests completions"| node_gemini
node_live -->|"fetches live data"| node_live_services
node_tree -->|"persists DAG records"| node_sessions
node_cli -->|"requests steps"| node_router
node_cli -->|"reads and appends"| node_tree
node_cli -->|"dispatches tools"| node_live

click node_frontend "https://github.com/ren-pillai30/chronofork/blob/main/frontend/src/App.jsx"
click node_api "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/main.py"
click node_runner "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/stream_runner.py"
click node_cli "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/cli_react.py"
click node_router "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/llm_router.py"
click node_sessions "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/db/models.py"
click node_tree "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/db/tree_store.py"
click node_live "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/tools/live_tools.py"
click node_basic "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/tools/basic_tools.py"
click node_webgeo "https://github.com/ren-pillai30/chronofork/blob/main/backend/app/tools/web_and_geo.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_frontend toneBlue
class node_api,node_runner,node_cli toneAmber
class node_sessions,node_tree toneMint
class node_live,node_basic,node_webgeo toneRose
class node_router,node_operator,node_groq,node_gemini,node_live_services toneIndigo
```

## Components

### Web Workspace

- [Canvas Workspace](https://github.com/ren-pillai30/chronofork/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### Execution Runtime

- [Session API](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/main.py): `backend/app/main.py`
- [Streaming ReAct Runner](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/stream_runner.py): `backend/app/agents/stream_runner.py`
- [CLI ReAct Runner](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/cli_react.py): `backend/app/agents/cli_react.py`

### DAG Persistence

- [Session Records](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/db/models.py): `backend/app/db/models.py`
- [Tree Store and LCA Diff](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/db/tree_store.py): `backend/app/db/tree_store.py`

### Tooling

- [Live Tools](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/tools/live_tools.py): `backend/app/tools/live_tools.py`
- [Basic Tools](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/tools/basic_tools.py): `backend/app/tools/basic_tools.py`
- [Web and Geo Tools](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/tools/web_and_geo.py): `backend/app/tools/web_and_geo.py`

### Model Providers

- [LLM Router](https://github.com/ren-pillai30/chronofork/blob/main/backend/app/agents/llm_router.py): `backend/app/agents/llm_router.py`

### Other components

- **Operator**
- **Groq**
- **Gemini**
- **Live Data Services**

## Connections

- Operator → Canvas Workspace: uses (evidence: `README.md`)
- Canvas Workspace → Session API: streams requests (evidence: `README.md`)
- Session API → Streaming ReAct Runner: starts or resumes (evidence: `backend/app/main.py`)
- Session API → Tree Store and LCA Diff: reads and diffs (evidence: `backend/app/main.py`)
- Session API → Session Records: queries records (evidence: `backend/app/main.py`)
- Streaming ReAct Runner → LLM Router: requests steps (evidence: `backend/app/agents/stream_runner.py`)
- Streaming ReAct Runner → Tree Store and LCA Diff: reconstructs and appends (evidence: `backend/app/agents/stream_runner.py`)
- Streaming ReAct Runner → Live Tools: dispatches tools (evidence: `backend/app/agents/stream_runner.py`)
- LLM Router → Groq: requests completions (evidence: `backend/app/agents/llm_router.py`)
- LLM Router → Gemini: requests completions (evidence: `backend/app/agents/llm_router.py`)
- Live Tools → Live Data Services: fetches live data (evidence: `backend/app/tools/live_tools.py`)
- Tree Store and LCA Diff → Session Records: persists DAG records (evidence: `backend/app/db/tree_store.py`)
- CLI ReAct Runner → LLM Router: requests steps (evidence: `backend/app/agents/cli_react.py`)
- CLI ReAct Runner → Tree Store and LCA Diff: reads and appends (evidence: `backend/app/agents/cli_react.py`)
- CLI ReAct Runner → Live Tools: dispatches tools (evidence: `backend/app/agents/cli_react.py`)
