# codex-session-patcher

Finds AI refusals in Claude CLI, Claude and OpenCode session files and replaces them so you can resume the conversation.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 798 installs · ★ 88
- Author: reason-machines
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/reason-machines/trending-skills/tree/HEAD/skills/codex-session-patcher/SKILL.md
- Updated: 2026-10-09
- HTML: https://affpapa.org/en/nevibecode/skills/codex-session-patcher

## What it does

The skill scans session files for refusal phrases and swaps them for a cooperative reply, after which the session can be resumed as usual. Formats differ: Claude CLI and Claude store JSONL, OpenCode uses SQLite.

Under the hood there is a Python library with a parser, a refusal detector and a patcher, plus the `codex-patcher` CLI and a web dashboard with diff preview and live logs. Run `--dry-run` first to see exactly what would change before anything is written. LLM rewriting is optional and needs a key for an Anthropic-compatible API, set through an environment variable rather than pasted into the config.

A second feature injects CTF context into tool profiles and workspaces to lower the chance of a refusal in the first place. For Claude CLI the profile activates only on an explicit `codex -p ctf` launch and leaves normal sessions alone. OpenCode has no profile mechanism, so you have to start it from the generated workspace. Editing session files rewrites your conversation history, so on a real project preview the diff before applying it.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill codex-session-patcher -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/codex-session-patcher/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/codex-session-patcher/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill codex-session-patcher -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/codex-session-patcher/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill codex-session-patcher -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/codex-session-patcher/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install reason-machines/trending-skills codex-session-patcher
```

2. **Manually: put the files in place**
- File: `.github/skills/codex-session-patcher/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill codex-session-patcher -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/reason-machines/trending-skills --path skills/codex-session-patcher
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/codex-session-patcher/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add reason-machines/trending-skills --skill codex-session-patcher -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/reason-machines/trending-skills/tree/HEAD/skills/codex-session-patcher/SKILL.md

## When to use it
- clear a refusal from a session file and keep working
- preview the diff before touching any file
- rewrite a refusal with an LLM instead of a canned reply
- add your own phrases to refusal detection
- manage sessions from three tools in one dashboard

## Example prompts
- clean the latest Claude session and show me the diff
- find refusals in my Claude session and replace them
- install the CTF profile for Claude

## Similar
- [session-handoff](https://affpapa.org/en/nevibecode/skills/softaworks-session-handoff.md) — skill · 4200 installs
- [session-wrap](https://affpapa.org/en/nevibecode/skills/session-wrap.md) — skill · 1300 installs
- [session-persist](https://affpapa.org/en/nevibecode/skills/session-persist.md) — skill · 774 installs
- [session-logger](https://affpapa.org/en/nevibecode/skills/session-logger.md) — skill · 743 installs
- [session-end](https://affpapa.org/en/nevibecode/agents/session-end.md) — subagent · ★ 41729
- [session-brain](https://affpapa.org/en/nevibecode/skills/session-brain.md) — skill · 316 installs

From the same set: [reason-machines/trending-skills](https://affpapa.org/en/nevibecode/by/reason-machines/trending-skills.md) — 49 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
