一键导入
memory-discipline-worker
Memory index discipline — cap enforcement, pruning, archival, health reporting
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Memory index discipline — cap enforcement, pruning, archival, health reporting
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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
Prompt assembler optimization — sorting, memoization, cache-break detection, integration tests
Compresses and merges CLAUDE.md and rules files to fit under the 40K character cap
| name | memory-discipline-worker |
| description | Memory index discipline — cap enforcement, pruning, archival, health reporting |
NOTE: Startup and cleanup are handled by worker-base. This skill defines the WORK PROCEDURE.
Features that enforce size/line caps on markdown memory files, add pruning logic, archive overflow content, or report memory health.
Read the feature description carefully. Understand which files are affected and what the expected caps are (25KB / 200 lines).
Read source files. Before modifying:
.claude/lib/memory/memory-rotator.cjs fully (current rotation logic).claude/lib/memory/memory-paths.cjs for canonical path definitionsAGENTS.md for CC patterns referenceWrite tests first (red). Create test file at tests/lib/memory/<descriptive-name>.test.cjs. Tests should cover:
Implement changes.
Run tests (green). All tests pass.
Run lint and format.
pnpm lint
npx prettier --check <modified-files>
Run existing memory tests for regression.
node --test tests/lib/memory/memory-rotator.test.cjs
{
"salientSummary": "Added 25KB/200-line dual cap enforcement to memory-rotator.cjs. Preserved [PERMANENT] sections during pruning. Archive file created for overflow. 24 tests.",
"whatWasImplemented": "enforceMemoryCaps() function in memory-rotator.cjs enforces both 25KB and 200-line caps. Prunes oldest non-[PERMANENT] sections. Archives to .claude/context/memory/archive/<name>-YYYY-MM-DD.md. Appends warning line.",
"whatWasLeftUndone": "",
"verification": {
"commandsRun": [
{ "command": "node --test tests/lib/memory/memory-cap-enforcement.test.cjs", "exitCode": 0, "observation": "24 tests passing" },
{ "command": "node --test tests/lib/memory/memory-rotator.test.cjs", "exitCode": 0, "observation": "Existing tests still pass" },
{ "command": "pnpm lint", "exitCode": 0, "observation": "0 errors" }
]
}
}