session-codex
Use when delegating a task to Codex CLI with session persistence across turns.
What this skill does
# Codex Session
## Direct (review, analysis, quick edits — no git)
First run:
```bash
codex exec --json -s workspace-write -c 'approval_policy="never"' "prompt"
```
Following runs:
```bash
codex exec resume --json -c 'approval_policy="never"' ${THREAD_ID} "follow-up prompt"
```
## Worktree (implementation — sandboxed with git)
Only for worktrees where `.git` is a gitfile (pointer to main repo). Do not apply to repo root where `.git` is a directory.
### Step 1: Create worktree
```bash
git worktree add .worktrees/${NAME} -b ${NAME} main
```
Copy `.env*` files, run `uv sync` where needed.
### Step 2: Rename `.git` to bypass Codex denylist
Before renaming, verify state:
- `.worktrees/${NAME}/.git` must exist (gitfile)
- `.worktrees/${NAME}/.git-codex-sandbox-workaround` must NOT exist
- If `.git` already contains `gitdir: .git-codex-sandbox-workaround`, the workaround is already active — skip this step
Add exclude rule to prevent accidental staging, then rename:
```bash
printf '.git-codex-sandbox-workaround\n' >> "$(git -C .worktrees/${NAME} rev-parse --git-path info/exclude)"
mv .worktrees/${NAME}/.git .worktrees/${NAME}/.git-codex-sandbox-workaround
printf 'gitdir: .git-codex-sandbox-workaround\n' > .worktrees/${NAME}/.git
```
**Why this creates double indirection**: In a worktree, the original `.git` is a gitfile containing `gitdir: /abs/path/.git/worktrees/NAME`. After rename:
- `.git` (new) → `gitdir: .git-codex-sandbox-workaround`
- `.git-codex-sandbox-workaround` (original gitfile) → `gitdir: /abs/path/.git/worktrees/NAME`
Git does not follow two `gitdir:` hops. Plain `git` commands fail with "not a git repository".
### Step 3: Use GIT_DIR= prefix on ALL git commands — MANDATORY
`GIT_DIR=.git-codex-sandbox-workaround` skips the first hop — git reads the file, follows one `gitdir:` to the real git data.
**You (Claude) MUST use the prefix** when running git commands in the worktree yourself. Always run from the worktree root (`cd .worktrees/${NAME}/` first):
```bash
GIT_DIR=.git-codex-sandbox-workaround git status
GIT_DIR=.git-codex-sandbox-workaround git add file.py
GIT_DIR=.git-codex-sandbox-workaround git log --oneline
```
FAIL: `git status` without `GIT_DIR=` — will error.
FAIL: running from a nested subdirectory — relative `GIT_DIR` resolves to wrong path.
### Step 4: Build the Codex prompt
Set `WT_ABS` to the absolute path of the worktree (e.g., `/Users/foo/project/.worktrees/myfeature`).
Prepend this exact block to EVERY Codex prompt (first run AND every `resume`):
```
MANDATORY GIT RULES — violations break all git commands:
Git data is renamed to .git-codex-sandbox-workaround
From worktree root:
GIT_DIR=.git-codex-sandbox-workaround git <command>
From any other directory:
GIT_DIR=${WT_ABS}/.git-codex-sandbox-workaround GIT_WORK_TREE=${WT_ABS} git <command>
NEVER run bare 'git' without GIT_DIR= prefix — it WILL fail.
NEVER use 'git add .', 'git add -A', or 'git add :/' — they stage internal files.
Use 'git add <explicit paths>' for new files, 'git add -u' for tracked-file updates.
Correct: GIT_DIR=.git-codex-sandbox-workaround git status
Correct: GIT_DIR=.git-codex-sandbox-workaround git add -u
Correct: GIT_DIR=.git-codex-sandbox-workaround git add src/foo.py tests/test_foo.py
Correct: GIT_DIR=.git-codex-sandbox-workaround git commit -m "msg"
Correct: GIT_DIR=.git-codex-sandbox-workaround git diff
WRONG: git status
WRONG: git add .
WRONG: git add -A
WRONG: GIT_DIR=.git-codex-sandbox-workaround git add .
```
### Step 5: Run Codex
First run:
```bash
codex exec --json -s workspace-write -c 'approval_policy="never"' -C .worktrees/${NAME} "${PROMPT}"
```
Following runs — `resume` inherits sandbox mode and working directory from the session. Only `approval_policy` needs override:
```bash
codex exec resume --json -c 'approval_policy="never"' ${THREAD_ID} "${PROMPT}"
```
### Step 6: Reverse before rebase/merge
Only reverse if `.git` contains the workaround pointer and `.git-codex-sandbox-workaround` exists:
```bash
rm .worktrees/${NAME}/.git && mv .worktrees/${NAME}/.git-codex-sandbox-workaround .worktrees/${NAME}/.git
```
After reversal, plain `git` works again. GIT_DIR= prefix no longer needed.
## Response parsing
Parse first JSONL line: `{"type":"thread.started","thread_id":"<id>"}` → set `${THREAD_ID}`.
Response: lines where `item.type == "agent_message"` → `item.text`.
If Codex returns error or empty output: show stderr, STOP.
Use Bash timeout >= 300000 for long-running tasks.
## Security
`workspace-write` sandbox is kernel-enforced (Seatbelt/Landlock): writes restricted to CWD + subdirs, network blocked. The `.git` rename bypasses the hardcoded denylist while keeping filesystem isolation. This is safer than `danger-full-access` which has no restrictions at all.
Related in Productivity
gitea-workflow
IncludedOrchestrate agile development workflows for Gitea repositories using the tea CLI. Use when working with Gitea-hosted repos and asking to 'run the workflow', 'continue working', 'what's next', 'complete the task cycle', 'start my day', 'end the sprint', 'implement the next task', or wanting guided step-by-step development assistance. Keywords: workflow, orchestrate, agile, task cycle, sprint, daily, implement, review, PR, standup, retrospective, gitea, tea.
microsoft-graph-gateway
IncludedRoute Microsoft Graph work in this workspace. Use when users want to read or write Outlook mail, calendar events, contacts, OneDrive or SharePoint files, Teams, Planner, To Do, users, groups, directory data, or arbitrary Microsoft Graph endpoints from VS Code. Prefer WorkIQ for common read scenarios. Use Microsoft Graph for write actions and gap-read scenarios that need exact Graph properties, filters, permissions, or endpoints.
copilotkit
IncludedUse when building with CopilotKit — setup, development, integrations, debugging, upgrading, or contributing. Routes to the appropriate specialized skill based on the task.
wordly-wisdom
IncludedProvides calibrated decision analysis using Charlie Munger-style multiple mental models, inversion, incentive mapping, circle-of-competence checks, misjudgment audits, second-order effects, and forecast updates. Use when the user asks for an oracle take, a hard call, a decision memo, a premortem, an outside view, a red-team, a sanity-check, what am I missing, think this through, or wants a strategy, hire, investment, plan, product, partnership, or major life choice analysed. Avoid for simple factual lookups or time-sensitive legal, medical, or market questions without fresh evidence.
swain-session
IncludedSession management and project status dashboard. Owns the full session lifecycle (start/work/close/resume), focus lane, bookmarks, worktree detection, and tab naming. Also serves as the project status dashboard — shows active epics, progress, actionable next steps, blocked items, tasks, GitHub issues, and recommendations. Worktree creation is deferred to swain-do task dispatch (SPEC-195). Triggers on: 'session', 'status', 'what's next', 'dashboard', 'overview', 'where are we', 'what should I work on', 'show me priorities', 'bookmark', 'focus on', 'session info'.
gandi
IncludedComprehensive Gandi domain registrar integration for domain and DNS management. Register and manage domains, create/update/delete DNS records (A, AAAA, CNAME, MX, TXT, SRV, and more), configure email forwarding and aliases, check SSL certificate status, create DNS snapshots for safe rollback, bulk update zone files, and monitor domain expiration. Supports multi-domain management, zone file import/export, and automated DNS backups. Includes both read-only and destructive operations with safety controls.