knowledge/main/about/architecture.md
The agent loop builds a system prompt, appends conversation history, asks the model for one JSON tool request, executes that tool, records the result, and repeats until response ends the task.
Key runtime files:
agent.py: Agent, AgentContext, loop state, tool dispatchinitialize.py: framework initializationrun_ui.py: Web UI entry pointhelpers/: shared framework helperstools/: core toolsplugins/: framework pluginsusr/: user data, custom plugins, settings, workdirPrompt assembly is file-based. Main prompts come from prompts/, profile overrides from agents/<profile>/prompts/, and plugin prompts from plugins/<plugin>/prompts/.
Plugins can add tools, prompts, API handlers, Web UI components, extensions, and hooks. User plugins live in usr/plugins/ and should survive updates.
Memory and knowledge use the memory plugin and vector search. Knowledge files are indexed for recall; they should be concise because irrelevant recall can steer behavior badly.