Prompt file imported from zotoio/CRUX-Compress (
.cursor/commands/crux-compress.md). Copyright stays with the author.
crux-compress
Compress markdown rule files, code files, and images into CRUX notation for token/size efficiency.
Repository: github.com/zotoio/CRUX-Compress
Usage
/crux-compress ALL - Compress all eligible rules (formatted output)
/crux-compress @path/to/file.md - Compress a specific file (formatted output)
/crux-compress @file1.md @file2.md - Compress multiple files (formatted output)
/crux-compress @file.md --minified - Compress with single-line output
/crux-compress ALL --minified - Compress all with single-line output
/crux-compress ALL --force - Force recompression (delete existing CRUX files first)
/crux-compress @file.md --force - Force recompression of specific file
/crux-compress @file.md --40 - Compress targeting 40% of original size
/crux-compress @file.md --10 - Aggressive compression targeting 10%
/crux-compress @script.sh - Compress a code file
/crux-compress @src/app.ts @lib/utils.py - Compress multiple code files
/crux-compress @image.png - Compress an image (semantic visual description)
/crux-compress @image.png --80 - Compress image retaining 80% detail
/crux-compress @img1.png @img2.jpg - Compress multiple images
/crux-compress https://example.com/page - Compress a webpage (URL source)
/crux-compress https://a.com https://b.com - Compress multiple URLs
/crux-compress @file.md --plugin=frontmatter-tagger - Run a plugin while compressing
/crux-compress ALL --plugin quality-gate --plugin release-notes - Run multiple plugins
/crux-compress @file.md --no-plugin compression-level - Disable a default-enabled plugin
Flags
| Flag | Description | Use Case |
|---|---|---|
--minified |
Single-line output, no spaces, max compression | Copy-paste demos, LLM testing |
--force |
Delete existing CRUX output files (.crux.mdc or .crux.md) before compression |
Force fresh recompression, bypass checksum skip |
--<n> |
Set compression level to n% (1-100). Overrides frontmatter crux: <n>. Default: 25 |
--40 for 40% target, --10 for aggressive compression |
--plugin <name> / --plugin=<name> |
Enable a named plugin from the plugin registry | Add optional feature behavior without changing core command flow |
--no-plugin <name> |
Disable a specific default-enabled plugin | Opt out of a default plugin without switching to fully-explicit mode |
Note: Flags can be combined: /crux-compress ALL --force --minified --40 --plugin quality-gate
Compression Level
The compression level controls the target output size as a percentage of the original:
| Level | Target | Effect |
|---|---|---|
--10 |
≤10% of original | Very aggressive — heavy abbreviation, symbols only |
--25 (default) |
≤25% of original | Standard compression |
--40 |
≤40% of original | Moderate — more prose preserved |
--80 |
≤80% of original | Light — close to original structure |
The level can also be set in the source file's frontmatter as crux: <n> (e.g., crux: 40). The CLI flag overrides frontmatter when both are present.
For images, the level controls detail retention (100 = maximum detail, 1 = minimal; default 80). For text sources, it controls the token ratio target (default 25).
Output Formats
| Format | Description | Use Case |
|---|---|---|
| Formatted (default) | Multi-line, indented, ~80 char lines | .crux.md files for readability |
Minified (--minified) |
Single-line, no spaces, max compression | Copy-paste demos, LLM testing |
Plugin Parameter System
/crux-compress supports optional plugins to add feature-specific behavior via command parameters.
- Parameter format:
--plugin <name>or--plugin=<name> - Repeatable: multiple plugins can be enabled in one run
- Execution model: plugins run at predefined lifecycle hooks
- Isolation: plugin failures are reported per plugin and should not block base compression unless explicitly configured in the plugin
Plugin Registry
Plugins are resolved from .crux/plugins/registry.json (if present). Minimal shape:
{
"plugins": {
"compression-level": {
"description": "Enforce compression ratio targets and generate token metrics.",
"hooks": ["beforeCompress", "afterCompress"],
"failClosed": false,
"enabledByDefault": true
},
"frontmatter-tagger": {
"description": "Add standardized metadata after compression.",
"hooks": ["afterCompress"],
"failClosed": false,
"enabledByDefault": false
}
}
}
Plugins with enabledByDefault: true load automatically when no --plugin flags are given. See Default Plugin Loading below.
Standard Plugin Hooks
beforeFetch- URL sources only, beforeWebFetchbeforeCompress- after source resolution, before compression subagent promptafterCompress- after CRUX output is generatedafterValidate- after semantic validation completes
Parallelism Limits
Maximum parallel agents: 4
When processing multiple files, spawn at most 4 crux-cursor-rule-manager subagent instances simultaneously. If there are more than 4 eligible files, process them in sequential batches:
- Batch 1: Files 1-4 (parallel)
- Batch 2: Files 5-8 (parallel, after Batch 1 completes)
- Batch N: Continue until all files processed
This prevents resource exhaustion and ensures reliable processing.
Source Checksum Tracking
CRUX files track the source file's checksum to avoid unnecessary updates.
Each CRUX output file (.crux.mdc or .crux.md) includes a sourceChecksum field in its frontmatter containing the checksum of the source file. Before processing:
- Agent gets current checksum using
crux-utilsskill (--cksummode) - If existing CRUX file's
sourceChecksummatches, the source is unchanged - skip update - If no match (or no existing CRUX file), proceed with compression
- After compression, store the new
sourceChecksumin the output frontmatter
This optimization prevents redundant recompression of unchanged files.
Instructions
Compression Level Resolution
Before processing any files, resolve the compression level:
- Check CLI flags for
--<n>wherenis 1-100 (e.g.,--40,--10). This is the highest priority. - Check source frontmatter for
crux: <n>wherenis a number.crux: trueis equivalent tocrux: 25. - Default: 25 for text sources, 80 for images (if neither CLI flag nor numeric frontmatter is present)
The resolved level is:
- Passed to each
crux-cursor-rule-managersubagent ascompressionLevel: <n> - Recorded in output frontmatter as
cruxLevel: <n> - Used to set the target ratio:
target_ratio = level / 100
Validation: If the level is outside 1-100, reject with an error message and do not proceed.
Plugin Resolution (--plugin, --no-plugin)
Before source-type routing, resolve enabled plugins:
- Parse all plugin flags from both forms:
--plugin <name>/--plugin=<name>(explicit enable)--no-plugin <name>(disable a default-enabled plugin)
- Normalize plugin names to lowercase and de-duplicate while preserving order.
- Determine the active plugin set using one of two modes:
Default Plugin Loading
When no --plugin flags are present:
- Read
.crux/plugins/registry.json(if present). - Collect all plugins with
enabledByDefault: true. These load automatically in registry order. - Remove any plugins named in
--no-pluginflags.--no-plugin compression-level→ load defaults minuscompression-level--no-pluginon a non-default plugin → no-op (it was not going to load)--no-pluginon a nonexistent plugin → warning, no error
- If no default-enabled plugins exist and no
--no-pluginflags are given, continue with the base compression flow (backward-compatible no-plugin path).
Explicit Plugin Mode
When one or more --plugin flags are present:
- Load only the explicitly named plugins. Default-enabled plugins are not implicitly added.
--plugin frontmatter-taggerloads onlyfrontmatter-tagger, even ifcompression-levelisenabledByDefault: true- To get defaults plus extras:
--plugin compression-level --plugin frontmatter-tagger
--no-pluginflags are ignored in explicit mode (the explicit list is authoritative). Emit a warning if both are provided.
This ensures full backward compatibility: existing scripts that pass --plugin flags get exactly the same behavior as before.
Common Validation (Both Modes)
- Read
.crux/plugins/registry.json(if not already loaded). - Validate each active plugin exists in
plugins. - Validate each plugin declares at least one supported hook:
beforeFetch,beforeCompress,afterCompress,afterValidate - If a requested plugin is unknown, fail fast with an actionable message:
"Unknown plugin: <name>. Add it to .crux/plugins/registry.json or remove the flag." - Build an in-memory execution plan:
pluginsByHook.beforeFetch[]pluginsByHook.beforeCompress[]pluginsByHook.afterCompress[]pluginsByHook.afterValidate[]
Pass the enabled plugin list to each compression and validation task so plugins can apply consistently across single-file and batch workflows.
Plugin Execution Contract
When plugin hooks are present, execute them in this order:
beforeFetch(URL sources only)beforeCompress(all source types)- Base compression workflow
afterCompress(if compression produced output)- Base semantic validation workflow (when applicable)
afterValidate(if validation produced a score)
Execution rules:
- When using default plugin loading, run plugins in registry order. When using explicit mode, run plugins in CLI order (first
--pluginruns first for each hook). - Provide each plugin with a structured context object:
sourcePath|sourceUrl,sourceType,outputPath,compressionLevel,format,force, and current lifecycle data (beforeTokens,afterTokens,confidencewhen available). - For the
compression-levelplugin specifically, the context also includescontentType("text","code","url", or"image") so it can resolve default targets. See.crux/plugins/compression-level.mdfor full context schema. - Plugin failures are recorded per plugin and hook in the final report.
- Continue base compression unless the plugin explicitly declares
failClosed: truein the registry entry. - Plugin hooks must not mutate
CRUX.mdor bypass core quality gates.
Force Flag Pre-processing (--force)
When the --force flag is passed, before any compression:
-
Identify target CRUX files:
- For sources in
.cursor/rules/: the output is[name].crux.mdc - For sources elsewhere: the output is
[name].crux.md - Also check for any leftover intermediary files (e.g.,
.crux.mdin.cursor/rules/) and delete those too
- For sources in
-
Delete existing CRUX files:
- Delete the CRUX output file for each source
- Delete any leftover intermediary
.crux.mdfiles in.cursor/rules/(legacy cleanup) - This removes the cached
sourceChecksum, forcing fresh compression - Log each deletion: "Deleted: rules/docs-sync.crux.mdc (--force)"
-
Proceed with normal compression (steps below)
This ensures compression agents always perform full recompression rather than skipping due to checksum match.
When invoked with image file reference(s) (@path/to/image.png)
When any referenced file has a supported image extension (.png, .jpg, .jpeg, .gif, .webp, .svg):
-
If
--forceflag is passed, delete existing.crux.mdfiles for the images first -
For each image file, spawn a fresh
crux-cursor-rule-managersubagent instance:- Process images in batches of up to 4 parallel agents
- Run enabled
beforeCompressplugins for the image context - Task the subagent:
Compress this image into CRUX notation (semantic visual description): - Source: <image file path> - Output: <image path with extension replaced by .crux.md> - Compression level: <resolved level, default 80> - Use vision capabilities to analyze the image - Describe semantic content using CRUX blocks (Ρ, Κ, Π.layout, E.element, Ω.metaphor) - Preserve all visible text/labels verbatim - Capture spatial relationships, visual style, and conceptual meaning - Detail retention: level controls how much visual detail to describe (100 = maximum detail, every element; 80 = detailed with textures and secondary elements; 25 = key elements and meaning; 10 = essential concept only) - Follow CRUX.md specification for notation - Report original file size and .crux.md file size
-
Collect results and report:
- Image file processed
- Original file size vs
.crux.mdfile size - Plugin execution results (if plugins were enabled)
- Any issues encountered
Note: Image compression does not use sourceChecksum tracking, crux: true frontmatter, or the --minified flag. Semantic validation is not automated for images — visual fidelity must be verified manually by feeding the .crux.md file to an LLM with image generation.
When invoked with URL(s) (https://...)
When any argument is a URL (starts with http:// or https://):
-
If
--forceflag is passed, delete existing.crux.mdfiles in.crux/out/for matching URL-derived filenames first -
For each URL, spawn a fresh
crux-cursor-rule-managersubagent instance:- Process URLs in batches of up to 4 parallel agents
- Run enabled
beforeFetchplugins beforeWebFetch - Before spawning: fetch the webpage content using the
WebFetchtool - Run enabled
beforeCompressplugins with fetched content metadata - Derive output filename from the URL: strip protocol, replace
/and special chars with-, remove trailing-, append.crux.mdhttps://agents.md/→agents-md.crux.mdhttps://example.com/docs/api→example-com-docs-api.crux.md
- Output directory:
.crux/out/(create if it doesn't exist) - Task the subagent:
Compress this webpage content into CRUX notation: - Source URL: <url> - Content: <fetched webpage content> - Output: .crux/out/<derived-filename>.crux.md - Format: <formatted (default) OR minified if --minified flag was passed> - Compression level: <resolved level, default 25> - Use sourceUrl in frontmatter instead of sourceChecksum - Include reducedBy percentage and cruxLevel in frontmatter - Follow CRUX.md specification for notation - Report before/after token counts
-
After compression completes, spawn a fresh validation agent (same as for markdown)
- Run enabled
afterCompressplugins after each successful compression - Run enabled
afterValidateplugins after each validation result
- Run enabled
-
Collect results and report:
- URL processed
- Output file path (in
.crux/out/) - Token reduction achieved and
reducedBypercentage - Confidence score from validation
- Plugin execution results (if plugins were enabled)
- Any issues encountered
Note: URL compression uses sourceUrl instead of sourceChecksum in frontmatter. No Cursor adapter (.crux.mdc) is produced for URL sources. URLs are NOT included in ALL scans — they must be explicitly provided.
When invoked with code file reference(s) (@path/to/file.sh, @path/to/file.ts, etc.)
When any referenced file has a supported code extension (.sh, .bash, .ts, .tsx, .js, .jsx, .py, .rs, .go, .java, .sql, .css, .scss):
-
If
--forceflag is passed, delete existing.crux.mdfiles for the code files first -
For each code file, spawn a fresh
crux-cursor-rule-managersubagent instance:- Process code files in batches of up to 4 parallel agents
- Run enabled
beforeCompressplugins for the code context - Task the subagent:
Compress this code file into CRUX notation: - Source: <code file path> - Output: <code path with extension replaced by .crux.md> - Format: <formatted (default) OR minified if --minified flag was passed> - Compression level: <resolved level, default 25> - Use code block mappings: Λ for functions, Γ for orchestration, Φ for config - Preserve function names verbatim, type signatures for public interfaces - Encode IO semantics explicitly (stdout vs stderr, return channels) - Generate Ω.decomp block with emulate= and focus= fields - Follow CRUX.md specification for notation - Check source checksum vs existing CRUX sourceChecksum - skip if unchanged - Report before/after token counts
-
After compression completes, spawn a fresh validation agent (same as for markdown)
- Run enabled
afterCompressplugins after each successful compression - Run enabled
afterValidateplugins after each validation result
- Run enabled
-
Collect results and report:
- File processed or skipped
- Token reduction achieved
- Confidence score from validation
- Plugin execution results (if plugins were enabled)
- Any issues encountered
Note: Code compression does not use alwaysApply frontmatter, crux: true opt-in, or the Cursor adapter step. Code files are not included in ALL scans — they must be explicitly referenced.
When invoked with markdown file reference(s) (@path/to/file.md*)
-
If
--forceflag is passed, delete existing CRUX output files first (see above) -
For each file reference provided, spawn a fresh
crux-cursor-rule-managersubagent instance:- Each file gets its own dedicated agent instance
- Process files in batches of up to 4 parallel agents
- Wait for each batch to complete before starting the next
- Run enabled
beforeCompressplugins for each markdown source - Task the subagent:
Compress this rule file into CRUX notation: - Source: <file path> - Output: <.crux.mdc if source is in .cursor/rules/, otherwise .crux.md> - For .cursor/rules/ sources: include alwaysApply from source frontmatter in output - For other sources: do NOT include alwaysApply or IDE-specific frontmatter - Format: <formatted (default) OR minified if --minified flag was passed> - Compression level: <resolved level, default 25> - Follow CRUX.md specification - Check source checksum vs existing CRUX sourceChecksum - skip if unchanged - Report before/after token counts using `crux-utils` skill (or "skipped - source unchanged") - If source lacks `crux: true` or `crux: <n>` frontmatter, add `crux: true` first - Ensure source uses .md extension (rename from .mdc if needed)
-
Pre-processing for each file (if needed):
- If the file is
.mdcbut not.crux.mdc, rename to.mdfirst - If the file lacks
crux: truein frontmatter, add it - Then proceed with compression
- If the file is
-
After compression completes, spawn a fresh
crux-cursor-rule-managerinstance for validation:- Task the validation agent:
Perform semantic validation on this CRUX file: - Source: <source .md file path> - CRUX: <generated CRUX output file path (.crux.mdc or .crux.md)> - DO NOT use the CRUX specification - evaluate purely on semantic understanding - Compare meaning and completeness between source and CRUX - Return confidence score (0-100%) - Flag any issues if confidence < 80% - The validation agent returns the confidence score
- Update the CRUX output file's frontmatter with
confidence: XX% - Run enabled
afterCompressplugins after each successful compression - Run enabled
afterValidateplugins after each validation result
- Task the validation agent:
-
Collect results and report:
- File processed or skipped (with reason: "source unchanged" or "compression not beneficial")
- Token reduction achieved (if processed)
- Confidence score from validation
- Plugin execution results (if plugins were enabled)
- Any issues encountered
- If
--forcewas used, note files that were deleted before recompression
-
Clear processed files from pending-compression.json:
- Read
.crux/pending-compression.jsonif it exists - Remove any files from the
filesarray that were just processed (successfully compressed or skipped) - Do NOT remove files that were not part of this compression run (preserve newly added pending files)
- Write the updated JSON back to the file
- If the
filesarray is now empty, write{"files": []}(omit theupdatedfield)
- Read
When invoked with ALL
-
If
--forceflag is passed, delete all existing CRUX output files first:- Find all
.crux.mdcfiles in.cursor/rules/(excluding_CRUX-RULE.mdc) - Also delete any leftover
.crux.mdintermediary files in.cursor/rules/(legacy cleanup) - Delete each one and log the deletion
- This ensures all eligible sources will be freshly compressed
- Find all
-
Find all eligible files:
- Search
.cursor/rules/**/*.mdand.cursor/rules/**/*.mdcfor files with frontmattercrux: trueorcrux: <n> - Exclude files that already have a
.crux.mdor.crux.mdcextension (they are outputs, not sources) - For
.mdcfiles found: apply pre-processing (rename to.md, addcrux: trueif missing) before compression - Extract numeric
cruxvalue from frontmatter if present (used as per-file compression level unless CLI--<n>overrides)
- Search
-
For each eligible file, spawn a separate
crux-cursor-rule-managersubagent instance:- Task the subagent to compress the source file
- The subagent will:
- Read the CRUX specification from
CRUX.md - Compress the source file
- Create/update the
[filename].crux.mdcoutput directly (withalwaysApplyfrom source frontmatter) - Report token reduction metrics
- Apply enabled
beforeCompressandafterCompressplugin hooks
- Read the CRUX specification from
- Process in batches of up to 4 parallel agents
- Wait for each batch to complete before starting the next batch.
-
After each compression completes, spawn a fresh validation agent:
- For each successfully compressed file, spawn a separate
crux-cursor-rule-managerinstance - Task: semantic validation (compare CRUX to source, produce confidence score)
- Update the
.crux.mdfrontmatter with the confidence score - Cursor adapter: Copy
.crux.mdto.crux.mdcwithalwaysApplyinjected from source - Apply enabled
afterValidateplugin hooks - Validation agents can run in parallel with other compression agents (within the 4-agent limit)
- For each successfully compressed file, spawn a separate
-
Collect results from all subagents and report summary:
- Number of files processed
- Files created/updated
- Files skipped:
- Source unchanged (checksum matches) - Note: with
--force, no files are skipped for this reason - Already compact (compression not beneficial)
- Source unchanged (checksum matches) - Note: with
- If
--forcewas used, list files that were deleted before recompression - Total token savings
- Confidence scores for each file (with average)
- Plugin execution summary:
- Plugins requested
- Hooks executed
- Any plugin failures (and whether they were fail-open or fail-closed)
-
Clear processed files from pending-compression.json:
- Read
.crux/pending-compression.jsonif it exists - Remove any files from the
filesarray that were just processed (successfully compressed or skipped) - Do NOT remove files that were not part of this compression run (preserve newly added pending files)
- Write the updated JSON back to the file
- If the
filesarray is now empty, write{"files": []}(omit theupdatedfield)
- Read
Eligibility Criteria
Markdown Rules
A markdown file is eligible for CRUX compression if:
- Has
.mdor.mdcextension - Has
crux: trueorcrux: <n>(wherenis 1-100) in YAML frontmatter - Is not already a
.crux.mdor.crux.mdcfile (outputs are not recompressed) - For
ALLscans: must be in.cursor/rules/directory - For explicit file references: can be located anywhere
Note: .mdc files with crux: true or crux: <n> will be pre-processed (renamed to .md) before compression. The resulting .crux.md is the universal output. If the source is in .cursor/rules/, a .crux.mdc Cursor adapter file is also produced.
Code Files
A code file is eligible for CRUX compression if:
- Has a supported code extension:
.sh,.bash,.ts,.tsx,.js,.jsx,.py,.rs,.go,.java,.sql,.css,.scss - Is explicitly provided as a file reference (
@path/to/file.sh) - Is not already accompanied by a
.crux.mdfile (unless--forceis used) - Can be located anywhere in the project
Note: Code files are NOT included in ALL scans. They must always be explicitly referenced. No crux: true frontmatter opt-in is needed. No Cursor adapter (.crux.mdc) is produced for code files.
URLs (Webpages)
A URL is eligible for CRUX compression if:
- Starts with
http://orhttps:// - Returns fetchable text content (HTML/markdown)
- Is explicitly provided as an argument (not via file reference)
Note: URL compression always outputs to .crux/out/. No sourceChecksum is used — sourceUrl replaces it in frontmatter. No Cursor adapter (.crux.mdc) is produced. URLs are NOT included in ALL scans.
Images
An image file is eligible for CRUX compression if:
- Has a supported extension:
.png,.jpg,.jpeg,.gif,.webp,.svg - Is not already accompanied by a
.crux.mdfile (unless--forceis used) - Can be located anywhere in the project (not restricted to
.cursor/rules/)
Note: Image compression is always invoked via direct file reference (@path/to/image.png). Images are NOT included in ALL scans, which only process markdown rules. Image compression produces a .crux.md file (not .crux.mdc).
Adding New Files for Compression
To make a rule file eligible for CRUX compression:
- Ensure the source file uses
.mdextension (not.mdc) - Add
crux: true(orcrux: <n>for a specific compression level) to the YAML frontmatter:
Or with a specific level:--- crux: true # default 25% target alwaysApply: true # or other frontmatter ------ crux: 40 # 40% target (more verbose output) alwaysApply: true --- - Run
/crux-compress ALLor/crux-compress @path/to/file.md
Source vs Output Convention
| Type | Extension | Example |
|---|---|---|
| Source markdown (human-readable) | .md |
core-tenets.md |
Compressed Cursor rule (.cursor/rules/ sources) |
.crux.mdc |
core-tenets.crux.mdc |
| Compressed (universal, non-rule sources) | .crux.md |
core-tenets.crux.md |
| Source code | .sh, .ts, .py, etc. |
install.sh |
| Compressed code (semantic structure) | .crux.md |
install.crux.md |
| Source image | .png, .jpg, etc. |
diagram.png |
| Compressed image (semantic description) | .crux.md |
diagram.crux.md |
| Source URL (webpage) | URL | https://agents.md/ |
| Compressed URL (webpage content) | .crux.md |
.crux/out/agents-md.crux.md |
Output Path Rules
| Source Type | Output Location | Example |
|---|---|---|
Local file (@path/to/file.md) |
Same directory as source | path/to/file.crux.md |
URL (https://...) |
.crux/out/ |
.crux/out/agents-md.crux.md |
| No implied location | .crux/out/ |
.crux/out/content.crux.md |
The .crux/out/ directory is created automatically if it does not exist. This provides a consistent default location for compression output when there's no local source file to place the output alongside.
Direct output: For sources in .cursor/rules/, compression produces .crux.mdc directly (with alwaysApply injected from source frontmatter). No intermediary .crux.md is created. For all other sources, compression produces .crux.md.
Important: The CRUX header in compressed files references the source file:
⟦CRUX:core-tenets.md
...content...
⟧
Example Batch Execution
With ALL (≤4 files)
When /crux-compress ALL finds 4 or fewer eligible files:
Batch 1 (parallel, max 4):
├── crux-cursor-rule-manager → core-tenets.md → core-tenets.crux.mdc
├── crux-cursor-rule-manager → xfi-coding-standards.md → xfi-coding-standards.crux.mdc
├── crux-cursor-rule-manager → vscode-optimise.md → vscode-optimise.crux.mdc
└── crux-cursor-rule-manager → _IMPORTANT_CORE_MEMORY.md → _IMPORTANT_CORE_MEMORY.crux.mdc
With ALL (>4 files)
When /crux-compress ALL finds 6 eligible files:
Batch 1 (parallel, max 4):
├── crux-cursor-rule-manager → file1.md → file1.crux.mdc
├── crux-cursor-rule-manager → file2.md → file2.crux.mdc
├── crux-cursor-rule-manager → file3.md → file3.crux.mdc
└── crux-cursor-rule-manager → file4.md → file4.crux.mdc
[Wait for Batch 1 to complete]
Batch 2 (parallel, remaining files):
├── crux-cursor-rule-manager → file5.md → file5.crux.mdc
└── crux-cursor-rule-manager → file6.md → file6.crux.mdc
With file references (>4 files)
When /crux-compress @file1.md @file2.md @file3.md @file4.md @file5.md:
Batch 1 (parallel, max 4):
├── crux-cursor-rule-manager → file1.md
├── crux-cursor-rule-manager → file2.md
├── crux-cursor-rule-manager → file3.md
└── crux-cursor-rule-manager → file4.md
[Wait for Batch 1 to complete]
Batch 2 (parallel, remaining):
└── crux-cursor-rule-manager → file5.md
Single file
When /crux-compress @.cursor/rules/core-tenets.md:
Compression (source in .cursor/rules/ → direct .crux.mdc):
└── crux-cursor-rule-manager → core-tenets.md → core-tenets.crux.mdc
Validation (after compression completes):
└── crux-cursor-rule-manager (fresh) → validate core-tenets.crux.mdc → confidence: 92%
With URL(s)
When /crux-compress https://agents.md/specification:
Fetch URL content:
└── WebFetch → https://agents.md/specification → markdown content
Compression:
└── crux-cursor-rule-manager → agents-md-specification content → .crux/out/agents-md-specification.crux.md
Validation (after compression completes):
└── crux-cursor-rule-manager (fresh) → validate .crux/out/agents-md-specification.crux.md → confidence: 94%
With --force flag
When /crux-compress ALL --force:
Force delete (pre-processing):
├── Deleted: .cursor/rules/docs-sync.crux.mdc
├── Deleted: .cursor/rules/version-bump.crux.mdc
├── Deleted: .cursor/rules/ignore-example-rules.crux.mdc
└── Deleted: .cursor/rules/example/coding-standards-demo.crux.mdc
Batch 1 (parallel, max 4):
├── crux-cursor-rule-manager → docs-sync.md → docs-sync.crux.mdc
├── crux-cursor-rule-manager → version-bump.md → version-bump.crux.mdc
├── crux-cursor-rule-manager → ignore-example-rules.md → ignore-example-rules.crux.mdc
└── crux-cursor-rule-manager → coding-standards-demo.md → coding-standards-demo.crux.mdc
Note: With --force, no files are skipped due to "source unchanged" since all CRUX files are deleted first.
Semantic Validation
Every compression is followed by validation using a fresh agent instance:
- Compression agent writes the CRUX output (
.crux.mdcfor.cursor/rules/sources,.crux.mdotherwise) without confidence - Fresh validation agent compares CRUX output to source
- Validation agent returns confidence score (0-100%)
- Frontmatter is updated with
confidence: XX%
Confidence Score
The confidence score indicates how well the CRUX preserves the semantic meaning of the source:
| Score | Status | Action |
|---|---|---|
| ≥90% | Excellent | Accept as-is |
| 80-89% | Good | Accept, minor improvements optional |
| 70-79% | Marginal | Review flagged issues, consider revision |
| <70% | Poor | Revise compression, re-validate |
Why Fresh Agent for Validation?
Using a separate agent instance for validation ensures:
- No bias from the compression process
- Independent semantic evaluation
- The validator doesn't rely on CRUX specification knowledge
- True test of whether an LLM can understand the compressed notation
Related
crux-cursor-rule-managersubagent - The specialist that performs compressionCRUX.md- The CRUX notation specification.cursor/rules/_CRUX-RULE.mdc- Rules for working with CRUX filescrux-utilsskill - Token estimation and checksum utilities
