Skip to content

Commit aefb94d

Browse files
docs: fix documentation inaccuracies flagged by Codex in PR #115 (#117)
* docs: fix documentation inaccuracies flagged by Codex in PR #115 Fix all seven documentation inaccuracies across en/zh/es docs: 1. Generic host runner: Add required RB_HOST_COMMAND example - Show concrete trae-cli template instead of claiming generic is drop-in - SWARM_PROTOCOL.md: Configuration section 2. Ask fallback order: Correct pipeline flow description - Document actual code behavior: host-runner bypasses swarm entirely - Structured facts path tries agent.md then legacy-facts internally - SWARM_PROTOCOL.md: Fallback Strategy section 3. Remove non-existent RB_LOG_LEVEL env var - No such env var exists in engine or CLI - SWARM_PROTOCOL.md: Example 3 debugging section 4. Remove .repobrain/config.json ignore pattern advice - No reader/schema exists for this file - Scan exclusions are hard-coded in hub/scanner.py - SWARM_PROTOCOL.md: Performance Tips section 5. Fix Phase 9 status conflict in ROADMAP.md - Mark Phase 9 as completed with productization achievements - Relabel future ideas (sandbox, DAG, fleet, observability) as extensions - ROADMAP.md: Phase 9 section (en only; zh/es already correct) 6. Qualify Ask Swarm behavior in host-runner mode - Document single local CLI call, no Router/ModuleAgent/GitAgent - SWARM_PROTOCOL.md: New Host-Runner Mode subsection 7. Correct ModuleAgent knowledge sources - ModuleAgents read agents/*.md, not structured facts.json - Structured facts consumed by separate ask path - SWARM_PROTOCOL.md: ModuleAgent description All changes verified via grep for residual mentions. Co-authored-by: JingWen Fan <study8677@users.noreply.github.com> * docs(zh): fix Phase 9 status in table to match section heading Table showed '进行中' (In Progress) while section heading shows ✅. Changed to '完成' (Complete) for internal consistency. Spanish version already correct (Completa). Co-authored-by: JingWen Fan <study8677@users.noreply.github.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: JingWen Fan <study8677@users.noreply.github.com>
1 parent f32cb11 commit aefb94d

5 files changed

Lines changed: 132 additions & 52 deletions

File tree

‎docs/en/ROADMAP.md‎

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -99,19 +99,18 @@ one IDE.
9999

100100
**Implemented by:** [@devalexanderdaza](https://github.com/devalexanderdaza)
101101

102-
## 🚀 Phase 9: Enterprise Core (In Progress)
102+
## 🚀 Phase 9: Enterprise Core (Completed with Future Extensions)
103103

104-
**Goal**: Transform RepoBrain from a workspace into an autonomous **Agent Operating System**
104+
**Completed:** 2025
105105

106-
The final vision is a production-grade system where enterprises can:
107-
- 🏗️ Build agents declaratively
108-
- 🚀 Deploy at global scale
109-
- 🔒 Execute code safely in sandboxes
110-
- 🧪 Orchestrate complex workflows
111-
- 📊 Monitor and observe at scale
112-
- 💾 Persist state and history
106+
**Productized Achievements:**
107+
- Safety boundaries and model selection controls
108+
- Observability through `rb report`, status tracking, and structured logs
109+
- Deployment polish: host-runner backend, incremental refresh, stable CLI
113110

114-
### Phase 9A: Sandbox Environment 🔒
111+
The core phase is complete. Below are **future extension ideas** (not currently in-progress) that would build on this foundation:
112+
113+
### Future Extension: Sandbox Environment 🔒
115114
**Objective**: Safe, isolated code execution for high-risk operations
116115

117116
**Proposed Solutions:**
@@ -138,7 +137,7 @@ result = sandbox.execute(
138137
- ✅ Cost-efficient resource scaling
139138
- ✅ Compliance with security policies
140139

141-
### Phase 9B: Orchestrated Flows 🔀
140+
### Future Extension: Orchestrated Flows 🔀
142141
**Objective**: Complex, structured task pipelines with DAG support
143142

144143
**Proposed Architecture:**
@@ -185,7 +184,7 @@ steps:
185184
- 📈 Real-time monitoring and observability
186185
- 🎯 Composable, reusable workflows
187186
188-
### Phase 9C: Distributed Agent Fleet 🌍
187+
### Future Extension: Distributed Agent Fleet 🌍
189188
**Objective**: Multi-agent coordination across regions
190189
191190
**Planned Features:**
@@ -195,8 +194,8 @@ steps:
195194
- **Load Balancing**: Intelligent task distribution
196195
- **Failover**: Automatic agent replacement
197196
198-
### Phase 9D: Observability & Monitoring 📊
199-
**Objective**: Production-grade observability
197+
### Future Extension: Observability & Monitoring 📊
198+
**Objective**: Production-grade observability beyond current status tracking
200199
201200
**Planned Components:**
202201
- **Metrics**: Agent performance, tool usage, success rates
@@ -205,7 +204,7 @@ steps:
205204
- **Alerts**: Anomaly detection and alerting
206205
- **Dashboards**: Real-time agent health monitoring
207206
208-
### Phase 9E: Enterprise Integrations 🔗
207+
### Future Extension: Enterprise Integrations 🔗
209208
**Objective**: Out-of-the-box enterprise connectors
210209
211210
**Target Integrations:**

‎docs/en/SWARM_PROTOCOL.md‎

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Keeps it under 300 words, outputs ONLY Markdown content.
7272

7373
When no API key is configured (`RB_HOST_RUNNER` set to `codex` or `generic`), Refresh uses a single-turn, tool-free Convention Agent (`build_single_turn_convention_agent()`) that collapses the three-stage chain into one generation.
7474

75+
**Important:** Host-runner mode for refresh is single-turn only. It does not use the full three-agent handoff chain.
76+
7577
## 💬 Ask Swarm: Dynamic Module Router
7678

7779
When you run `rb-ask "question"`, the Ask Swarm routes your question to the relevant module's agent and returns an answer with file paths and line numbers.
@@ -115,11 +117,11 @@ graph TD
115117
**Responsibility:** Deep knowledge of a specific module
116118

117119
Each module gets its own agent with:
118-
- Module's structured facts (JSON claims + source evidence)
120+
- Module's agent knowledge (`agents/*.md` — grouped module summaries or legacy `modules/*.md`)
119121
- Tools to explore code (read_file, search_code, etc.)
120122
- Ability to hand off to other ModuleAgents for cross-module information
121123

122-
ModuleAgents are created dynamically based on the project scan (one agent per detected module).
124+
ModuleAgents are created dynamically in the legacy swarm path (one agent per detected module). When structured artifacts exist, the ask pipeline uses `_ask_with_agent_md` instead, which routes directly via `map.md` without building the full swarm.
123125

124126
#### 📜 GitAgent
125127
**Responsibility:** Git history and change analysis
@@ -136,13 +138,29 @@ Handles questions about:
136138
- **Pipeline:** `engine/repobrain_engine/hub/ask_pipeline.py`
137139
- **Knowledge:** Reads from generation directory pointed to by `.repobrain/current.json`
138140

141+
### Host-Runner Mode (No Multi-Agent Routing)
142+
143+
When `RB_HOST_RUNNER` is set (`codex` or `generic`), Ask uses `_ask_with_host_runner` exclusively:
144+
- **Single local CLI invocation** with project context and question
145+
- Does **not** build Router/ModuleAgent/GitAgent or perform multi-agent handoffs
146+
- Returns direct answer from the local host CLI (no swarm orchestration)
147+
148+
Users of the no-API-key path must understand that they get a single-turn local answer, not the full Router-Worker collaboration.
149+
139150
### Fallback Strategy
140151

141-
The ask pipeline implements a three-tier fallback mechanism:
152+
The ask pipeline implements a context-sensitive fallback mechanism:
153+
154+
**When `RB_HOST_RUNNER` is set** (codex or generic):
155+
- Uses `_ask_with_host_runner` exclusively
156+
- Does not build Router/ModuleAgent/GitAgent
157+
- Single local CLI invocation with no multi-agent routing
142158

143-
1. **`_ask_with_structured_facts`** — Uses structured facts (JSON claims + source verification)
144-
2. **`_ask_with_agent_md`** — Falls back to agent.md files (plain text knowledge)
145-
3. **`_ask_with_legacy_swarm`** — Final fallback (if both fail)
159+
**Standard API-based ask flow:**
160+
1. **`_ask_with_structured_facts`** (when `.repobrain/map.md` and `agents/*.md` exist):
161+
- First tries `_ask_with_agent_md` — Routes via map.md to agent.md knowledge
162+
- Falls back to `_ask_with_legacy_facts` within the same call — Uses legacy `*.facts.json` if available
163+
2. **`_ask_with_legacy_swarm`** — Final fallback when structured artifacts return no answer
146164

147165
This ensures ask functionality remains available even if knowledge base is partially generated or uses older formats.
148166

@@ -157,7 +175,13 @@ This ensures ask functionality remains available even if knowledge base is parti
157175

158176
2. **Host-runner (no API key):**
159177
```bash
160-
export RB_HOST_RUNNER=codex # or generic
178+
# Codex preset (built-in configuration)
179+
export RB_HOST_RUNNER=codex
180+
181+
# Generic runner (requires RB_HOST_COMMAND template)
182+
export RB_HOST_RUNNER=generic
183+
export RB_HOST_COMMAND='trae-cli exec --cd {workspace} --sandbox read-only --skip-git-repo-check --ephemeral -o {output_file}'
184+
export RB_HOST_OUTPUT_MODE=file
161185
# Uses logged-in IDE CLI, no API key needed
162186
```
163187

@@ -219,11 +243,14 @@ rb-ask "What changed in the auth module?"
219243
### Example 3: Debugging Usage
220244

221245
```bash
222-
# Refresh with debug logging
223-
RB_LOG_LEVEL=DEBUG rb-refresh
246+
# Ask with verbose output (streamed progress)
247+
rb-ask "Where is the database connection?"
224248

225-
# Ask with verbose output
226-
RB_LOG_LEVEL=DEBUG rb-ask "Where is the database connection?"
249+
# Check refresh status
250+
rb report
251+
252+
# Force full refresh (non-incremental)
253+
rb-refresh # without --quick
227254
```
228255

229256
## 🐛 Troubleshooting
@@ -272,7 +299,7 @@ MCP server implementation: `engine/repobrain_engine/hub/mcp_server.py`
272299

273300
### Speed Up Refresh
274301
- Use `--quick` for incremental updates (clean worktree after commit)
275-
- Exclude unnecessary directories (configure ignore patterns in `.repobrain/config.json`)
302+
- Scan exclusions are built-in (venv, node_modules, .git, etc. — see `SKIP_DIRS` in `engine/repobrain_engine/hub/_constants.py`)
276303
- Use faster models (e.g., GPT-4o-mini or Claude 3.5 Haiku)
277304

278305
### Improve Answer Quality

‎docs/es/SWARM_PROTOCOL.md‎

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ Lo mantiene bajo 300 palabras, genera SOLO contenido Markdown.
7272

7373
Cuando no hay API key configurada (`RB_HOST_RUNNER` establecido en `codex` o `generic`), Refresh usa un Agente de Convenciones de turno único sin herramientas (`build_single_turn_convention_agent()`) que colapsa la cadena de tres etapas en una sola generación.
7474

75+
**Importante:** El modo host-runner para refresh es de turno único solamente. No usa la cadena completa de handoff de tres agentes.
76+
7577
## 💬 Ask Swarm: Enrutador de Módulos Dinámico
7678

7779
Cuando ejecutas `rb-ask "pregunta"`, el Ask Swarm enruta tu pregunta al agente del módulo relevante y devuelve una respuesta con rutas de archivo y números de línea.
@@ -115,11 +117,11 @@ graph TD
115117
**Responsabilidad:** Conocimiento profundo de un módulo específico
116118

117119
Cada módulo obtiene su propio agente con:
118-
- Facts estructurados del módulo (claims JSON + evidencia de fuente)
120+
- Conocimiento del agente del módulo (`agents/*.md` — resúmenes de módulos agrupados o `modules/*.md` heredado)
119121
- Herramientas para explorar código (read_file, search_code, etc.)
120122
- Capacidad de pasar el control a otros ModuleAgents para información entre módulos
121123

122-
Los ModuleAgents se crean dinámicamente basados en el escaneo del proyecto (un agente por módulo detectado).
124+
Los ModuleAgents se crean dinámicamente en el camino de swarm heredado (un agente por módulo detectado). Cuando existen artefactos estructurados, el pipeline ask usa `_ask_with_agent_md` en su lugar, que enruta directamente vía `map.md` sin construir el swarm completo.
123125

124126
#### 📜 GitAgent
125127
**Responsabilidad:** Historial de Git y análisis de cambios
@@ -136,13 +138,29 @@ Maneja preguntas sobre:
136138
- **Pipeline:** `engine/repobrain_engine/hub/ask_pipeline.py`
137139
- **Conocimiento:** Lee del directorio de generación apuntado por `.repobrain/current.json`
138140

141+
### Modo Host-Runner (Sin Enrutamiento Multi-Agente)
142+
143+
Cuando `RB_HOST_RUNNER` está configurado (`codex` o `generic`), Ask usa `_ask_with_host_runner` exclusivamente:
144+
- **Invocación CLI local única** con contexto del proyecto y pregunta
145+
- **No** construye Router/ModuleAgent/GitAgent ni realiza handoffs multi-agente
146+
- Devuelve respuesta directa del CLI local (sin orquestación de swarm)
147+
148+
Los usuarios del modo sin API key deben entender que reciben una respuesta local de turno único, no la colaboración completa Router-Worker.
149+
139150
### Estrategia de Fallback
140151

141-
El pipeline de ask implementa un mecanismo de fallback de tres niveles:
152+
El pipeline de ask implementa un mecanismo de fallback sensible al contexto:
153+
154+
**Cuando `RB_HOST_RUNNER` está configurado** (codex o generic):
155+
- Usa `_ask_with_host_runner` exclusivamente
156+
- No construye Router/ModuleAgent/GitAgent
157+
- Invocación CLI local única sin enrutamiento multi-agente
142158

143-
1. **`_ask_with_structured_facts`** — Usa facts estructurados (claims JSON + verificación de fuente)
144-
2. **`_ask_with_agent_md`** — Recurre a archivos agent.md (conocimiento en texto plano)
145-
3. **`_ask_with_legacy_swarm`** — Fallback final (si ambos fallan)
159+
**Flujo ask estándar basado en API:**
160+
1. **`_ask_with_structured_facts`** (cuando `.repobrain/map.md` y `agents/*.md` existen):
161+
- Primero intenta `_ask_with_agent_md` — Enruta vía map.md al conocimiento de agent.md
162+
- Recurre a `_ask_with_legacy_facts` dentro de la misma llamada — Usa `*.facts.json` heredado si está disponible
163+
2. **`_ask_with_legacy_swarm`** — Fallback final cuando los artefactos estructurados no devuelven respuesta
146164

147165
Esto asegura que la funcionalidad ask permanezca disponible incluso si la base de conocimiento está parcialmente generada o usa formatos antiguos.
148166

@@ -157,7 +175,13 @@ Esto asegura que la funcionalidad ask permanezca disponible incluso si la base d
157175

158176
2. **Host-runner (sin API key):**
159177
```bash
160-
export RB_HOST_RUNNER=codex # o generic
178+
# Preset Codex (configuración incorporada)
179+
export RB_HOST_RUNNER=codex
180+
181+
# Generic runner (requiere plantilla RB_HOST_COMMAND)
182+
export RB_HOST_RUNNER=generic
183+
export RB_HOST_COMMAND='trae-cli exec --cd {workspace} --sandbox read-only --skip-git-repo-check --ephemeral -o {output_file}'
184+
export RB_HOST_OUTPUT_MODE=file
161185
# Usa IDE CLI con sesión iniciada, no se necesita API key
162186
```
163187

@@ -219,11 +243,14 @@ rb-ask "¿Qué cambió en el módulo auth?"
219243
### Ejemplo 3: Uso de Depuración
220244

221245
```bash
222-
# Actualizar con logging de depuración
223-
RB_LOG_LEVEL=DEBUG rb-refresh
246+
# Preguntar con salida verbosa (progreso en streaming)
247+
rb-ask "¿Dónde está la conexión de base de datos?"
224248

225-
# Preguntar con salida verbosa
226-
RB_LOG_LEVEL=DEBUG rb-ask "¿Dónde está la conexión de base de datos?"
249+
# Verificar estado de actualización
250+
rb report
251+
252+
# Forzar actualización completa (no incremental)
253+
rb-refresh # sin --quick
227254
```
228255

229256
## 🐛 Solución de Problemas
@@ -272,7 +299,7 @@ Implementación del servidor MCP: `engine/repobrain_engine/hub/mcp_server.py`
272299

273300
### Acelerar Actualización
274301
- Usar `--quick` para actualizaciones incrementales (árbol de trabajo limpio después de commit)
275-
- Excluir directorios innecesarios (configurar patrones de ignorar en `.repobrain/config.json`)
302+
- Las exclusiones de escaneo están incorporadas (venv, node_modules, .git, etc. — ver `SKIP_DIRS` en `engine/repobrain_engine/hub/_constants.py`)
276303
- Usar modelos más rápidos (ej., GPT-4o-mini o Claude 3.5 Haiku)
277304

278305
### Mejorar Calidad de Respuesta

‎docs/zh/ROADMAP.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ RepoBrain 正收敛为一个可移植的 repository knowledge engine:把 works
1717
| 6 动态发现 | 完成 | 工具/上下文零配置加载 |
1818
| 7 Multi-Agent Swarm | 完成 | Router-Worker 编排 |
1919
| 8 MCP 集成 | 完成 | MCP server / consumer 支持 |
20-
| 9 产品化加固 | 进行中 | 安全边界、可观测、安装与文档契约 |
20+
| 9 产品化加固 | 完成 | 安全边界、可观测、安装与文档契约 |
2121
| 10 Knowledge Hub | 完成 | 代码库刷新、模块知识、路由式问答 |
2222

2323
## 已完成的核心功能(截至 2026 年 8 月)

‎docs/zh/SWARM_PROTOCOL.md‎

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ graph LR
7272

7373
当没有配置 API key 时(`RB_HOST_RUNNER` 设置为 `codex` 或 `generic`),Refresh 会使用单轮、无工具的 Convention Agent (`build_single_turn_convention_agent()`),该 Agent 将三阶段链压缩为一次生成。
7474

75+
**重要:** Host-runner 模式的 refresh 仅为单轮。不使用完整的三 Agent handoff 链。
76+
7577
## 💬 Ask Swarm:动态模块路由
7678

7779
当你运行 `rb-ask "问题"` 时,Ask Swarm 会将问题路由到相关模块的 Agent 并返回带有文件路径和行号的答案。
@@ -115,11 +117,11 @@ graph TD
115117
**职责:** 负责特定模块的深度知识
116118

117119
每个模块都有自己的 Agent,具有:
118-
- 模块的结构化 facts(JSON claims + 源码证据)
120+
- 模块的 agent 知识(`agents/*.md` — 分组模块摘要或旧版 `modules/*.md`)
119121
- 探索代码的工具(read_file、search_code 等)
120122
- 可以移交给其他 ModuleAgent 以获取跨模块信息
121123

122-
ModuleAgent 根据项目扫描结果动态创建(每个检测到的模块一个 Agent)。
124+
ModuleAgent 在旧版 swarm 路径中动态创建(每个检测到的模块一个 Agent)。当结构化工件存在时,ask pipeline 使用 `_ask_with_agent_md`,通过 `map.md` 直接路由,而不构建完整的 swarm。
123125

124126
#### 📜 GitAgent
125127
**职责:** Git 历史和变更分析
@@ -136,13 +138,29 @@ ModuleAgent 根据项目扫描结果动态创建(每个检测到的模块一
136138
- **管道:** `engine/repobrain_engine/hub/ask_pipeline.py`
137139
- **知识库:** 从 `.repobrain/current.json` 指向的生成目录读取
138140

141+
### Host-Runner 模式(无多 Agent 路由)
142+
143+
当设置 `RB_HOST_RUNNER`(`codex` 或 `generic`)时,Ask 仅使用 `_ask_with_host_runner`:
144+
- **单次本地 CLI 调用**,包含项目上下文和问题
145+
- **不**构建 Router/ModuleAgent/GitAgent 或执行多 Agent handoff
146+
- 从本地 host CLI 直接返回答案(无 swarm 编排)
147+
148+
使用无 API key 路径的用户必须理解,他们得到的是单轮本地答案,而非完整的 Router-Worker 协作。
149+
139150
### 回退策略
140151

141-
Ask pipeline 实现了三层回退机制:
152+
Ask pipeline 实现了上下文感知的回退机制:
153+
154+
**当设置 `RB_HOST_RUNNER`(codex 或 generic)时:**
155+
- 仅使用 `_ask_with_host_runner`
156+
- 不构建 Router/ModuleAgent/GitAgent
157+
- 单次本地 CLI 调用,无多 Agent 路由
142158

143-
1. **`_ask_with_structured_facts`** — 使用结构化 facts(JSON claims + 源码验证)
144-
2. **`_ask_with_agent_md`** — 回退到 agent.md 文件(纯文本知识)
145-
3. **`_ask_with_legacy_swarm`** — 最终回退(如果前两者都失败)
159+
**标准 API-based ask 流程:**
160+
1. **`_ask_with_structured_facts`**(当 `.repobrain/map.md` 和 `agents/*.md` 存在时):
161+
- 首先尝试 `_ask_with_agent_md` — 通过 map.md 路由到 agent.md 知识
162+
- 在同一调用中回退到 `_ask_with_legacy_facts` — 如可用则使用旧版 `*.facts.json`
163+
2. **`_ask_with_legacy_swarm`** — 当结构化工件未返回答案时的最终回退
146164

147165
这确保了即使知识库部分生成或使用旧格式,ask 功能仍然可用。
148166

@@ -157,7 +175,13 @@ Ask pipeline 实现了三层回退机制:
157175

158176
2. **Host-runner(无 API key):**
159177
```bash
160-
export RB_HOST_RUNNER=codex # 或 generic
178+
# Codex 预设(内置配置)
179+
export RB_HOST_RUNNER=codex
180+
181+
# Generic runner(需要 RB_HOST_COMMAND 模板)
182+
export RB_HOST_RUNNER=generic
183+
export RB_HOST_COMMAND='trae-cli exec --cd {workspace} --sandbox read-only --skip-git-repo-check --ephemeral -o {output_file}'
184+
export RB_HOST_OUTPUT_MODE=file
161185
# 使用登录的 IDE CLI,无需 API key
162186
```
163187

@@ -219,11 +243,14 @@ rb-ask "auth 模块有什么变化?"
219243
### 示例 3:调试使用
220244

221245
```bash
222-
# 带调试日志的刷新
223-
RB_LOG_LEVEL=DEBUG rb-refresh
246+
# 带详细输出的问答(流式进度)
247+
rb-ask "数据库连接在哪里?"
224248

225-
# 带详细输出的问答
226-
RB_LOG_LEVEL=DEBUG rb-ask "数据库连接在哪里?"
249+
# 检查刷新状态
250+
rb report
251+
252+
# 强制完全刷新(非增量)
253+
rb-refresh # 不使用 --quick
227254
```
228255

229256
## 🐛 故障排查
@@ -272,7 +299,7 @@ MCP server 实现:`engine/repobrain_engine/hub/mcp_server.py`
272299

273300
### 加快刷新速度
274301
- 使用 `--quick` 进行增量更新(提交后的干净工作树)
275-
- 排除不必要的目录(在 `.repobrain/config.json` 中配置忽略模式)
302+
- 扫描排除项已内置(venv、node_modules、.git 等 — 参见 `engine/repobrain_engine/hub/_constants.py` 中的 `SKIP_DIRS`)
276303
- 使用更快的模型(例如 GPT-4o-mini 或 Claude 3.5 Haiku)
277304

278305
### 提高回答质量

0 commit comments

Comments
 (0)