# suyashkumarsingour/trueforge architecture

> Architecture diagram of the GitHub repository suyashkumarsingour/trueforge, 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/suyashkumarsingour/trueforge
- Repository: https://github.com/suyashkumarsingour/trueforge

## Overview

TrueForge is an agent harness exposed through a bundled chat UI, an HTTP API with a TypeScript SDK, and an embeddable UI package. The principal workflow is: a user configures an agent and resources, creates a session and turn, the server runs the agent loop with model/tool/sandbox capabilities, and session events and results are persisted and returned. The graph combines README-documented capabilities with source-index and excerpt evidence; some implementation-level links are omitted because their callers were not sampled.

Main entry points: [`packages/trueforge-core/src/core/runtime/AgentThread.ts`](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/runtime/AgentThread.ts) (Agent loop), [`packages/trueforge/src/app.ts`](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/app.ts) (HTTP server), [`packages/trueforge-ui`](https://github.com/suyashkumarsingour/trueforge/tree/main/packages/trueforge-ui) (Embeddable UI), [`packages/frontend/src/App.tsx`](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/frontend/src/App.tsx) (Chat frontend)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_frontend["Chat frontend<br/>[App.tsx]"]
  node_ui["Embeddable UI"]
  node_sdk["TypeScript SDK<br/>[Client.ts]"]
end

subgraph group_service["HTTP service"]
  node_server["HTTP server<br/>[app.ts]"]
  node_session_api["Session API<br/>[sessions.ts]"]
  node_turn_api["Turn API<br/>[turns.ts]"]
  node_session_routes["Session routes<br/>[sessionRoutes.ts]"]
  node_turn_routes["Turn routes<br/>[turnRoutes.ts]"]
end

subgraph group_execution["Agent execution"]
  node_runtime["Agent loop<br/>[AgentThread.ts]"]
  node_orchestrator["Thread orchestration"]
  node_llm["Model adapters<br/>[VercelAILLM.ts]"]
  node_mcp["MCP tools<br/>[remoteMcpClient.ts]"]
  node_sandbox["Sandbox execution<br/>[Sandbox.ts]"]
  node_capabilities["Agent capabilities"]
end

subgraph group_resources["Resource setup"]
  node_catalogs["Resource catalogs"]
  node_stores["Resource stores<br/>[agentStore.ts]"]
end

subgraph group_state["Session state"]
  node_session_store[("Session store")]
  node_sqlite[("SQLite storage<br/>[client.ts]")]
  node_postgres[("Postgres storage<br/>[client.ts]")]
end

node_user(("User"))

node_user -->|"uses chat"| node_frontend
node_user -->|"embeds UI"| node_ui
node_user -->|"calls API"| node_sdk
node_frontend -->|"renders"| node_ui
node_ui -->|"calls API"| node_server
node_sdk -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_session_routes
node_server -->|"mounts routes"| node_turn_routes
node_session_routes -->|"registers handlers"| node_session_api
node_turn_routes -->|"registers handlers"| node_turn_api
node_session_api -.->|"persists sessions"| node_session_store
node_turn_api -.->|"executes turns"| node_runtime
node_runtime -.->|"delegates control"| node_orchestrator
node_orchestrator -->|"manages threads"| node_runtime
node_runtime -->|"requests completions"| node_llm
node_runtime -->|"invokes tools"| node_mcp
node_runtime -->|"runs code"| node_sandbox
node_runtime -->|"uses capabilities"| node_capabilities
node_catalogs -.->|"configures resources"| node_stores
node_runtime -.->|"records session state"| node_session_store
node_server -->|"starts local storage"| node_sqlite
node_server -.->|"starts hosted storage"| node_postgres

click node_frontend "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/frontend/src/App.tsx"
click node_ui "https://github.com/suyashkumarsingour/trueforge/tree/main/packages/trueforge-ui"
click node_sdk "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-sdk/src/api/resources/sessions/client/Client.ts"
click node_server "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/app.ts"
click node_session_api "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/apis/sessions.ts"
click node_turn_api "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/apis/turns.ts"
click node_session_routes "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/routes/sessionRoutes.ts"
click node_turn_routes "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/routes/turnRoutes.ts"
click node_runtime "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/runtime/AgentThread.ts"
click node_orchestrator "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts"
click node_llm "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/llm/VercelAILLM.ts"
click node_mcp "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/mcp/remoteMcpClient.ts"
click node_sandbox "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/sandbox/Sandbox.ts"
click node_capabilities "https://github.com/suyashkumarsingour/trueforge/tree/main/packages/trueforge-core/src/core/capabilities"
click node_catalogs "https://github.com/suyashkumarsingour/trueforge/tree/main/packages/trueforge/src/catalog"
click node_stores "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/db/agentStore.ts"
click node_session_store "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/agent-session/store/InMemorySessionStore.ts"
click node_sqlite "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/db/sqlite/client.ts"
click node_postgres "https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/db/postgres/client.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_frontend,node_ui,node_sdk,node_user toneBlue
class node_server,node_session_api,node_turn_api,node_session_routes,node_turn_routes toneAmber
class node_runtime,node_orchestrator,node_llm,node_mcp,node_sandbox,node_capabilities toneMint
class node_catalogs,node_stores toneRose
class node_session_store,node_sqlite,node_postgres toneIndigo
```

## Components

### User experience

- [Chat frontend](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/frontend/src/App.tsx): `packages/frontend/src/App.tsx`
- [Embeddable UI](https://github.com/suyashkumarsingour/trueforge/tree/main/packages/trueforge-ui): `packages/trueforge-ui`
- [TypeScript SDK](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-sdk/src/api/resources/sessions/client/Client.ts): `packages/trueforge-sdk/src/api/resources/sessions/client/Client.ts`

### HTTP service

- [HTTP server](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/app.ts): `packages/trueforge/src/app.ts`
- [Session API](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/apis/sessions.ts): `packages/trueforge/src/apis/sessions.ts`
- [Turn API](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/apis/turns.ts): `packages/trueforge/src/apis/turns.ts`
- [Session routes](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/routes/sessionRoutes.ts): `packages/trueforge/src/routes/sessionRoutes.ts`
- [Turn routes](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/routes/turnRoutes.ts): `packages/trueforge/src/routes/turnRoutes.ts`

### Agent execution

- [Agent loop](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/runtime/AgentThread.ts): `packages/trueforge-core/src/core/runtime/AgentThread.ts`
- [Thread orchestration](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts): `packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts`
- [Model adapters](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/llm/VercelAILLM.ts): `packages/trueforge-core/src/core/llm/VercelAILLM.ts`
- [MCP tools](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/mcp/remoteMcpClient.ts): `packages/trueforge-core/src/core/mcp/remoteMcpClient.ts`
- [Sandbox execution](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/core/sandbox/Sandbox.ts): `packages/trueforge-core/src/core/sandbox/Sandbox.ts`
- [Agent capabilities](https://github.com/suyashkumarsingour/trueforge/tree/main/packages/trueforge-core/src/core/capabilities): `packages/trueforge-core/src/core/capabilities`

### Resource setup

- [Resource catalogs](https://github.com/suyashkumarsingour/trueforge/tree/main/packages/trueforge/src/catalog): `packages/trueforge/src/catalog`
- [Resource stores](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/db/agentStore.ts): `packages/trueforge/src/db/agentStore.ts`

### Session state

- [Session store](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge-core/src/agent-session/store/InMemorySessionStore.ts): `packages/trueforge-core/src/agent-session/store/InMemorySessionStore.ts`
- [SQLite storage](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/db/sqlite/client.ts): `packages/trueforge/src/db/sqlite/client.ts`
- [Postgres storage](https://github.com/suyashkumarsingour/trueforge/blob/main/packages/trueforge/src/db/postgres/client.ts): `packages/trueforge/src/db/postgres/client.ts`

### Other components

- **User**

## Connections

- User → Chat frontend: uses chat
- User → Embeddable UI: embeds UI
- User → TypeScript SDK: calls API
- Chat frontend → Embeddable UI: renders (evidence: `packages/frontend/src/App.tsx`)
- Embeddable UI → HTTP server: calls API
- TypeScript SDK → HTTP server: sends requests
- HTTP server → Session routes: mounts routes (evidence: `packages/trueforge/src/app.ts`)
- HTTP server → Turn routes: mounts routes (evidence: `packages/trueforge/src/app.ts`)
- Session routes → Session API: registers handlers (evidence: `packages/trueforge/src/routes/sessionRoutes.ts`)
- Turn routes → Turn API: registers handlers (evidence: `packages/trueforge/src/routes/turnRoutes.ts`)
- Session API → Session store: persists sessions
- Turn API → Agent loop: executes turns
- Agent loop → Thread orchestration: delegates control (evidence: `packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts`)
- Thread orchestration → Agent loop: manages threads (evidence: `packages/trueforge-core/src/core/runtime/AgentThreadOrchestrator.ts`)
- Agent loop → Model adapters: requests completions
- Agent loop → MCP tools: invokes tools
- Agent loop → Sandbox execution: runs code
- Agent loop → Agent capabilities: uses capabilities
- Resource catalogs → Resource stores: configures resources
- Agent loop → Session store: records session state
- HTTP server → SQLite storage: starts local storage (evidence: `packages/trueforge/src/main.ts`)
- HTTP server → Postgres storage: starts hosted storage
