• Stars
    star
    4,566
  • Rank 8,857 (Top 0.2 %)
  • Language
    Python
  • License
    MIT License
  • Created 4 months ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

fabric

Static Badge
GitHub top language GitHub last commit License: MIT

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

Introduction Video • What and Why • Philosophy • Quickstart • Structure • Examples • Meta

Navigation


Note

We are adding functionality to the project so often that you should update often as well. That means: git pull; pipx upgrade fabric; fabric --update; source ~/.zshrc (or ~/.bashrc) in the main directory!

March 13, 2024 — We just added pipx install support, which makes it way easier to install Fabric, support for Claude, local models via Ollama, and a number of new Patterns. Be sure to update and check fabric -h for the latest!

Introduction videos

Note

These videos use the ./setup.sh install method, which is now replaced with the easier pipx install . method. Other than that everything else is still the same.

What and why

Since the start of 2023 and GenAI we've seen a massive number of AI applications for accomplishing tasks. It's 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 enabling everyone to granularly apply AI to everyday challenges.

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.

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:

  • Extracting the most interesting parts of YouTube videos and podcasts
  • Writing an essay in your own voice with just an idea as an input
  • Summarizing opaque academic papers
  • Creating perfectly matched AI art prompts for a piece of writing
  • Rating the quality of content to see if you want to read/watch the whole thing
  • Getting summaries of long, boring content
  • Explaining code to you
  • Turning bad documentation into usable documentation
  • Creating social media posts from any content input
  • And a million more…

Our approach to prompting

Fabric Patterns are different than most prompts you'll see.

  • First, we use Markdown to help ensure maximum readability and editability. This not only helps the creator make a good one, but also anyone who wants to deeply understand what it does. Importantly, this also includes the AI you're sending it to!

Here's an example of a Fabric Pattern.

https://github.com/danielmiessler/fabric/blob/main/patterns/extract_wisdom/system.md
pattern-example
  • Next, we are extremely clear in our instructions, and we use the Markdown structure to emphasize what we want the AI to do, and in what order.

  • And finally, we tend to use the System section of the prompt almost exclusively. In over a year of being heads-down with this stuff, we've just seen more efficacy from doing that. If that changes, or we're shown data that says otherwise, we will adjust.

Quickstart

The most feature-rich way to use Fabric is to use the fabric client, which can be found under /client directory in this repository.

Setting up the fabric commands

Follow these steps to get all fabric related apps installed and configured.

  1. Navigate to where you want the Fabric project to live on your system in a semi-permanent place on your computer.
# Find a home for Fabric
cd /where/you/keep/code
  1. Clone the project to your computer.
# Clone Fabric to your computer
git clone https://github.com/danielmiessler/fabric.git
  1. Enter Fabric's main directory
# Enter the project folder (where you cloned it)
cd fabric
  1. Install pipx:

macOS:

brew install pipx

Linux:

sudo apt install pipx

Windows:

Use WSL and follow the Linux instructions.

  1. Install fabric
pipx install .
  1. Run setup:
fabric --setup
  1. Restart your shell to reload everything.

  2. Now you are up and running! You can test by running the help.

# Making sure the paths are set up correctly
fabric --help

Note

If you're using the server functions, fabric-api and fabric-webui need to be run in distinct terminal windows.

Using the fabric client

Once you have it all set up, here's how to use it.

  1. Check out the options fabric -h
us the results in
                        realtime. NOTE: You will not be able to pipe the
                        output into another command.
  --list, -l            List available patterns
  --clear               Clears your persistent model choice so that you can
                        once again use the --model flag
  --update, -u          Update patterns. NOTE: This will revert the default
                        model to gpt4-turbo. please run --changeDefaultModel
                        to once again set default model
  --pattern PATTERN, -p PATTERN
                        The pattern (prompt) to use
  --setup               Set up your fabric instance
  --changeDefaultModel CHANGEDEFAULTMODEL
                        Change the default model. For a list of available
                        models, use the --listmodels flag.
  --model MODEL, -m MODEL
                        Select the model to use. NOTE: Will not work if you
                        have set a default model. please use --clear to clear
                        persistence before using this flag
  --listmodels          List all available models
  --remoteOllamaServer REMOTEOLLAMASERVER
                        The URL of the remote ollamaserver to use. ONLY USE
                        THIS if you are using a local ollama server in an non-
                        deault location or port
  --context, -c         Use Context file (context.md) to add context to your
                        pattern
age: fabric [-h] [--text TEXT] [--copy] [--agents {trip_planner,ApiKeys}]
              [--output [OUTPUT]] [--stream] [--list] [--clear] [--update]
              [--pattern PATTERN] [--setup]
              [--changeDefaultModel CHANGEDEFAULTMODEL] [--model MODEL]
              [--listmodels] [--remoteOllamaServer REMOTEOLLAMASERVER]
              [--context]

An open source framework for augmenting humans using AI.

options:
  -h, --help            show this help message and exit
  --text TEXT, -t TEXT  Text to extract summary from
  --copy, -C            Copy the response to the clipboard
  --agents {trip_planner,ApiKeys}, -a {trip_planner,ApiKeys}
                        Use an AI agent to help you with a task. Acceptable
                        values are 'trip_planner' or 'ApiKeys'. This option
                        cannot be used with any other flag.
  --output [OUTPUT], -o [OUTPUT]
                        Save the response to a file
  --stream, -s          Use this option if you want to see

Example commands

The client, by default, runs Fabric patterns without needing a server (the Patterns were downloaded during setup). This means the client connects directly to OpenAI using the input given and the Fabric pattern used.

  1. Run the summarize Pattern based on input from stdin. In this case, the body of an article.
pbpaste | fabric --pattern summarize
  1. Run the analyze_claims Pattern with the --stream option to get immediate and streaming results.
pbpaste | fabric --stream --pattern analyze_claims
  1. new All of the patterns have been added as aliases to your bash (or zsh) config file
pbpaste | analyze_claims --stream

Note

More examples coming in the next few days, including a demo video!

Just use the Patterns

fabric-patterns-screenshot

If you're not looking to do anything fancy, and you just want a lot of great prompts, you can navigate to the /patterns directory and start exploring!

We hope that if you used nothing else from Fabric, the Patterns by themselves will make the project useful.

You can use any of the Patterns you see there in any AI application that you have, whether that's ChatGPT or some other app or website. Our plan and prediction is that people will soon be sharing many more than those we've published, and they will be way better than ours.

The wisdom of crowds for the win.

Create your own Fabric Mill

fabric_mill_architecture

But we go beyond just providing Patterns. We provide code for you to build your very own Fabric server and personal AI infrastructure!

Structure

Fabric is themed off of, well… fabric—as in…woven materials. So, think blankets, quilts, patterns, etc. Here's the concept and structure:

Components

The Fabric ecosystem has three primary components, all named within this textile theme.

  • The Mill is the (optional) server that makes Patterns available.
  • Patterns are the actual granular AI use cases (prompts).
  • Stitches are chained together Patterns that create advanced functionality (see below).
  • Looms are the client-side apps that call a specific Pattern hosted by a Mill.

CLI-native

One of the coolest parts of the project is that it's command-line native!

Each Pattern you see in the /patterns directory can be used in any AI application you use, but you can also set up your own server using the /server code and then call APIs directly!

Once you're set up, you can do things like:

# Take any idea from `stdin` and send it to the `/write_essay` API!
echo "An idea that coding is like speaking with rules." | write_essay

Directly calling Patterns

One key feature of fabric and its Markdown-based format is the ability to _ directly reference_ (and edit) individual patterns directly—on their own—without surrounding code.

As an example, here's how to call the direct location of the extract_wisdom pattern.

https://github.com/danielmiessler/fabric/blob/main/patterns/extract_wisdom/system.md

This means you can cleanly, and directly reference any pattern for use in a web-based AI app, your own code, or wherever!

Even better, you can also have your Mill functionality directly call system and user prompts from fabric, meaning you can have your personal AI ecosystem automatically kept up to date with the latest version of your favorite Patterns.

Here's what that looks like in code:

https://github.com/danielmiessler/fabric/blob/main/server/fabric_api_server.py
# /extwis
@app.route("/extwis", methods=["POST"])
@auth_required  # Require authentication
def extwis():
    data = request.get_json()

    # Warn if there's no input
    if "input" not in data:
        return jsonify({"error": "Missing input parameter"}), 400

    # Get data from client
    input_data = data["input"]

    # Set the system and user URLs
    system_url = "https://raw.githubusercontent.com/danielmiessler/fabric/main/patterns/extract_wisdom/system.md"
    user_url = "https://raw.githubusercontent.com/danielmiessler/fabric/main/patterns/extract_wisdom/user.md"

    # Fetch the prompt content
    system_content = fetch_content_from_url(system_url)
    user_file_content = fetch_content_from_url(user_url)

    # Build the API call
    system_message = {"role": "system", "content": system_content}
    user_message = {"role": "user", "content": user_file_content + "\n" + input_data}
    messages = [system_message, user_message]
    try:
        response = openai.chat.completions.create(
            model="gpt-4-1106-preview",
            messages=messages,
            temperature=0.0,
            top_p=1,
            frequency_penalty=0.1,
            presence_penalty=0.1,
        )
        assistant_message = response.choices[0].message.content
        return jsonify({"response": assistant_message})
    except Exception as e:
        return jsonify({"error": str(e)}), 500

Examples

Here's an abridged output example from the extract_wisdom pattern (limited to only 10 items per section).

# Paste in the transcript of a YouTube video of Riva Tez on David Perrel's podcast
pbpaste | extract_wisdom
## SUMMARY:

The content features a conversation between two individuals discussing various topics, including the decline of Western culture, the importance of beauty and subtlety in life, the impact of technology and AI, the resonance of Rilke's poetry, the value of deep reading and revisiting texts, the captivating nature of Ayn Rand's writing, the role of philosophy in understanding the world, and the influence of drugs on society. They also touch upon creativity, attention spans, and the importance of introspection.

## IDEAS:

1. Western culture is perceived to be declining due to a loss of values and an embrace of mediocrity.
2. Mass media and technology have contributed to shorter attention spans and a need for constant stimulation.
3. Rilke's poetry resonates due to its focus on beauty and ecstasy in everyday objects.
4. Subtlety is often overlooked in modern society due to sensory overload.
5. The role of technology in shaping music and performance art is significant.
6. Reading habits have shifted from deep, repetitive reading to consuming large quantities of new material.
7. Revisiting influential books as one ages can lead to new insights based on accumulated wisdom and experiences.
8. Fiction can vividly illustrate philosophical concepts through characters and narratives.
9. Many influential thinkers have backgrounds in philosophy, highlighting its importance in shaping reasoning skills.
10. Philosophy is seen as a bridge between theology and science, asking questions that both fields seek to answer.

## QUOTES:

1. "You can't necessarily think yourself into the answers. You have to create space for the answers to come to you."
2. "The West is dying and we are killing her."
3. "The American Dream has been replaced by mass packaged mediocrity porn, encouraging us to revel like happy pigs in our own meekness."
4. "There's just not that many people who have the courage to reach beyond consensus and go explore new ideas."
5. "I'll start watching Netflix when I've read the whole of human history."
6. "Rilke saw beauty in everything... He sees it's in one little thing, a representation of all things that are beautiful."
7. "Vanilla is a very subtle flavor... it speaks to sort of the sensory overload of the modern age."
8. "When you memorize chapters [of the Bible], it takes a few months, but you really understand how things are structured."
9. "As you get older, if there's books that moved you when you were younger, it's worth going back and rereading them."
10. "She [Ayn Rand] took complicated philosophy and embodied it in a way that anybody could resonate with."

## HABITS:

1. Avoiding mainstream media consumption for deeper engagement with historical texts and personal research.
2. Regularly revisiting influential books from youth to gain new insights with age.
3. Engaging in deep reading practices rather than skimming or speed-reading material.
4. Memorizing entire chapters or passages from significant texts for better understanding.
5. Disengaging from social media and fast-paced news cycles for more focused thought processes.
6. Walking long distances as a form of meditation and reflection.
7. Creating space for thoughts to solidify through introspection and stillness.
8. Embracing emotions such as grief or anger fully rather than suppressing them.
9. Seeking out varied experiences across different careers and lifestyles.
10. Prioritizing curiosity-driven research without specific goals or constraints.

## FACTS:

1. The West is perceived as declining due to cultural shifts away from traditional values.
2. Attention spans have shortened due to technological advancements and media consumption habits.
3. Rilke's poetry emphasizes finding beauty in everyday objects through detailed observation.
4. Modern society often overlooks subtlety due to sensory overload from various stimuli.
5. Reading habits have evolved from deep engagement with texts to consuming large quantities quickly.
6. Revisiting influential books can lead to new insights based on accumulated life experiences.
7. Fiction can effectively illustrate philosophical concepts through character development and narrative arcs.
8. Philosophy plays a significant role in shaping reasoning skills and understanding complex ideas.
9. Creativity may be stifled by cultural nihilism and protectionist attitudes within society.
10. Short-term thinking undermines efforts to create lasting works of beauty or significance.

## REFERENCES:

1. Rainer Maria Rilke's poetry
2. Netflix
3. Underworld concert
4. Katy Perry's theatrical performances
5. Taylor Swift's performances
6. Bible study
7. Atlas Shrugged by Ayn Rand
8. Robert Pirsig's writings
9. Bertrand Russell's definition of philosophy
10. Nietzsche's walks

Meta

Note

Special thanks to the following people for their inspiration and contributions!

  • Caleb Sima for pushing me over the edge of whether to make this a public project or not.
  • Joel Parish for super useful input on the project's Github directory structure.
  • Jonathan Dunn for spectacular work on the soon-to-be-released universal client.
  • Joseph Thacker for the idea of a -c context flag that adds pre-created context in the ./config/fabric/ directory to all Pattern queries.
  • Jason Haddix for the idea of a stitch (chained Pattern) to filter content using a local model before sending on to a cloud model, i.e., cleaning customer data using llama2 before sending on to gpt-4 for analysis.
  • Dani Goland for enhancing the Fabric Server (Mill) infrastructure by migrating to FastAPI, breaking the server into discrete pieces, and Dockerizing the entire thing.
  • Andre Guerra for simplifying installation by getting us onto Poetry for virtual environment and dependency management.

Primary contributors

fabric was created by Daniel Miessler in January of 2024.

X (formerly Twitter) Follow

More Repositories

1

SecLists

SecLists is the security tester's companion. It's a collection of multiple types of lists used during security assessments, collected in one place. List types include usernames, passwords, URLs, sensitive data patterns, fuzzing payloads, web shells, and many more.
PHP
51,997
star
2

RobotsDisallowed

A curated list of the most common and most interesting robots.txt disallowed directories.
Shell
1,361
star
3

vim

My Vim configuration.
JavaScript
150
star
4

HoneyCredIPTracker

Quick script to gather stats on incoming credentials and IPs for a honey listener.
Shell
97
star
5

Source2URL

Parse source code directories and output list of URLs that are then sent through a proxy.
95
star
6

nginx

My Nginx configuration files, for all to use and improve upon.
94
star
7

egression

Test a network's egress controls with various levels of success and failure.
Shell
91
star
8

Caparser

A quick and dirty PCAP parser that helps you identify who your applications are sending sensitive data to without encryption.
Ruby
86
star
9

SecurityTools

A repo for collecting and organizing security tools of various types. As new ones come out, they get added to the list.
84
star
10

iptables

An iptables firewall configuration template.
Shell
71
star
11

BugOutBag

BugOutBag
56
star
12

CTFSolutionTypes

A collection of CTF solution types, i.e. not solutions to specific CTF challenges, but the general categories that those solutions fall under. Includes CTF solution categories for web, binary, network, crypto, and others. Please contribute!
54
star
13

DNSHarvester

This tool will harvest valid DNS subdomains from a given domain.
Python
50
star
14

TechStack

This project exists as a free (and transparent) alternative to paid services that show you what technologies are running on a given website.
Shell
45
star
15

ATM

The Adaptive Security Testing Methodology (ASTM) provides context-adjusted testing methodologies based on factors such as time available to test, platform, technology stack, versions, plugins, modules, and other variables.
42
star
16

geoip

A Ruby script that takes in IPs and returns Country, State, and City
Ruby
31
star
17

GeoHarvest

A simple script for translating IP addresses to GeoLocations
Shell
30
star
18

Books

A list of the books that I am reading, with priorities.
24
star
19

hostfind

Does a dictionary lookup on common, valuable hostnames for a given domain.
Shell
22
star
20

GitHubRating

A composite score for one's GitHub quality.
Shell
22
star
21

tmux

My tmux stuff
21
star
22

mobiletools

Free tools for mobile testing.
21
star
23

ServerConfig

My various configuration files for zsh, vim, tmux, etc.
Vim Script
19
star
24

top-domains

A repository for maintaining a list of the top domains based on multiple lists
18
star
25

athi

ATHI — An AI Threat Modeling Framework for Policymakers
17
star
26

mst

A meta-scan tool used to kick off a number of command-line security tools during VA/PT work.
Shell
17
star
27

unsupervised-learning

16
star
28

Personal

A repository for personal tracking.
14
star
29

NewBox

Zsh and Vim on new Linux boxen.
Shell
14
star
30

CertExpirationCheck

Checks to see when the cert for a given domain expires.
14
star
31

Self

A tracking system for everything me, e.g.: beliefs, passions, must-haves, must-dos, favorite movies, favorite quotes, favorite aphorisms, etc.
13
star
32

neovim

My Neovim settings
Lua
12
star
33

gscour

Find all hostnames related to a given domain. Helpful during VA/PT work.
11
star
34

augmented-course

The website for the AUGMENTED AI course.
Vue
11
star
35

GetTweets

Get a number of your tweets from the Twitter API.
Ruby
6
star
36

FreeWill_TwoLever_Argument

This is a project aimed to show that Free Will is impossible using Ruby
Ruby
6
star
37

WorkDay

An ideal (regular) work day.
5
star
38

Dicematch

Determines how many times a given number of dice match each other.
Ruby
5
star
39

LifeOpt

A repository for life optimizations. Examples include wardrobe, work bag, knives, coffee gear, etc.
5
star
40

Intimate

INTIMATE -- The audience management platform.
Ruby
4
star
41

MostPoweredBy

Checks to see the most common X-Powered-By headers for the world's most popular websites.
4
star
42

CaliforniaAirQuality

Get the air quality for your area from California's AIrNow website using Ruby and Nokogiri.
Ruby
4
star
43

Opim

Optimize images in OS X
Shell
3
star
44

import-alignment

A library-based attempt to increase our chances for achieving AI Alignment with an emergent AGI.
3
star
45

Restaurants

A list of restaurants I've experienced or want to experience.
3
star
46

BandShuffle

Shuffle some bands, yo.
Ruby
2
star
47

TeamShuffle

A script to randomly pick the order your team does something.
Ruby
2
star
48

threshold-site

The website for the Threshold.
Vue
2
star
49

mhp

A proof-by-simulation of the Monty Hall problem [Python]
1
star
50

Statraises

A Ruby script that checks to see how many stat checks are needed to raise a stat.
Ruby
1
star