Architecture
System Architecture Logic
Explains the current logic across console, agent runtime, session execution, services, and plugins
System Architecture Logic
This page explains how the system actually runs, not just where files live.
Overall Layers
Downcity is easiest to read as four layers:
- Entry surfaces: CLI, Console UI, Chrome Extension, HTTP API
- Control plane: console
- Execution plane: agent runtime
- Business layer: session, services, plugins
Why split console and agent
Console
Console is the global control plane. It:
- manages multiple agent projects
- maintains registry
- owns global model configuration, shared env, and control state
- provides the common entry for Console UI and extension surfaces
Agent
Agent is the single-project execution plane. It:
- loads the current project config
- exposes the project HTTP runtime
- owns
AgentRuntime - drives session, services, and plugins
The Runtime Center
The runtime center is:
AgentRuntime
It owns:
configenvsystemsmodelsessionFacadeservicespluginRegistry
So the most accurate high-level sentence is:
console manages many agents
each agent runtime is centered on AgentRuntime
AgentRuntime then owns session, services, and pluginsWhy split session, service, and plugin
These layers answer different questions.
Session
Session answers:
- which
sessionIdan input belongs to - how messages are persisted
- when execution enters the model loop
- how results are written back
The real objects here are:
SessionFacadeSessionExecutorRegistryLocalSessionExecutorSessionEngineJsonlSessionHistoryStore
Service
Service answers:
- which kind of input it owns
- how the business workflow moves
- when to enter session execution
- which extension points it exposes
The current services are:
chattaskmemoryshell
Plugin
Plugin answers:
- how to extend a workflow without owning it
Plugin capabilities include:
- actions
- system injection
- hooks
Hook semantics are unified as:
pipelineguardeffectresolve
Startup Path
Execution Path
Real Chat Plugin Points
The chat service defines and uses:
chat.augmentInboundchat.observePrincipalchat.authorizeIncomingchat.resolveUserRolechat.beforeEnqueuechat.afterEnqueuechat.beforeReplychat.afterReply
These point names belong to the service. Plugins only implement some of them.
Core Objects in Code
AgentRuntime: single-project runtime centerAgentContext: unified runtime surfaceSessionFacade: session facadeSessionEngine: execution kernelPluginRegistry: plugin registration and dispatchBaseService: service instance base class
In One Sentence
The current system logic is: console manages many agents, each agent runtime is centered on AgentRuntime, and session, services, and plugins all hang off that runtime in clearly separated roles.