Unified TypeScript SDK for AI coding agent CLIs (Claude Code, Codex CLI, Gemini CLI, OpenCode, and more)
README
Unified TypeScript SDK for AI coding agent CLIs (Claude Code, Codex CLI, Gemini CLI, OpenCode, and more).
Register an adapter, send a prompt, and consume a single async event stream — regardless of which agent runs underneath.
npm install @sublang/cligent
import { Cligent } from '@sublang/cligent';
import { ClaudeCodeAdapter } from '@sublang/cligent/adapters/claude-code';
// Cligent wraps an adapter with role identity, session continuity,
// option merging, and protocol hardening.
const agent = new Cligent(new ClaudeCodeAdapter(), {
role: 'coder',
model: 'claude-opus-4-8',
});
for await (const event of agent.run('Refactor auth module')) {
if (event.type === 'text_delta') process.stdout.write(event.payload.delta);
if (event.type === 'done') console.log('\nDone:', event.payload.status);
}
// Session continuity — the next run auto-resumes the previous session.
for await (const event of agent.run('Now add tests for it')) {
// ...
}
@anthropic-ai/claude-agent-sdk@openai/codex-sdk@opencode-ai/sdktmux-play is a reference application built on Cligent — a working
showcase of what you can compose with the SDK. You chat with a Captain
on the left pane; the Captain dispatches work to players, each a
Cligent on its own adapter and model, streaming live into its own pane
on the