knowledge-extractor

knowledge-extractor is an agent for Claude Code from SethGammon/Citadel. It costs 53 tokens per session (815 once invoked), scanned A, original, MIT.

A knowledge-capture agent that extracts reusable patterns, pitfalls, and decisions from completed coding work and writes them to a wiki staging area. A staging area holds findings temporarily before they are added to the main knowledge wiki.

In plain words
What is it for?
Use it after a body of work to record what worked, what caused problems, and which architectural choices should inform future tasks.
Why use it?
It preserves lessons from finished work so they can be reused later instead of being lost in a session transcript.

Agent for Claude Code

Written for Claude Code: effort in frontmatter. Also seen: names the NotebookEdit tool; mentions Claude Code.

Part of the citadel plugin — 48 skills, 7 agents, 2 MCP servers shipped together

Good fit Use it after a body of work to record what worked, what caused problems, and which architectural choices should inform future tasks.

Compare 6 agents from other repositories ↓
Install with agentmods
npx agentmods add agents/sethgammon/citadel/knowledge-extractor
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.

Clone the repo
git clone --depth 1 https://github.com/SethGammon/Citadel

Made for: Claude Code.

Or install citadel, the plugin that ships this one along with the rest of its 48 skills, 7 agents, 2 MCP servers.

Wrote 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.

agentmods badge for knowledge-extractor

README.md
[![agentmods](https://agentmods.dev/badge/agents/sethgammon/citadel/knowledge-extractor/github.svg)](https://agentmods.dev/agents/sethgammon/citadel/knowledge-extractor)
Your own site
<a href="https://agentmods.dev/agents/sethgammon/citadel/knowledge-extractor"><img src="https://agentmods.dev/badge/agents/sethgammon/citadel/knowledge-extractor/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.

agentmods 80×15 button for knowledge-extractor

Your own site · 80×15
<a href="https://agentmods.dev/agents/sethgammon/citadel/knowledge-extractor"><img src="https://agentmods.dev/badge/agents/sethgammon/citadel/knowledge-extractor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 53 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 815 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00053 $0.00815
Opus 5.5 $0.00021 $0.00326
Sonnet 5.5 $0.00011 $0.00163
Haiku 4.5 $0.00005 $0.00081

Measured 1mo ago against content hash dd2c318fce8b, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

knowledge-extractor 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 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.

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.

agents/knowledge-extractor.md · 78 lines

How it starts

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

Knowledge Extractor

You extract reusable knowledge from completed work and write it to the wiki staging area at .planning/wiki/_staging/ so /learn --compile can integrate it into the knowledge wiki.

What You Extract

  1. Patterns: Approaches that worked well and should be repeated
  2. Pitfalls: Things that broke and how they were fixed
  3. Decisions: Architectural choices and their reasoning

How You Work

  1. Read the completed campaign file or recent session handoff
  2. Identify knowledge worth preserving — only reusable findings, not one-off details
  3. Write each finding as a JSONL record to .planning/wiki/_staging/{source}-{timestamp}.jsonl
  4. Use the format below

Staging Record Format

One JSON record per line. Each record is one finding:

{"type":"pattern","name":"orientation-neighbor-naming","mechanism":"Name 2 adjacent skills in 'Don't use when' rather than only describing this skill's use case","topic":"skill-orientation","evidence":"hook-surface-update (2026-05-07)","confidence":"high","applies-to":"Any skill corpus where 2+ skills have overlapping but distinct use cases"}
{"type":"pitfall","name":"early-exit-before-check","mechanism":"Placing an early process.exit() before the check that needs to run defeats the check","topic":"hook-design","evidence":"intake-scanner wiki-staging fix (2026-05-07)","confidence":"high","applies-to":"Any Node.js hook that has multiple check paths"}
{"type":"decision","what":"Wiki lives at .planning/wiki/ not .claude/","rationale":"Claude Code silently blocks writes under .claude/","outcome":"completed","topic":"harness-design"}

Field Reference

Field Required Description
type yes pattern, pitfall, or decision
name yes Short kebab-case identifier
topic yes Wiki page slug (e.g., skill-orientation, hook-design)
mechanism yes (pattern/pitfall) What caused success or failure
what + rationale + outcome yes (decision) Decision record
evidence yes Source: campaign slug and date
confidence yes high, medium, or low
applies-to recommended Scope description

Read the full file on GitHub · 78 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. 1mo ago First seen · 78 lines · 53 tokens per session scan A dd2c318fce8b

Subscribe to this mod's changes

knowledge-extractor is an agent published in the GitHub repository SethGammon/Citadel (925 stars, last pushed today), licensed MIT. It adds 53 tokens to every session and 815 once invoked, about $0.0002 per session on Opus 5.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-30.