AgentSquad for Swift
2FastLabs/agent-squad
Guides building on-device multi-agent apps in Swift with the AgentSquad framework: which agent, orchestrator, classifier, storage or voice type fits each situation.
Uses ChatGPT in the browser as the planning and review brain for a Codex session, with Codex keeping all execution and ChatGPT reading the workspace through a bridge.
$ npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a claude-codeProject install by default; add -g for ~/.claude/skills/.
$ gh skill install XiaoDuoYa/codex-with-chatgpt codex-with-chatgpt --agent claude-codeProject scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).
$ git clone --depth 1 https://github.com/XiaoDuoYa/codex-with-chatgpt.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skill .claude/skills/codex-with-chatgpt && rm -rf skills-srcUse ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.
Claude Code skills documentation · loads skills from .claude/skills/
Install the "codex-with-chatgpt" agent skill from https://github.com/XiaoDuoYa/codex-with-chatgpt/tree/main/skill into .claude/skills/codex-with-chatgpt/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "codex-with-chatgpt", then confirm the skill loads.Claude Code copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$skill-installer install https://github.com/XiaoDuoYa/codex-with-chatgpt/tree/main/skillType this inside Codex. $skill-installer <name> installs a curated skill from openai/skills. The installer writes to $CODEX_HOME/skills (default ~/.codex/skills). Restart Codex if the skill does not show up.
$ npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a codexProject install goes to .agents/skills/; add -g for ~/.codex/skills/.
$ gh skill install XiaoDuoYa/codex-with-chatgpt codex-with-chatgpt --agent codexProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/XiaoDuoYa/codex-with-chatgpt.git skills-src && mkdir -p .agents/skills && cp -r skills-src/skill .agents/skills/codex-with-chatgpt && rm -rf skills-srcUse ~/.agents/skills/ instead of .agents/skills for a personal install.
Codex skills documentation · loads skills from .agents/skills/
Install the "codex-with-chatgpt" agent skill from https://github.com/XiaoDuoYa/codex-with-chatgpt/tree/main/skill into .agents/skills/codex-with-chatgpt/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "codex-with-chatgpt", then confirm the skill loads.Codex copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a cursorProject install goes to .agents/skills/; add -g for ~/.cursor/skills/.
$ gh skill install XiaoDuoYa/codex-with-chatgpt codex-with-chatgpt --agent cursorProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/XiaoDuoYa/codex-with-chatgpt.git skills-src && mkdir -p .cursor/skills && cp -r skills-src/skill .cursor/skills/codex-with-chatgpt && rm -rf skills-srcUse ~/.cursor/skills/ instead of .cursor/skills for a personal install.
Cursor skills documentation · loads skills from .cursor/skills/, .agents/skills/, .claude/skills/, .codex/skills/
Install the "codex-with-chatgpt" agent skill from https://github.com/XiaoDuoYa/codex-with-chatgpt/tree/main/skill into .cursor/skills/codex-with-chatgpt/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "codex-with-chatgpt", then confirm the skill loads.Cursor copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gemini skills install https://github.com/XiaoDuoYa/codex-with-chatgpt.git --path skill--scope user (default) or --scope workspace; --path is the subfolder of the repo that holds the skill; --consent skips the security confirmation prompt.
$ npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a gemini-cliProject install goes to .agents/skills/; add -g for ~/.gemini/skills/.
$ gh skill install XiaoDuoYa/codex-with-chatgpt codex-with-chatgpt --agent gemini-cliProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/XiaoDuoYa/codex-with-chatgpt.git skills-src && mkdir -p .gemini/skills && cp -r skills-src/skill .gemini/skills/codex-with-chatgpt && rm -rf skills-srcUse ~/.gemini/skills/ instead of .gemini/skills for a personal install, then run /skills reload.
Gemini CLI skills documentation · loads skills from .gemini/skills/, .agents/skills/
Install the "codex-with-chatgpt" agent skill from https://github.com/XiaoDuoYa/codex-with-chatgpt/tree/main/skill into .gemini/skills/codex-with-chatgpt/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "codex-with-chatgpt", then confirm the skill loads.Gemini CLI copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ gh skill install XiaoDuoYa/codex-with-chatgpt codex-with-chatgptInstalls for Copilot at project scope by default; add --scope user for a personal install. Preview a skill first with gh skill preview. Needs GitHub CLI 2.90.0 or later (public preview).
$ npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a github-copilotProject install goes to .agents/skills/; add -g for ~/.copilot/skills/.
$ git clone --depth 1 https://github.com/XiaoDuoYa/codex-with-chatgpt.git skills-src && mkdir -p .github/skills && cp -r skills-src/skill .github/skills/codex-with-chatgpt && rm -rf skills-srcUse ~/.copilot/skills/ instead of .github/skills for a personal install. Commit .github/skills so cloud agent and code review can use it.
GitHub Copilot skills documentation · loads skills from .github/skills/, .claude/skills/, .agents/skills/
Install the "codex-with-chatgpt" agent skill from https://github.com/XiaoDuoYa/codex-with-chatgpt/tree/main/skill into .github/skills/codex-with-chatgpt/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "codex-with-chatgpt", then confirm the skill loads.GitHub Copilot copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
$ npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a opencodeOpenCode documents no install command of its own. Project install goes to .agents/skills/; add -g for ~/.config/opencode/skills/.
$ gh skill install XiaoDuoYa/codex-with-chatgpt codex-with-chatgpt --agent opencodeProject scope by default (.agents/skills/); add --scope user for a personal install.
$ git clone --depth 1 https://github.com/XiaoDuoYa/codex-with-chatgpt.git skills-src && mkdir -p .opencode/skills && cp -r skills-src/skill .opencode/skills/codex-with-chatgpt && rm -rf skills-srcUse ~/.config/opencode/skills/ instead of .opencode/skills for a personal install.
OpenCode skills documentation · loads skills from .opencode/skills/, .claude/skills/, .agents/skills/
Install the "codex-with-chatgpt" agent skill from https://github.com/XiaoDuoYa/codex-with-chatgpt/tree/main/skill into .opencode/skills/codex-with-chatgpt/ in this project. Copy the whole folder (SKILL.md and every file beside it), keep the folder name "codex-with-chatgpt", then confirm the skill loads.OpenCode copies the folder itself, the same result as the manual copy. Check what it changed before you commit it.
codex-with-chatgptUses ChatGPT in the browser as the planning and review brain for a Codex session, with Codex keeping all execution and ChatGPT reading the workspace through a bridge.
The skill splits a coding session between two roles: ChatGPT in the browser does high-level reasoning (understanding, planning, review and debugging strategy) while Codex keeps editing, shell, git, tests and recovery. A C2C Bridge gives ChatGPT read-only MCP access to the current workspace, so the messages between the two stay under 1 KB and ChatGPT pulls whatever files it needs itself. The agent is told never to paste file contents, diffs or logs into ChatGPT.
Rules for the user experience include never showing technical internals such as MCP, OAuth or tunnels, speaking in terms of connecting and pairing, and typing only the pairing code into a browser, never tokens or cookies. Failures are repaired quietly with `c2c doctor`, and you are involved only for logins, CAPTCHAs, two-factor prompts or consent screens. On first use the agent asks whether setup should be automatic or manual and stores the choice per machine; repeated failures of one step move automatic setup to a guided manual flow. All ChatGPT steps use the built-in in-app browser rather than computer use.
9 steps, taken from the first numbered list in SKILL.md.
Read from SKILL.md and the folder at commit 535a07d. It shows what the files ask for, not the result of running them.
Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.
From allowed-tools in the SKILL.md frontmatter.
Shell commands in SKILL.md call:
codexgitnodepnpmbrewwingetFrom the folder's file list and the shell code blocks in SKILL.md.
Hosts in commands or code, which the agent is likely to contact:
chatgpt.comFrom URLs in SKILL.md, links to its own repository left out.
Names no API keys, tokens, secrets or passwords.
From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.
Codex with ChatGPT Planning Loop loads about 11k tokens when it runs. Until then it costs about 91 tokens; SKILL.md has 5,576 words of instructions outside code blocks.
Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.
The automated check noted patterns worth knowing about, such as sudo or a known installer.
d failure. Do not record shell history, `.env`,Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.
The full file from XiaoDuoYa/codex-with-chatgpt at commit 535a07d, republished under its MIT licence (© XiaoDuoYa). 5,576 words, ~10,587 tokens.
.claude/skills/codex-with-chatgpt/SKILL.md (or your agent's skills folder).ChatGPT thinks. Codex works.
You (Codex) own execution: editing, shell, git, tests, recovery. ChatGPT owns high-level reasoning: understanding, planning, review, debug strategy. The C2C Bridge gives ChatGPT read-only MCP access to the current workspace, so control messages between you and ChatGPT stay tiny (< 1 KB) — ChatGPT pulls whatever data it needs by itself.
Golden rules
c2c doctor and repair silently. Only involve the user
for logins, CAPTCHA, 2FA, explicit consent screens, or guided manual
ChatGPT setup below — and then give them ONE action.
Before the first ChatGPT connection on this machine, c2c prefs --json:setupMode missing: tell the user exactly setupChoicePrompt, wait for
「1」or「2」, then c2c prefs set --setup-mode auto|manual --json.
Do not start ChatGPT configuration until they answer. Do not guess.setupMode is manual: skip automatic ChatGPT settings. Use guided
manual from the start (chosen, not a failure).setupMode is auto: automatic browser setup. Two explicit failures of
the same configuration step after repair then enter guided manual.
A browser/js timeout, a page still loading/generating, or waiting for
user login/2FA does NOT count as a failure. Do not change the saved
setupMode when falling back.
developerModeEnabled: true means skip #settings/Security until a
connector create fails because developer mode is required. Then open
that page, enable it, and c2c prefs set --developer-mode --json.
These prefs are for this machine, not per workspace. Do not ask again
on reconnect or a second repo. A new computer (empty prefs) asks/checks
once.open <url> to hand off to one.c2c session --json → conversation.mode
(see Conversation management). Do not invent a second mode.goto https://chatgpt.com/ to create it, and never reuse another
Codex conversation's chat URL just because session.url exists.
Each workspace also has exactly ONE ChatGPT connector. Do not create a
second connector for the same workspace. Other workspaces may have their
own connectors — never edit those.c2c sandbox-allow --json (idempotent). If it fails
with EPERM / Operation not permitted, request elevated permissions and retry
ONCE. After { "alreadyAllowed": true } or { "added": true }, stay silent.c2c doctor --json, do not goto ChatGPT and do not
send [C2C] until local is green — except the reconnect settings pages when
chatgptRepair.needed is true. Not green:report.bridge.ok is not truereport.mcp.ok is not true (unauthenticated local /mcp must be 401)chatgptRepair.needed is true (fix the connector first, then doctor again)namedRepair.needed is true (user must log in to Cloudflare, then doctor again.
Do not Delete the ChatGPT connector — the address did not change)report.bridge says 状态无法确认: the local bridge may still be running.
Do not c2c start, do not Delete the connector, do not treat it as
chatgptRepair. Wait and run doctor again.
If doctor is already green and chatgptRepair.needed is false, do not
c2c restart, do not start a second tunnel, and do not Delete the
connector. ChatGPT/IAB-only errors are not permission to churn the
public address.
A ChatGPT-side 401 after a sent message is different: repair then, do not
treat it as permission to skip this gate next time.Official skill: control-in-app-browser. These C2C rules override defaults
that close the tab, hide the window, or stall on the settings page.
Surface. Once per Codex session: setupBrowserRuntime(), then
const iab = await agent.browsers.get("iab"). Reuse iab. Do not re-read
documentation() if it is already bound. Never getDefault(), getForUrl(),
or Computer Use.
One tab. Create the ChatGPT tab once (tabs.new()). After that, only
tab.goto(...) to switch URLs. If the tab still exists, claim it — never
open a second ChatGPT tab. Do not goto the URL you are already on.
Foreground + keep (standby). Right after opening or claiming the tab:
await (await iab.capabilities.get("visibility")).set(true) — first-time
setup and ChatGPT chatting stay in front of the user so they can watch.await tab.markHandoff() immediately, then again at the start and end of
every turn. After setup succeeds or the C2C chat is open, also
await tab.markDeliverable().
Never close this tab. Finished, waiting for the user, or timed out: leave it
marked (standby). Do not let default turn cleanup close it.URLs only (same tab, goto — never hunt menus):
https://chatgpt.com/#settings/Security
(skip when c2c prefs --json has developerModeEnabled: true)https://chatgpt.com/pluginshttps://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fpluginshttps://chatgpt.com/conversation.chatUrl / session.url (long-chat, or
the chat already bound in THIS Codex conversation)conversation.projectUrl
(https://chatgpt.com/g/g-p-…/project)
Never click Reconnect / Refresh on an existing connector. The old address is
dead and that page hangs on "This site cannot be reached". When the address
changed: Delete THIS workspace's connectorName only, then create it again
via the 加插件 URL (same name, new Server URL). Do not put that public
address into Project instructions — write the connector name only.Do not wait for 8 tools on the settings page. "Connected" / authorize
success / pairing accepted is enough. Confirm tools in the conversation with
workspace_info.
Batch. Fill a known form in one Playwright / js script when you can.
After an action, one cheap DOM check. Do not screenshot-poll.
One conversation, Chat mode. The first ChatGPT chat is the C2C conversation. Chat and Work (聊天 / 工作) are separate: a Work conversation cannot become Chat. On every NEW conversation, if a Chat/Work switcher is visible (often top-left), confirm Chat is selected before the boot prompt. If it is Work, do not continue there — Switch to a new Chat conversation (HANDOFF). If no switcher is visible, do not hunt menus; continue. Send the boot prompt and the workspace_info check in that Chat conversation. Confirm the reply names the current workspace before saving or replacing the session URL. If validation fails, keep the old saved URL. Do not open a throwaway verify chat and later another C2C chat.
A collection or chat page that shows only Retry / 重试 is a navigation
error, not generation and not a pairing failure. Reuse the same iab tab.
Try Retry once. If it stays Retry-only, goto the last working chat URL
from this thread (or session.url if that is the only saved chat), then
click the on-page Open … project / 打开“… ”项目 link — that same-site
hop is allowed. Do not treat the URLs-only rule as forbidding this link.
On the collection, require the project chat list and new-chat composer
before continuing. Keep the old saved URL/checkpoint until the replacement
chat passes workspace_info. Do not session clear. Do not use Computer Use.
Wait for a ChatGPT reply (do not hold one long browser wait). After you
send INIT, EXECUTED, boot, or the workspace_info check: markHandoff, keep
the tab foreground, and stay in this same task. Do not waitFor 5 minutes
and do not screenshot-poll. Every 20–30 seconds, one cheap DOM check:
STATE: PLAN / DONE / BLOCKED / the verify workspace name → read it
and continue the existing protocol;<ACTUAL_CHECKOUT_PATH>
(installer/update MUST replace this line in the installed Skill with the user's actual checkout path.)<codex-home> be a non-empty CODEX_HOME when set; otherwise
use ~/.codex (%USERPROFILE%\.codex on Windows).<checkout> mean the path on the previous line; run
node "<checkout>/bin/c2c.js" <command> (or c2c <command> if globally linked).
All commands support --json for parsing.node_modules or no dist/, first run
corepack pnpm install && corepack pnpm build inside it.setup, doctor, session,
restart, start, stop, status, pair, unpair, logs, workspace,
record, tunnel status, tunnel choose), pass -w <workspace root>
(the project the user is working on, NOT the c2c repo).-w to machine-wide commands: update-check, sandbox-allow,
prefs, tunnel login. They still accept and ignore -w, so a leftover
flag must not fail the command.At the START of every workflow below (before anything else), run these two commands (both are cheap / cached; never mention them unless an update exists):
c2c update-check --json (do not pass -w)c2c sandbox-allow --json (do not pass -w) — writes the C2C state directory into Codex's
sandbox writable_roots (macOS: ~/Library/Application Support/codex-with-chatgpt;
Windows: %LOCALAPPDATA%\codex-with-chatgpt; config file is
<codex-home>/config.toml; see Locations).
If already allowlisted, this is a no-op and does not trigger elevation.{ "updateAvailable": false } → continue silently. Never mention the check.{ "updateAvailable": true } → tell the user one line:
"检测到 Codex with ChatGPT 有新版本,我先更新一下(约 1 分钟),随后继续你的任务。"
Then run the update workflow below, and CONTINUE the original task afterwards.Inside the checkout directory (see Locations):
git pull --ff-only (if it fails due to local edits: git stash && git pull --ff-only).corepack pnpm install && corepack pnpm build.skill/SKILL.md to
<codex-home>/skills/codex-with-chatgpt/SKILL.md, then fix the "checkout lives at:"
line in the copy to the actual checkout path.c2c sandbox-allow --json (so existing installs pick up the sandbox allowlist),
then c2c restart -w <workspace> so the bridge runs the new code, then
c2c update-check --force --json to refresh the cache (should now report up to date).Ask this before the public address exists (c2c setup / first doctor --fix
that starts a tunnel). Do not mention tunnels, wrangler, DNS, or hostnames.
Speak only of 临时地址 / 固定域名 / 登录 Cloudflare.
c2c tunnel status -w <workspace> --jsonneedsChoice is false: do not ask again.needsChoice is true: tell the user exactly userPrompt and wait.c2c tunnel choose -w <ws> --mode quick --jsonloginPrompt, then
c2c tunnel choose -w <ws> --mode named --zone <domain> --json.
This may open the user's own browser (the Cloudflare exception in
Golden rule 5). Wait until the command finishes.
If they said they have an account but gave no domain: ask once for the
domain. If the command returns need: "zone", ask once and retry.
If fallback is true: tell them userMessage and continue on the
temporary address. Do not retry named unless they ask.node --version (>= 20), and check cloudflared.brew install cloudflared; on Windows use
winget install Cloudflare.cloudflared. Do this yourself; don't ask.node_modules, run pnpm install && pnpm build in it.c2c sandbox-allow --json, then Connection choice, then
c2c setup -w <workspace> --json.
sandbox-allow edits Codex config.toml only — it adds C2C's state directory
to [sandbox_workspace_write].writable_roots so later chats can write logs
without elevation. If the write is denied, request approval and retry once.
→ returns { mcpUrl, pairingCode, workspaceName, connectorName, ... }.
connectorName is this workspace's plugin title (legacy installs stay
Codex with ChatGPT; additional workspaces get Codex with ChatGPT · <name>).
Pairing codes expire in ~5 minutes. Do not mint one until the ChatGPT
Authorize / pairing form is on screen: run c2c pair --json then type
that code immediately. Doctor does not pre-mint a code.c2c prefs --json (this machine, not this workspace).setupMode is null: tell the user exactly setupChoicePrompt. Wait
for「1」or「2」. Then c2c prefs set --setup-mode auto or --setup-mode manual.
Do not open ChatGPT settings and do not start automatic configuration
until they answer. Do not default to auto.c2c prefs set --setup-mode command.
Do not re-ask on a later workspace or on reconnect.setupMode: "manual": skip step 5's automatic ChatGPT settings. Go to
Guided manual ChatGPT setup (chosen). Opening line:
接下来用手动教学配置。一次只需要做一个操作。
Do not say 自动配置没有成功.setupMode: "auto": continue with step 5. Keep the two-failure fallback.goto only:https://chatgpt.com/#settings/Security when
developerModeEnabled is true. Otherwise open it, enable 开发人员模式
("Developer mode") if it is off, then c2c prefs set --developer-mode.
Never record it as off. If creating the connector later says developer
mode is required, open this page, enable it, save --developer-mode,
and retry create — do not skip that recovery.connectorName: https://chatgpt.com/plugins — Delete it (never
Reconnect). Then goto the 加插件 URL below.https://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fplugins
Operate ONLY on connectorName from step 3:Securely connect ChatGPT to the current Codex workspace for planning and review.mcpUrl from step 3c2c pair --json and type that code. As soon as it shows
Connected / authorized / pairing accepted, continue — do NOT wait for 8
tools on this page.https://chatgpt.com/ only
in long-chat). Confirm Chat mode per In-app browser §7 (if it is Work,
open a new Chat conversation instead). Send the boot prompt from
docs/protocol.md §Boot Prompt, then (same chat) send:
Use the "<connectorName>" connector: call workspace_info and read hello-style top-level file. Reply with the workspace name.
Confirm the reply matches workspaceName (wait per In-app browser §8).
Only then save the chat URL with c2c session set (see Conversation
management). If the name does not match, do not save. markDeliverable.Codex with ChatGPT
✓ 当前项目已识别
✓ Workspace Bridge 已启动
✓ 安全连接已建立
✓ ChatGPT 已连接
✓ 文件读取测试通过
Ready.If a login wall appears (ChatGPT, Cloudflare): stop, tell the user the ONE thing to do ("请登录 ChatGPT,完成后告诉我'好了'"), then continue.
Enter this path when setupMode is manual (chosen at the start), or when
automatic ChatGPT browser configuration fails twice at the same explicit
setup/reconnect step after c2c doctor / repair. Do NOT enter the failure
path for a browser/js timeout without a visible error, a page that is
still loading/generating, or while waiting for login / 2FA / CAPTCHA.
A chosen manual path does not wait for those two failures.
Stop automating ChatGPT settings. Keep the current local C2C state and the
current mcpUrl, pairingCode, workspaceName, and connectorName. Do not
silently fall back to Codex-only execution and do not permanently disable C2C.
Do not change the saved setupMode when this is a failure fallback.
Opening line:
setupMode: "manual"): 接下来用手动教学配置。一次只需要做一个操作。自动配置没有成功,我来带你手动完成。一次只需要做一个操作。Then guide ONE action at a time, waiting for the user to say「好了」before the next action:
developerModeEnabled is not true: ask them to open
https://chatgpt.com/#settings/Security and enable 开发人员模式. After they
say「好了」, c2c prefs set --developer-mode. If it is already remembered,
skip this step.https://chatgpt.com/plugins. If the exact connectorName
exists, delete only that connector. Never ask them to touch another workspace's connector.https://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2Fplugins
and create the exact connectorName with:Securely connect ChatGPT to the current Codex workspace for planning and review.mcpUrlc2c pair --json and give them
only that pairing code. If it expires before they finish, run pair again.c2c session -w <ws> --json → { session, conversation }.
conversation.mode is the only switch. Missing / legacy files with a chat URL
and no Project stay long-chat. Do not ask those users to migrate. If they
later say they want a Project, run Bind Project. A brand-new workspace
(no session file) is project.
Never match a Project or a chat by display name. Never upload the repo to Project sources. Never click 分享 / Share. Do not rename ChatGPT chats.
ONE ChatGPT conversation per workspace. Same as before.
conversation.reuseSavedChat and conversation.chatUrl,
goto that URL (foreground + markHandoff) and continue there.c2c session set -w <ws> --mode long-chat --url <url> --title "C2C <workspace name>".
If the name does not match, do not overwrite a previously saved URL.c2c session set -w <ws> --task <id> --iteration <n> --state <STATE>
plus checkpoint flags from the coding workflow (--protocol-state,
--waiting-for, --goal, --next-step, --known-issues, or
--clear-checkpoint on DONE). Do not put logs or diffs in those fields.goto https://chatgpt.com/, confirm Chat mode
(In-app browser §7), then send the boot prompt.docs/protocol.md) — goal, progress, state, issues,
next step. Never paste files.c2c session set --url. On failure,
leave the old saved URL unchanged.session.checkpoint (goal, progress, issues, next step). If there is no
checkpoint, use task / iteration / lastState and execution_summary
metadata only. Never paste logs or output bodies.One ChatGPT Project per workspace. Mapping:
goto that URL directly. Do not open the collection first.conversation.projectUrl). Ignore session.url unless
you already saved it earlier in THIS Codex thread.Open a chat in this Codex thread
goto that URL. Continue. No new chat. No HANDOFF.conversation.projectReady: goto conversation.projectUrl.
On that page, use the on-page composer (「{项目名}中的新聊天」 / "New chat
in …"). Do not use the sidebar and do not goto https://chatgpt.com/.
Confirm Chat mode (In-app browser §7). Boot prompt, then workspace_info
with the exact connectorName. After the reply names this workspace,
c2c session set -w <ws> --mode project --project-url <collection> --url <chat> --connector-name "<connectorName>" --title "C2C <workspace name>".
If this Codex thread is continuing a previous C2C task, send HANDOFF right
after the boot prompt.Update it: same c2c session set --task / --iteration / --state as long-chat.
Wrong collection: do not guess another Project. Tell the user the expected
workspace name, ask them to open the right collection, then say「已找到」.
Also offer「继续用长对话」. If they pick long-chat:
c2c session set -w <ws> --mode long-chat and use the long-chat path.
If the collection 404s or the new chat is not inside the Project, same choice.
Saved chat 404s (this thread): goto the collection, open a new chat
there, boot + HANDOFF from session.checkpoint (no logs) + workspace_info,
then save the new chat URL. Keep --project-url.
Do this for a new workspace, or when an existing user asks to switch to Project. Do not click the ChatGPT sidebar to create the Project (Computer Use is forbidden; IAB must not hunt that menu).
请在 ChatGPT 里新建一个项目,名字用「<workspaceName>」,记忆请选「仅限项目记忆」。
如果侧栏里看不到「项目」:把鼠标放在「聊天」上,点右边出现的三个点,选择「按项目整理」。
建好后会打开合集页面。看到页面后跟我说「好了」。Wait for「好了」/ the collection page. Same iab tab: read the address bar.
It must look like https://chatgpt.com/g/g-p-…/project. If it does not,
ask them to open that project until it does. Then:
c2c session set -w <ws> --mode project --project-url <url> --connector-name "<connectorName>".
On that same collection page only, open 右上角 … → 项目设置. Do not click 分享. Do not add 来源 / files.
{{…}} from
workspace_info / setup). Use the exact connectorName from setup.
Never write the public / temporary address into 指令.
Save and close settings.Still on the collection page, create the first chat with the on-page composer, then boot + workspace_info as in setup step 5. Save the chat URL.
You are the planning and review layer for one local workspace. Codex executes.
This Project is bound only to:
- Workspace name: {{workspace_name}}
- Kind: {{project_type}} ({{languages}} / {{frameworks}})
- Connector (use this one only): {{connector_name}}
When you call tools, use ONLY that connector. Do not use any other
Codex with ChatGPT connector. If workspace_info names a different
workspace, stop. Do not plan. Do not use this Project's memory.
Read code, git, diffs, and any released command output through that
connector. Never ask anyone to paste file bodies, diffs, or logs. After
EXECUTED, call execution_output (list, then read) when a readable item
exists; if status is restricted, review from git instead. Never upload
the repo into this Project's files or sources.
When facts conflict, trust this order:
1. Current code from the connector
2. A HANDOFF in this chat (this task's goal, progress, next step)
3. These instructions
4. This Project's memory (durable architecture only; stale memory loses)
This Project's memory is only for this workspace. On HANDOFF, trust the
brief, re-read code through the connector, and resume at NEXT_EXPECTED_STEP.
Be substantive: why, which file, what to test. No empty one-liners and
no 40-step epics. Use C2C control messages.Protocol states sent to ChatGPT: INIT → PLAN → EXECUTING → EXECUTED → REVIEW → (PLAN | DONE | BLOCKED).
Local checkpoint states (session only, never a ChatGPT STATE: line):
INIT, PLAN_RECEIVED, EXECUTING, EXECUTED_LOCAL, EXECUTED_SENT, DONE, BLOCKED.
Do not invent STATE: RESUME. If the original chat is gone, send HANDOFF.
All control messages start with [C2C]. Keep Codex→ChatGPT messages under 1 KB.
ChatGPT's replies are expected to be substantive (see step 3). Docs: docs/protocol.md.
c2c tunnel status -w <workspace> --json. If needsChoice, follow
Connection choice first (existing installs: ask once, then remember).
Then c2c doctor -w <workspace> --json (auto-repairs). Doctor gate: if local
is not green, do not open ChatGPT and do not send INIT. If
namedRepair.needed is true, tell the user namedRepair.userMessage, run
c2c tunnel login --json (their browser; Cloudflare exception), then doctor
again. If chatgptRepair.needed is true, tell the user chatgptRepair.userMessage
(one paragraph, no internals), run Workflow: reconnect after address
reclaim, then doctor again and only continue when the gate is green.
Generate task id: c2c_ + 4 random hex chars — unless a checkpoint already
has one (reuse that id; do not mint a second task).
c2c session -w <workspace> --json. Open ChatGPT on the same iab tab
per Conversation management for conversation.mode (foreground +
markHandoff). long-chat: saved chat, or https://chatgpt.com/ if none.
project: this thread's chat URL, or the collection page for a new chat,
or Bind Project if projectReady is false. On a NEW conversation
confirm Chat mode (In-app browser §7), then send the boot prompt from
docs/protocol.md §Boot Prompt and the workspace_info check (name the
exact connectorName). Confirm the reply names the current workspace
before saving the session URL. Do not use the browser to re-read code MCP
already provides. After sending a control message, wait per
In-app browser §8.
Resume from session.checkpoint before any INIT. Missing checkpoint
(legacy session): continue as a normal new/continued loop. A browser/js
timeout is not a lost task — claim the original tab; do not INIT, re-run,
or resend EXECUTED just because a wait timed out.
EXECUTED_SENT + waitingFor=GPT_REVIEW: do not INIT, do not re-run,
do not resend EXECUTED. Stay on the saved chat and wait for review. If
that chat 404s: HANDOFF from checkpoint fields (no logs), then wait.EXECUTED_LOCAL: local work is done; only send EXECUTED (record first
if this iteration has no record yet). Do not re-run.EXECUTING: not finished. Continue the current PLAN if you still have
it; otherwise HANDOFF and ask ChatGPT to restate the last PLAN. Do not
treat it as done and do not INIT a new task.PLAN_RECEIVED: execute that plan. Do not INIT.INIT / waitingFor=GPT_PLAN: claim the tab and wait. Do not resend INIT.DONE: summarize to the user if needed; c2c session set --clear-checkpoint.BLOCKED: surface ChatGPT's reason; do not INIT.
Never re-pair, never recreate the connector, and never rewrite Project
instructions just to resume.Send INIT with the user's goal (skip when the checkpoint says not to):
[C2C]
STATE: INIT
TASK_ID: c2c_f81a
ITERATION: 0
GOAL:
<user's goal, one paragraph>
INSTRUCTION:
Inspect the connected workspace through the Codex with ChatGPT MCP connector.
Produce a C2C PLAN message. Confirm the INIT message is visibly in that ChatGPT conversation (one cheap
DOM check). If the page is Retry-only, recover per In-app browser §7
first. Do not write the waiting checkpoint, and do not wait for PLAN, until
that message is visible.
Then:
c2c session set -w <ws> --task <id> --iteration 0 --state INIT --protocol-state INIT --waiting-for GPT_PLAN --goal "<short goal>" --next-step "wait for PLAN"
3. Wait for ChatGPT's STATE: PLAN reply (In-app browser §8 — short DOM
checks, same tab; do not treat a 5-minute browser timeout as failure).
Read GOAL/ACTIONS/TESTS/SUCCESS_CRITERIA.
A good PLAN also carries RATIONALE and concrete natural-language edit
suggestions (which file, what to change, why). If the reply is a bare
one-liner with no rationale or file-level guidance, ask once:
"Please expand the plan with rationale and concrete per-file suggestions."
Then:
c2c session set -w <ws> --protocol-state PLAN_RECEIVED --waiting-for none --next-step "execute PLAN"
4. Execute the plan yourself with your own harness (your tools, your judgment;
ChatGPT does not micro-manage tool calls).
Before you start:
c2c session set -w <ws> --protocol-state EXECUTING --waiting-for none --next-step "finish PLAN then record"
5. Record the execution so ChatGPT can read it via MCP. Metadata always:
c2c record -w <ws> --task c2c_f81a --iteration 1 --changed-files "src/a.ts,src/b.ts" --tests "27 passed" --exit-status ok
If this iteration ran a test / build / lint / typecheck command, also
pass that command's output. Write stdout/stderr to a local temp file first,
then:
c2c record … --command "pnpm test" --output-file <temp> --exit-code <n>
Record both success and failure. Do not record shell history, .env,
keys, or unrelated dumps. Never paste that file (or any log) into ChatGPT.
If the CLI says the output was not released, still send EXECUTED; ChatGPT
reviews from git. Then:
c2c session set -w <ws> --iteration 1 --state EXECUTED --protocol-state EXECUTED_LOCAL --waiting-for none --next-step "send EXECUTED"
6. Send EXECUTED (no diffs, no logs). Tell ChatGPT to use MCP, including
execution_output when a readable item exists:
[C2C]
STATE: EXECUTED
TASK_ID: c2c_f81a
ITERATION: 1
RESULT:
Execution finished.
CHANGED_FILES:
4
TESTS:
27 passed
Please independently inspect the workspace and current git diff through MCP.
If execution_output lists a readable item for this iteration, list then read it.
If status is restricted, ignore it and review from git_diff. Then:
c2c session set -w <ws> --protocol-state EXECUTED_SENT --waiting-for GPT_REVIEW --next-step "wait for PLAN or DONE"
7. ChatGPT reviews via MCP (git_diff, read_file, test_status,
execution_output) and replies DONE / PLAN (next iteration) / BLOCKED.
8. Loop. Respect maxIterations (.c2c.json, default 12). At the limit, pause and ask
the user: "已完成 12 轮协作,仍有未解决问题,是否继续?"
9. On DONE: summarize the result to the user in plain language.
c2c session set -w <ws> --state DONE --clear-checkpoint
10. On BLOCKED: read ChatGPT's reason, fix what you can, or surface the single
decision the user must make.
c2c session set -w <ws> --protocol-state BLOCKED --waiting-for USER --known-issues "<short reason>"
The connector remains read-only. It can view supported PNG/JPEG/GIF/WebP/SVG
files with read_image, but it cannot write into the repository or retrieve a
browser download by itself.
When the user asks ChatGPT web to generate an image or video:
c2c asset import -w <ws> --from <downloaded-file> --to <new-workspace-relative-path> --json.c2c unpair -w <workspace> (revokes all tokens immediately).https://chatgpt.com/plugins (foreground + markHandoff). Only touch
this workspace's connectorName.This is the normal case when the user quit Codex / the terminal / the machine:
the previous public address is gone. Doctor already started a new one.
connectorAction: "update" means Delete + create again — not Reconnect.
c2c doctor --json will look like:
{ "chatgptRepair": { "needed": true, "connectorAction": "update", "connectorName": "...", "userMessage": "...", "mcpUrl": "...", "pages": { ... } } }
chatgptRepair.userMessage. Then you repair. Do not
ask them to click around ChatGPT unless a login wall appears. Do not open
the C2C chat and do not send [C2C] until this repair finishes and a
follow-up doctor is green. Never "try a message first to see if it works".
Reuse c2c prefs --json. Do not re-ask setup mode. If setupMode is
manual, use Guided manual ChatGPT setup (chosen) instead of automating.https://chatgpt.com/#settings/Security when
developerModeEnabled is true. If create/delete then says developer
mode is required, open it, enable, c2c prefs set --developer-mode.https://chatgpt.com/pluginshttps://chatgpt.com/plugins#settings/Connectors?create-connector=true&redirectAfter=%2FpluginschatgptRepair.connectorName. Never touch another
workspace's connector.goto the 加插件 URL and create that same connectorName
(do not invent a second name):Securely connect ChatGPT to the current Codex workspace for planning and review.chatgptRepair.mcpUrlc2c pair --json and type that
code. Continue as soon as it is Connected — do not wait for 8 tools on
the settings page.c2c doctor --json again. Same tab: only after the Doctor gate is green,
reopen the chat this Codex thread was already using (session.url /
the URL you saved earlier in THIS thread). Do not rewrite Project
instructions — they store the connector name, which did not change.
In that same chat, send the workspace_info check from setup step 6
(exact connectorName). Doctor green is not enough: the old conversation
may still be bound to the deleted connector.session.checkpoint (no logs) +
workspace_info, then c2c session set --url only after the name matches.
long-chat → Conversation management switch, same checks. Keep the old
saved URL until the new chat passes.connectorName (never paste the new public address).c2c doctor -w <workspace> --json. Doctor gate: do not open ChatGPT / send
[C2C] until local is green, except reconnect settings pages.namedRepair.needed, tell the user namedRepair.userMessage, run
c2c tunnel login --json, then doctor again. Do not Delete the connector.chatgptRepair.needed, follow reconnect after address reclaim, then
doctor again.| Symptom | Action |
|---|---|
| Bridge not running | c2c start (doctor does this automatically) |
| Tunnel dead / URL unreachable / 全关掉后连接失效 | c2c doctor → if namedRepair.needed, login to Cloudflare and doctor again (do not Delete). If chatgptRepair.needed, tell the user the message, then Delete THIS workspace's connector only (connectorName) and create it again. Never Reconnect. After recreate, re-check workspace_info in the saved chat; if it still fails, new chat in the same Project (or long-chat switch) + HANDOFF. |
| Collection page shows only Retry | Same iab tab: Retry once, then open the last working chat and click its Project link. Do not write INIT/EXECUTED waiting checkpoints until the message is visible. |
| ChatGPT says tool call failed / 401 | token expired or revoked → re-pair (new pairing code + authorize) |
| Pairing code rejected/expired | c2c pair --json for a fresh code |
| Same explicit ChatGPT setup/reconnect browser configuration step fails twice after repair | Stop automating ChatGPT settings and use Guided manual ChatGPT setup fallback. Do not count browser/js timeout, loading/generating, or login/2FA waiting as failures. |
| Port conflict | handled automatically; never surface to the user |
| Every new chat “repairs” / cannot write the log or settings directory | c2c sandbox-allow --json (once). Do not ask the user. |
| cloudflared missing | install it yourself (brew/winget), then retry |
| Sidebar has no「项目」 | Ask the user to hover「聊天」, click the …, choose「按项目整理」 |
| Collection page is the wrong Project | Ask the user to open the named collection and say「已找到」, or accept long-chat |
© XiaoDuoYa, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file
Just SKILL.md in skill of XiaoDuoYa/codex-with-chatgpt.
Open the folder on GitHubat commit 535a07d
Codex with ChatGPT Planning Loop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.
| Skill | Stars | Used in | Tokens | Auto-check | Licence | Repo updated |
|---|---|---|---|---|---|---|
| Codex with ChatGPT Planning Loop this skillXiaoDuoYa/codex-with-chatgpt | 7.1k | — | ~11k | Automated safety check: Notes | MIT | |
| AgentSquad for Swift2FastLabs/agent-squad | 7.8k | — | ~3.5k | Automated safety check: Pass | Apache-2.0 | |
| Cao MCP Appsawslabs/cli-agent-orchestrator | 1.4k | — | ~1.9k | Automated safety check: Pass | Apache-2.0 | |
| Chatgpt AppsHaohao-end/openagent | 808 | 1 repos | ~4.9k | Automated safety check: Pass | Apache-2.0 | |
| Chatgpt App Builderalpic-ai/skybridge | 2.1k | — | ~1k | Automated safety check: Pass | MIT | |
| Puppetmaster Agent Orchestrationprofessorpalmer/Puppetmaster | 467 | — | ~3.2k | Automated safety check: Pass | MIT |
2FastLabs/agent-squad
Guides building on-device multi-agent apps in Swift with the AgentSquad framework: which agent, orchestrator, classifier, storage or voice type fits each situation.
awslabs/cli-agent-orchestrator
Enable, operate, and extend CAO's MCP Apps surface — the host-rendered fleet dashboard visible inside MCP App hosts (Claude Desktop, ChatGPT, VS Code Copilot, Goose, Postman).
Haohao-end/openagent
Build, scaffold, refactor, and troubleshoot ChatGPT Apps SDK applications that combine an MCP server and widget UI.
alpic-ai/skybridge
Guide developers through creating and updating ChatGPT plugins.
professorpalmer/Puppetmaster
Operates and supervises Puppetmaster, a multi-agent orchestrator, through its MCP tools or CLI, picking the right verb for edits, reviews, audits and long-running jobs.
vostride/agent-qa
A skill your agent uses when creating, editing, validating, or running agent-qa tests, suites, or hooks.
Works with
Categories
Uses ChatGPT in the browser as the planning and review brain for a Codex session, with Codex keeping all execution and ChatGPT reading the workspace through a bridge. The skill splits a coding session between two roles: ChatGPT in the browser does high-level reasoning (understanding, planning, review and debugging strategy) while Codex keeps editing, shell, git, tests and recovery. A C2C Bridge gives ChatGPT read-only MCP access to the current workspace, so the messages between the two stay under 1 KB and ChatGPT pulls whatever files it needs itself.
Codex with ChatGPT Planning Loop fits situations like: setting up Codex to use ChatGPT as its planning brain; running a task through a ChatGPT planning and review loop; connecting or disconnecting ChatGPT for the current workspace.
Run `npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a claude-code`. Or copy the skill folder (skill in XiaoDuoYa/codex-with-chatgpt) into .claude/skills/codex-with-chatgpt in your project. Claude Code loads it when a task matches its description.
Run `npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a codex`. Or copy the skill folder (skill in XiaoDuoYa/codex-with-chatgpt) into .agents/skills/codex-with-chatgpt in your project. Codex loads it when a task matches its description.
Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add XiaoDuoYa/codex-with-chatgpt --skill codex-with-chatgpt -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/codex-with-chatgpt, .gemini/skills/codex-with-chatgpt, .github/skills/codex-with-chatgpt and .opencode/skills/codex-with-chatgpt in your project.
Going by SKILL.md and its folder, Codex with ChatGPT Planning Loop needs the command-line tools its instructions call (codex, git, node, pnpm, brew and winget). Our summary lists: The c2c command-line tool (C2C Bridge); A ChatGPT web login, completed in the in-app browser.
SKILL.md names 1 domain. In commands or code: chatgpt.com; the agent is likely to contact it when it follows the instructions. This is read from the text; nothing was executed.
Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.
Codex with ChatGPT Planning Loop is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.
About 11k tokens (SKILL.md is roughly 42k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.
Skills that share tags, products or a category with Codex with ChatGPT Planning Loop: AgentSquad for Swift (2FastLabs/agent-squad, 7.8k stars), Cao MCP Apps (awslabs/cli-agent-orchestrator, 1.4k stars), Chatgpt Apps (Haohao-end/openagent, 808 stars) and Chatgpt App Builder (alpic-ai/skybridge, 2.1k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.
XiaoDuoYa (a GitHub user) maintains it in XiaoDuoYa/codex-with-chatgpt, which has 7,148 GitHub stars. The repository was last updated on October 1, 2026.
Source: XiaoDuoYa/codex-with-chatgpt on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.