discover

A command for creating or updating a project note after inspecting a repository’s files and development documents. The note records the project’s technologies, structure, important files, conventions, and open questions.

In plain words
What is it for?
Scanning a repository, documenting its architecture and workflow, and appending a dated discovery section to an existing project note.
Why use it?
It provides project context when automatic discovery did not run or when an existing note needs a fresh review without replacing user-written content.

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/m3talux/superbrain/discover
Clone the repo
git clone --depth 1 https://github.com/m3talux/superbrain
Per session 84 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,020 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.00084 $0.01020
Opus 5 $0.00042 $0.00510
Sonnet 5 $0.00017 $0.00204
Haiku 4.5 $0.00008 $0.00102

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

Security

Grade A, and why

discover 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 2d 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.

commands/discover.md · 59 lines

How it starts

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

/superbrain:discover

Manual project discovery. Auto-discovery only fires on first session in a project with no existing note — this command bypasses that gate.

What it does

  1. Walks the project tree (bounded: 600 files, depth 5, vendored/build dirs skipped).
  2. Reads manifests + CLAUDE.md + README + Dockerfile (each capped at 8 KB).
  3. Invokes one detached claude -p sonnet-4-6 call with the gathered context.
  4. Writes a structured project note covering: stack, architecture, top-level folders, key files, docs, conventions, open questions.
  5. If the project note already exists, appends a fresh ## SuperBrain discovery (YYYY-MM-DD) section at the bottom — never overwrites user content. If no note exists, creates one with full discovered: true frontmatter.

How to invoke

Step 1 — determine the target project directory:

  • If an argument was passed to the slash command, treat it as an absolute path (or relative to the current working directory). Verify it exists and is a directory.
  • Otherwise, default to $CLAUDE_PROJECT_DIR (the project the current session opened in).

Step 2 — invoke the discoverer binary. The plugin classifies the target through the four-stage detection cascade (blocklist → strong-signal → workspace declaration → implicit umbrella) and handles single-project vs umbrella fan-out internally.

node "${CLAUDE_PLUGIN_ROOT}/dist/bin/sb-discover.js" --force "<project_dir>"

If the user explicitly asked to refresh every sub-project under an umbrella (not just the missing ones), pass --all too:

node "${CLAUDE_PLUGIN_ROOT}/dist/bin/sb-discover.js" --force --all "<project_dir>"

What the binary actually does given <project_dir>:

  • Blocked path (HOME, Documents, Library, /tmp, etc.) → silent skip, no note. Tell the user the path is on the blocklist and discovery cannot run there.
  • No strong project signal (just a README or LICENSE, no real manifest) → silent skip. Tell the user the directory doesn't look like a code project.
  • Single project → one note at ~/.superbrain/vault/projects/<slug>.md. If the note already exists, a fresh ## SuperBrain discovery (date) section is appended.
  • Umbrella / monorepo (workspace declaration or ≥2 sibling sub-projects detected) → one note per detected child (capped at 8), each named <umbrella-slug>-<child-slug>.md with umbrella: <umbrella-slug> frontmatter. Without --all, only children whose note doesn't exist yet are written; with --all, every child's note gets a fresh appended section.
  • Sub-project of an umbrella, opened directly → discovery treats it as a single project but with umbrella context, so the slug is correctly prefixed.

Read the full file on GitHub · 59 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. 2d ago First seen · 59 lines · 84 tokens per session scan A e8b0b0fd75e7

Subscribe to this mod's changes

discover is a command published in the GitHub repository m3talux/superbrain (41 stars, last pushed 22d ago), licensed MIT. It adds 84 tokens to every session and 1,020 once invoked, about $0.0004 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.