[TypeScript SDK] Expose an ephemeral thread option

Open 💬 0 comments Opened Jul 22, 2026 by hanakannzashi

What feature would you like to see?

Please expose an ephemeral option in the TypeScript SDK, equivalent to codex exec --ephemeral.

The CLI supports running without persisting session files, but @openai/codex-sdk 0.144.6 does not expose this through ThreadOptions. As a result, startThread() launches codex exec without --ephemeral and persists rollout files under CODEX_HOME, even for independent automation jobs that should never be resumed.

A possible API would be:

const thread = codex.startThread({
  ephemeral: true,
  workingDirectory: workspace,
});

The SDK would pass --ephemeral to codex exec for that thread.

Why is this useful?

Long-running automation services often share one CODEX_HOME for authentication, configuration, and skills while starting many isolated, non-resumable jobs. Giving each job a private sqlite_home isolates SQLite-backed state, but it does not prevent session rollout files from accumulating in the shared Codex home.

First-class SDK support would:

  • match an existing CLI capability;
  • prevent unbounded session-file accumulation in automation;
  • make the intended non-resumable lifecycle explicit; and
  • avoid subprocess wrappers or SDK forks solely to add one CLI flag.

Additional context

Verified with @openai/codex-sdk 0.144.6. Its ThreadOptions includes sandbox, working directory, network, approval, and additional-directory controls, but no ephemeral-session option. The bundled CLI exposes codex exec --ephemeral as “Run without persisting session files to disk.”

View original on GitHub ↗