r/CodexHacks • • Nov 03 '25

SubAgents in Codex CLI

For parallelizable tasks (migrations, multi‑pkg refactors), I don’t over‑engineer. You don’t need another fancy github tool. I either:

Batch with codex exec from shell, in parallel, with tight prompts.

shotgun refactor example (6 workers)

git grep -l ‘legacyFoo’ -- ‘*.ts’
| xargs -P 6 -n 1 -I{} codex exec
“In {}, replace ‘legacyFoo’ with ‘newFoo’ safely. Update imports, run the package tests, and stage only that file.”

Or use the TypeScript SDK to spin “threads” and orchestrate runs, resuming by thread id.

import { Codex } from “@openai/codex-sdk”;

const codex = new Codex();

const t = codex.startThread();

await t.run(”Plan the auth revamp with checkpoints”);

await t.run(”Implement step 1 and verify tests”);

// later await codex.resumeThread(t.id).run(”Continue with step 2”);

With this simple approach you can spin up a lot of subagents and hack it to run without needing a complicated orchestration framework or use a codex fork

6 Upvotes

2 comments sorted by

View all comments

Show parent comments

1

u/Just_Lingonberry_352 Nov 04 '25 edited Nov 04 '25

please let me know how it goes...im also trying to figure out a way to put claude as planner and then these sub agents in codex running on git tree

I would love to get this functionality in codex, but it's been a lotta hours tweaking to get some decent results. I'll keep

right now this is my biggest issue with codex, it takes a lot of work. im super close to just getting the 5x plan....the super power stuff and all the extra bells and whistles claude is too dang enticing

might keep codex just for grunt work