Preliminary notes
Content provided “as-is”. Before applying it to real client documents:
- Validate on public or fake documents first.
- Back up the documents folder before each session: Fabric does not modify PDFs, but a wrapping script that moves or renames them does.
- Do not transmit documents containing personal data or privileged content to cloud endpoints. For real work, configure Fabric against a local model (Ollama).
- Each pattern is a prompt: read it before using it. The upstream repo includes third-party patterns that may not match your methodology.
- For output entering a professional deliverable (opinion, report, offer) full human review remains necessary, as for any draft produced by a collaborator.
What Fabric is
Fabric (github.com/danielmiessler/fabric) is an open-source framework by Daniel Miessler for applying “patterns” — reusable, versioned prompts — to input text. The public repository dates back to 3 January 2024; in August 2024 the project was rewritten from Python to Go and distributed as a single binary. License: MIT.
Fabric’s philosophy differs from that of a general agent: it does not negotiate, plan or run code. It is a collection of input → output transformations with a catalogue of patterns (extract_wisdom, summarize, extract_insights, analyze_claims, …) in ~/.config/fabric/patterns/. You add your own patterns, keep them in git, share them across the team.
For a professional firm, this structure maps to the established practice of check-lists and working schemas: Fabric formalises them as reapplicable prompts.
Use case: extracting summary sheets from public tenders
A consulting firm tracks tender participations. Each week 10–15 PDFs arrive (regional, European, foundation tenders). For each we need a sheet: title, issuing body, deadline, eligible beneficiaries, maximum amount, formal requirements, evaluation criteria.
1. Install
# Official Go binary:
go install github.com/danielmiessler/fabric@latest
# or download the release binary from the repo
fabric --setup
# Enter or confirm providers. For local use, point to Ollama:
# OpenAI API endpoint: http://127.0.0.1:11434/v1
# API key: ollama
After setup, fabric --listmodels shows available models. fabric --listpatterns lists downloaded patterns.
2. Custom pattern for the tender sheet
Patterns live in ~/.config/fabric/patterns/<name>/system.md. Create one:
mkdir -p ~/.config/fabric/patterns/tender_sheet
cat > ~/.config/fabric/patterns/tender_sheet/system.md <<'EOF'
# IDENTITY
You are a consultant preparing summary sheets on public tenders
for a mid-sized Italian company.
# GOAL
Extract from the tender text the fields listed below. If a field is
not present in the text, write "not stated". Do not invent values.
Do not include information not literally derivable from the text.
# STEPS
1. Read the tender text.
2. Fill in the sheet fields.
3. If multiple interpretations are possible, pick the most conservative
and flag it in the notes.
# OUTPUT FORMAT
- Title:
- Issuing body:
- Deadline (date):
- Eligible beneficiaries:
- Maximum amount:
- Co-financing required:
- Formal requirements:
- Evaluation criteria (summary):
- Regulatory references:
- Extraction notes:
EOF
3. Extracting text from the PDF
Fabric does not handle PDFs directly: it takes text. For conversion:
# pdftotext ships with poppler-utils, present on most Linux distros:
pdftotext -layout tender-regione-2024.pdf tender-regione-2024.txt
# For scanned (image-only) PDFs, OCR is required:
ocrmypdf --skip-text tender-scan.pdf tender-scan-ocr.pdf
pdftotext -layout tender-scan-ocr.pdf tender-scan.txt
4. Applying the pattern
cat tender-regione-2024.txt \
| fabric -sp tender_sheet \
> sheets/tender-regione-2024.md
-sp picks the pattern in stream mode. Output is markdown: storable in git, openable in any editor, publishable as an internal attachment.
5. Batch run
mkdir -p sheets
for f in tenders-in/*.txt; do
base=$(basename "$f" .txt)
cat "$f" | fabric -sp tender_sheet > "sheets/${base}.md"
done
A few seconds per tender (with a local 7B–14B model), one sheet per PDF. The output stays a draft: it must be checked by an operator before becoming a working document.
Limits and caveats
- Hallucinations on numeric values: LLMs get dates, amounts and percentages wrong more easily than they get text summaries wrong. For critical fields like deadline and maximum amount, always require human verification against the original document.
- Imperfect OCR: poorly scanned PDFs produce dirty text; the model “corrects” it creatively and risks reinventing numbers. Do not accept the sheet without reopening the PDF.
- Public patterns ≠ good patterns: the upstream Fabric catalogue is rich but heterogeneous. Before adopting a pattern for professional work, read it as you would read a template letter: it must match your methodology.
- Patterns as code: keep your firm’s patterns in an internal git repo with peer review, tags and a
CHANGELOG.md. A pattern changed without tracking is an error that propagates across dozens of files.
Link: github.com/danielmiessler/fabric
