From first-plan
Performs semantic search (BM25) over project symbol index, matching by intent rather than exact name. Replaces grep during /fp:reuse and /fp:plan to find reusable components.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fp:semantic-reuseThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Habilita busca por **intencao** em vez de busca por nome exato. Isso fecha o gap mais comum entre Claude e o codigo: nomes de simbolos divergem da forma como descrevemos intencoes.
Habilita busca por intencao em vez de busca por nome exato. Isso fecha o gap mais comum entre Claude e o codigo: nomes de simbolos divergem da forma como descrevemos intencoes.
Exemplos:
validateEmailRFC, is_valid_email, EmailValidatorhttpClientWithBackoff, fetchWithRetries, RetryableClientConfirmDialog, useConfirmModal, AlertConfirmationENGINE=""
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
Se ausente, oferecer first-plan-engine-bootstrap skill ou cair no fallback markdown.
DB=".first-plan/cache/search.db"
# Re-indexar se DB nao existe ou esta stale (>= 24h)
if [ ! -f "$DB" ] || [ $(find "$DB" -mmin +1440 | wc -l) -gt 0 ]; then
"$ENGINE" index --repo . --db-path "$DB" --output-json /tmp/idx.json
echo "indexado: $(jq -r .total_symbols /tmp/idx.json) simbolos em $(jq -r .elapsed_ms /tmp/idx.json)ms"
fi
"$ENGINE" search \
--db-path "$DB" \
--query "<intencao>" \
--limit 10 \
--output-json /tmp/search.json
Output JSON first-plan-search-v1:
{
"$schema": "first-plan-search-v1",
"query": "<intencao>",
"hits": [
{
"symbol": {
"name": "ValidateEmail",
"kind": "function",
"language": "go",
"path": "pkg/validation/email.go",
"line": 12,
"signature": "func ValidateEmail(s string) error",
"doc": "Valida formato RFC 5322"
},
"score": 8.42,
"matched_tokens": ["validate", "email"]
}
]
}
Para /fp:reuse <intencao>, mostrar top 5 com:
Para /fp:plan (verificacao automatica de reuse), filtrar score >= 5.0 (threshold empirico) e listar candidatos no plano.
| Situacao | BM25 (engine) | Grep (fallback) |
|---|---|---|
| Query "preciso de X" abstrato | Vence facil | Falha |
| Query exata por substring | Empata ou vence (ranking) | Funciona |
| Codebase < 100 simbolos | Empata | Funciona |
| Codebase > 1000 simbolos | Vence (rapido + ranqueado) | Lento, lista flat |
| Sem engine disponivel | N/A | Funciona |
A partir da v0.4.1, o engine suporta tres modos via --mode:
| Mode | Como funciona | Quando usar |
|---|---|---|
bm25 (default) | Tokenizacao identifier-aware + BM25 ranking | Sempre disponivel. Bom para 80% dos casos |
embed | Cosine similarity sobre embeddings BGE-small | Sinonimos puros, conceitos abstratos |
hybrid | Combinacao linear: alpha*BM25 + (1-alpha)*cosine | Best-of-both. Default alpha=0.3 |
Embeddings exigem build com --features=ml (binario com sufixo -ml nos releases). Sem ele, modes embed/hybrid retornam erro.
Build ML pode ser identificado pela presenca do binario -ml:
ENGINE_PATH=""
HAS_ML=false
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_PATH="$c" && break
done
# Tentar mode hybrid - se erro, fallback bm25
if [ -n "$ENGINE_PATH" ]; then
if "$ENGINE_PATH" search --db-path "$DB" --query "test" --mode hybrid --limit 1 --output-json - 2>/dev/null > /tmp/cap.json; then
HAS_ML=true
fi
fi
BM25 acerta quando:
BM25 falha quando:
Para o segundo caso, embeddings (v0.4.1+) resolvem via similaridade vetorial.
npx claudepluginhub vynazevedo/first-plan --plugin fpSemantic codebase search — use for exploring code, finding implementations, and answering questions about any project. Searches using natural language queries, identifier names, or file paths. Returns ranked results using embedding-based similarity, BM25 keyword matching, symbol matching, import graph analysis, and git recency. Use this as the default exploration tool instead of grep when you don't know the exact text to search for.
Provides semantic code search and index management via the ccc CLI. Automatically initializes and refreshes the codebase index for relevant file retrieval.
Search code symbols (functions, classes, methods, types), find call sites and references, list file symbols, get outlines, check index status, and query static analysis findings. Requires indexed codebase.