# danielmiessler/fabric architecture

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

- Interactive diagram: https://gitdiagram.com/danielmiessler/fabric
- Repository: https://github.com/danielmiessler/fabric

## Overview

Fabric is an AI-augmentation framework centered on reusable task patterns. Users submit prompts or media through the CLI or Svelte web UI; the server routes requests into chat orchestration, pattern/extension processing, and configurable AI-provider plugins, returning streamed or structured results. Sessions, contexts, patterns, and notes persist through filesystem-backed storage. The tree and excerpts establish web-to-REST forwarding, storage delegation, extension execution, YouTube transcript retrieval, and file-change parsing; several deeper server orchestration calls are represented conservatively from their module boundaries.

Main entry points: [`internal/server/chat.go`](https://github.com/danielmiessler/fabric/blob/main/internal/server/chat.go) (REST Chat API), [`internal/core/chatter.go`](https://github.com/danielmiessler/fabric/blob/main/internal/core/chatter.go) (Chat Orchestrator), [`web/src/lib/components/chat/Chat.svelte`](https://github.com/danielmiessler/fabric/blob/main/web/src/lib/components/chat/Chat.svelte) (Web Chat UI), [`web/src/routes/chat/+server.ts`](https://github.com/danielmiessler/fabric/blob/main/web/src/routes/chat/%2Bserver.ts) (Chat Web Route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_cli["Fabric CLI<br/>[cli.go]"]
  node_web_ui["Web Chat UI<br/>[Chat.svelte]"]
  node_chat_route["Chat Web Route<br/>[+server.ts]"]
end

subgraph group_orchestration["Core Orchestration"]
  node_rest_chat["REST Chat API<br/>[chat.go]"]
  node_chatter["Chat Orchestrator<br/>[chatter.go]"]
  node_pattern_engine["Pattern Engine<br/>[template.go]"]
  node_plugin_registry["Plugin Registry<br/>[plugin_registry.go]"]
  node_pattern_api["Pattern API<br/>[patterns.go]"]
  node_context_api["Context API<br/>[contexts.go]"]
end

subgraph group_providers["AI Providers"]
  node_ai_plugins["AI Provider Plugins<br/>[vendors.go]"]
end

subgraph group_state["State and Content"]
  node_storage_api["Storage Handlers<br/>[storage.go]"]
  node_fsdb[("Filesystem Database<br/>[storage.go]")]
  node_session_ui["Session Manager"]
  node_sessions[("Session Storage<br/>[sessions.go]")]
  node_file_manager["File Change Manager<br/>[file_manager.go]"]
  node_notes_files[("User Note Files")]
end

subgraph group_integrations["Integrations"]
  node_extension_manager["Extension Manager"]
  node_extension_registry[("Extension Registry")]
  node_extension_executor["Extension Executor"]
  node_youtube_route["YouTube Route<br/>[+server.ts]"]
  node_notes_route["Notes Endpoint<br/>[+server.ts]"]
  node_obsidian_route["Obsidian Endpoint<br/>[+server.ts]"]
end

node_user(("User"))
node_ai_services["AI Services"]
node_youtube["YouTube Transcript"]

node_user -->|"submits prompts"| node_cli
node_user -->|"enters prompts"| node_web_ui
node_web_ui -->|"posts requests"| node_chat_route
node_chat_route -->|"forwards requests"| node_rest_chat
node_chat_route -.->|"fetches transcripts"| node_youtube
node_youtube_route -->|"fetches transcripts"| node_youtube
node_cli -->|"dispatches chat"| node_chatter
node_rest_chat -->|"dispatches chat"| node_chatter
node_chatter -->|"applies pattern"| node_pattern_engine
node_chatter -->|"requests completion"| node_ai_plugins
node_ai_plugins -->|"calls models"| node_ai_services
node_pattern_engine -.->|"processes extensions"| node_extension_manager
node_extension_manager -->|"loads registry"| node_extension_registry
node_extension_manager -->|"executes operation"| node_extension_executor
node_rest_chat -->|"manages state"| node_storage_api
node_storage_api -->|"reads and writes"| node_fsdb
node_session_ui -->|"loads sessions"| node_sessions
node_rest_chat -.->|"serves patterns"| node_pattern_api
node_rest_chat -.->|"serves contexts"| node_context_api
node_chatter -.->|"applies file changes"| node_file_manager
node_web_ui -.->|"saves notes"| node_notes_route
node_web_ui -.->|"exports notes"| node_obsidian_route
node_notes_route -->|"writes files"| node_notes_files
node_obsidian_route -->|"writes files"| node_notes_files

click node_cli "https://github.com/danielmiessler/fabric/blob/main/internal/cli/cli.go"
click node_web_ui "https://github.com/danielmiessler/fabric/blob/main/web/src/lib/components/chat/Chat.svelte"
click node_chat_route "https://github.com/danielmiessler/fabric/blob/main/web/src/routes/chat/%2Bserver.ts"
click node_rest_chat "https://github.com/danielmiessler/fabric/blob/main/internal/server/chat.go"
click node_chatter "https://github.com/danielmiessler/fabric/blob/main/internal/core/chatter.go"
click node_pattern_engine "https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/template.go"
click node_plugin_registry "https://github.com/danielmiessler/fabric/blob/main/internal/core/plugin_registry.go"
click node_pattern_api "https://github.com/danielmiessler/fabric/blob/main/internal/server/patterns.go"
click node_context_api "https://github.com/danielmiessler/fabric/blob/main/internal/server/contexts.go"
click node_ai_plugins "https://github.com/danielmiessler/fabric/blob/main/internal/plugins/ai/vendors.go"
click node_storage_api "https://github.com/danielmiessler/fabric/blob/main/internal/server/storage.go"
click node_fsdb "https://github.com/danielmiessler/fabric/blob/main/internal/plugins/db/fsdb/storage.go"
click node_session_ui "https://github.com/danielmiessler/fabric/blob/main/web/src/lib/components/chat/SessionManager.svelte"
click node_sessions "https://github.com/danielmiessler/fabric/blob/main/internal/plugins/db/fsdb/sessions.go"
click node_file_manager "https://github.com/danielmiessler/fabric/blob/main/internal/domain/file_manager.go"
click node_extension_manager "https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/extension_manager.go"
click node_extension_registry "https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/extension_registry.go"
click node_extension_executor "https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/extension_executor.go"
click node_youtube_route "https://github.com/danielmiessler/fabric/blob/main/web/src/routes/api/youtube/transcript/%2Bserver.ts"
click node_notes_route "https://github.com/danielmiessler/fabric/blob/main/web/src/routes/notes/%2Bserver.ts"
click node_obsidian_route "https://github.com/danielmiessler/fabric/blob/main/web/src/routes/obsidian/%2Bserver.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_cli,node_web_ui,node_chat_route,node_user toneBlue
class node_rest_chat,node_chatter,node_pattern_engine,node_plugin_registry,node_pattern_api,node_context_api toneAmber
class node_ai_plugins toneMint
class node_storage_api,node_fsdb,node_session_ui,node_sessions,node_file_manager,node_notes_files toneRose
class node_extension_manager,node_extension_registry,node_extension_executor,node_youtube_route,node_notes_route,node_obsidian_route,node_ai_services,node_youtube toneIndigo
```

## Components

### User Interfaces

- [Fabric CLI](https://github.com/danielmiessler/fabric/blob/main/internal/cli/cli.go): `internal/cli/cli.go`
- [Web Chat UI](https://github.com/danielmiessler/fabric/blob/main/web/src/lib/components/chat/Chat.svelte): `web/src/lib/components/chat/Chat.svelte`
- [Chat Web Route](https://github.com/danielmiessler/fabric/blob/main/web/src/routes/chat/%2Bserver.ts): `web/src/routes/chat/+server.ts`

### Core Orchestration

- [REST Chat API](https://github.com/danielmiessler/fabric/blob/main/internal/server/chat.go): `internal/server/chat.go`
- [Chat Orchestrator](https://github.com/danielmiessler/fabric/blob/main/internal/core/chatter.go): `internal/core/chatter.go`
- [Pattern Engine](https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/template.go): `internal/plugins/template/template.go`
- [Plugin Registry](https://github.com/danielmiessler/fabric/blob/main/internal/core/plugin_registry.go): `internal/core/plugin_registry.go`
- [Pattern API](https://github.com/danielmiessler/fabric/blob/main/internal/server/patterns.go): `internal/server/patterns.go`
- [Context API](https://github.com/danielmiessler/fabric/blob/main/internal/server/contexts.go): `internal/server/contexts.go`

### AI Providers

- [AI Provider Plugins](https://github.com/danielmiessler/fabric/blob/main/internal/plugins/ai/vendors.go): `internal/plugins/ai/vendors.go`

### State and Content

- [Storage Handlers](https://github.com/danielmiessler/fabric/blob/main/internal/server/storage.go): `internal/server/storage.go`
- [Filesystem Database](https://github.com/danielmiessler/fabric/blob/main/internal/plugins/db/fsdb/storage.go): `internal/plugins/db/fsdb/storage.go`
- [Session Manager](https://github.com/danielmiessler/fabric/blob/main/web/src/lib/components/chat/SessionManager.svelte): `web/src/lib/components/chat/SessionManager.svelte`
- [Session Storage](https://github.com/danielmiessler/fabric/blob/main/internal/plugins/db/fsdb/sessions.go): `internal/plugins/db/fsdb/sessions.go`
- [File Change Manager](https://github.com/danielmiessler/fabric/blob/main/internal/domain/file_manager.go): `internal/domain/file_manager.go`
- **User Note Files**

### Integrations

- [Extension Manager](https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/extension_manager.go): `internal/plugins/template/extension_manager.go`
- [Extension Registry](https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/extension_registry.go): `internal/plugins/template/extension_registry.go`
- [Extension Executor](https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/extension_executor.go): `internal/plugins/template/extension_executor.go`
- [YouTube Route](https://github.com/danielmiessler/fabric/blob/main/web/src/routes/api/youtube/transcript/%2Bserver.ts): `web/src/routes/api/youtube/transcript/+server.ts`
- [Notes Endpoint](https://github.com/danielmiessler/fabric/blob/main/web/src/routes/notes/%2Bserver.ts): `web/src/routes/notes/+server.ts`
- [Obsidian Endpoint](https://github.com/danielmiessler/fabric/blob/main/web/src/routes/obsidian/%2Bserver.ts): `web/src/routes/obsidian/+server.ts`

### Other components

- **User**
- **AI Services**
- **YouTube Transcript**

## Connections

- User → Fabric CLI: submits prompts
- User → Web Chat UI: enters prompts
- Web Chat UI → Chat Web Route: posts requests
- Chat Web Route → REST Chat API: forwards requests
- Chat Web Route → YouTube Transcript: fetches transcripts
- YouTube Route → YouTube Transcript: fetches transcripts
- Fabric CLI → Chat Orchestrator: dispatches chat
- REST Chat API → Chat Orchestrator: dispatches chat
- Chat Orchestrator → Pattern Engine: applies pattern
- Chat Orchestrator → AI Provider Plugins: requests completion
- AI Provider Plugins → AI Services: calls models
- Pattern Engine → Extension Manager: processes extensions
- Extension Manager → Extension Registry: loads registry
- Extension Manager → Extension Executor: executes operation
- REST Chat API → Storage Handlers: manages state
- Storage Handlers → Filesystem Database: reads and writes
- Session Manager → Session Storage: loads sessions
- REST Chat API → Pattern API: serves patterns
- REST Chat API → Context API: serves contexts
- Chat Orchestrator → File Change Manager: applies file changes
- Web Chat UI → Notes Endpoint: saves notes
- Web Chat UI → Obsidian Endpoint: exports notes
- Notes Endpoint → User Note Files: writes files
- Obsidian Endpoint → User Note Files: writes files
