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.
npx agentmods add commands/study8677/repobrain/rb-setupgit clone --depth 1 https://github.com/study8677/repobrainWhat 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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00092 | $0.03223 |
| Opus 5 | $0.00046 | $0.01612 |
| Sonnet 5 | $0.00018 | $0.00645 |
| Haiku 4.5 | $0.00009 | $0.00322 |
Grade A, and why
rb-setup 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.
How it starts
The opening of the file, as written. The whole thing — 194 lines — stays where its author put it; the contents beside it link to each section on GitHub.
You are running first-time setup for the RepoBrain plugin. The user just installed the plugin and needs an LLM backend configured before the ask/refresh commands will work (/repobrain:rb-ask in Claude Code; /rb-ask in Codex CLI). There are two families of backends:
- API-key providers (OpenAI-compatible) — write
OPENAI_*keys. - Local host runners (no API key) — drive a headless CLI the user already has logged in (Codex, Trae, Claude, or any command that answers a prompt on stdin). This covers both
rb-askandrb-refresh: refresh runs its tool-free stages (module docs, map) through the host runner and automatically falls back to deterministic output for tool/handoff stages (conventions, git insights).
Goal: write a .env file at the current workspace root.
你正在执行 RepoBrain 插件的首次 setup。用户刚安装插件,需要先配置一个 LLM 后端,ask/refresh 命令才能正常工作(Claude Code 内为 /repobrain:rb-ask;Codex CLI 内为 /rb-ask)。后端分两类:
- API-key 提供商(OpenAI 兼容)—— 写入
OPENAI_*配置。 - 本地 host runner(无需 API key)—— 驱动用户本机已登录的无头 CLI(Codex、Trae、Claude,或任意能在命令行吃 prompt、吐文本的命令)。这条路同时支持
rb-ask和rb-refresh:refresh 的无工具阶段(module 文档、map)走 host runner,工具/handoff 阶段(conventions、git insights)会自动降级为确定性产物。
目标是在当前工作区根目录写入 .env 文件。
Step 1 — Detect existing config / 步骤 1 —— 检测已有配置
Read .env at the workspace root if it exists. If OPENAI_API_KEY or RB_HOST_RUNNER is already set, ask the user whether to overwrite the RepoBrain LLM/host-runner keys. If they say no, confirm "already configured" and stop.
如果工作区根目录已有 .env,先读取它。如果已经设置了 OPENAI_API_KEY 或 RB_HOST_RUNNER,询问用户是否覆盖 RepoBrain 的 LLM/host-runner 配置。若用户选择不覆盖,确认“already configured / 已配置”并停止。
Step 2 — Ask which backend (use AskUserQuestion) / 步骤 2 —— 询问后端(使用 AskUserQuestion)
First, detect which local headless CLIs are available so you only offer runners that can actually work. Run these checks (ignore ones that error):
先探测本机可用的无头 CLI,只向用户提供真正能用的 runner。运行以下检查(报错的忽略即可):
command -v codexand, if present,codex login statuscommand -v trae-cliand, if present,trae-cli login statuscommand -v claude(Claude Code; logged-in state is implicit)command -v gemini,command -v ollama
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.
- 2d ago First seen · 194 lines · 92 tokens per session scan A 270def867e50
rb-setup is a command published in the GitHub repository study8677/repobrain (1,321 stars, last pushed 4d ago), licensed MIT. It adds 92 tokens to every session and 3,223 once invoked, about $0.0005 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.
Other commands, from other repositories
codesage-review
Review CodeSage feature slices in parallel and persist validated findings.
codesage-report
Render a Markdown findings report from .codesage/findings/. No LLM call — pure formatter.
codesage-revalidate
Re-check findings after code changes without inferring fixes from omission.
codesage-eval
Evaluate CodeSage effectiveness on a project by mining session-based eval cases and running the bench runner.
codesage-onboard
Onboard a project to CodeSage (global MCP registration, init, index, git hooks, agent hint).
codesage-reset
Drop a project's CodeSage index and rebuild from scratch (use after settings changes, device switches, or corruption).