用途:把任务一次性、非交互式地委托给 OMP(Oh My Pi),供其他智能体在无需管理交互式终端的情况下运行提示词。
主要能力:支持即发即忘与阻塞等待两种调用;以行分隔 JSON 输出,可提取 agent_end 事件中的助手文本;支持多轮会话,通过 --session-dir 与 --resume 保留上下文;提供 --auto-approve 跳过工具审批、--cwd 指定工作目录、--max-time 限制时长、--model 指定模型、--no-tools 仅提示不执行工具、--no-lsp 禁用 LSP、--system-prompt 与 --append-system-prompt 定制系统提示、--print-thoughts 输出思考内容等标志。
使用方式:即发即忘示例:omp -p "<prompt>" --no-session --mode json --thinking off。阻塞等待并提取结果:omp -p "<prompt>" --no-session --mode json --auto-approve 2>&1 | jq -r 'select(.type == "agent_end") | .messages[] | select(.role == "assistant") | .content[] | select(.type == "text") | .text' | tail -1。多轮会话先用 --session-dir 创建会话,从首行 JSON 的 session.id 取 ULID,再用 --resume "$SID" 继续;每个委托任务使用独立 --session-dir,--continue 会新建会话,续接应使用 --resume。
输出与退出码:输出事件含 session(首行元数据)、agent_end(完成信号)、error(失败);退出码 0 成功、1 一般错误、2 用法错误、126 未找到 OMP。错误可用 grep '"type":"error"' | jq '.' 提取。
限制:--thinking off 仅抑制 TUI 显示,思考 token 仍会生成,剥离思考只节省调用方 token;具体模型、平台与收费信息暂未提供。