discover

discover is a command for Claude Code from rtazima/claude-proj-blueprint. It costs 0 tokens per session (662 once invoked), scanned A, original, MIT.

A read-only investigation of older code that combines the code, Git history, project tickets, and remote pull requests or issues when available. It reconstructs why a module exists and records notes and possible architecture or product decisions for human review.

In plain words
What is it for?
Use it when taking over legacy modules, investigating past decisions, or preparing architecture decision records and product requirements.
Why use it?
It helps explain unfamiliar or surprising code when the original reasoning is not clear from the files alone.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

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/rtazima/claude-proj-blueprint/discover
Clone the repo
git clone --depth 1 https://github.com/rtazima/claude-proj-blueprint

Made for: Claude Code.

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 discover

README.md
[![agentmods](https://agentmods.dev/badge/commands/rtazima/claude-proj-blueprint/discover.svg)](https://agentmods.dev/commands/rtazima/claude-proj-blueprint/discover)
Your own site
<a href="https://agentmods.dev/commands/rtazima/claude-proj-blueprint/discover"><img src="https://agentmods.dev/badge/commands/rtazima/claude-proj-blueprint/discover.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 662 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.1 $0.00000 $0.00662
Opus 5 $0.00000 $0.00331
Sonnet 5 $0.00000 $0.00132
Haiku 4.5 $0.00000 $0.00066

Measured 6d ago against content hash 12c83127d504, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, 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 6d 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.

.claude/commands/discover.md · 41 lines

What it actually says

Legacy code archaeology and context bootstrap. Reads code, git history, Jira (when configured), and remote PRs/issues to reconstruct WHY a module exists. Produces discovery notes in memory/, ADR candidates and PRD candidates in docs/ for human review, then re-indexes memory.

Arguments: $ARGUMENTS (one or more module paths or file paths, space-separated)

Workflow:

  1. Activate the context-legacy skill
  2. For each target in $ARGUMENTS, run all phases in order:
    • Phase 0 — Memory query: check if already discovered, avoid redo
    • Phase 1 — Code archaeology: static analysis, hot/cold files, public interface, surprising patterns
    • Phase 2 — Git history: churn, authors, regression commits, decision messages, git blame (targeted on hot files), dead PRs (closed without merge)
    • Phase 3 — Jira enrichment: ticket history, bug patterns, decision comments, epic chain (skipped if JIRA_* not set in .env)
    • Phase 4 — Cross-reference: correlate all signals, produce synthesis table
    • Phase 5 — Output: discovery notes, main context doc, ADR candidates, PRD candidates, marker patch, re-index
  3. Never modify source files — read-only on code

Tunable flags (defaults in parentheses, override via env var):

  • LEGACY_CONTEXT_EARLY_EXIT (false): if true, Phase 2 dead PR scan may run in lean mode on repos with no PR review culture
  • LEGACY_CONTEXT_TRUNK_THRESHOLD (30): PR coverage % below which the repo is classified as trunk-based

Defaults bias toward completeness. Override for speed when you have validated the repo profile.

Output paths:

  • Survey: memory/discoveries/-survey.md
  • Per-file notes: memory/discoveries//.md
  • Dead PR notes: memory/discoveries/-dead-prs.md
  • Jira notes: memory/discoveries/-jira.md
  • Main context doc: docs/architecture/legacy-context--.md
  • ADR candidates: docs/architecture/_candidates/adr-candidate-.md
  • PRD candidates: docs/product/_candidates/prd-candidate-.md
  • Marker patch: memory/discoveries//markers.patch

After all targets are processed, run: memory/.venv/bin/python -m memory.index --incremental

Supported remote providers (Phase 2 dead PR scan):

  • GitHub: detected by github.com in remote URL. Requires gh auth login completed.
  • Azure DevOps: detected by dev.azure.com or .visualstudio.com. Requires AZURE_DEVOPS_EXT_PAT in shell.
  • Other providers (GitLab, Bitbucket, self-hosted): dead PR scan skipped with warning.

Use this before /implement or /refactor on modules where memory and docs are empty. Designed for codebases older than 5 years with no convention discipline.

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. 6d ago First seen · 41 lines · 0 tokens per session scan A 12c83127d504

Subscribe to this mod's changes

discover is a command published in the GitHub repository rtazima/claude-proj-blueprint (20 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 662 tokens. 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.