
Trim
FreeEfficiently reduce oversized context files safely.
Free · Opens the source repo
What Trim does
Trim is a specialized tool designed for managing the size of context files within the LifeOS environment. It is particularly useful for files that have grown too large, such as OPERATIONAL_RULES or CLAUDE.md. The skill operates through a series of well-defined steps to ensure safety and integrity, starting with a deterministic garbage collection (GC) of stale entries, followed by human-gated semantic merges and relocations. This systematic approach guarantees that no directives are lost during the trimming process, making it a reliable choice for users who need to maintain the accuracy of their operational rules while reducing file size.
The workflow begins with a simple command, /trim <file>, which initiates the reduction process. The tool first shows the current state of the file, then performs a zero-risk GC to identify removable entries. After that, it ranks potential semantic trims, which are then reviewed and approved by the user before being applied. This ensures that every important directive is preserved, as the invariant of the tool is that no distinct directive will ever be dropped. Users can also execute a trim without specifying a file, allowing the tool to automatically target the largest always-on context set.
Trim is best suited for developers and designers working within the LifeOS framework who need to manage large context files effectively. It is particularly beneficial when dealing with operational rules or doctrine files that require regular updates and maintenance. However, users should be aware that Trim is not intended for general code refactoring or for handling media files like audio or video. For those tasks, other specialized tools should be used.
In summary, Trim provides a structured and safe method for reducing the size of context files in LifeOS, ensuring that essential directives remain intact while improving overall file manageability. Its deterministic approach to garbage collection and semantic editing makes it a valuable tool for maintaining efficient workflows in a complex coding environment.
When to use it
Use Trim when you need to reduce the size of an always-on context file like `OPERATIONAL_RULES` or `CLAUDE.md` that has become too large to handle efficiently.
When not to use it
Trim is not suitable for general code refactoring or for editing media files. It should not be used for removing AI writing patterns from prose either.
What you can build with it
Trimming Operational Rules
When your `OPERATIONAL_RULES` file has grown too large, use Trim to safely reduce its size while preserving all directives.
Managing Context File Size
If you notice that the `CLAUDE.md` file is becoming unwieldy, Trim can help you shrink it without losing important information.
Folding Proposal Inbox
For users with a large proposal inbox, Trim can assist in folding and managing this data efficiently, ensuring clarity and organization.
How to install Trim
View source1. Install with the skills CLI
npx skills add danielmiessler/lifeos/Trim --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by danielmiesslerTrim
Shrink an always-on context file that has gotten too big. /trim <file> walks the reduction, safest cuts first, never dropping a rule.
Workflow Routing
| Trigger | Workflow |
|---|---|
/trim <file>, "trim OPERATIONAL_RULES", "this file is too big", "reduce a doctrine file", "fold the proposal inbox" | Workflows/Trim.md |
Quick Reference
- Target resolution: a bare name (
OPERATIONAL_RULES) resolves against the always-on set — the system prompt,CLAUDE.md, its@-imports, and the hook-injected memory files. No arg →wc -cthat set and take the largest. - Order is safest-first: (1) show state, (2) deterministic GC (zero-risk), (3) semantic trims (human-gated), (4) safety gate, (5) re-measure. Full steps:
Workflows/Trim.md. - One tool it orchestrates — never reimplement:
LIFEOS/TOOLS/ProposalGC.ts(removes superseded/duplicate/absorbed entries). Sizes come fromwc -c. - Three semantic moves: MERGE overlapping rules, TIGHTEN verbose ones, RELOCATE rarely-used detail to an on-demand reference (leave a stub + pointer).
- The invariant: a trim never drops a distinct directive. If a merge would, keep the original.
Gotchas
- USER files commit to the USER_DATA repo, not
~/.claude.LIFEOS/USER/**(OPERATIONAL_RULES, PROJECTS, the identity files) is a symlink into a separate private repo. Commit withgit -C ~/.config/LIFEOS/USER …. A~/.claudecommit captures nothing underLIFEOS/USER/— a false safety net. - The file can change mid-edit. The autonomic memory loop appends proposals to these files while you work. If a Write/Edit reports "modified since read", RE-READ before writing — a concurrent correction may have landed (this is how a real deploy-command fix was nearly reverted). Never write from a stale read.
- Semantic merges must never drop a directive. Before applying any merge/tighten, confirm every proper noun, path, tool name, and imperative from the originals survives in the result. If one is missing, the merge is wrong — keep the original. Deterministic GC (superseded/dup/absorbed) is always safe; semantic edits are the risky class.
bun/bunxonly, nevernpm/npx.- Deterministic first, always. Run ProposalGC before proposing any semantic edit — the free, zero-risk removals often clear enough that no judgment-call edit is needed.
Examples
/trim OPERATIONAL_RULES
# → shows 40,456 B → ProposalGC dry-run (0 removable) → ranks semantic trims (fold the
# 40-entry proposal tail, relocate skill-scoped directives to a reference)
# → applies approved ones behind the safety gate → commits to USER_DATA → 28,043 B (−31%)
/trim
# → no arg: wc -c the always-on set, take the largest, then the same walkthrough
Execution Log
After completing the workflow, append a single JSONL entry:
echo '{"ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","skill":"Trim","workflow":"Trim","input":"8_WORD_SUMMARY","status":"ok|error","duration_s":SECONDS}' >> ~/.claude/LIFEOS/MEMORY/SKILLS/execution.jsonl
Frequently asked questions about Trim
Similar skills
PDFtk Server
Command-line tool for comprehensive PDF manipulation.
PDF Processing
Comprehensive tools for manipulating PDF files.
PDF Processing
Comprehensive tools for managing PDF files.
Mac Storage Cleaner
Reclaim disk space safely and transparently on macOS.
PDF Processing
Comprehensive tools for managing PDF files.
Screenshot Capture
Capture screenshots across different platforms easily.
