sdoat-skill-codex
v0.1.1
Published
SDOAT Codex autonomous lifecycle skill bundle and CLI.
Readme
SDOAT-sKILL-Codex
Technical reference for the autonomous Codex task lifecycle skill and CLI.
What this project provides
- npm-distributed CLI:
sdoat-codex - Codex skill bundle:
skill/sdoat-codex - Deterministic lifecycle commands:
install-skillpreflighttask-starttask-merge-cleanresume
Prerequisites
- macOS
gitavailable inPATH- Node.js 20+ (tested with Node 24 runtime)
- A valid Codex home:
CODEX_HOMEif set, else~/.codex- Must exist and contain at least one of:
sessions/archived_sessions/worktrees/
Install dependencies and build
npm install
npm run buildInstall the skill bundle
npx sdoat-skill-codex install-skillOptional overwrite:
npx sdoat-skill-codex install-skill --forceInstalled destination:
$CODEX_HOME/skills/sdoat-codex(fallback base is~/.codex)
Quick start
1) Start a task worktree
npx sdoat-skill-codex task-start \
--repo-root /abs/path/to/repo \
--parent-branch dev \
--task-description "implement deterministic cleanup"Optional flags:
--task-branch codex/<kebab>--thread-id <id>--config /abs/path/config.json--log-file /abs/path/run.log--json
2) Merge, push, and cleanup
npx sdoat-skill-codex task-merge-clean \
--worktree-path /abs/path/to/worktree \
--test-command "npm test"Alternative metadata input:
npx sdoat-skill-codex task-merge-clean \
--meta-file /abs/path/to/worktree/.codex-task.jsonOptional flags:
--thread-id <id>--ui-hook-cmd "codex-app archive --thread {thread_id}"--config /abs/path/config.json--log-file /abs/path/run.log--json
3) Resume interrupted cleanup
npx sdoat-skill-codex resume --run-id <run_id>Or:
npx sdoat-skill-codex resume --run-id <run_id> --run-file /abs/path/run.jsonCLI command reference
preflight
Validates Codex home and optional repo path.
npx sdoat-skill-codex preflight --repo-root /abs/path/to/repotask-start
- Validates parent and task branch policy.
- Fetches remote (
originby default). - Checks out parent safely.
- Fast-forward syncs parent from remote if present.
- Creates task branch and dedicated worktree.
- Writes
.codex-task.json.
task-merge-clean
- Requires
--worktree-pathor--meta-file. - Auto-commits dirty task branch checkpoint.
- Performs merge with conflict matrix.
- Runs configured tests.
- Pushes parent branch.
- Runs merge gate before destructive cleanup.
- Performs git cleanup, session archive/purge, UI hook best-effort.
resume
- Reopens previous run state.
- Re-validates merge gate before destructive continuation.
- Continues idempotently from unfinished phase.
Configuration file (JSON)
Use --config /abs/path/config.json.
{
"version": 1,
"git": {
"remote": "origin",
"protected_branches": ["main", "master"]
},
"tests": {
"commands": ["npm test"]
},
"conflicts": {
"policy": "path-matrix"
},
"ui_removal": {
"hook_cmd": null
}
}Safety and scope guarantees
- Task branches must match:
^codex/[a-z0-9]+(-[a-z0-9]+){0,2}$
- Protected branches are blocked for destructive operations:
main,master
- Worktree cleanup is restricted to
$CODEX_HOME/worktrees. - Session purge scans JSONL lines and matches only:
type == "session_meta"andpayload.id == thread_id
- Cleanup runs only after:
- merge success
- push success
- merge-gate success
- Run state and locking:
- lock:
$CODEX_HOME/tmp/locks/<hash>.lock - run state:
$CODEX_HOME/tmp/self_destruction_runs/<run_id>.json
- lock:
Exit codes
0: success2: invalid arguments3: preflight failure4: merge gate failure5: merge or push failure6: cleanup interrupted7: UI removal best-effort only
Development
npm run typecheck
npm test
npm run pack:dryIf npm cache/permissions break packaging locally, fix ownership of ~/.npm and rerun.
