Oracle (CLI) — best use
Oracle bundles your prompt + selected files into one “one-shot” request so another model can answer with real repo context (API or browser automation). Treat outputs as advisory: verify against the codebase + tests.
Main use case (browser, GPT‑5.2 Pro)
Default workflow here: --engine browser with GPT‑5.2 Pro in ChatGPT. This is the “human in the loop” path: it can take ~10 minutes to ~1 hour; expect a stored session you can reattach to.
Recommended defaults:
- - Engine: browser (
--engine browser) - Model: GPT‑5.2 Pro (either
--model gpt-5.2-pro or a ChatGPT picker label like --model "5.2 Pro") - Attachments: directories/globs + excludes; avoid secrets.
Golden path (fast + reliable)
- 1. Pick a tight file set (fewest files that still contain the truth).
- Preview what you’re about to send (
--dry-run + --files-report when needed). - Run in browser mode for the usual GPT‑5.2 Pro ChatGPT workflow; use API only when you explicitly want it.
- If the run detaches/timeouts: reattach to the stored session (don’t re-run).
Commands (preferred)
- - Show help (once/session):
- INLINECODE6
-
npx -y @steipete/oracle --dry-run summary -p "<task>" --file "src/**" --file "!**/*.test.*"
- INLINECODE8
- INLINECODE9
- - Browser run (main path; long-running is normal):
- INLINECODE10
- - Manual paste fallback (assemble bundle, copy to clipboard):
-
npx -y @steipete/oracle --render --copy -p "<task>" --file "src/**"
- Note:
--copy is a hidden alias for
--copy-markdown.
Attaching files (--file)
INLINECODE15 accepts files, directories, and globs. You can pass it multiple times; entries can be comma-separated.
-
--file "src/**" (directory glob)
-
--file src/index.ts (literal file)
-
--file docs --file README.md (literal directory + file)
- - Exclude (prefix with
!):
- INLINECODE20
- - Defaults (important behavior from the implementation):
- Default-ignored dirs:
node_modules,
dist,
coverage,
.git,
.turbo,
.next,
build,
tmp (skipped unless you explicitly pass them as literal dirs/files).
- Honors
.gitignore when expanding globs.
- Does not follow symlinks (glob expansion uses
followSymbolicLinks: false).
- Dotfiles are filtered unless you explicitly opt in with a pattern that includes a dot-segment (e.g.
--file ".github/**").
- Hard cap: files > 1 MB are rejected (split files or narrow the match).
Budget + observability
- - Target: keep total input under ~196k tokens.
- Use
--files-report (and/or --dry-run json) to spot the token hogs before spending. - If you need hidden/advanced knobs:
npx -y @steipete/oracle --help --verbose.
Engines (API vs browser)
- - Auto-pick: uses
api when OPENAI_API_KEY is set, otherwise browser. - Browser engine supports GPT + Gemini only; use
--engine api for Claude/Grok/Codex or multi-model runs. - API runs require explicit user consent before starting because they incur usage costs.
- Browser attachments:
-
--browser-attachments auto|never|always (auto pastes inline up to ~60k chars then uploads).
- - Remote browser host (signed-in machine runs automation):
- Host:
oracle serve --host 0.0.0.0 --port 9473 --token <secret>
- Client: INLINECODE41
Sessions + slugs (don’t lose work)
- - Stored under
~/.oracle/sessions (override with ORACLE_HOME_DIR). - Runs may detach or take a long time (browser + GPT‑5.2 Pro often does). If the CLI times out: don’t re-run; reattach.
- List:
oracle status --hours 72
- Attach:
oracle session <id> --render
- - Use
--slug "<3-5 words>" to keep session IDs readable. - Duplicate prompt guard exists; use
--force only when you truly want a fresh run.
Prompt template (high signal)
Oracle starts with zero project knowledge. Assume the model cannot infer your stack, build tooling, conventions, or “obvious” paths. Include:
- - Project briefing (stack + build/test commands + platform constraints).
- “Where things live” (key directories, entrypoints, config files, dependency boundaries).
- Exact question + what you tried + the error text (verbatim).
- Constraints (“don’t change X”, “must keep public API”, “perf budget”, etc).
- Desired output (“return patch plan + tests”, “list risky assumptions”, “give 3 options with tradeoffs”).
“Exhaustive prompt” pattern (for later restoration)
When you know this will be a long investigation, write a prompt that can stand alone later:
- - Top: 6–30 sentence project briefing + current goal.
- Middle: concrete repro steps + exact errors + what you already tried.
- Bottom: attach all context files needed so a fresh model can fully understand (entrypoints, configs, key modules, docs).
If you need to reproduce the same context later, re-run with the same prompt + --file … set (Oracle runs are one-shot; the model doesn’t remember prior runs).
Safety
- - Don’t attach secrets by default (
.env, key files, auth tokens). Redact aggressively; share only what’s required. - Prefer “just enough context”: fewer files + better prompt beats whole-repo dumps.
Oracle (CLI) — 最佳实践
Oracle 将你的提示词 + 选定的文件打包成一个“一次性”请求,以便另一个模型能够基于真实的仓库上下文(API 或浏览器自动化)进行回答。请将输出视为参考建议:务必对照代码库和测试进行验证。
主要使用场景(浏览器,GPT‑5.2 Pro)
此处的默认工作流:使用 --engine browser 搭配 ChatGPT 中的 GPT‑5.2 Pro。这是“人在回路”的路径:大约需要 10 分钟到 1 小时;预期会有一个你可以重新连接的已存储会话。
推荐默认配置:
- - 引擎:浏览器(--engine browser)
- 模型:GPT‑5.2 Pro(--model gpt-5.2-pro 或 ChatGPT 选择器标签如 --model 5.2 Pro)
- 附件:目录/通配符 + 排除项;避免包含机密信息。
黄金路径(快速且可靠)
- 1. 选择紧凑的文件集合(包含关键信息的最少文件)。
- 预览即将发送的内容(必要时使用 --dry-run + --files-report)。
- 在浏览器模式下运行常规的 GPT‑5.2 Pro ChatGPT 工作流;仅在明确需要时使用 API。
- 如果运行断开/超时:重新连接到已存储的会话(不要重新运行)。
命令(推荐)
- npx -y @steipete/oracle --help
- npx -y @steipete/oracle --dry-run summary -p <任务> --file src/
--file !/
.test.
- npx -y @steipete/oracle --dry-run full -p <任务> --file src/
- npx -y @steipete/oracle --dry-run summary --files-report -p <任务> --file src/
- npx -y @steipete/oracle --engine browser --model gpt-5.2-pro -p <任务> --file src/
- npx -y @steipete/oracle --render --copy -p <任务> --file src/
- 注意:--copy 是 --copy-markdown 的隐藏别名。
附加文件(--file)
--file 接受文件、目录和通配符。可以多次传递;条目可以用逗号分隔。
- --file src/
(目录通配符)
- --file src/index.ts(具体文件)
- --file docs --file README.md(具体目录 + 文件)
- --file src/
--file !src//
.test.ts --file !/.snap
- 默认忽略的目录:node_modules、dist、coverage、.git、.turbo、.next、build、tmp(除非你明确将其作为具体目录/文件传递,否则跳过)。
- 展开通配符时遵循 .gitignore。
- 不跟随符号链接(通配符展开使用 followSymbolicLinks: false)。
- 点文件会被过滤,除非你明确选择包含点段的模式(例如 --file .github/
)。
- 硬限制:大于 1 MB 的文件会被拒绝(分割文件或缩小匹配范围)。
预算 + 可观测性
- - 目标:保持总输入在约 196k 令牌以下。
- 使用 --files-report(和/或 --dry-run json)在消耗令牌前发现令牌大户。
- 如果需要隐藏/高级选项:npx -y @steipete/oracle --help --verbose。
引擎(API vs 浏览器)
- - 自动选择:当设置了 OPENAIAPIKEY 时使用 api,否则使用 browser。
- 浏览器引擎仅支持 GPT + Gemini;使用 --engine api 支持 Claude/Grok/Codex 或多模型运行。
- API 运行需要明确的用户同意才能启动,因为它们会产生使用成本。
- 浏览器附件:
- --browser-attachments auto|never|always(自动内联粘贴最多约 60k 字符,然后上传)。
- 主机:oracle serve --host 0.0.0.0 --port 9473 --token <密钥>
- 客户端:oracle --engine browser --remote-host <主机:端口> --remote-token <密钥> -p <任务> --file src/
会话 + 标识符(不要丢失工作)
- - 存储在 ~/.oracle/sessions 下(可通过 ORACLEHOMEDIR 覆盖)。
- 运行可能会断开或耗时较长(浏览器 + GPT‑5.2 Pro 经常如此)。如果 CLI 超时:不要重新运行;重新连接。
- 列出:oracle status --hours 72
- 连接:oracle session
--render
- - 使用 --slug <3-5个词> 保持会话 ID 可读。
- 存在重复提示保护;仅在确实需要全新运行时使用 --force。
提示模板(高信号)
Oracle 从零项目知识开始。假设模型无法推断你的技术栈、构建工具、约定或“显而易见”的路径。包括:
- - 项目简介(技术栈 + 构建/测试命令 + 平台约束)。
- “文件位置”(关键目录、入口点、配置文件、依赖边界)。
- 确切问题 + 你尝试过的方法 + 错误文本(逐字)。
- 约束条件(“不要更改 X”、“必须保持公共 API”、“性能预算”等)。
- 期望输出(“返回补丁计划 + 测试”、“列出有风险的假设”、“给出 3 个选项及其权衡”)。
“详尽提示”模式(用于后续恢复)
当你知道这将是一个长时间的调查时,编写一个以后可以独立使用的提示:
- - 顶部:6–30 句的项目简介 + 当前目标。
- 中间:具体的复现步骤 + 确切错误 + 你已经尝试过的方法。
- 底部:附加所有所需的上下文文件,以便新模型能够完全理解(入口点、配置文件、关键模块、文档)。
如果你以后需要重现相同的上下文,使用相同的提示 + --file … 集重新运行(Oracle 运行是一次性的;模型不会记住之前的运行)。
安全
- - 默认不要附加机密信息(.env、密钥文件、认证令牌)。积极脱敏;仅分享必要的内容。
- 优先使用“恰到好处的上下文”:更少的文件 + 更好的提示胜过整个仓库的转储。