extract-knowledge

A session review that records reusable lessons in the project's knowledge files. The knowledge system stores rules, agent memories, and patterns that can help future work.

In plain words
What is it for?
Use it after development or review work to inspect changes and conversation history, then capture conventions, gotchas, and fixes for future agents.
Why use it?
Useful decisions and lessons can otherwise disappear when a coding session ends. Recording them reduces repeated mistakes across later sessions.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/xsovad06/sova/extract-knowledge
Clone the repo
git clone --depth 1 https://github.com/xsovad06/sova

Made for: Claude Code.

Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,002 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00016 $0.01002
Opus 5 $0.00008 $0.00501
Sonnet 5 $0.00003 $0.00200
Haiku 4.5 $0.00002 $0.00100

Measured yesterday against content hash c6c4c27d29c7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

extract-knowledge scanned grade A with 0 findings 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 yesterday.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/extract-knowledge.md · 110 lines

How it starts

The opening of the file, as written. The whole thing — 110 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Extract Knowledge

Review this session's work and extract reusable knowledge into the project's knowledge system.

Knowledge Architecture

This project uses a four-tier knowledge system:

Tier 0: ~/.claude/shared-knowledge/ (cross-project patterns)

Reusable patterns that apply across multiple repositories. Loaded by agent startup scripts.

Tier 1: .claude/rules/*.md (canonical, always loaded via CLAUDE.md)

Stable patterns loaded into every session via CLAUDE.md. Primary destination for confirmed conventions.

Tier 2: .claude/agent-memory/ (agent learnings, loaded by morning agent)

Lessons learned from development and review cycles. Destination for agent-specific patterns that improve autonomous development quality.

  • MEMORY.md -- Index file
  • cookbook.md -- Topical knowledge by domain, common mistakes with occurrence counts

Tier 3: User auto-memory (~/.claude/projects/.../memory/)

User preferences, workflow conventions, and project state.

Steps

1. Identify What Changed

Run git diff and git diff --cached to see current changes. Also review the conversation for patterns, gotchas, decisions, and fixes that came up during the session.

2. Categorize Findings

For each finding, determine the right destination:

Finding type Destination
Domain-specific patterns (security, performance, etc.) .claude/rules/<domain>.md
ORM/framework gotchas, review lessons, recurring mistakes .claude/agent-memory/cookbook.md (under matching domain section)
Agent workflow or project pattern changes .claude/agent-memory/MEMORY.md
User preferences, workflow, collaboration style User auto-memory

3. Check for Duplicates

Before writing anything:

  1. Read the target file
  2. Check for existing entries about the same topic
  3. Update existing entries rather than adding duplicates
  4. Remove entries that are now outdated or wrong

4. Write Knowledge

For .claude/rules/*.md (Tier 1):

  • Follow the existing structure and formatting of the target file. Write concise entries with bold labels, then the lesson. These are always loaded -- keep entries actionable and specific to this project.

Read the full file on GitHub · 110 lines

Changes

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.

  1. yesterday First seen · 110 lines · 16 tokens per session scan A c6c4c27d29c7

Subscribe to this mod's changes

extract-knowledge is a command published in the GitHub repository xsovad06/sova (2 stars, last pushed 2d ago), licensed Apache-2.0. It adds 16 tokens to every session and 1,002 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.