# steve02081504/fount architecture

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

- Interactive diagram: https://gitdiagram.com/steve02081504/fount
- Repository: https://github.com/steve02081504/fount

## Overview

fount is a modular AI-agent runtime: users interact through chat, which resolves a character and its configured parts, builds a prompt, calls an AI source, and processes plugin reply handlers. The wider product also provides part management, social/file-sharing features, service integrations, importing, exports, and terminal/server interfaces. The principal workflow is grounded in the excerpts; several capability branches are documented in the README but their internal wiring was not sampled.

Main entry points: [`default/templates/user/chars/ZL-31/main.mjs`](https://github.com/steve02081504/fount/blob/master/default/templates/user/chars/ZL-31/main.mjs) (ZL-31 Character), [`src/server/parts_loader.mjs`](https://github.com/steve02081504/fount/blob/master/src/server/parts_loader.mjs) (Part Loader), [`src/server/server.mjs`](https://github.com/steve02081504/fount/blob/master/src/server/server.mjs) (fount Server), [`src/server/web_server/parts_router.mjs`](https://github.com/steve02081504/fount/blob/master/src/server/web_server/parts_router.mjs) (Part API Router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and Parts"]
  node_server["fount Server<br/>[server.mjs]"]
  node_partload["Part Loader<br/>[parts_loader.mjs]"]
  node_router["Part API Router<br/>[parts_router.mjs]"]
  node_auth["Authentication<br/>[index.mjs]"]
end

subgraph group_conversation["Conversation and Agents"]
  node_chat["Chat Shell"]
  node_trigger["Reply Triggers"]
  node_character["ZL-31 Character<br/>[main.mjs]"]
  node_prompt["Prompt Builder"]
  node_reply["Reply Handlers"]
  node_agentstudio["Agent Studio"]
end

subgraph group_extensions["Services and Plugins"]
  node_ai["AI Sources<br/>[AIsource.ts]"]
  node_services["Search and Translation"]
  node_plugins["Agent Plugins"]
  node_pluginapi["Plugin API<br/>[pluginAPI.ts]"]
  node_importers["Part Importers"]
end

subgraph group_community["Community and Content"]
  node_social["Social and Federation"]
  node_chatstorage[("Chat File Storage<br/>[storage.mjs]")]
  node_worlds["World Parts<br/>[main.mjs]"]
  node_export["Report Export<br/>[manager.mjs]"]
end

subgraph group_operations["Interfaces and Operations"]
  node_logviewer["Terminal Log Viewer<br/>[index.mjs]"]
  node_logrender["Log Rendering<br/>[render.mjs]"]
end

node_user(("User"))

node_user -.->|"sends messages"| node_chat
node_chat -.->|"triggers replies"| node_trigger
node_trigger -->|"resolves character"| node_character
node_character -->|"loads configured parts"| node_partload
node_character -->|"builds prompt"| node_prompt
node_character -->|"requests generation"| node_ai
node_character -->|"runs reply handlers"| node_reply
node_reply -->|"executes tools"| node_plugins
node_plugins -.->|"uses contracts"| node_pluginapi
node_server -->|"loads default parts"| node_partload
node_router -->|"authenticates requests"| node_auth
node_router -->|"loads requested part"| node_partload
node_user -.->|"imports parts"| node_importers
node_user -.->|"shares and chats"| node_social
node_social -.->|"shares files"| node_chatstorage
node_user -.->|"exports reports"| node_export
node_user -.->|"configures agents"| node_agentstudio
node_character -.->|"uses world context"| node_worlds
node_server -.->|"streams logs"| node_logviewer
node_logviewer -->|"renders output"| node_logrender

click node_server "https://github.com/steve02081504/fount/blob/master/src/server/server.mjs"
click node_partload "https://github.com/steve02081504/fount/blob/master/src/server/parts_loader.mjs"
click node_router "https://github.com/steve02081504/fount/blob/master/src/server/web_server/parts_router.mjs"
click node_auth "https://github.com/steve02081504/fount/blob/master/src/server/auth/index.mjs"
click node_chat "https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/chat"
click node_trigger "https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/chat/src/chat/session/triggerPipeline.mjs"
click node_character "https://github.com/steve02081504/fount/blob/master/default/templates/user/chars/ZL-31/main.mjs"
click node_prompt "https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/chat/src/prompt_struct"
click node_reply "https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/chat/src/reply/handlerPipeline.mjs"
click node_ai "https://github.com/steve02081504/fount/blob/master/src/decl/AIsource.ts"
click node_services "https://github.com/steve02081504/fount/tree/master/src/public/parts/serviceGenerators"
click node_plugins "https://github.com/steve02081504/fount/tree/master/src/public/parts/plugins"
click node_pluginapi "https://github.com/steve02081504/fount/blob/master/src/decl/pluginAPI.ts"
click node_importers "https://github.com/steve02081504/fount/tree/master/src/public/parts/ImportHandlers"
click node_social "https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/social"
click node_chatstorage "https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/chat/src/chat/storage.mjs"
click node_worlds "https://github.com/steve02081504/fount/blob/master/default/templates/user/worlds/fount/main.mjs"
click node_export "https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/export/src/manager.mjs"
click node_agentstudio "https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/agent_studio"
click node_logviewer "https://github.com/steve02081504/fount/blob/master/src/log_viewer/index.mjs"
click node_logrender "https://github.com/steve02081504/fount/blob/master/src/log_viewer/render.mjs"

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_server,node_partload,node_router,node_auth,node_user toneBlue
class node_chat,node_trigger,node_character,node_prompt,node_reply,node_agentstudio toneAmber
class node_ai,node_services,node_plugins,node_pluginapi,node_importers toneMint
class node_social,node_chatstorage,node_worlds,node_export toneRose
class node_logviewer,node_logrender toneIndigo
```

## Components

### Runtime and Parts

- [fount Server](https://github.com/steve02081504/fount/blob/master/src/server/server.mjs): `src/server/server.mjs`
- [Part Loader](https://github.com/steve02081504/fount/blob/master/src/server/parts_loader.mjs): `src/server/parts_loader.mjs`
- [Part API Router](https://github.com/steve02081504/fount/blob/master/src/server/web_server/parts_router.mjs): `src/server/web_server/parts_router.mjs`
- [Authentication](https://github.com/steve02081504/fount/blob/master/src/server/auth/index.mjs): `src/server/auth/index.mjs`

### Conversation and Agents

- [Chat Shell](https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/chat): `src/public/parts/shells/chat`
- [Reply Triggers](https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/chat/src/chat/session/triggerPipeline.mjs): `src/public/parts/shells/chat/src/chat/session/triggerPipeline.mjs`
- [ZL-31 Character](https://github.com/steve02081504/fount/blob/master/default/templates/user/chars/ZL-31/main.mjs): `default/templates/user/chars/ZL-31/main.mjs`
- [Prompt Builder](https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/chat/src/prompt_struct): `src/public/parts/shells/chat/src/prompt_struct`
- [Reply Handlers](https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/chat/src/reply/handlerPipeline.mjs): `src/public/parts/shells/chat/src/reply/handlerPipeline.mjs`
- [Agent Studio](https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/agent_studio): `src/public/parts/shells/agent_studio`

### Services and Plugins

- [AI Sources](https://github.com/steve02081504/fount/blob/master/src/decl/AIsource.ts): `src/decl/AIsource.ts`
- [Search and Translation](https://github.com/steve02081504/fount/tree/master/src/public/parts/serviceGenerators): `src/public/parts/serviceGenerators`
- [Agent Plugins](https://github.com/steve02081504/fount/tree/master/src/public/parts/plugins): `src/public/parts/plugins`
- [Plugin API](https://github.com/steve02081504/fount/blob/master/src/decl/pluginAPI.ts): `src/decl/pluginAPI.ts`
- [Part Importers](https://github.com/steve02081504/fount/tree/master/src/public/parts/ImportHandlers): `src/public/parts/ImportHandlers`

### Community and Content

- [Social and Federation](https://github.com/steve02081504/fount/tree/master/src/public/parts/shells/social): `src/public/parts/shells/social`
- [Chat File Storage](https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/chat/src/chat/storage.mjs): `src/public/parts/shells/chat/src/chat/storage.mjs`
- [World Parts](https://github.com/steve02081504/fount/blob/master/default/templates/user/worlds/fount/main.mjs): `default/templates/user/worlds/fount/main.mjs`
- [Report Export](https://github.com/steve02081504/fount/blob/master/src/public/parts/shells/export/src/manager.mjs): `src/public/parts/shells/export/src/manager.mjs`

### Interfaces and Operations

- [Terminal Log Viewer](https://github.com/steve02081504/fount/blob/master/src/log_viewer/index.mjs): `src/log_viewer/index.mjs`
- [Log Rendering](https://github.com/steve02081504/fount/blob/master/src/log_viewer/render.mjs): `src/log_viewer/render.mjs`

### Other components

- **User**

## Connections

- User → Chat Shell: sends messages
- Chat Shell → Reply Triggers: triggers replies (evidence: `src/public/parts/shells/chat/src/chat/session/triggerPipeline.mjs`)
- Reply Triggers → ZL-31 Character: resolves character (evidence: `src/public/parts/shells/chat/src/chat/session/triggerPipeline.mjs`)
- ZL-31 Character → Part Loader: loads configured parts (evidence: `default/templates/user/chars/ZL-31/main.mjs`)
- ZL-31 Character → Prompt Builder: builds prompt (evidence: `default/templates/user/chars/ZL-31/main.mjs`)
- ZL-31 Character → AI Sources: requests generation (evidence: `default/templates/user/chars/ZL-31/main.mjs`)
- ZL-31 Character → Reply Handlers: runs reply handlers (evidence: `default/templates/user/chars/ZL-31/main.mjs`)
- Reply Handlers → Agent Plugins: executes tools (evidence: `src/public/parts/shells/chat/src/reply/handlerPipeline.mjs`)
- Agent Plugins → Plugin API: uses contracts
- fount Server → Part Loader: loads default parts (evidence: `src/server/server.mjs`)
- Part API Router → Authentication: authenticates requests (evidence: `src/server/web_server/parts_router.mjs`)
- Part API Router → Part Loader: loads requested part (evidence: `src/server/web_server/parts_router.mjs`)
- User → Part Importers: imports parts
- User → Social and Federation: shares and chats
- Social and Federation → Chat File Storage: shares files
- User → Report Export: exports reports
- User → Agent Studio: configures agents
- ZL-31 Character → World Parts: uses world context (evidence: `default/templates/user/worlds/fount/main.mjs`)
- fount Server → Terminal Log Viewer: streams logs (evidence: `src/log_viewer/index.mjs`)
- Terminal Log Viewer → Log Rendering: renders output (evidence: `src/log_viewer/index.mjs`)
