一键导入
rules-worker
Compresses and merges CLAUDE.md and rules files to fit under the 40K character cap
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Compresses and merges CLAUDE.md and rules files to fit under the 40K character cap
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Agent frontmatter enhancements — disallowedTools, mcpServers scoping, fork_eligible field
Context management — pre-compact persistence, threshold alignment, microcompact/circuit breaker detection
Hook enhancements — updatedInput for bash safety prefixes, suppressOutput for verbose blocks, denial-based routing feedback
Hook system optimization — async conversion, consolidation, deduplication, new hook events
Memory index discipline — cap enforcement, pruning, archival, health reporting
Prompt assembler optimization — sorting, memoization, cache-break detection, integration tests
基于 SOC 职业分类
| name | rules-worker |
| description | Compresses and merges CLAUDE.md and rules files to fit under the 40K character cap |
NOTE: Startup and cleanup are handled by worker-base. This skill defines the WORK PROCEDURE.
Features that modify .claude/CLAUDE.md or .claude/rules/*.md files — compression, merging, restructuring, frontmatter changes, cross-reference updates.
Read the feature description carefully. Understand exactly which files to modify, what to preserve, and what to compress/merge.
Baseline measurement. Before ANY changes, run the character count script from AGENTS.md to record the current total. Record individual file sizes for files you'll modify.
Write tests first (red). Create test file at tests/rules/<descriptive-name>.test.cjs. Tests should verify:
Implement changes.
--- delimiters, description: and globs: or paths: keys.Run tests (green). All tests pass. Fix any failures.
Verify character count. Run the total character count script. Must be under target.
Run lint and format.
pnpm lint
pnpm format:check
Manual verification. Read each modified file end-to-end. Verify no critical content was lost. Check that the file reads naturally and coherently — not just mechanically compressed.
{
"salientSummary": "Compressed CLAUDE.md from 11,163 to 7,012 chars (-37%) by removing verbose examples and deduplicating routing table with agents.md. All 9 section anchors preserved, 3 IRON LAW markers retained, all @-references valid. Total CLAUDE.md+rules now at 37,450 chars (under 38K target).",
"whatWasImplemented": "Rewrote CLAUDE.md removing: verbose Self-Check Gates examples (3 paragraphs → 3 bullet points), duplicated routing table entries (already in agents.md), expanded tool descriptions (replaced with cross-references). Preserved all section headings, IRON LAW markers, @-references, and routing table structure.",
"whatWasLeftUndone": "",
"verification": {
"commandsRun": [
{
"command": "node -e \"const fs=require('fs');const p=require('path');let t=fs.readFileSync('.claude/CLAUDE.md','utf8').length;fs.readdirSync('.claude/rules').filter(f=>f.endsWith('.md')).forEach(f=>{t+=fs.readFileSync(p.join('.claude/rules',f),'utf8').length});console.log('Total:',t,t<40000?'PASS':'FAIL')\"",
"exitCode": 0,
"observation": "Total: 37450 PASS"
},
{
"command": "node --test tests/rules/claudemd-compression.test.cjs",
"exitCode": 0,
"observation": "8 tests passing"
},
{
"command": "pnpm lint",
"exitCode": 0,
"observation": "0 errors"
}
]
},
"tests": {
"added": [
{
"file": "tests/rules/claudemd-compression.test.cjs",
"cases": [
{ "name": "CLAUDE.md is between 6500 and 7500 chars", "verifies": "VAL-RC-003" },
{ "name": "all section anchors present", "verifies": "VAL-RC-002" },
{ "name": "at least 3 IRON LAW markers", "verifies": "VAL-RC-013" }
]
}
]
},
"discoveredIssues": []
}