Codex sdk
Architect-level guidance, workflows, and scripts for building agentic coding systems with OpenAI Codex. Use for Codex SDK (@openai/codex-sdk) threads + streaming JSONL events; Codex CLI automation (codex exec, output schema, JSONL, resume); MCP server usage (codex mcp-server) and dynamic tool integration; multi-agent orchestration with OpenAI Agents SDK (handoffs, gating, tracing); durable state, caching, and memory using SQLite; safe-by-default sandbox/approval patterns and execpolicy rules.From its SKILL.md
npx -y skills add BjornMelin/dev-skills --skill codex-sdkAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 5 stars5 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.9 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
Codex SDK + Codex CLI (master skill)
Build reliable, auditable, multi-step coding workflows that scale from a single run to multi-agent orchestration.
ExecPlans (durable planning)
For multi-hour work, keep intent durable across compaction/restarts using an ExecPlan:
- Contract:
references/execplans.md - Template + rules:
.agent/PLANS.md(usescripts/init_agent_workspace.pyto bootstrap a repo) - ExecPlan skeleton:
assets/templates/execplan.md(or generate a file withscripts/new_execplan.py)
Workflow decision tree
- Need a scriptable one-shot in CI or cron? → use
codex exec(references/codex-cli-exec.md) - Need a server-side app controlling Codex programmatically? → use
@openai/codex-sdk(references/codex-sdk-typescript.md) - Need multi-agent orchestration or dynamic tools? → run
codex mcp-serverand orchestrate via OpenAI Agents SDK (references/mcp-and-agents-sdk.md) - Need durability across runs (memory, caching, resumable state)? → persist run metadata and event logs in SQLite (
references/state-memory-sqlite.md)
Default workflow (safe + production-friendly)
- Inventory inputs (repo root, diffs, failing commands, constraints).
- Choose sandbox + approvals (least privilege; default to read-only).
- Plan in explicit steps (short, verifiable; include stop conditions).
- Use structured outputs (JSON Schema) and validate before acting.
- Record an audit trail (JSONL events → SQLite).
- Verify (re-run tests/lint/format; stop).
Durable state and “memory” (SQLite)
SQLite is the simplest reliable substrate for:
- recording every
codex exec --jsonevent as an immutable audit log - indexing runs by repo, branch, and purpose
- storing
threadIdso runs can resume deterministically - caching expensive analysis artifacts (diff summaries, inventories, dependency graphs)
Use the bundled scripts
- Initialize a DB:
python3 scripts/codex_jsonl_to_sqlite.py --db codex-runs.sqlite --init
- Ingest a JSONL run:
codex exec --json "<prompt>" | python3 scripts/codex_jsonl_to_sqlite.py --db codex-runs.sqlite --run-label "ci-autofix"
- Summarize runs:
python3 scripts/codex_sqlite_report.py --db codex-runs.sqlite --latest
Multi-agent orchestration (recommended shape)
Use:
- a single orchestrator responsible for gating and artifact checks
- multiple scoped worker agents with strict deliverables
- structured outputs at boundaries (handoff payloads, review findings, test results)
- traces/telemetry to debug and tune
Details: references/mcp-and-agents-sdk.md
Safety and policy
Prefer:
- analysis-only:
sandbox: read-only,approval-policy: never - controlled edits:
sandbox: workspace-write,approval-policy: on-request/on-failure - block risky commands with
execpolicyrules (references/safety-and-execpolicy.md)
Resources
references/
references/codex-sdk-typescript.md– SDK patterns (threads, streaming, schemas)references/codex-cli-exec.md– CLI patterns (JSONL, schema files, resume)references/mcp-and-agents-sdk.md– Codex as MCP server + multi-agent orchestrationreferences/agents-sdk-consistent-workflows.md– gated handoffs + traces with Codex MCP + Agents SDKreferences/execplans.md– ExecPlans for long-running work across compactionreferences/state-memory-sqlite.md– SQLite schema + memory/caching patternsreferences/safety-and-execpolicy.md– sandboxing, approvals, prompt-injection defensesreferences/codex-config-knobs.md– config keys and feature flags that matterreferences/orchestration-patterns.md– planner/executor/verifier and orchestrator/worker patternsreferences/rag-and-memory.md– SQLite-first shared memory and RAG guidancereferences/context-personalization.md– state + memory notes personalization patterns (Agents SDK)
scripts/
scripts/codex_jsonl_to_sqlite.py– ingest Codex JSONL into SQLitescripts/codex_sqlite_report.py– summarize runs from SQLitescripts/init_agent_workspace.py– create.agent/AGENTS.md+.agent/PLANS.mdfrom templatesscripts/new_execplan.py– generateexecplans/execplan-*.mdfrom the ExecPlan template
assets/
assets/templates/– copy/paste templates (ExecPlan, prompts, schemas)assets/templates/agents-sdk/– Agents SDK starter snippets (MCP stdio, sessions, personalization)
What ships with it: 28 files
52.9 KB alongside SKILL.md, 8 of them executable
agents/
- openai.yaml292 B
assets/
- templates/agent/AGENTS.md915 B
- templates/agent/PLANS.md2.3 KB
- templates/agents-sdk/python/codex_mcp_multiagent_workflow.pyruns3.4 KB
- templates/agents-sdk/python/context_personalization_memory_notes.pyruns4.3 KB
- templates/agents-sdk/typescript/mcp-filesystem-example.tsruns862 B
- templates/agents-sdk/typescript/sessions-trimming-example.tsruns919 B
- templates/execplan.md2.1 KB
- templates/execpolicy/default.rules1.4 KB
- templates/prompts/ci-autofix.md343 B
- templates/prompts/code-review.md668 B
- templates/sqlite/rag-schema.sql1.3 KB
- templates/sqlite/schema.sql726 B
references/
- agents-sdk-consistent-workflows.md3.1 KB
- codex-cli-exec.md1.3 KB
- codex-config-knobs.md1.1 KB
- codex-sdk-typescript.md1.6 KB
- context-personalization.md4.0 KB
- execplans.md3.1 KB
- mcp-and-agents-sdk.md2.5 KB
- orchestration-patterns.md2.8 KB
- rag-and-memory.md1.7 KB
- safety-and-execpolicy.md1.1 KB
- state-memory-sqlite.md1.1 KB
scripts/
- codex_jsonl_to_sqlite.pyruns3.8 KB
- codex_sqlite_report.pyruns2.0 KB
- init_agent_workspace.pyruns1.5 KB
- new_execplan.pyruns2.9 KB