/project-toolkit:memory-maintenancefrom project-toolkit
Runs memory-system health checks, token-cost counting, atomicity size validation, graph-density improvement, and performance benchmarking. Activated by phrases like 'check memory health', 'count memory tokens', or 'benchmark memory performance'.
Ships in project-toolkit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Health, budget, atomicity, and performance operations for the memory system,
extracted from the memory router per ADR-063 (memory-skill decomposition).
memory still routes here; an agent that only needs to check system health or
count a memory's token cost loads this sub-skill instead of the full router.
Maintenance is a family of read-mostly checks over the memory stores. Every
operation delegates to a canonical script under .claude/skills/memory/scripts/;
this sub-skill owns the operator guidance, not the script implementations. The
scripts are shared with the router and are not reimplemented here.
Use this skill when the user says:
check memory health for the tier-availability dashboardcount memory tokens for retrieval budget analysisbenchmark memory performance for Serena search latency# System health across all tiers
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/test_memory_health.py --format table; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Token cost of a memory before you retrieve it
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/count_memory_tokens.py <memory-file>; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Atomicity size validation (pre-commit gate)
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/test_memory_size.py <memory-dir> --pattern "*.md"; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Performance benchmark (Serena lexical search, by phase)
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/measure_memory_performance.py --format table; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
The canonical scripts live at
.claude/skills/memory/scripts/test_memory_health.py,
.claude/skills/memory/scripts/count_memory_tokens.py, and their siblings. This
sub-skill delegates to them and does not reimplement any check.
| Operation | Script | Key Parameters |
|---|---|---|
| Health check | test_memory_health.py | --format (json/table) |
| Token count | count_memory_tokens.py | <memory-file> |
| Size validation | test_memory_size.py | <memory-dir>, --pattern |
| Benchmark performance | measure_memory_performance.py | --iterations, --warmup, --format |
| Improve graph density | improve_memory_graph_density.py | --memory-path, --dry-run |
| Cross-reference | invoke_memory_cross_reference.py | --memory-path, --threshold |
| Convert index links | convert_index_table_links.py | --memory-path, --dry-run |
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/test_memory_health.py --format table; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
A healthy system reports available: true for each tier. Every tier is now
backed by files in the working tree, so available: false means a missing or
unreadable directory rather than a service being down, and there is no
fallback mode to select. Use the health check before a maintenance batch so you
know which tiers are readable.
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/count_memory_tokens.py <memory-file>; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Output: memory-index.md: 2,450 tokens
Count tokens before retrieval so the return-on-investment decision is informed. A SHA-256 hash-based cache gives a 10x to 100x speedup on repeated queries. See scripts/README-count-tokens.md for the cache layout and flags.
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/test_memory_size.py <memory-dir> --pattern "*.md"; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Exit 0 (pass) or 1 (fail) with decomposition recommendations
Atomic memories keep the token cost low: one retrievable concept per file.
Thresholds (from the memory-size-001-decomposition-thresholds memory):
See scripts/README-test-size.md for the full threshold rationale.
# Suggest cross-links to raise knowledge-graph density
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/improve_memory_graph_density.py --dry-run; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
# Compute reference candidates above a similarity threshold
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/invoke_memory_cross_reference.py --threshold 0.7; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
Density work is advisory: run it with --dry-run first, review the proposed
links, then apply. Denser cross-linking improves multi-hop retrieval; over-dense
linking adds noise. Prefer a threshold that adds few, high-confidence links.
( for d in "${CLAUDE_PLUGIN_ROOT}" "${COPILOT_PLUGIN_ROOT}" .claude; do if [ -n "$d" ] && [ -f "$d/lib/ptk_run.py" ]; then exec python3 "$d/lib/ptk_run.py" skills/memory/scripts/measure_memory_performance.py --format table; fi; done; echo "ptk_run: no plugin root holds lib/ptk_run.py" >&2; exit 2 )
The benchmark measures Serena lexical search latency, split into its listing, matching, and reading phases. Use it to confirm a change did not regress retrieval speed. The full method and the query set are in references/benchmarking.md.
| Operation | Verification |
|---|---|
| Health check | All tiers show available: true (or a known degraded tier) |
| Token count | CLI prints the file name and a token total |
| Size validation | Exit 0 (pass) or 1 with a decomposition recommendation |
| Benchmark | Latency report prints for each backend queried |
| Density dry run | Proposed links print and nothing is written |
| Anti-Pattern | Do This Instead |
|---|---|
| Retrieving a memory blind | Count tokens first; decide on the return on investment |
| Letting memories grow large | Run size validation; decompose past the thresholds |
| Applying density links blind | Dry-run first; apply only high-confidence links |
| Skipping the health check | Confirm tier availability before a maintenance batch |
| Trusting a slow retrieval | Benchmark; confirm the change did not regress latency |
Run the health check to learn which tiers are reachable and whether any store is degraded.
Run the specific maintenance operation (token count, size validation, benchmark, or density) against the target memories.
Apply size decomposition or density links only after a dry run confirms the change. Re-run the relevant check to verify the result.
| Skill | When to Use Instead |
|---|---|
memory | Router for search, reflexion, or gate operations |
memory-search | Tier 1 semantic lookup, not a maintenance check |
memory-reflexion | Record a completed session as an episode |
curating-memories | Content maintenance (obsolete, deduplicate, link) |
| Symptom | Cause | Recovery |
|---|---|---|
| Health check shows a tier down | Store directory missing or unreadable | Verify the path exists; every tier is local files, so this is not a service outage |
| Token count slow | Cache cold on first run | Re-run; the SHA-256 cache warms after the first pass |
| Size validation fails | Memory past atomicity thresholds | Decompose the memory into atomic files per the recommendation |
| Benchmark latency high | Large corpus, or many files matched and read | Read the per-phase split: listing, matching, and reading are timed separately |
See references/troubleshooting.md for the full diagnostic tables by component and symptom, and references/benchmarking.md for the performance targets.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub rjmurillo/ai-agents --plugin project-toolkit105 skills in this plugin
/adr-generatorCreate comprehensive Architectural Decision Records (ADRs). Researches the destination directory to detect existing template conventions, gathers context, determines next ADR number, generates the ADR, validates completeness, and saves. Supports multiple ADR formats (MADR, Nygard, Alexandrian, project canonical). Use when documenting technical decisions, creating new ADR files, or capturing rationale so future readers can revisit a choice. Use when you say "write an ADR", "document this decision", "document these design choices", "record why we chose this", "capture the rationale", or "for future maintainers", or when creating an ADR-like markdown file under docs/decisions/, docs/adr/, docs/architecture/, architecture/decisions/, or .project-toolkit/architecture/. Do NOT use to debate or review an existing ADR (use adr-review)./adr-reviewMulti-agent debate orchestration for Architecture Decision Records. Automatically triggers on ADR create/edit/delete. Coordinates architect, critic, independent-thinker, security, analyst, and high-level-advisor agents in structured debate rounds until consensus. Use when you say "review this ADR", when an ADR is created/edited/deleted, or when reviewing, accepting, or updating a decision file under .project-toolkit/architecture/, docs/architecture/, docs/decisions/, docs/adr/, or architecture/decisions/, including intent like "review this decision record" or "check this rationale for future maintainers". Do NOT use to author a new ADR (use adr-generator)./agent-harness-referenceField reference for Claude Code and GitHub Copilot CLI hook contracts. Covers hook locations, events, matchers, payloads, decisions, exit codes, timeouts, plugin roots, and cloud limits with official URLs and versioned probes. Use for `harness contract`, `copilot cli hook behavior`, `hook payload format`, `stale plugin root`, `Errno 2 _dispatch.py`, or before changing cross-harness hooks. Do NOT use to run the porting campaign (in the ai-agents repository, use `ai-agents-portability-campaign`)./ai-agents-external-claimsVerify external, vendor, and third-party claims (numbers, attributions, structure) against authoritative primary sources before they land in a repo artifact or external deliverable. Covers stake-holding sources, round-number tells, citation-chain drift, and the walk-the-gate-or-file-conservative discipline. Use when you say `verify an external claim`, `check a vendor number`, `is this stat real`, `validate a third-party citation`. Do NOT use for running an experiment (use `ai-agents-research-methodology` in the ai-agents repository) or command-injection scanning (use `security-scan`)./analysis-provenanceIdentify code ownership before modifying validators or linters. Checks file headers for provenance indicators, reviews documentation, and determines provenance as UPSTREAM, LOCAL, VENDOR, or UNKNOWN. Prevents accidental modification of upstream tools./analyzeSystematic multi-step codebase analysis producing prioritized findings with file-line evidence. Covers architecture reviews, security assessments, and code quality evaluations through guided exploration, investigation planning, and synthesis. Use when you say "analyze this codebase", "run security assessment", "architecture review of this system", "find code smells", or "review code quality" across multiple files. Do NOT use for single-file maintainability scoring (use code-qualities-assessment) or CWE-78 injection pattern scanning (use security-scan).Other plugins' skills for the same job