retex — Claude Code command: what it does, how to install
retex logs technical incidents, rollbacks, and mistakes into project memory so Claude Code retains prevention rules across sessions.
CC-BY-SA-4.0 ★ 6,529 updated 2026-10-22
.claude/commands/retex.mdWhat retex does
The command inspects the Git environment by checking the active branch and five recent commits, then collects incident details. You can pass the summary directly via command arguments or answer two guided questions when running without parameters.
The resulting record is written as a Markdown file in .claude/memories/. Each entry includes the root technical cause, recommended solutions, tags, and an imperative prevention rule starting with an action verb.
The central index file retex-index.md caps history at 50 records, dropping older logs as newer post-mortems arrive.
What it helps with
- record lessons learned right after a rollback or failed script
- enforce concise prevention rules for subsequent coding sessions
- maintain a structured log of development errors in repository memory
- associate post-mortem summaries with recent Git commits
Example prompts for the agent
- /retex
- /retex Typst build failed due to incorrect template arguments
- /retex Release hook stopped working after configuration update
How to install retex
Manually: put the files in place
.claude/commands/retex.mdCall it with /retex. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/retex.mdCall it with /prompts:retex. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/retex.prompt.mdManually: put the files in place
.gemini/commands/retex.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about retex
How to install retex in Claude Code?
Save the command file into .claude/commands/retex.md inside your repository root.
What does the retex command do?
It examines Git context, categorizes the underlying root cause of a failure, and writes prevention guidelines to the agent memory directory.
How does retex handle brief input arguments?
Supplying no arguments or fewer than 10 characters prompts the tool to start an interactive questionnaire to clarify the incident.