Borrowing it
Nothing to install: this file belongs to xsovad06/sova. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/xsovad06/sova/main/.claude/commands/optimize-knowledge.mdgit clone --depth 1 https://github.com/xsovad06/sovaWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/commands/xsovad06/sova/optimize-knowledge)<a href="https://agentmods.dev/commands/xsovad06/sova/optimize-knowledge"><img src="https://agentmods.dev/badge/commands/xsovad06/sova/optimize-knowledge/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/commands/xsovad06/sova/optimize-knowledge"><img src="https://agentmods.dev/badge/commands/xsovad06/sova/optimize-knowledge.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00025 | $0.01068 |
| Opus 5.5 | $0.00010 | $0.00427 |
| Sonnet 5.5 | $0.00005 | $0.00214 |
| Haiku 4.5 | $0.00003 | $0.00107 |
Grade B, and why
optimize-knowledge scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
find ~/.claude/projects/ -maxdepth 2 -name "MEMORY.md" -path "*/memory/*" 2>/dev/null How it starts
The opening of the file, as written. The whole thing — 136 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Optimize Knowledge System
Audit the entire Claude Code knowledge system for this project. Find gaps between what's known and what's enforced, prune stale entries, and embed lessons into skills.
Focus: $ARGUMENTS
Instructions
Phase 1: Discover and Read
Auto-discover all knowledge layers. Read every file found.
Layer 1: Shared knowledge (cross-project):
ls ~/.claude/shared-knowledge/*.md 2>/dev/null
Layer 2: Project rules (stable patterns):
ls .claude/rules/*.md 2>/dev/null
Layer 3: Agent memory (accumulated learnings):
ls .claude/agent-memory/*.md 2>/dev/null
Layer 4: Auto-memory (user preferences, feedback, project state):
# Find the project memory directory
find ~/.claude/projects/ -maxdepth 2 -name "MEMORY.md" -path "*/memory/*" 2>/dev/null
# Then list all files in that directory
Layer 5: Skills/commands:
ls .claude/commands/*.md 2>/dev/null
ls ~/.claude/commands/*.md 2>/dev/null
Layer 6: Project instructions:
cat CLAUDE.md 2>/dev/null | head -5
Read ALL discovered files. Skip binary files and files over 500 lines (summarize those instead).
Phase 2: Cross-Reference Analysis
2a. Knowledge vs Skills (gap detection)
For each feedback memory and cookbook/learnings entry:
- Is it enforced in any skill? A "never do X" that no skill checks for is a gap waiting to bite.
- Could it prevent a class of bugs? If yes, it belongs as a pre-flight check in the relevant skill.
For each skill:
- Does it miss patterns from the knowledge system? Cookbook says "check X before Y" but the skill doesn't.
- Does it reference outdated things? Old branch names, deprecated tools, removed workflows.
- Does it have error recovery gaps? What happens when a step fails?
2b. Staleness check
For each knowledge entry:
- Is it still true? Verify claims about file paths, function names, branch names against current code.
- Is it too specific? One-time fixes that will never recur don't belong in long-term memory.
- Is it duplicated? Same lesson in multiple layers, so consolidate to the most appropriate layer.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 1mo ago Changed · +135 lines · +25 tokens per session scan A → B a036a9552fa6
- 2mo ago First seen · 1 lines · 0 tokens per session scan A 9af343970dc8
optimize-knowledge is a command published in the GitHub repository xsovad06/sova (2 stars, last pushed yesterday), licensed Apache-2.0. It adds 25 tokens to every session and 1,068 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other commands, from other repositories
greptile-review
Execute the full Greptile review cycle on a PR, looping until score meets threshold or circuit breaker triggers.
review-branch
Review the current branch's diff against base by dispatching atomic-reviewer. No orchestration loop, no spec required — pre-flight before /commit pr or /commit merge.
review
Review current changes for correctness, style, and potential issues.
advanced-code-review-context
Advanced Code Review Phase 2: Context Analysis - load previous reviews, PR history, declined items.
code-review-give
Give mode for code-review: Review someone else's code with multi-pass analysis and structured recommendations.
mach12:issue-review
Read a GitHub issue and all comments, review the implementation plan, and present findings.