一条命令跑通自然语言编程:Open Interpreter 上手指南
【免费下载链接】openinterpreterA coding agent for open models like Kimi K3项目地址: https://gitcode.com/GitHub_Trending/op/openinterpreter
Open Interpreter 是一个面向 Kimi K3 这类低成本开源模型的终端编码代理(coding agent),用 Rust 在 Codex CLI 代码表面实现,能读仓库、改文件、跑命令、审 diff,并在新会话里恢复之前的工作。你只需要用自然语言描述任务,它负责生成代码、执行验证并回报结果。
它到底能做什么
- TUI 交互式编码:
i或interpreter启动全屏终端界面,支持@模糊引用文件、/plan先规划再动手、/review审查当前变更。 - 跨平台原生沙箱:macOS 用 Seatbelt、Linux/WSL 用 Bubblewrap 与 seccomp、Windows 用原生沙箱,策略无法强制执行时会直接失败而不是裸奔。
- 多模型与 harness 模拟:
/model切换 OpenAI、Anthropic、Ollama、LM Studio 等提供者;/harness可模拟 claude-code、kimi-code、deepseek-tui、swe-agent 等不同代理的行为风格,让低成本模型按各家官方推荐的"提示词形状"运行。 - 协议兼容:支持 ACP(
interpreter acp接入编辑器)、MCP 服务器、共享AGENTS.md与.agents/skills目录,也能用 Codex SDK 一行codexPathOverride: "interpreter"替换二进制。
从安装到第一条输出
macOS / Linux 一行装好(Windows 用irm https://www.openinterpreter.com/install.ps1 | iex):
curl -fsSL https://www.openinterpreter.com/install | sh # 安装器,Windows 走 .ps1 脚本进入项目目录启动,首次运行会引导你选择提供者:ChatGPT 账号登录、API Key、本地 Ollama/LM Studio,或其他兼容服务:
cd my-project && i然后直接提一个具体任务即可:
> add a /health endpoint that returns the build sha典型的一轮交互长这样(输出做了删节):
> find the auth middleware and explain how it works plan: locate auth middleware, trace request flow edit: 2 files changed, verified with cargo test > /review 1 issue: missing refresh-token rotation guard它读项目、改文件、跑命令都经过当前沙箱与审批设置;需要更多权限的操作会先停下来问你,用/permissions随时调整。
把任务从管道里喂进去:exec 非交互模式
interpreter exec用于脚本和 CI,一次跑完一个任务,结果走 stdout:
git diff | interpreter exec --json "explain this diff and flag risky changes" # JSON 事件流 interpreter exec review --uncommitted # 不开 TUI 直接审未提交变更配合--output-schema schema.json可强制最终答案符合你定义的 JSON Schema,适合做自动化风险打标。中断后还能interpreter exec resume --last "continue"接着跑,或interpreter resume --last恢复交互会话的上下文与工作目录。
两个安全旋钮:沙箱模式与审批策略
沙箱管技术边界,审批管"什么时候停下来问你",二者独立:
| 项 | 取值 | 默认/说明 |
|---|---|---|
sandbox_mode | read-only/workspace-write/danger-full-access | workspace-write:可写工作区,默认无网络 |
approval_policy | untrusted/on-request/never | on-request:沙箱内自动跑,越界才询问 |
| 单次覆盖 | interpreter --sandbox read-only "audit the auth flow" | 不改配置文件 |
| 会话加目录 | interpreter --add-dir ../shared-lib | 额外可写根 |
模型侧常用配置写在~/.openinterpreter/config.toml(项目级用.openinterpreter/config.toml,-c key=value单次覆盖):
model = "gpt-5.1-codex" # 也可换成 kimi、deepseek 等 model_reasoning_effort = "medium" # minimal|low|medium|high|xhigh model_reasoning_summary = "auto" # auto|concise|detailed|none # ... 其余选项见 config.md按场景选档:查陌生代码用read-only+on-request;日常可信仓库用默认的workspace-write+on-request;隔离 CI runner 里可放宽到never。
边界与风险
⚠️--yolo/--dangerously-bypass-approvals-and-sandbox会同时移除审批和沙箱,官方文档明确建议只在一次性 VM 或隔离容器里使用;danger-full-access+never同理,属于"环境本身可信"的前提。
⚠️ 在不受信任的仓库里工作时,先切read-only:代理读到的内容会进入它的上下文,恶意仓库可能诱导它执行危险操作,审批提示是你最后的确认点。
另外注意:.git/等敏感控制目录即使在可写工作区内也应视为受保护路径,代理要求改动时要逐条审查;日志与会话状态存在~/.openinterpreter/,/debug-config可查看生效配置及其来源,排查"为什么行为和我预期不一致"时先跑它。
延伸入口
- 想查命令细节:docs/cli-reference.md 和 docs/slash_commands.md
- 想接本地模型:docs/models.md(Ollama / LM Studio 章节)与 docs/providers.md
- 想让它遵守你的团队规范:用
/init生成 AGENTS.md,把构建命令和红线写进去,而不是每次提示里重复
先在测试仓库里跑一遍「从安装到第一条输出」那两行命令,再按场景表选一档沙箱配置,你就有了一套能直接进 CI 的自然语言编程工作流。
【免费下载链接】openinterpreterA coding agent for open models like Kimi K3项目地址: https://gitcode.com/GitHub_Trending/op/openinterpreter
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考