$ show danielmiessler/Fabric
Fabric is an open-source framework for augmenting humans using AI, centered on a large library of crowdsourced prompt templates called 'patterns'. The system provides a CLI tool, a REST API server, and a SvelteKit web UI, all sharing a common pattern engine that applies structured prompts to user input (text, URLs, YouTube videos, PDFs, images). The architecture is modular: a plugin registry manages AI vendor adapters (OpenAI, Anthropic, Gemini, Ollama, Azure, Bedrock, Vertex AI, and 25+ OpenAI-compatible providers), a template engine supports variable substitution and executable extensions, and a filesystem-backed storage layer handles patterns, sessions, and contexts with path-traversal protection. Key entry points include the Go CLI (`cmd/fabric`), the Gin-based REST API (`internal/server`), and the SvelteKit web app (`web/`). External dependencies span multiple AI SDKs, web scraping libraries (go-readability), YouTube transcription (yt-dlp), and SQLite for caching. The pattern library itself is a data asset with over 100 markdown files, each defining identity, steps, and output instructions for tasks like summarization, analysis, code review, and creative writing.
The LLM identified 5 files worth highlighting for reuse:
Core template engine that processes double-brace syntax (`{{variable}}`) with recursive resolution, plugin operations (text, datetime, file, fetch, sys), and user-defined executable extensions. Demonstrates clean separation of concerns via a plugin registry and extension manager with SHA-256 integrity verification. Reusable in any Go project needing dynamic content generation with sandboxed external calls.
Generic filesystem-backed storage entity with CRUD operations, name validation, symlink escape rejection, and path traversal protection. Used for patterns, sessions, and contexts. The `StorageEntity` pattern is a reusable building block for any application needing simple, secure file-based persistence without a full database.
Structured streaming abstraction using `StreamUpdate` types (content, usage, error) and Go channels. Normalizes streaming responses from diverse AI vendors into a uniform interface, enabling SSE and NDJSON conversion. This pattern is reusable for any multi-provider streaming integration, decoupling transport from business logic.
Lightweight i18n helper with POSIX locale detection, BCP47 normalization, Portuguese variant support (pt-BR/pt-PT), and fallback to raw GitHub locale files. The `i18n.T()` function is used pervasively across the codebase. This module can be extracted as a standalone localization library for Go applications needing minimal-dependency i18n.
Cross-platform desktop notification provider supporting macOS (osascript), Linux (notify-send), and Windows (PowerShell). Uses environment variable injection safely and handles Unicode truncation. This is a self-contained utility that can be reused in any Go CLI tool requiring desktop alerts.
The divergent implementation improves upon the typical pattern by introducing structured types like `AddUrlArgs` and `Status` which enhance type safety and clarity. It also refines the `Tool` interface with more specific method signatures that better encapsulate the download workflow, such as `AddURL` taking a structured argument and `Status` returning detailed progress information. These changes make the API more predictable and easier to use correctly compared to the more generic and less typed approach in typical implementations.