rootnode-memory-optimization
Rebalances context across Memory, Custom Instructions, knowledge files, and User Preferences in Claude Projects. Audits Memory for redundancy, staleness, and misplacement; prescribes optimization including Codification of stable Memory patterns into explicit User Preferences or Project CI rules. Use when user says "optimize my memory," "what should be in my memory," "trim my knowledge files," "reduce my context usage," "rebalance my project," "what should be in my preferences vs memory," or asks whether something belongs in Memory, a knowledge file, or User Preferences. Also trigger on symptom-phrased: "my project feels bloated," "Claude keeps forgetting things," "my context window keeps hitting limits." Activate whenever Memory-layer balance is the primary concern. Do NOT use for full Project audits (use rootnode-project-audit if available), single-prompt evaluation (use rootnode-prompt-validation if available), or global-layer audits that don't touch Project Memory (use rootnode-glob
rootnode · Static checks on file
Installation
Read the source and dependencies before running a command. Copying does not install or execute anything.
npx skills add drayline/rootnode-skills --skill rootnode-memory-optimizationAbout this skill
name: rootnode-memory-optimization description: >- Rebalances context across Memory, Custom Instructions, knowledge files, and User Preferences in Claude Projects. Audits Memory for redundancy, staleness, and misplacement; prescribes optimization including Codification of stable Memory patterns into explicit User Preferences or Project CI rules. Use when user says "optimize my memory," "what should be in my memory," "trim my knowledge files," "reduce my context usage," "rebalance my project," "what should be in my preferences vs memory," or asks whether something belongs in Memory, a knowledge file, or User Preferences. Also trigger on symptom-phrased: "my project feels bloated," "Claude keeps forgetting things," "my context window keeps hitting limits." Activate whenever Memory-layer balance is the primary concern. Do NOT use for full Project audits (use rootnode-project-audit if available), single-prompt evaluation (use rootnode-prompt-validation if available), or global-layer audits that don't touch Project Memory (use rootnode-global-audit if available). license: Apache-2.0 metadata: author: rootnode version: "4.0.0" original-source: "NEW"
Context Layer Optimization for Claude Projects
Calibration: Tier 2 (Sonnet-graceful) — designed and tested against Opus 5 + Sonnet 5 dual-primary. Runs correctly on Sonnet 4.6 (legacy-graceful) with slightly less depth on multi-dimensional analysis; on Haiku 4.5 with extended thinking; fallback-graceful on Opus 4.8. Effort default is
highon Opus 5 and Sonnet 5; step down tomediumfor cost-sensitive runs where evals show quality holds. See repository README for model compatibility.
Rebalances context across Memory, Custom Instructions, knowledge files, and User Preferences in Claude Projects. Produces Memory edit prescriptions, knowledge file trimming recommendations, codification prescriptions for promoting stable patterns to explicit instructions, and cross-layer alignment findings.
Critical Rule: User Confirmation Before Memory Edits
Never execute Memory edits without presenting the full prescription and receiving explicit user confirmation. Memory is persistent and personal — this skill recommends, the user decides.
Confirmation protocol (every engagement):
- Present the complete optimization prescription: Memory edits (organized Remove → Add → Replace), codification prescriptions (if any), knowledge file trimming recommendations, and context budget impact summary
- State clearly: "These are my recommendations. I'll make the Memory changes only after you confirm."
- Wait for explicit user approval before calling
memory_user_edits - Execute edits in the correct sequence: removals first (highest line numbers first to avoid index shifts), then additions, then replacements
- Present the final Memory state (via
memory_user_editsview) as verification after execution
If the user says "just do it" or "go ahead with everything" — that IS confirmation. Execute. The gate ensures the user has seen the prescription, not to add friction.
If the user wants partial execution — execute only the approved edits. Note which recommendations remain unexecuted.
Critical Rule: Complete File Output
When producing any updated file — Custom Instructions, knowledge files, or any other deliverable — always output the complete file as a single, separately copyable unit. Never output diffs, patches, or partial sections that require manual splicing. The user replaces the old file by copying the complete output.
Reasoning discipline
A defensible prescription shows its grounding. Observe the specific Memory entries, content types, redundancies, and staleness markers; name the placement pattern or principle they match against (Memory vs. Custom Instructions vs. knowledge file vs. User Preferences); then apply the rebalancing prescription. A compressed summary recommendation is harder for the user to interrogate and easier to misroute — the explicit walk-through is what makes Stage 4 confirmation meaningful. The user-confirmation gate above stays load-bearing regardless.
If the optimization scope is unclear (Memory-only? full context-layer rebalance? Codification-focused?), confirm scope with the user before proceeding. Do not proceed on inferred assumptions.
Core Thesis
Optimal Project performance requires the right fact in the right layer:
| Layer | Purpose | What Belongs Here |
|---|---|---|
| User Preferences | Always-loaded universal foundation | Behavioral rules that improve every conversation everywhere — communication style, evidence standards, working style. Must pass the Universality Test. |
| Memory | Always-loaded orientation | High-frequency facts every conversation needs: current phase, active constraints, key decisions, identity facts |
| Custom Instructions | Always-loaded behavioral architecture | Identity, behavioral rules, output standards, knowledge file routing, mode definitions — project-specific |
| Knowledge files | Searchable reference depth | Structured content, detailed procedures, historical records, checklists, extended examples |
| Conversation | Per-message working context | Task-specific input, iterative refinement, session state |
Misalignment in any direction — orientation buried in a knowledge file, reference material crammed into Memory, behavioral rules in a knowledge file, universal preferences locked inside a single Project's CI — degrades performance. Memory optimization is not a standalone operation; it cascades. When Memory is optimized, knowledge files can be trimmed. When knowledge files are trimmed, context budget is freed. When context budget is freed, Claude has more room for the actual conversation.
When to Use This Skill
Use when:
- User wants to optimize their Memory or review what's in it
- User wants to trim knowledge files or reduce context usage
- User asks whether content belongs in Memory, a know