reuse

reuse is a command for coding agents from vynazevedo/first-plan. It costs 53 tokens per session (915 once invoked), scanned A, original, MIT.

A command that searches an index of existing code to find reusable implementations for a plain-language request.

In plain words
What is it for?
Finding existing email validation, retrying HTTP requests, structured logging, confirmation modals, or other reusable code.
Why use it?
It helps avoid rewriting functionality that the project already contains and returns likely matches with their locations.

Command

Installs and runs on its own, but its text points at files inside its plugin — anything it tells you to read at a ${CLAUDE_PLUGIN_ROOT} path is only there once the plugin is installed. Installing the plugin gets both.

Part of the fp plugin — 19 skills, 19 commands, 4 agents, 1 hook shipped together

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/vynazevedo/first-plan/reuse
Clone the repo
git clone --depth 1 https://github.com/vynazevedo/first-plan

Or install fp, the plugin that ships this one along with the rest of its 19 skills, 19 commands, 4 agents, 1 hook.

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 reuse

README.md
[![agentmods](https://agentmods.dev/badge/commands/vynazevedo/first-plan/reuse.svg)](https://agentmods.dev/commands/vynazevedo/first-plan/reuse)
Your own site
<a href="https://agentmods.dev/commands/vynazevedo/first-plan/reuse"><img src="https://agentmods.dev/badge/commands/vynazevedo/first-plan/reuse.svg" alt="Measured on agentmods" 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 915 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.00053 $0.00915
Opus 5 $0.00026 $0.00458
Sonnet 5 $0.00011 $0.00183
Haiku 4.5 $0.00005 $0.00092

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

Security

Grade A, and why

reuse 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 4d 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/reuse.md · 110 lines

How it starts

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

/fp:reuse

Query do Reuse Index invertido.

Argumentos

$ARGUMENTS - intenção em texto livre. Exemplos:

  • "validação de email"
  • "fetch HTTP com retry"
  • "logging estruturado"
  • "modal de confirmação"

Workflow

Passo 0 - BM25 engine path (v0.4.0+)

Se first-plan-engine esta disponivel (ver skill first-plan-engine-bootstrap), preferir busca BM25 sobre o indice de simbolos via skill first-plan-semantic-reuse:

ENGINE=""
for c in "${CLAUDE_PLUGIN_ROOT}/engine/bin/first-plan-engine" "${HOME}/.local/bin/first-plan-engine" "$(command -v first-plan-engine 2>/dev/null)"; do
  [ -x "$c" ] && ENGINE="$c" && break
done

if [ -n "$ENGINE" ]; then
  DB=".first-plan/cache/search.db"
  # Re-indexar se ausente ou >= 24h velho
  if [ ! -f "$DB" ] || [ $(find "$DB" -mmin +1440 2>/dev/null | wc -l) -gt 0 ]; then
    "$ENGINE" index --repo . --db-path "$DB" --output-json /tmp/idx.json > /dev/null
  fi

  "$ENGINE" search --db-path "$DB" --query "$ARGUMENTS" --limit 10 --output-json /tmp/search.json
  # Renderizar JSON como tabela markdown
  # Veja skill semantic-reuse para detalhes
fi

Se sem engine OU search retornou 0 hits com score >= 3.0, fallback markdown abaixo.

Passo 1 - Pre-flight (fallback)

Verificar .first-plan/03-reuse/INDEX.md existe.

Passo 2 - Match por intenção

  1. Identificar categoria provável da intenção (validação, http, logging, ui, etc)
  2. Ler 03-reuse/INDEX.md na categoria correspondente
  3. Ler 03-reuse/search.json se intenção atravessa categorias
  4. Buscar matches via:
    • Match por keyword na intenção vs name/purpose/tags dos items
    • Categoria exata
    • Categoria adjacente (e.g., "validação" -> também checar "format")

Passo 3 - Priorizar

Items rankeados por:

  1. Match exato de categoria
  2. Match de keyword (peso por proximidade)
  3. usage_count (mais usado = mais provavelmente bem testado)
  4. Recência (atualizado recentemente)

Passo 4 - Apresentar

Top items para "<intenção>"

1. <name> em <path:line>
   <signature>
   Propósito: <purpose>
   Usado em: <usage_count> lugares
   Quando reusar: <when_to_reuse>
   Confidence: <score>

2. <name> em <path:line>
   ...

(até 5 items)

Se nenhum casa:
- Considerar criar novo (justificar no plano)
- Verificar adjacências: /fp:reuse "<intenção alternativa>"
- Refresh do índice: /fp:refresh 03-reuse

Read the full file on GitHub · 110 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. 4d ago First seen · 110 lines · 53 tokens per session scan A 62f56b48c5c9

Subscribe to this mod's changes

reuse is a command published in the GitHub repository vynazevedo/first-plan (23 stars, last pushed 10d ago), licensed MIT. It adds 53 tokens to every session and 915 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-30.