danielmiessler/Fabric

▲ 10 stars today★ 44,147⑂ 4,293

Fabric is an open-source framework for augmenting humans using AI. It provides a modular system for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere.

About danielmiessler/Fabric

danielmiessler/Fabric is an open-source project on GitHub, mainly written in Go. Fabric is an open-source framework for augmenting humans using AI. It provides a modular system for solving specific problems using a crowdsourced set of AI It currently holds 44,147 stars and 4,293 forks with 0 open issues, and was last pushed on an unknown date (repository created unknown).

Project Overview

AI Homed tracks it on the Today's Trending board, currently at rank #60 with 10 new stars today.

GitHub Repository Details

Repository danielmiessler/Fabric · default branch - · size 0 KB · watchers 0 · source: GitHub REST API and repository README

README

Special thanks to:
https://github.com/danielmiessler/Fabric/blob/HEAD/Warp sponsorship
Warp, built for coding with multiple AI agents
Available for macOS, Linux and Windows


https://github.com/danielmiessler/Fabric/blob/HEAD/fabriclogo

fabric

Static Badge
GitHub top language GitHub last commit License: MIT Ask DeepWiki

fabric is an open-source framework for augmenting humans using AI.

English · 中文

Screenshot of fabric

Updates • What and Why • Philosophy • Installation • Usage • REST API • Examples • Just Use the Patterns • Custom Patterns • Helper Apps • Meta

What and why

Since the start of modern AI in late 2022 we've seen an _extraordinary_ number of AI applications for accomplishing tasks. There are thousands of websites, chat-bots, mobile apps, and other interfaces for using all the different AI out there.

It's all really exciting and powerful, but _it's not easy to integrate this functionality into our lives._

In other words, AI doesn't have a capabilities problem—it has an integration problem.

Fabric was created to address this by creating and organizing the fundamental units of AI—the prompts themselves!

Fabric organizes prompts by real-world task, allowing people to create, collect, and organize their most important AI solutions in a single place for use in their favorite tools. And if you're command-line focused, you can use Fabric itself as the interface!

Updates

For a deep dive into Fabric and its internals, read the documentation in the docs folder. There is also the extremely useful and regularly updated DeepWiki for Fabric.

Click to view recent updates

Dear Users,

We've been doing so many exciting things here at Fabric, I wanted to give a quick summary here to give you a sense of our development velocity!

Below are the new features and capabilities we've added (newest first):

Recent Major Features

models (see RouteLLM APIs). ja (Japanese), pt (Portuguese), zh (Chinese) These features represent our commitment to making Fabric the most powerful and flexible AI augmentation framework available!

Intro videos

Keep in mind that many of these were recorded when Fabric was Python-based, so remember to use the current install instructions below.

Navigation


Changelog

Fabric is evolving rapidly.

Stay current with the latest features by reviewing the CHANGELOG for all recent changes.

Philosophy

AI isn't a thing; it's a _magnifier_ of a thing. And that thing is human creativity.

We believe the purpose of technology is to help humans flourish, so when we talk about AI we start with the human problems we want to solve.

Breaking problems into components

Our approach is to break problems into individual pieces (see below) and then apply AI to them one at a time. See below for some examples.

https://github.com/danielmiessler/Fabric/blob/HEAD/augmented_challenges

Too many prompts

Prompts are good for this, but the biggest challenge I faced in 2023——which still exists today—is the sheer number of AI prompts out there. We all have prompts that are useful, but it's hard to discover new ones, know if they are good or not, _and manage different versions of the ones we like_.

One of fabric's primary features is helping people collect and integrate prompts, which we call _Patterns_, into various parts of their lives.

Fabric has Patterns for all sorts of life and work activities, including:

Installation

One-Line Install (Recommended)

Unix/Linux/macOS:

curl -fsSL https://raw.githubusercontent.com/danielmiessler/fabric/main/scripts/installer/install.sh | bash

Windows PowerShell:

iwr -useb https://raw.githubusercontent.com/danielmiessler/fabric/main/scripts/installer/install.ps1 | iex
See scripts/installer/README.md for custom installation options and troubleshooting.

Manual Binary Downloads

The latest release binary archives and their expected SHA256 hashes can be found at

Using package managers

NOTE: using Homebrew or the Arch Linux package managers makes fabric available as fabric-ai, so add the following alias to your shell startup files to account for this:

alias fabric='fabric-ai'

macOS (Homebrew)

brew install fabric-ai

Arch Linux (AUR)

yay -S fabric-ai

Windows

Use the official Microsoft supported Winget tool:

winget install danielmiessler.Fabric

Windows (Scoop)

scoop install fabric-ai

From Source

To install Fabric, make sure Go is installed, and then run the following command.

# Install Fabric directly from the repo
go install github.com/danielmiessler/fabric/cmd/fabric@latest

Docker

Run Fabric using pre-built Docker images:

# Use latest image from Docker Hub
docker run --rm -it kayvan/fabric:latest --version

Use specific version from GHCR

docker run --rm -it ghcr.io/ksylvan/fabric:v1.4.305 --version

Run setup (first time)

mkdir -p $HOME/.fabric-config docker run --rm -it -v $HOME/.fabric-config:/home/appuser/.config/fabric kayvan/fabric:latest --setup

Use Fabric with your patterns

docker run --rm -it -v $HOME/.fabric-config:/home/appuser/.config/fabric kayvan/fabric:latest -p summarize

Run the REST API server (see REST API Server section)

docker run --rm -it -p 8080:8080 -v $HOME/.fabric-config:/home/appuser/.config/fabric kayvan/fabric:latest --serve

Images available at:

See scripts/docker/README.md for building custom images and advanced configuration.

Environment Variables

You may need to set some environment variables in your ~/.bashrc on linux or ~/.zshrc file on mac to be able to run the fabric command. Here is an example of what you can add:

For Intel based macs or linux

# Golang environment variables
export GOROOT=/usr/local/go
export GOPATH=$HOME/go

Update PATH to include GOPATH and GOROOT binaries

export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH

for Apple Silicon based macs

# Golang environment variables
export GOROOT=$(brew --prefix go)/libexec
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:$GOROOT/bin:$HOME/.local/bin:$PATH

Setup

Now run the following command

# Run the setup to set up your directories and keys
fabric --setup

If everything works you are good to go.

Supported AI Providers

Fabric supports a wide range of AI providers:

Native Integrations:

OpenAI-Compatible Providers: Run fabric --setup to configure your preferred provider(s), or use fabric --listvendors to see all available vendors.

Per-Pattern Model Mapping

You can configure specific models for individual patterns using environment variables like FABRIC_MODEL_PATTERN_NAME=vendor|model

This makes it easy to maintain these per-pattern model mappings in your shell startup files.

Add aliases for all patterns

In order to add aliases for all your patterns and use them directly as commands, for example, summarize instead of fabric --pattern summarize You can add the following to your .zshrc or .bashrc file. You can also optionally set the FABRIC_ALIAS_PREFIX environment variable before, if you'd prefer all the fabric aliases to start with the same prefix.

# Loop through all files in the ~/.config/fabric/patterns directory
for pattern_file in $HOME/.config/fabric/patterns/*; do
    # Get the base name of the file (i.e., remove the directory path)
    pattern_name="$(basename "$pattern_file")"
    alias_name="${FABRIC_ALIAS_PREFIX:-}${pattern_name}"

# Create an alias in the form: alias pattern_name="fabric --pattern pattern_name" alias_command="alias $alias_name='fabric --pattern $pattern_name'"

# Evaluate the alias command to add it to the current shell eval "$alias_command" done

yt() { if [ "$#" -eq 0 ] || [ "$#" -gt 2 ]; then echo "Usage: yt [-t | --timestamps] youtube-link" echo "Use the '-t' flag to get the transcript with timestamps." return 1 fi

transcript_flag="--transcript" if [ "$1" = "-t" ] || [ "$1" = "--timestamps" ]; then transcript_flag="--transcript-with-timestamps" shift fi local video_link="$1" fabric -y "$video_link" $transcript_flag }

You can add the below code for the equivalent aliases inside PowerShell by running notepad $PROFILE inside a PowerShell window:

# Path to the patterns directory
$patternsPath = Join-Path $HOME ".config/fabric/patterns"
foreach ($patternDir in Get-ChildItem -Path $patternsPath -Directory) {
    # Prepend FABRIC_ALIAS_PREFIX if set; otherwise use empty string
    $prefix = $env:FABRIC_ALIAS_PREFIX ?? ''
    $patternName = "$($patternDir.Name)"
    $aliasName = "$prefix$patternName"
    # Dynamically define a function for each pattern
    $functionDefinition = @"
function $aliasName {
    [CmdletBinding()]
    param(
        [Parameter(ValueFromPipeline = `$true)]
        [string] `$InputObject,

[Parameter(ValueFromRemainingArguments = `$true)] [String[]] `$patternArgs )

begin { # Initialize an array to collect pipeline input `$collector = @() }

process { # Collect pipeline input objects if (`$InputObject) { $collector += $InputObject } }

end { # Join all pipeline input into a single string, separated by newlines $pipelineContent = $collector -join "`n"

# If there's pipeline input, include it in the call to fabric if (`$pipelineContent) { $pipelineContent | fabric --pattern $patternName $patternArgs } else { # No pipeline input; just call fabric with the additional args fabric --pattern $patternName `$patternArgs } } } "@ # Add the function to the current session Invoke-Expression $functionDefinition }

Define the 'yt' function as well

function yt { [CmdletBinding()] param( [Parameter()] [Alias("timestamps")] [switch]$t,

[Parameter(Position = 0, ValueFromPipeline = $true)] [string]$videoLink )

begin { $transcriptFlag = "--transcript" if ($t) { $transcriptFlag = "--transcript-with-timestamps" } }

process { if (-not $videoLink) { Write-Error "Usage: yt [-t | --timestamps] youtube-link" return } }

end { if ($videoLink) { # Execute and allow output to flow through the pipeline fabric -y $videoLink $transcriptFlag } } }

This also creates a yt alias that allows you to use yt https://www.youtube.com/watch?v=4b0iet22VIk to get transcripts, comments, and metadata.

Save your files in markdown using aliases

If in addition to the above aliases you would like to have the option to save the output to your favorite markdown note vault like Obsidian then instead of the above add the following to your .zshrc or .bashrc file:

# Define the base directory for Obsidian notes
obsidian_base="/path/to/obsidian"

Loop through all files in the ~/.config/fabric/patterns directory

for pattern_file in ~/.config/fabric/patterns/*; do # Get the base name of the file (i.e., remove the directory path) pattern_name=$(basename "$pattern_file")

# Remove any existing alias with the same name unalias "$pattern_name" 2>/dev/null

# Define a function dynamically for each pattern eval " $pattern_name() { local title=\$1 local date_stamp=\$(date +'%Y-%m-%d') local output_path=\"\$obsidian_base/\${date_stamp}-\${title}.md\"

# Check if a title was provided if [ -n \"\$title\" ]; then # If a title is provided, use the output path fabric --pattern \"$pattern_name\" -o \"\$output_path\" else # If no title is provided, use --stream fabric --pattern \"$pattern_name\" --stream fi } " done

This will allow you to use the patterns as aliases like in the above for example summarize instead of fabric --pattern summarize --stream, however if you pass in an extra argument like this summarize "my_article_title" your output will be saved in the destination that you set in obsidian_base="/path/to/obsidian" in the following format YYYY-MM-DD-my_article_title.md where the date gets autogenerated for you. You can tweak the date format by tweaking the date_stamp format.

Migration

If you have the Legacy (Python) version installed and want to migrate to the Go version, here's how you do it. It's basically two steps: 1) uninstall the Python version, and 2) install the Go version.

```bash

Uninstall Legacy Fabric

pipx uninstall fabric

Clear any old Fabric aliases

(check your .bashrc, .zshrc, etc.)

Install the Go ver

GitHub Stars & Activity

44,147Stars
4,293Forks
0Open issues
GoLanguage

GitHub Popularity

GitHub stars44,147
Forks4,293
Open issues0
Primary languageGo
License-
Stars gained today10
Created-
Last pushed-

Trending History

Daily boardrank #60 · ▲ 10 stars

Related AI Projects

1

JuliusBrussee / caveman

Go★ 109,003⑂ 6,314▲ 271 stars
→
2

lharries / whatsapp-mcp

Go★ 6,375⑂ 1,353▲ 24 stars
→
3

github / gh-aw

Go★ 5,334⑂ 573▲ 12 stars
→
4

tphakala / birdnet-go

Go★ 2,233⑂ 186▲ 10 stars
→
5

grafana / gcx

Go★ 758⑂ 56▲ 3 stars
→
6

obra / superpowers

Shell★ 294,369⑂ 26,315▲ 561 stars
→
7

mattpocock / skills

Shell★ 274,594⑂ 23,053▲ 955 stars
→
8

affaan-m / ECC

JavaScript★ 271,104⑂ 40,507▲ 572 stars
→

More AI Rankings