IWE Squash
Creates consolidated documents by combining linked content into a single markdown file.
Usage
iwe squash <KEY> [OPTIONS]Arguments
| Argument | Description |
|---|---|
<KEY> | Document key to squash |
Options
| Option | Default | Description |
|---|---|---|
-d, --depth <DEPTH> | 2 | How deep to traverse links |
-v, --verbose <LEVEL> | 0 | Verbosity level |
What It Does
- Starts from the specified document
- Traverses Inclusion Links up to specified depth
- Combines content into a single markdown document
- Converts linked sections to inline sections
- Adjusts header levels to maintain hierarchy
Output Format
Given this document structure:
project-overview.md:
# Project Overview
Introduction to the project.
- [Goals](goals)
- [Architecture](/docs/architecture/)goals.md:
# Goals
Our main objectives are:
- Improve performance
- Add new featuresRunning iwe squash project-overview outputs:
# Project Overview
Introduction to the project.
## Goals
Our main objectives are:
- Improve performance
- Add new features
## Architecture
...Note that linked document headers become sub-headers (# → ##) to preserve hierarchy.
Examples
# Squash starting from document "project-overview"
iwe squash project-overview
# Squash with greater depth
iwe squash main-topic --depth 4
# Save output to file
iwe squash research-notes --depth 3 > output.md
# With debug output
iwe squash research-notes --depth 3 -v 2Header Level Adjustment
When documents are inlined, their header levels are adjusted:
| Original Level | Becomes | Reason |
|---|---|---|
# (h1) | ## (h2) | Linked document becomes section |
## (h2) | ### (h3) | Preserves relative hierarchy |
### (h3) | #### (h4) | And so on… |
This ensures the squashed document maintains a logical structure with the root document as the top-level heading.
Use Cases
- Export to PDF: Create a single document for typesetting with tools like Typst
- Sharing: Generate a standalone file from interconnected notes
- Backup: Consolidate project knowledge into a portable format
- Context building: Create comprehensive documents for review
AI Agent Tips
- Use
squashto build comprehensive context from related documents - Combine with
retrievefor maximum context: squash provides structure, retrieve provides backlinks - Adjust depth based on scope: shallow (2) for focused topics, deep (4+) for comprehensive overviews
- Squashed output is ideal for sending to language models as context
Example PDF generated using squash command and Typst.