codex-setup
Initialize sd0x-dev-flow infrastructure for Codex CLI and other non-Claude agents.
Skill by sd0xdev
Chalk Labs
Need help deploying codex-setup?
Chalk Labs sets up agents like this inside real teams: connected to your tools, tested on your data, with a human in the loop where it matters.
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/sd0xdev-codex-setup
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: devops, agent-building
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/codex-setup
Tools it pre-approves 14
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
Read,Grep,Glob,Edit,Write,Bash(node:*),Bash(git:*),Bash(ls:*),Bash(mkdir:*),Bash(cp:*),Bash(chmod:*),Bash(bash:*),
Show 2 more
Bash(cat:*),Bash(wc:*)
What's inside
- Skill name
codex-setup- Description
- Initialize sd0x-dev-flow infrastructure for Codex CLI and other non-Claude agents. Generates AGENTS.md, installs the commit-msg hook, copies runner scripts. The pre-push gate is opt-in via --with-push-gate. Use when setting up a new project or after updating skills.
- License
- MIT
- Allowed tools
- Read,, Grep,, Glob,, Edit,, Write,, Bash(node:*),, Bash(git:*),, Bash(ls:*),, Bash(mkdir:*),, Bash(cp:*),, Bash(chmod:*),, Bash(bash:*),, Bash(cat:*),, Bash(wc:*)
- Instructions
- 722 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Agent Skills spec issues
- body: 722 lines (spec recommends under 500)
- files: referenced but missing: scripts/commit-msg-guard.sh, scripts/build-codex-artifacts.js, scripts/pre-push-gate.sh, scripts/precommit-runner.js, scripts/verify-runner.js
Files (2)
- SKILL.md
- agents-kernel.md · references/
SKILL.md (first lines)
# Codex Setup
## Trigger
- Keywords: codex setup, codex init, agents.md, setup codex, initialize codex, codex doctor, codex sync
- After: `npx skills add sd0xdev/sd0x-harness`
## Subcommands
| Command | Purpose |
|---------|---------|
| `init` | First-time setup: generate AGENTS.md + install the `commit-msg` hook + copy scripts |
| `doctor` | Verify installation integrity: files exist, AGENTS.md hash matches, and each recorded hook is **active** — hook *bytes* are `sync`'s axis, not this one (§ doctor) |
| `sync` | Re-generate AGENTS.md + update installed hooks/scripts after skill update |
Default (no subcommand): `init`
## Arguments
| Flag | Applies to | Effect |
|------|-----------|--------|
| `--with-push-gate` | `init`, `sync` | Install `pre-push-gate.sh` as the `pre-push` hook. **Off by default** |
The `pre-push` gate is the one hook that **waits for a human** — it reads `/dev/tty`,
so from a non-interactive context it stalls or fails on a terminal that is not there.
That is why it is opt-in, and why every path below reads that choice from state rather
than re-deciding it. `commit-msg` stays a default install because it never prompts:
it guards the attribution anchor (CLAUDE.md rule 3) by reading the message and
deciding, with no `/dev/tty` and no input. **It does still reject** — exit 1 on a
policy violation, exit 3 when the policy cannot be evaluated — and it rejects
interactive and non-interactive commits alike (`scripts/commit-msg-guard.sh`). The
distinction that makes it safe to install by default is *prompts vs. rejects*, not
*blocks vs. does not block*.
**The flag is the opt-in interface — there is no prompt.** `init` must not ask
interactively whether to install the gate: this skill runs under Codex sandboxes and
in non-interactive setup flows where an unanswered prompt would either hang or be
silently defaulted, and a silent default is exactly what opt-in exists to prevent.
## init
### Phase 1: Detect Host Context
1. Find repo root: `git rev-parse --show-toplevel`
2. Read `package.json` if present → extract `name`, `scripts.test`
3. Read `.claude/CLAUDE.md` or `CLAUDE.md` → extract test command pattern
4. Detect plugin root: find `scripts/build-codex-artifacts.js` relative to this skill
### Phase 2: Generate AGENTS.md Kernel
```bash
node <plugin-root>/scripts/build-codex-artifacts.js \
--project-dir <repo-root> \
--output <repo-root>/AGENTS.md
```
If the file already exists, warn and ask before overwriting.
Verify output:
- File exists and is non-empty
- Size ≤ 24 KiB (`wc -c < AGENTS.md` ≤ 24576)
- No unresolved placeholders (`{PROJECT_NAME}`, `{VERSION}`, `{TEST_COMMAND}`)
### Phase 3: Multi-Mode Hook Install
Install the git hooks using priority-ordered detection. The mode detection is
identical for both hooks; only *which* hooks are installed differs:
| Priority | Condition | Action |
|----------|-----------|--------|
| 1 | `.husky/` directory exists | Copy the hook's script to `.claude/scripts/`, **then prepend** that hook's executing stanza below to `.husky/<hook>` — `commit-msg-guard.sh` into `.husky/commit-msg`, and (only under `--with-push-gate`) `pre-push-gate.sh` into `.husky/pre-push`. **Two stanzas, not one**: they are shaped by what git hands each hook, and § The Husky commit-msg stanza says where they differ |
| 2 | `git config core.hooksPath` is set | Install to that path |
| 3 | `.git/hooks/` is writable | Direct write |
| 4 | Fallback | Write to `.githooks/` + print `git config core.hooksPath .githooks` — **the write alone does not arm the hook**; see below |
#### Modes 2–4 write the hook **as** the file, so check who owns it first
Mode 1 prepends into a shared container; modes 2–4 put the gate — or the guard — at the resolved
hook path **as that file's whole content**. A write there is a delete of whatever was there, and
the operator's own `pre-push` may be the only thing standing between them and something this
skill knows nothing about. `--with-push-gate` is a request to *add* a guard; taking one away to
honour it is not a lesser reading of that request, it is the opposite of it.
So before any dedicated-file mode writes a hook, classify the destination — **by content, never by
existence**:
| Destination | Action |
|-------------|--------|
| Absent, or present and empty | Write. Nothing is lost |
| **sd0x-owned** — one of the first 20 lines is exactly `# <script> - ` followed by that script's own summary, where `<script>` is `pre-push-gate.sh` or `commit-msg-guard.sh` per hook | Overwrite. This is a refresh of our own file, which is what `sync` exists to do |
| Anything else | **Do not write.** Record `pending`, and report: `<hook>: <resolved> already exists and is not sd0x-owned — the gate was not installed; move or rename that hook, then re-run` |
The marker is the shipped scripts' own second line, so an older shipped version is still recognised
as ours and a refresh across versions is not blocked. It is matched as a prefix of a line rather
than against the whole file because the byte-for-byte alternative refuses every past version — the
one case a refresh most needs to succeed on.
**The predicate is deliberately strict in one direction.** A hand-edited header stops matching and
the install refuses; a foreign file matches only if someone copied our header into it. Refusing an
install costs a re-run, and the operator is told which file to move; clobbering costs a hook nobody
can get back. The asymmetry decides, exactly as it does for `uninstall` below — that row already
said "only after verifying it is sd0x-owned", and this is the same predicate, stated once, on the
side where the file is still there to protect.
**`pending` is the honest record for a refused write**: the operator opted in, the wiring did not
finish, and the transition matrix already treats `pending` as a gate to keep — so a later
`sync` retries rather than reading the refusal as a decline. Recording `declined` would turn
their request into an opt-out they never made.
#### The Husky stanza — prepended, executed, and it hands stdin back
Mode 1 does not write its own file: it goes into `.husky/<hook>`, beside whatever the project
already put there. Two properties of that neighbourhood decide the shape of the stanza, and both
were got wrong by the words this section used to carry ("append sourcing"):
| Property | Consequence | Measured 2026-08-21 |
|----------|-------------|---------------------|
| git delivers the ref list on **stdin, once** | An earlier consumer in the same hook takes it, and the gate then reads EOF — zero refs, nothing protected, nothing rewritten, **exit 0** | An existing `while read …` loop ahead of the gate turned a protected-branch rewrite that the gate refuses with exit 1 into an allowed push |
| `.`/`source` does not change `$0` | The gate's privileged re-exec, which then read `exec … bash -p "$0" "$@"`, named **the Husky hook** rather than the gate | The parent hook's first line printed twice — once at `$-`=`hB`, once at `hpB` — i.e. the user's whole `pre-push` re-ran under a privileged shell, and the gate never ran as the gate. The gate has since switched that word to `${BASH_SOURCE[0]:-$0}`, which resolves correctly under `source`, and an ordinary `source` of the gate now refuses (2026-08-22) — so no *supported* caller reaches this defect. Not "closed entirely": the refusal compares against `$0`, which a sourcing caller supplies, and a forged one walks past it (`4-implementation.md` § 4.3, Round 54). Row 1 above was already reason enough on its own |From sd0xdev/sd0x-harness, MIT.
More from sd0xdev/sd0x-harness
- 0.713score
debug
sd0xdev
Interactive debugging workflow with hypothesis-driven probe loop.
SkillAFreshness: A★ 194Claude Code - 0.713score
contract-decode
sd0xdev
EVM contract error and calldata decoder.
SkillAFreshness: A★ 194Claude Code - 0.713score
codex-brainstorm
sd0xdev
Adversarial brainstorming via Claude+Codex debate.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
best-practices
sd0xdev
Industry best practices conformance audit with mandatory adversarial debate.
SkillAFreshness: A★ 194Claude Code - 0.713score
codex-cli-review
sd0xdev
Code review via Codex CLI with full disk access.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
codex-explain
sd0xdev
Explain complex code via Codex exec.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
ask
sd0xdev
Context-aware Q&A with auto context gathering.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
claude-health
sd0xdev
Claude Code config health check + plugin sync.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
code-explore
sd0xdev
Pure Claude code investigation.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
code-investigate
sd0xdev
Dual-perspective code investigation.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
codex-architect
sd0xdev
Codex architecture consulting.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
deep-explore
sd0xdev
Multi-wave parallel code exploration orchestrator.
SkillAFreshness: A★ 194Claude Code +9
Signals
- Stars
- 194
- Forks
- 26
- Open issues
- 5
- Last commit (this folder)
- Oct 3, 2026 (29 days ago)
- Last release
- Oct 6, 2026 (26 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/sd0xdev/sd0x-harness
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from sd0xdev
- 0.713score
code-investigate
sd0xdev
Dual-perspective code investigation.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
code-explore
sd0xdev
Pure Claude code investigation.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
ask
sd0xdev
Context-aware Q&A with auto context gathering.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
best-practices
sd0xdev
Industry best practices conformance audit with mandatory adversarial debate.
SkillAFreshness: A★ 194Claude Code - 0.713score
claude-health
sd0xdev
Claude Code config health check + plugin sync.
SkillAFreshness: A★ 194Claude Code +9 - 0.713score
codex-architect
sd0xdev
Codex architecture consulting.
SkillAFreshness: A★ 194Claude Code +9
Done for you
Rather not set it up yourself?
Chalk Labs scopes, builds and runs agents for your team: the task audit, the eval harness, the integrations and the weekly ops report. Fixed scope, priced before we start.
See how we build AI agents →Read the case studies
Chalk Labs is a two-founder AI and growth studio. We build AI agents, CRMs and MVPs for Web3 and AI companies, and have shipped 50+ product and token launches.
- launches shipped
- 50+
- launches shipped
- media placements
- 500+
- media placements
- founders on every account
- 2
- founders on every account
Press we've placed: Forbes · CoinDesk · Decrypt · Cointelegraph · The Block
Rahil Jain, Co-founder, Chalk Labs. Ex-Goldman Sachs engineer. You talk to the person who builds it.
Get codex-setup running in your business
Tell us what you want to automate. A founder replies within one working day with a plan, not a pitch deck.
Cite this page
codex-setup skill. Agent Mart. https://agentmart.dev/skills/sd0xdev-codex-setup (last updated 2026-10-24)