fix: resolve GitHub issues (#50, #54)

- #54: Add API endpoint configuration documentation to DASHBOARD_GUIDE.md
- #50: Add brainstorm context overflow protection with output size limits

Note: #72 and #53 not changed per user feedback - existing behavior is sufficient
(users can configure envFile themselves; default Python version is appropriate)
This commit is contained in:
catlog22
2026-01-16 15:02:38 +08:00
parent 9ccaa7e2fd
commit 39d070eab6
3 changed files with 106 additions and 0 deletions

View File

@@ -308,3 +308,37 @@ When analysis is complete, ensure:
- **Relevance**: Directly addresses user's specified requirements
- **Actionability**: Provides concrete next steps and recommendations
## Output Size Limits (Context Overflow Prevention)
**⚠️ CRITICAL**: To prevent API context overflow in brainstorm workflows, enforce these limits:
### Document Size Limits
- `analysis.md` (main): **< 3000 words** (~12KB)
- `analysis-*.md` (sub-docs): **< 2000 words each** (~8KB)
- Maximum 5 sub-documents per role
- **Total per-role**: **< 15000 words** (~60KB)
### Strategies for Staying Within Limits
1. **Be concise**: Focus on key insights, not exhaustive detail
2. **Use bullet points**: More efficient than prose paragraphs
3. **Reference don't repeat**: Use `@filename.md` references instead of duplicating content
4. **Prioritize**: Include top 3-5 recommendations per section, not all possible ones
5. **Defer details**: Mark "further analysis needed" for complex areas instead of expanding
### Self-Check Before Output
```
Before writing files, verify:
□ Main analysis.md < 3000 words
□ Each sub-document < 2000 words
□ Total sub-documents ≤ 5
□ No duplicated content across files
□ References used where appropriate
```
### If Limit Exceeded
If analysis naturally exceeds limits:
1. Split into essential vs nice-to-have content
2. Move nice-to-have to a separate `analysis-appendix.md` (counts toward 5 sub-doc limit)
3. Use executive summary style for main document
4. Note "detailed analysis available on request" for deferred topics

View File

@@ -424,6 +424,48 @@ CONTEXT_VARS:
- **Agent execution failure**: Agent-specific retry with minimal dependencies
- **Template loading issues**: Agent handles graceful degradation
- **Synthesis conflicts**: Synthesis highlights disagreements without resolution
- **Context overflow protection**: See below for automatic context management
## Context Overflow Protection
**⚠️ IMPORTANT**: Brainstorm workflows can generate substantial content across multiple roles. To prevent API context limit issues:
### Per-Role Output Limits
- Each `analysis.md` should be **< 3000 words**
- Sub-documents (`analysis-*.md`) should be **< 2000 words each**
- Maximum 5 sub-documents per role
- Total per-role content: **< 15000 words**
### Synthesis Phase Protection
Before Phase 3 (synthesis), check total analysis size:
```javascript
// Check combined analysis size before synthesis
const analysisFiles = Glob(".workflow/active/WFS-{session}/.brainstorming/*/analysis*.md");
let totalSize = 0;
for (const file of analysisFiles) {
totalSize += getFileSize(file);
}
// If total > 100KB, use summary mode
if (totalSize > 100 * 1024) {
console.log("⚠️ Large context detected. Using summary mode for synthesis.");
// Synthesis will read only analysis.md (index) files, not sub-documents
useSummaryMode = true;
}
```
### Recovery from Context Overflow
If API returns empty response or timeout:
1. **Identify overflow**: Check last request size in logs
2. **Reduce scope**: Re-run synthesis with fewer roles (use `--count 2`)
3. **Use summary mode**: Pass `--summary-only` to synthesis command
4. **Manual synthesis**: Combine key insights from each role's `analysis.md` manually
### Prevention Best Practices
- Start with `--count 3` (default) before trying more roles
- Use structured topic format: `"GOAL: [x] SCOPE: [y] CONTEXT: [z]"`
- Review each role's output size before proceeding to synthesis
- For complex topics, consider running brainstorm in phases (3 roles at a time)
## Reference Information

View File

@@ -148,6 +148,36 @@ CCW Dashboard 是一个单页应用SPA界面由四个核心部分组成
- **模型配置**: 配置每个工具的主要和次要模型
- **安装/卸载**: 通过向导安装或卸载工具
#### API Endpoint 配置(无需安装 CLI
如果您没有安装 Gemini/Qwen CLI但有 API 访问权限(如反向代理服务),可以在 `~/.claude/cli-tools.json` 中配置 `api-endpoint` 类型的工具:
```json
{
"version": "3.2.0",
"tools": {
"gemini-api": {
"enabled": true,
"type": "api-endpoint",
"id": "your-api-id",
"primaryModel": "gemini-2.5-pro",
"secondaryModel": "gemini-2.5-flash",
"tags": ["analysis"]
}
}
}
```
**配置说明**
- `type: "api-endpoint"`: 表示使用 API 调用而非 CLI
- `id`: API 端点标识符,用于路由请求
- API Endpoint 工具仅支持**分析模式**(只读),不支持文件写入操作
**使用示例**
```bash
ccw cli -p "分析代码结构" --tool gemini-api --mode analysis
```
#### CodexLens 管理
- **索引路径**: 查看和修改索引存储位置
- **索引操作**: