codebase-knowledge

A command for presenting structured knowledge about a codebase, including its architecture, modules, public interfaces, and recurring patterns.

In plain words
What is it for?
It helps document a whole repository or selected path and can include context from a referenced ticket or issue.
Why use it?
It turns scattered project details into a consistent overview without ranking defects.

Command

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/lugassawan/swe-workbench/codebase-knowledge
Clone the repo
git clone --depth 1 https://github.com/lugassawan/swe-workbench
Per session 60 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 380 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.00060 $0.00380
Opus 5 $0.00030 $0.00190
Sonnet 5 $0.00012 $0.00076
Haiku 4.5 $0.00006 $0.00038

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

Security

Grade A, and why

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

commands/codebase-knowledge.md · 28 lines

What it actually says

Produce a structured knowledge document for this codebase.

Step 1 — Parse arguments

From $ARGUMENTS, extract:

  • Optional path — a token is treated as a path if it contains /, starts with ., or matches an existing directory in the repo; otherwise treat the entire argument string as natural-language context with no path scoping. If a path is identified, scope all phases to that path and its descendants; if absent, use the repo root.
  • Ticket ref — scan first: any token matching #\d+, [A-Z]+-\d+, or an atlassian.net/GitHub URL is a ticket ref. Collect the first match and remove it from the remaining argument string before further parsing; ignore if none.

Step 2 — Ticket context (when a ref is present)

If a ticket ref was found in Step 1, invoke swe-workbench:ticket-context with that ref and prepend its summary to the context passed in Step 3.

Step 3 — Invoke workflow skill

Pass the parsed path (or . if absent) to swe-workbench:workflow-codebase-knowledge:

"Path: <path>."

Append the ticket-context summary from Step 2 if present.

The skill handles all five phases (Scope → Module map → Public API surfaces → Patterns → Render) and produces the structured knowledge document. This command does not produce Plan-mode output — the sweep is read-only by definition.

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 · 28 lines · 60 tokens per session scan A a19df0f70a97

Subscribe to this mod's changes

codebase-knowledge is a command published in the GitHub repository lugassawan/swe-workbench (2 stars, last pushed yesterday), licensed MIT. It adds 60 tokens to every session and 380 once invoked, about $0.0003 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.