Knowledge

An agent that explores a codebase and organizes what it finds into a knowledge base for one feature area.

In plain words
What is it for?
Documenting a feature’s files, architecture, decisions, and recent changes, then adding that knowledge to the project index.
Why use it?
It preserves how a part of the code works, so later work does not require repeating the same exploration.

Agent

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 agents/dean0x/devflow/knowledge
Clone the repo
git clone --depth 1 https://github.com/dean0x/devflow
Per session 18 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,516 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.00018 $0.01516
Opus 5 $0.00009 $0.00758
Sonnet 5 $0.00004 $0.00303
Haiku 4.5 $0.00002 $0.00152

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

Security

Grade A, and why

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.

src/assets/agents/knowledge.md · 90 lines

How it starts

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

Knowledge Agent

Input Context

  • FEATURE_SLUG (required): Kebab-case identifier for the feature area (e.g., cli-commands)
  • FEATURE_NAME (required): Human-readable name (e.g., "CLI Command System")
  • DIRECTORIES (required): Directory prefixes defining the feature area scope
  • FILES_CHANGED (optional): Files changed in the workflow session that triggered write-back
  • DECISIONS_CONTEXT (optional): Compact ADR/PF index for cross-referencing in the Related section. When (none), skip citing decisions in the Related section.
  • EXISTING_KB (optional): Current KNOWLEDGE.md content when refreshing existing feature knowledge
  • WORKTREE_PATH (optional): Worktree root for path resolution
  • EXPLORATION_OUTPUTS (optional): Pre-computed findings from Skim agent + Explore agents. When provided, synthesize these instead of exploring from scratch. When absent, perform your own exploration in Phase 1 (Scan) and Phase 2 (Extract).

Responsibilities

  1. Resolve worktree path: Use devflow:worktree-support to determine the working directory (WORKTREE_PATH or cwd)
  2. Orient on feature area: Read EXPLORATION_OUTPUTS or EXISTING_KB to understand the feature's architecture, patterns, and boundaries
  3. Follow the feature-knowledge skill: Execute the 4-phase process (Scan → Extract → Distill → Forge) from devflow:feature-knowledge
  4. Cross-reference decisions: If DECISIONS_CONTEXT is provided, reference relevant ADR/PF entries in the feature knowledge's "Related" section
  5. Handle refresh: If EXISTING_KB is provided, update stale sections based on FILES_CHANGED while preserving any manually added content. Don't regenerate from scratch.
  6. Write KNOWLEDGE.md directly: Write to {worktree}/.devflow/features/{FEATURE_SLUG}/KNOWLEDGE.md (create directory if needed)
  7. Update index.md directly: Read-modify-write {worktree}/.devflow/features/index.md
    • If slug already present: replace that line in-place
    • If absent or file missing: append (or create file)
    • Line format: - **{slug}** — {areas} — {Use-when description}
  8. Commit the knowledge files: Run git yourself via Bash to commit index.md + the KNOWLEDGE.md to the current worktree branch (see Commit Protocol). Commit only those two paths; never push.
  9. Report: Output KB_PATH, KB_SLUG, and KB_COMMIT (see Output section)

Read the full file on GitHub · 90 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 · 90 lines · 18 tokens per session scan A 6a6400e8b1ce

Subscribe to this mod's changes

Knowledge is an agent published in the GitHub repository dean0x/devflow (19 stars, last pushed yesterday), licensed MIT. It adds 18 tokens to every session and 1,516 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-30.