لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI تاریخ شمسی… --:--:--

Agent-CodexCLI Playbook

آزاد تازه‌وارد تاییدشده امن

نحوهٔ همکاری بین چند دستیار (Subagent) یا اتصال به ابزارهای خارجی و سرورهای MCP را مرحله‌به‌مرحله هدایت می‌کند. (شامل ۳۰ گام عملی · سازگار با OpenAI Codex و MCP).

سازگاری با ابزارها: سازنده فقط میزبان‌های نام‌برده را تأیید کرده است. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: agent-codexcli
description: >-
  Orchestrate local OpenAI Codex CLI via the `agent-codexcli` MCP server.
  Use when delegating coding, debugging, refactoring, testing, or code review tasks from an
  orchestrator agent to Codex CLI while enforcing session reuse, cross-platform sandbox rules,
  async polling limits, and quota safeguards.
---

# Agent-CodexCLI Playbook

When operating with the `agent-codexcli` MCP server, the calling agent acts as the **Orchestrator** and local **Codex CLI** acts as the **Executor**.

## Division of Responsibilities

- **Orchestrator (Host Agent)**: Clarify requirements with the user, decompose complex work into well-scoped tasks, review Codex's returned summaries and diffs, run final checks or cross-verification, and coordinate next steps.
- **Executor (Codex CLI)**: Perform deep codebase edits, run build/test commands, investigate implementation details, and conduct focused code reviews via `codex_run` and `codex_review`.

## Tool Usage Guidelines

1. **Always pass an explicit `cwd`**: Provide the exact absolute path of the target workspace or repository.
2. **Choose the right sandbox**:
   - New `codex_run` tasks use the configured sandbox, with `workspace-write` as the built-in default.
   - Use `sandbox: "read-only"` for pure investigation, architecture analysis, or auditing. `codex_review` defaults to `read-only` and accepts a per-call override.
   - **Windows trusted-use note**: On Windows, `workspace-write` can break tool and command execution inside Codex CLI. In trusted repositories after troubleshooting `workspace-write` failures, opt in by passing `sandbox: "danger-full-access"` or setting `CODEX_DEFAULT_SANDBOX=danger-full-access`.
   - **Resuming sessions**: Omit `sandbox` on `codex_run(session_id=...)` unless you intentionally want to change permissions; omitting it preserves the session's saved sandbox permissions.
3. **Model & reasoning effort inheritance**:
   - Omit `model` and `reasoning_effort` by default to use the server configuration, which inherits `~/.codex/config.toml` when no override is configured.
   - Only override them when the user requests a different model/effort or a tiny mechanical check warrants a lighter setting. Note that `codex_review` applies explicit `model` overrides to `review_model` as well.
4. **Reuse sessions (`session_id`) for iterative work**:
   - Capture `session_id` from `codex_run`'s response and pass it into follow-up `codex_run` calls for bug fixes, refinements, or follow-up tests in the same task (never start concurrent `codex_run` calls for the same active `session_id`).
   - Start a fresh session (omit `session_id`) when switching to an unrelated task or following up after `codex_review`.
   - Pass `worktree: true` only on new `codex_run` sessions when parallelizing independent coding tasks in the same Git repo (`resume` and `review` do not support `--worktree`).
5. **Polling & mid-flight steering**:
   - Poll directly via `codex_wait(task_id)` rather than wrapping polls in extra watcher subagents.
   - Running and terminal summaries can include `new_messages` with unread conversational `agent_message` text. Each poll includes up to 4,000 characters total, keeping the newest messages. `codex_wait(task_id)` marks omitted overflow as delivered too. `codex_status` peeks without consuming updates. Keep polling with `codex_wait` until the terminal summary arrives.
   - **Antigravity hosts** have a default per-call MCP timeout of 180s (configurable via `timeoutSeconds`). Select the Antigravity setup preset or set `CODEX_DEFAULT_WAIT_SECONDS=165` and `CODEX_DEFAULT_POLL_WAIT_SECONDS=165` in `mcp_config.json` to leave a margin. For strict deadlines, pass `wait_seconds: 0` first and poll with bounded `codex_wait`. Never pass `wait_seconds >= 180` unless `timeoutSeconds` was raised.
   - When requirements change while a Codex task is running, call `codex_steer(task_id, prompt)` — it defaults to `mode: "interrupt"` (waits briefly for `session_id`, then cancels the obsolete run and resumes the same `session_id`). If `codex_steer` fails because `session_id` has not been emitted yet, wait briefly and retry or cancel explicitly with `codex_cancel`.
   - Only pass `mode: "queue"` when queueing without interrupting is explicitly requested. It rejects per-call model, reasoning effort, sandbox, and foreground overrides and passes the message via CLI args.
   - Inspect `log_path` for the full message history and diagnostics.
<!-- ‹guest · 2026-12-02› -->
6. **Viewer and runtime defaults**
   - The live terminal viewer is enabled by default (`foreground: true`) when a desktop terminal is available. Pass `foreground: false` when background execution is explicitly desired for `codex_run`, `codex_review`, or interrupt `codex_steer`.
   - Once the viewer connects, manually closing it during a run cancels the task by default. On macOS, `foregroundAutoClose` exits the viewer and shell. Window closure follows the Terminal.app profile’s “When the shell exits” setting.
   - Use `npm run setup` or `agent-codexcli setup` to customize viewer behavior and runtime defaults. Precedence is per-call arguments > environment variables > `config.json` > built-in defaults.

## Quota & Reset-Card Safeguard

- **NEVER** instruct Codex to run `/usage` or redeem any quota reset card (the MCP server applies a best-effort prompt guard unless opted out with `CODEX_DISABLE_RESET_CARD_GUARD=1` or `true`).
- If any `codex_*` tool returns `status: "rate_limited"` (`rate_limited: true`):
  1. **STOP immediately** — do not retry, do not spawn another Codex task, and do not try to work around the limit.
  2. Report the exact `rate_limit_reason` / `error` to the user and ask how they want to proceed.

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
عامل‌های هوش مصنوعی
✦ Pro

REA

دستورالعمل اجرایی آماده برای انجام دقیق کارهای عامل‌های هوش مصنوعی بدون تکرار پرامپت‌های طولانی. (شامل ۶۵ گام عملی · سا…

⚡ /reverse-engineer-anything SKILL.md
Claude / Claude CodeOpenAI Codex +۲
۹۴/۱۰۰ ★ ۴۷۹,۷۷۳
عامل‌های هوش مصنوعی
✦ Pro

Dispatching Parallel Agents

این مهارت با نام «Dispatching Parallel Agents» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ کاف…

⚡ /dispatching-parallel-agents SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Subagent-Driven Development

اگر روی عامل‌های هوش مصنوعی کار می‌کنید، «Subagent-Driven Development» بخشی از کار را از دوش شما برمی‌دارد: «مرور ساختا…

⚡ /subagent-driven-development SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Using Git Worktrees

این مهارت با نام «Using Git Worktrees» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ کافی است در…

⚡ /using-git-worktrees SKILL.md
Cline
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Verification Before Completion

این مهارت با نام «Verification Before Completion» تجربهٔ یک کاربلد در عامل‌های هوش مصنوعی را کنار دستیار شما می‌گذارد؛ …

⚡ /verification-before-completion SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
عامل‌های هوش مصنوعی
✦ Pro

Diagnosing Superpowers

«Diagnosing Superpowers» دستورالعمل دقیقی برای «مدیریت هوشمند حافظه و کانتکست» در اختیار دستیار هوش مصنوعی می‌گذارد تا …

⚡ /diagnosing-superpowers SKILL.md
Claude / Claude Code
۹۱/۱۰۰ ★ ۳۲۴,۲۹۰