Context & Input¶
Understand the distinction between input and context files, supported document types, and how content is aggregated.
Input vs Context¶
WireFlow distinguishes between input (primary documents to process) and context (supporting materials):
| Aspect | Input (-in) |
Context (-cx) |
|---|---|---|
| Purpose | Documents to analyze/transform | Background information |
| Position | After context in prompt | Before input in prompt |
| Typical use | PDFs to summarize, data to analyze | Reference docs, prior outputs |
| Citations | Yes (with --enable-citations) |
Yes |
Example:
# Summarize a report (input) using style guide (context)
wfw run summarize -in report.pdf -cx style-guide.md
# Analyze data (input) with reference materials (context)
wfw run analyze -in results.csv -cx methodology.md prior-analysis.md
Supported Document Types¶
Text Files¶
All text-based files (.md, .txt, .py, .js, .csv, etc.) are processed directly with syntax highlighting based on extension.
PDF Documents¶
- Processed using Claude API (text + visual analysis)
- Maximum size: 32MB per PDF
- Supports citations with document indices
Microsoft Office Files¶
- Supported:
.docx,.pptx - Auto-converted to PDF via LibreOffice
- Cached in
.workflow/cache/office/ - Citations use original filename
Requirements: LibreOffice installed (libreoffice or soffice in PATH)
Images¶
- Native:
.jpg,.jpeg,.png,.gif,.webp - Converted:
.heic→ JPEG,.tiff→ PNG,.svg→ PNG - Processed using Claude Vision API
- Auto-resize if larger than 1568px on longest edge
- Maximum size: 5MB per image
- NOT citable (no document indices)
Requirements:
- HEIC:
sips(macOS) or ImageMagick - TIFF:
sips(macOS) or ImageMagick - SVG:
rsvg-convert(librsvg) or Inkscape
Mixing Types¶
Context Aggregation¶
Content is assembled in this order:
Run mode:
- System prompts (
SYSTEM_PROMPTS) - Project description (
project.txt) - Context files (config + CLI)
- Dependencies (
--depends-onoutputs) - Input files (config + CLI)
- Images
- Task prompt (
task.txt)
Task mode:
- System prompts
- Project description (if in project)
- Context files (CLI)
- Input files (CLI)
- Images
- Task prompt (inline or template)
Path Specification¶
Both config files and CLI options accept flexible path specifications for INPUT and CONTEXT. All path types work consistently across both methods.
Supported Path Types¶
| Path Type | Config File | CLI Option | Example |
|---|---|---|---|
| Relative file | Project-root relative | CWD-relative | data/notes.md |
| Absolute file | Direct resolution | Direct resolution | /tmp/shared/ref.pdf |
| Relative directory | Project-root relative | CWD-relative | data/ |
| Absolute directory | Direct resolution | Direct resolution | /external/docs/ |
| Glob pattern | Expands from project root | Shell-expands from CWD | data/*.csv |
Config File Paths¶
Paths in config files support relative paths (resolved from project root), absolute paths (anywhere on filesystem), and directories (expanded non-recursively):
# In .workflow/config or .workflow/run/<name>/config
# Relative paths (project-root relative)
CONTEXT=(notes/analysis.md refs/paper.pdf)
# Absolute paths (external files)
CONTEXT=(/tmp/shared-docs/reference.pdf /home/user/data/notes.md)
# Directories (expanded to supported files, non-recursive)
CONTEXT=(docs/ /external/shared-resources/)
# Glob patterns (expand at config source time from project root)
CONTEXT=(data/*.csv notes/**/*.md)
# Mixed paths
CONTEXT=(
notes/local.md # Relative file
/tmp/external.pdf # Absolute file
data/ # Relative directory
/shared/docs/ # Absolute directory
"reports/*.pdf" # Glob pattern
)
INPUT=(main-report.pdf /external/data.csv)
CLI Paths¶
CLI paths are resolved relative to your current working directory:
cd /project/subdir
wfw run analysis -cx local-notes.md
# Looks for: /project/subdir/local-notes.md
# Relative to CWD
wfw run analysis -cx data.csv -in report.pdf
# Absolute paths
wfw run analysis -cx /tmp/external-notes.md
# Directories (expanded non-recursively)
wfw run analysis -cx docs/ -in /external/data/
# Glob patterns (shell-expands before passing to WireFlow)
wfw run analysis -cx "data/*.csv" -in "reports/*.pdf"
Glob Patterns¶
# Single directory pattern
-cx "data/*.csv"
# Recursive pattern
-cx "notes/**/*.md"
# Multiple directories with brace expansion
-cx "data/{exp1,exp2}/*"
# In config (globs expand at source time from project root)
CONTEXT=(data/*.csv notes/**/*.md)
INPUT=(reports/**/*.pdf)
Directory Expansion¶
When a directory path is specified:
- Expansion is non-recursive (only immediate children)
- Only supported file types are included (text, PDF, Office, images)
- Binary files (executables, archives, etc.) are automatically excluded
# Directory with mixed content
data/
├── results.csv # ✓ Included (text)
├── chart.png # ✓ Included (image)
├── report.pdf # ✓ Included (PDF)
├── archive.zip # ✗ Excluded (binary)
└── subdir/ # ✗ Not traversed (non-recursive)
└── more.txt # ✗ Excluded (in subdirectory)
Caching¶
WireFlow caches converted files to speed up repeated runs.
Office Conversion Cache¶
Location: .workflow/cache/office/
- PDF conversions are cached per source file
- Cache invalidated when source file changes (by mtime)
- Shared across all workflows in the project
Image Conversion Cache¶
Location: .workflow/cache/images/
- Resized/converted images cached per source
- HEIC→JPEG, TIFF→PNG, SVG→PNG conversions cached
- Original dimensions preserved in cache filename
Cache Management¶
# Clear project cache
rm -rf .workflow/cache/
# View cache contents
ls -la .workflow/cache/office/
ls -la .workflow/cache/images/
Configuration Variables¶
| Variable | Description | Scope |
|---|---|---|
CONTEXT |
Context file paths (globs expand at source time) | Project, Workflow |
INPUT |
Input file paths (globs expand at source time) | Workflow |
ENABLE_CITATIONS |
Enable source citations | All |
Best Practices¶
Input vs Context:
- Use
-infor documents you're actively processing - Use
-cxfor reference materials, prior outputs, style guides - Dependencies (
--depends-on) automatically become context
File organization:
- Keep source documents in predictable locations
- Use glob patterns for dynamic file sets:
CONTEXT=(data/*.csv) - Use explicit paths for fixed sets:
INPUT=(report.pdf summary.md)
Performance:
- First run with Office/image files is slower (conversion)
- Subsequent runs use cache
- Large images auto-resize to reduce API costs
Continue to Execution Modes →