深度分析CLI
一个CLI工具,用于使用两层AI架构对markdown文档和代码库进行系统深入分析:GPT-5.4-Pro用于推理,GPT-5.4用于文件发现。
🤖 注: 这个项目是 “氛围设计” 随着 安培 Claude Opus 4.5和其他人,作为我持续努力的一部分,以证明人工智能辅助开发可以在与严格的设计文档、全面的测试和仔细的人工审查相结合的情况下生产出高质量的软件。
特性
- 两层技术模型:GPT-5.4-Pro专注于推理,而GPT-5.4处理文件发现
- 三个高级工具:
find_files,summarize_files,read_files通过成本控制 - 会话连续性:继续对话
--continue - 成本跟踪:研究人员和侦察员模型的单独使用报告
先决条件
- 布置 对于中固定的Go和CLI工具链
mise.toml - 如果没有构建,请转到1.25.3或更高版本
mise - OpenAI API密钥 可访问
gpt-5.4-pro和gpt-5.4
安装
mise install
# Build the CLI with the pinned toolchain
mise run build
# Install into your Go bin dir
mise run install
# Install into ~/bin
mise run install:global
# Or directly with Go if you already have it installed
mkdir -p dist
go build -o dist/deep-analysis .配置
设置您的OpenAI API密钥:
export OPENAI_API_KEY="your-api-key-here"用法
基本分析
# Analyze a markdown document (results appended in place)
./dist/deep-analysis notes.md
# Write output to a different file
./dist/deep-analysis notes.md --output annotated.md
# Analyze a project in a different directory
./dist/deep-analysis --cwd /path/to/project task.md后续问题
每次运行都会生成一个记录到stderr的会话ID:
INFO Saved session session=f1736654e6d5a7c1b58d14ac response_id=resp_xxx要继续对话,请执行以下操作:
- 将您的后续问题添加到文档中
- 与一起跑步
--continue:
./dist/deep-analysis notes.md --continue f1736654e6d5a7c1b58d14acAI将看到您之前的分析,并专注于新问题。
CLI标志
| 标志 | 描述 |
|---|---|
--output | 输出文件路径(默认为输入文件) |
--continue | 会话ID以继续之前的对话 |
--reset | 重新启动,忽略存储的会话状态 |
--cwd | 文件操作的工作目录 |
--researcher-model | 研究人员分析模型(默认:gpt-5.4-pro) |
--scout-model | 侦察调度员模型(默认:gpt-5.4) |
--reasoning-effort | 推理努力:低、中、高、xhigh(默认值:xhigh) |
--debug | 启用调试日志记录 |
运作原理
两层技术模型
Researcher (GPT-5.4-Pro) → Reasoning, analysis, conclusions
↓
find_files / summarize_files / read_files
↓
Scout (GPT-5.4) → Translates queries to glob/grep
↓
File System → Actual file access研究人员可用的工具
- 查找文件(查询、路径) -发现与自然语言意图匹配的文件
- 返回具有大小的文件路径 - Scout翻译为glob/grep模式
- 摘要文件(路径、焦点) -获取人工智能生成的摘要(便宜,自由使用)
- Scout读取并总结文件 - 用于全面阅读前的分类
- read_files(路径) -读取完整文件内容(昂贵,请谨慎使用)
- 每次通话限制为10个文件或200KB - 超出限制将返回带有指导的错误
工作流程
研究人员如下: find → 总结→ read
find_files("error handling")→ 返回15个文件(共180KB)summarize_files(all paths, "error patterns")→ 快速摘要- 从摘要中识别3个关键文件
read_files(those 3)→ 完整的分析内容- 引用特定代码编写分析
成本跟踪
每次运行都会报告两种模型的使用情况:
INFO Researcher usage model=gpt-5.4-pro api_calls=5 input_tokens=12000 output_tokens=3000 cost_usd=$0.9000
INFO Scout usage model=gpt-5.4 api_calls=8 input_tokens=45000 output_tokens=800 cost_usd=$0.1245
INFO Total cost usd=$1.0245发展
mise run build # Build to dist/deep-analysis
mise run install # Install to GOBIN or GOPATH/bin
mise run install:global # Install to ~/bin
mise run test # Run tests
mise run lint # Run linter
mise run run notes.md
mise run run notes.md --output annotated.md建筑
.
├── main.go # CLI entrypoint
├── internal/
│ ├── agent/
│ │ ├── scout.go # Scout dispatcher (defaults to gpt-5.4)
│ │ ├── manifest.go # Project file listing
│ │ └── file_search.go # Legacy file search
│ ├── client/
│ │ ├── deepanalysis.go # Researcher client (defaults to gpt-5.4-pro)
│ │ └── session_store.go # Session persistence
│ ├── fileops/
│ │ └── fileops.go # File operations (read, grep, glob)
│ └── server/ # MCP server (optional)
└── plans/
└── two-tier-analysis.md # Architecture documentation许可证
麻省理工学院
