Core Concepts
Architecture Overview
Core architecture layers in Downcity: console, agent, execution context, session, service, and plugin
Architecture Overview
To understand Downcity, start with 6 concepts:
console: the global control planeagent: the per-project host processexecution context: the unified capability surface exposed during executionsession: the actual execution instance for one conversation or one task runservice: the main workflow moduleplugin: the passive extension module
The Most Important Reading Order
Read the system from top to bottom:
consolemanages globallyagenthosts one projectexecution contextexposes a unified execution surfacesessionis where one real execution happensserviceowns the main pathpluginaugments that path at fixed points
That means:
agentis not each individual conversation turnsessionis the real execution unit for chat and task runspluginis neither a service nor an independent runtime
Layered Structure
- Console Layer
- owns registry, model pool, global config, and UI gateway
- resolves the target agent for commands and UI requests
- Agent Layer
- one project maps to one agent process
- loads project config and model
- owns the session facade, service instances, and plugin registry
- persists project-local runtime traces into
.downcity/
- Execution Context Layer
- exposes
session,invoke,plugins,logger,config, andenv - is the shared execution-facing surface used by services and plugins
- is not a second host process, only a view derived from the agent
- Session Layer
- one chat conversation is one session
- one task run is also one session
- prompt assembly, history, tools, and model execution all happen around the session
- Service Layer
- domains such as
chat,task,memory, andshell - own main-path orchestration and domain state
- decide when to create, reuse, or clear sessions
- Plugin Layer
- modules such as
skill,asr,tts, andauth - attach only through service-defined extension points
- do not own lifecycle and do not own a separate runtime
One Diagram
The Most Important Boundary
serviceactively participates in the main pathpluginjoins only at fixed pointssessionowns execution stateagentowns host state
So:
- main orchestration belongs in services
- execution state belongs in sessions
- host state belongs in the agent
- extension logic belongs in plugins
- plugin dependencies stay inside the plugin
A Concrete Example
In chat flows:
- the
chatservice owns ingress, queueing, session selection, execution, and replies - the
execution contextinjects unified access to session and plugin capabilities - the
asrplugin adds transcription at voice-related points - the
authplugin joins authorization-related points - the real model run still happens inside the target
session