# whoz-oss/coday architecture

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

- Interactive diagram: https://gitdiagram.com/whoz-oss/coday
- Repository: https://github.com/whoz-oss/coday

## Overview

#### Purpose and topology
Coday is a project-scoped, conversation-based AI-agent framework. Its primary product path is a Node.js web application that manages projects, threads, agents, tools, persistent context, and provider credentials. The repository also contains AgentOS: a Kotlin/Spring service platform with a generated TypeScript client and Angular administration/chat UI.

#### Primary entry points
- Web distribution/server: `apps/web/index.js` launches the Node service at `apps/server/src/server.ts`; CLI packaging begins at `apps/server/bin.js`.
- Browser client: Angular bootstraps from `apps/client/src/main.ts` and routes from `apps/client/src/app/app.routes.ts`.
- Desktop variants: Electron-style main/preload processes are in `apps/desktop/src/main.ts` and `apps/desktop/src/preload.ts`; shared lifecycle/IPC code is in `libs/desktop-core/src/lib/server-lifecycle.ts`.
- AgentOS independently starts as a Spring Boot application at `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/AgentOSApplication.kt`.

#### Coday request and conversation flow
The Node server exposes project, configuration, agent, prompt, scheduler, thread, message, preview, and transcription routes. Core route composition and startup live in `apps/server/src/server.ts`; long-lived thread execution is coordinated by `apps/server/src/lib/thread-coday-manager.ts`, while project event publication is handled by `apps/server/src/lib/project-event-manager.ts`.

A browser action flows from Angular state/API services to server routes, then into service and repository layers. Thread and project state/services are centered in `libs/service/src/lib/thread.service.ts`, `libs/service/src/lib/prompt-execution.service.ts`, and `libs/service/src/lib/project.service.ts`; filesystem-backed persistence boundaries are `libs/repository/src/lib/thread-file.repository.ts` and `libs/repository/src/lib/project-file.repository.ts`.

#### Agent execution, models, and tools
The execution domain models agents, threads, prompts, tool definitions, provider configuration, and events in `libs/model/src/lib/agent.ts`, `libs/model/src/lib/ai-thread.ts`, and `libs/model/src/lib/coday-tool.ts`. Agent orchestration and tool assembly are concentrated in `libs/agent/src/lib/agent.service.ts` and `libs/agent/src/lib/toolbox.ts`.

Provider adapters include OpenAI, Anthropic, and Google clients under `libs/handler/src/lib/openai.client.ts`, `libs/handler/src/lib/anthropic.client.ts`, and `libs/handler/src/lib/google.client.ts`. Tool capabilities span local filesystem/shell/Git operations and external systems such as Jira, GitLab, Slack, Confluence, and Basecamp; examples include `libs/integrations/file/src/lib/file.tools.ts`, `libs/integrations/git/src/lib/git.tools.ts`, and `libs/integrations/jira/src/lib/jira.tools.ts`.

#### Configuration, scope, and MCP boundary
Coday reads layered user/project configuration, including the root `coday.yaml`; configuration services and migrations are in `libs/service/src/lib/config-service-registry.ts`, `libs/service/src/lib/mcp-config.service.ts`, and `libs/utils/src/lib/project-config-migrations.ts`. MCP servers are modeled and pooled behind `libs/mcp/src/lib/mcp-instance-pool.ts` and `libs/mcp/src/lib/mcp-tools-factory.ts`, isolating external stdio/remote tool protocols from agent execution.

#### AgentOS platform
AgentOS provides REST/SSE APIs and multi-user, namespace-scoped agent execution. Its API contract is `agentos/openapi/agentos-openapi.yaml`, consumed by `libs/agentos-api-client/src/index.ts`. Cases are the conversation/runtime unit: `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/caseFlow/CaseRuntime.kt` drives execution, `.../agent/AgentServiceImpl.kt` resolves and runs agents, and `.../caseEvent/CaseEventSseController.kt` streams lifecycle and content events.

AgentOS discovers plugins and resolves tools through `.../plugin/PluginService.kt` and `.../tool/ToolResolverService.kt`. Built-in plugin modules implement filesystem, shell, tmux, datetime, and MCP integrations, notably `agentos/agentos-file-plugin/src/main/kotlin/io/whozoss/agentos/plugins/file/FilePlugin.kt` and `agentos/agentos-mcp-plugin/src/main/kotlin/io/whozoss/agentos/plugins/mcp/McpConnectionPool.kt`.

#### Persistence, security, and deployment
AgentOS persists cases, events, configuration, identities, namespaces, permissions, prompts, and feedback in Neo4j through repository interfaces/implementations such as `.../caseFlow/Neo4jCaseRepository.kt`, `.../caseEvent/Neo4jCaseEventRepository.kt`, and `.../permissions/Neo4jPermissionRepository.kt`. It supports embedded or external Neo4j profiles via `agentos/agentos-service/src/main/resources/application.yml` and `.../config/Neo4jPersistenceConfiguration.kt`.

Authentication and declarative authorization form a hard boundary before scoped services: `.../security/declarative/AgentOsAuthenticationFilter.kt` and `.../permissions/PermissionServiceImpl.kt`. Container deployment is supplied by `agentos/agentos-service/Dockerfile` and `agentos/docker-compose.yml`; the overall monorepo uses Node.js 22+, TypeScript/Nx, Kotlin/Gradle, Spring Boot, Angular, and Neo4j.

Main entry points: [`libs/agent/src/lib/agent.service.ts`](https://github.com/whoz-oss/coday/blob/master/libs/agent/src/lib/agent.service.ts) (Agent orchestration), [`apps/server/src/server.ts`](https://github.com/whoz-oss/coday/blob/master/apps/server/src/server.ts) (Coday server), [`libs/service/src/lib/thread.service.ts`](https://github.com/whoz-oss/coday/blob/master/libs/service/src/lib/thread.service.ts) (Thread & project services), [`agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/security/declarative/AgentOsAuthenticationFilter.kt`](https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/security/declarative/AgentOsAuthenticationFilter.kt) (Authentication & permissions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_coday["Coday"]
  node_web["Web distribution<br/>Node launcher<br/>[index.js]"]
  node_server["Coday server<br/>HTTP routes<br/>[server.ts]"]
  node_client["Angular client<br/>browser UI<br/>[main.ts]"]
  node_desktop["Desktop runtime<br/>Electron main/preload<br/>[main.ts]"]
  node_desktop_lifecycle["Desktop lifecycle<br/>IPC lifecycle"]
  node_thread_manager["Thread coordinator<br/>execution manager"]
  node_project_events["Project events<br/>event manager"]
  node_services["Thread &amp; project services<br/>service layer<br/>[thread.service.ts]"]
  node_file_persistence[("File persistence<br/>repositories")]
  node_agent_orchestrator["Agent orchestration<br/>agent service<br/>[agent.service.ts]"]
  node_domain_models["Agent domain models<br/>shared models<br/>[agent.ts]"]
  node_providers{{"AI providers<br/>model adapters<br/>[openai.client.ts]"}}
  node_tool_integrations{{"Tool integrations<br/>tool capabilities<br/>[file.tools.ts]"}}
  node_mcp{{"MCP boundary<br/>MCP pool"}}
  node_config["Configuration scope<br/>config registry"]
end

subgraph group_agentos["AgentOS"]
  node_agentos_api["AgentOS API<br/>REST/SSE service"]
  node_security{{"Authentication &amp; permissions<br/>security boundary"}}
  node_case_runtime["Case runtime<br/>conversation runtime<br/>[CaseRuntime.kt]"]
  node_agentos_agents["AgentOS agent service<br/>agent resolver"]
  node_plugins_tools{{"Plugins &amp; tools<br/>plugin resolution<br/>[PluginService.kt]"}}
  node_neo4j[("Neo4j persistence<br/>repositories")]
  node_agentos_client["Generated AgentOS client<br/>TypeScript API client<br/>[index.ts]"]
end

node_web -->|"launches"| node_server
node_client -->|"API requests"| node_server
node_desktop -->|"uses"| node_desktop_lifecycle
node_desktop_lifecycle -->|"manages"| node_server
node_server -->|"coordinates threads"| node_thread_manager
node_server -->|"routes invoke"| node_services
node_server -->|"publishes project events"| node_project_events
node_services -->|"persists"| node_file_persistence
node_services -->|"executes prompts"| node_agent_orchestrator
node_services -->|"loads scoped config"| node_config
node_thread_manager -->|"runs agent work"| node_agent_orchestrator
node_agent_orchestrator -->|"uses"| node_domain_models
node_agent_orchestrator -->|"calls models"| node_providers
node_agent_orchestrator -->|"assembles tools"| node_tool_integrations
node_agent_orchestrator -->|"uses MCP tools"| node_mcp
node_config -->|"configures"| node_mcp
node_agentos_client -->|"REST/SSE client"| node_agentos_api
node_agentos_api -->|"authenticates before services"| node_security
node_security -->|"authorizes scoped access"| node_case_runtime
node_case_runtime -->|"resolves agents"| node_agentos_agents
node_case_runtime -->|"stores cases and events"| node_neo4j
node_agentos_agents -->|"resolves tools"| node_plugins_tools
node_plugins_tools -.->|"MCP protocol integration"| node_mcp
node_security -->|"permissions and identities"| node_neo4j

click node_web "https://github.com/whoz-oss/coday/blob/master/apps/web/index.js"
click node_server "https://github.com/whoz-oss/coday/blob/master/apps/server/src/server.ts"
click node_client "https://github.com/whoz-oss/coday/blob/master/apps/client/src/main.ts"
click node_desktop "https://github.com/whoz-oss/coday/blob/master/apps/desktop/src/main.ts"
click node_desktop_lifecycle "https://github.com/whoz-oss/coday/blob/master/libs/desktop-core/src/lib/server-lifecycle.ts"
click node_thread_manager "https://github.com/whoz-oss/coday/blob/master/apps/server/src/lib/thread-coday-manager.ts"
click node_project_events "https://github.com/whoz-oss/coday/blob/master/apps/server/src/lib/project-event-manager.ts"
click node_services "https://github.com/whoz-oss/coday/blob/master/libs/service/src/lib/thread.service.ts"
click node_file_persistence "https://github.com/whoz-oss/coday/blob/master/libs/repository/src/lib/thread-file.repository.ts"
click node_agent_orchestrator "https://github.com/whoz-oss/coday/blob/master/libs/agent/src/lib/agent.service.ts"
click node_domain_models "https://github.com/whoz-oss/coday/blob/master/libs/model/src/lib/agent.ts"
click node_providers "https://github.com/whoz-oss/coday/blob/master/libs/handler/src/lib/openai.client.ts"
click node_tool_integrations "https://github.com/whoz-oss/coday/blob/master/libs/integrations/file/src/lib/file.tools.ts"
click node_mcp "https://github.com/whoz-oss/coday/blob/master/libs/mcp/src/lib/mcp-instance-pool.ts"
click node_config "https://github.com/whoz-oss/coday/blob/master/libs/service/src/lib/config-service-registry.ts"
click node_agentos_api "https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/AgentOSApplication.kt"
click node_security "https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/security/declarative/AgentOsAuthenticationFilter.kt"
click node_case_runtime "https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/caseFlow/CaseRuntime.kt"
click node_agentos_agents "https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/agent/AgentServiceImpl.kt"
click node_plugins_tools "https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/plugin/PluginService.kt"
click node_neo4j "https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/caseFlow/Neo4jCaseRepository.kt"
click node_agentos_client "https://github.com/whoz-oss/coday/blob/master/libs/agentos-api-client/src/index.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_web,node_server,node_client,node_desktop,node_desktop_lifecycle,node_thread_manager,node_project_events,node_services,node_file_persistence,node_agent_orchestrator,node_domain_models,node_providers,node_tool_integrations,node_mcp,node_config toneBlue
class node_agentos_api,node_security,node_case_runtime,node_agentos_agents,node_plugins_tools,node_neo4j,node_agentos_client toneAmber
```

## Components

### Coday

Node.js project-scoped agent application.

- [Web distribution](https://github.com/whoz-oss/coday/blob/master/apps/web/index.js): Node launcher · `apps/web/index.js`
- [Coday server](https://github.com/whoz-oss/coday/blob/master/apps/server/src/server.ts): HTTP routes · Composes API routes and server startup. · `apps/server/src/server.ts`
- [Angular client](https://github.com/whoz-oss/coday/blob/master/apps/client/src/main.ts): browser UI · Routes and state/API services initiate user actions. · `apps/client/src/main.ts`
- [Desktop runtime](https://github.com/whoz-oss/coday/blob/master/apps/desktop/src/main.ts): Electron main/preload · `apps/desktop/src/main.ts`
- [Desktop lifecycle](https://github.com/whoz-oss/coday/blob/master/libs/desktop-core/src/lib/server-lifecycle.ts): IPC lifecycle · `libs/desktop-core/src/lib/server-lifecycle.ts`
- [Thread coordinator](https://github.com/whoz-oss/coday/blob/master/apps/server/src/lib/thread-coday-manager.ts): execution manager · Coordinates long-lived Coday thread execution. · `apps/server/src/lib/thread-coday-manager.ts`
- [Project events](https://github.com/whoz-oss/coday/blob/master/apps/server/src/lib/project-event-manager.ts): event manager · `apps/server/src/lib/project-event-manager.ts`
- [Thread & project services](https://github.com/whoz-oss/coday/blob/master/libs/service/src/lib/thread.service.ts): service layer · Owns thread, prompt execution, and project operations. · `libs/service/src/lib/thread.service.ts`
- [File persistence](https://github.com/whoz-oss/coday/blob/master/libs/repository/src/lib/thread-file.repository.ts): repositories · Filesystem-backed project and thread state. · `libs/repository/src/lib/thread-file.repository.ts`
- [Agent orchestration](https://github.com/whoz-oss/coday/blob/master/libs/agent/src/lib/agent.service.ts): agent service · Builds agents and executes prompts with tools. · `libs/agent/src/lib/agent.service.ts`
- [Agent domain models](https://github.com/whoz-oss/coday/blob/master/libs/model/src/lib/agent.ts): shared models · Agents, threads, prompts, tools, providers, and events. · `libs/model/src/lib/agent.ts`
- [AI providers](https://github.com/whoz-oss/coday/blob/master/libs/handler/src/lib/openai.client.ts): model adapters · OpenAI, Anthropic, and Google clients. · `libs/handler/src/lib/openai.client.ts`
- [Tool integrations](https://github.com/whoz-oss/coday/blob/master/libs/integrations/file/src/lib/file.tools.ts): tool capabilities · Filesystem, shell, Git, and external-system tools. · `libs/integrations/file/src/lib/file.tools.ts`
- [MCP boundary](https://github.com/whoz-oss/coday/blob/master/libs/mcp/src/lib/mcp-instance-pool.ts): MCP pool · Pools external stdio and remote MCP tool servers. · `libs/mcp/src/lib/mcp-instance-pool.ts`
- [Configuration scope](https://github.com/whoz-oss/coday/blob/master/libs/service/src/lib/config-service-registry.ts): config registry · Layered user and project configuration, including MCP. · `libs/service/src/lib/config-service-registry.ts`

### AgentOS

Independent Kotlin/Spring multi-user agent platform.

- [AgentOS API](https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/AgentOSApplication.kt): REST/SSE service · Spring Boot API for namespace-scoped execution. · `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/AgentOSApplication.kt`
- [Authentication & permissions](https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/security/declarative/AgentOsAuthenticationFilter.kt): security boundary · Authenticates requests and enforces declarative authorization. · `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/security/declarative/AgentOsAuthenticationFilter.kt`
- [Case runtime](https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/caseFlow/CaseRuntime.kt): conversation runtime · Drives AgentOS case execution. · `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/caseFlow/CaseRuntime.kt`
- [AgentOS agent service](https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/agent/AgentServiceImpl.kt): agent resolver · Resolves and runs agents for cases. · `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/agent/AgentServiceImpl.kt`
- [Plugins & tools](https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/plugin/PluginService.kt): plugin resolution · Discovers plugins and resolves built-in and MCP tools. · `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/plugin/PluginService.kt`
- [Neo4j persistence](https://github.com/whoz-oss/coday/blob/master/agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/caseFlow/Neo4jCaseRepository.kt): repositories · Persists cases, events, identities, namespaces, and permissions. · `agentos/agentos-service/src/main/kotlin/io/whozoss/agentos/caseFlow/Neo4jCaseRepository.kt`
- [Generated AgentOS client](https://github.com/whoz-oss/coday/blob/master/libs/agentos-api-client/src/index.ts): TypeScript API client · Consumes the AgentOS OpenAPI contract. · `libs/agentos-api-client/src/index.ts`

## Connections

- Web distribution → Coday server: launches
- Angular client → Coday server: API requests
- Desktop runtime → Desktop lifecycle: uses
- Desktop lifecycle → Coday server: manages
- Coday server → Thread coordinator: coordinates threads
- Coday server → Thread & project services: routes invoke
- Coday server → Project events: publishes project events
- Thread & project services → File persistence: persists
- Thread & project services → Agent orchestration: executes prompts
- Thread & project services → Configuration scope: loads scoped config
- Thread coordinator → Agent orchestration: runs agent work
- Agent orchestration → Agent domain models: uses
- Agent orchestration → AI providers: calls models
- Agent orchestration → Tool integrations: assembles tools
- Agent orchestration → MCP boundary: uses MCP tools
- Configuration scope → MCP boundary: configures
- Generated AgentOS client → AgentOS API: REST/SSE client
- AgentOS API → Authentication & permissions: authenticates before services
- Authentication & permissions → Case runtime: authorizes scoped access
- Case runtime → AgentOS agent service: resolves agents
- Case runtime → Neo4j persistence: stores cases and events
- AgentOS agent service → Plugins & tools: resolves tools
- Plugins & tools → MCP boundary: MCP protocol integration
- Authentication & permissions → Neo4j persistence: permissions and identities
