Rulewright
Rulewright turns a failed or corrected agent session into a small, durable rule.
Prefer Codex thread/session sources over transcript files.
Workflow
Lock the requested session scope.
- If the user provided a Codex thread ID, use that exact thread.
- If they said "current", "last", or did not provide an ID, call
list_threads and choose the most relevant recent thread. Ask only if multiple plausible threads match.
- Do not analyze unrelated threads.
Read the Codex thread.
- Call
read_thread with includeOutputs: true, turnLimit between 20 and 40, and concise output limits.
- Use older cursors only when the correction or failure appears to be earlier than the returned turns.
- Keep private or unrelated content out of the final report.
Find agent-behavior correction events.
- Look for user rejection, frustration, rollback requests, "don't do that", "too broad", "wrong", "not what I meant", or equivalent non-English correction language.
- Separate user preference from objective bug. Mark one-off taste as low confidence.
- Prefer evidence from repeated corrections, explicit user instructions, or visible failures.
Choose the smallest rule destination.
- Read existing rule files before proposing anything:
AGENTS.md, CLAUDE.md, .cursorrules, .cursor/rules/**, .github/copilot-instructions.md, and relevant user/global instruction files when the lesson is cross-project.
- Prefer tightening or replacing an existing section over appending a new section.
- Do not create a new
.md file for one rule unless no suitable rule file exists and the user approves.
- If existing instructions are already long or repetitive, propose a compact replacement that removes duplication instead of adding more text.
Propose a compact patch, not silent edits.
- State the detected failure.
- Quote or paraphrase only the minimum evidence.
- Name the target rule file.
- Provide the exact Markdown block to add, replace, or delete.
- Explain why the rule is narrow enough and what adjacent behavior it must not affect.
- Keep the proposed rule under 120 words unless the user asks for detail.
Apply only after approval.
- If the user approves, edit the target rule file with the smallest patch.
- Preserve existing stronger instructions.
- Do not rewrite the whole rule file unless the user explicitly asks.
Rule Quality Bar
Good Rulewright rules are:
- behavioral, not emotional
- specific enough to prevent the observed failure
- narrow enough to avoid blocking valid future work
- tied to session evidence
- compatible with existing project instructions
- short enough that future agents will actually read them
Avoid rules that say only "be careful", "do better", "don't make mistakes", or "always ask first" unless the session evidence justifies that strength.
Suggested Output Shape
Detected failure:
The agent claimed an integration was available after checking files, but before runtime verification.
Evidence:
User objected that no real test had been run; the first smoke test then failed.
Target:
~/.codex/AGENTS.md, existing verification section
Proposed patch:
Add one bullet: "For runtime-loaded integrations, do not claim visible/available until a fresh runtime path confirms it."
Confidence:
High
Source: jdeploys/rulewright — distributed by TomeVault.
1---2name: rulewright3description: Turn Codex sessions or thread IDs into durable project instruction patches. Use when the user asks to analyze a Codex session, learn from a failed agent run, improve AGENTS.md/CLAUDE.md/Cursor/Copilot rules from chat history, or run Rulewright. Use when this capability is needed.4---56# Rulewright78Rulewright turns a failed or corrected agent session into a small, durable rule.9Prefer Codex thread/session sources over transcript files.1011## Workflow12131. Lock the requested session scope.14 - If the user provided a Codex thread ID, use that exact thread.15 - If they said "current", "last", or did not provide an ID, call `list_threads` and choose the most relevant recent thread. Ask only if multiple plausible threads match.16 - Do not analyze unrelated threads.17182. Read the Codex thread.19 - Call `read_thread` with `includeOutputs: true`, `turnLimit` between 20 and 40, and concise output limits.20 - Use older cursors only when the correction or failure appears to be earlier than the returned turns.21 - Keep private or unrelated content out of the final report.22233. Find agent-behavior correction events.24 - Look for user rejection, frustration, rollback requests, "don't do that", "too broad", "wrong", "not what I meant", or equivalent non-English correction language.25 - Separate user preference from objective bug. Mark one-off taste as low confidence.26 - Prefer evidence from repeated corrections, explicit user instructions, or visible failures.27284. Choose the smallest rule destination.29 - Read existing rule files before proposing anything: `AGENTS.md`, `CLAUDE.md`, `.cursorrules`, `.cursor/rules/**`, `.github/copilot-instructions.md`, and relevant user/global instruction files when the lesson is cross-project.30 - Prefer tightening or replacing an existing section over appending a new section.31 - Do not create a new `.md` file for one rule unless no suitable rule file exists and the user approves.32 - If existing instructions are already long or repetitive, propose a compact replacement that removes duplication instead of adding more text.33345. Propose a compact patch, not silent edits.35 - State the detected failure.36 - Quote or paraphrase only the minimum evidence.37 - Name the target rule file.38 - Provide the exact Markdown block to add, replace, or delete.39 - Explain why the rule is narrow enough and what adjacent behavior it must not affect.40 - Keep the proposed rule under 120 words unless the user asks for detail.41426. Apply only after approval.43 - If the user approves, edit the target rule file with the smallest patch.44 - Preserve existing stronger instructions.45 - Do not rewrite the whole rule file unless the user explicitly asks.4647## Rule Quality Bar4849Good Rulewright rules are:50- behavioral, not emotional51- specific enough to prevent the observed failure52- narrow enough to avoid blocking valid future work53- tied to session evidence54- compatible with existing project instructions55- short enough that future agents will actually read them5657Avoid rules that say only "be careful", "do better", "don't make mistakes", or "always ask first" unless the session evidence justifies that strength.5859## Suggested Output Shape6061```markdown62Detected failure:63The agent claimed an integration was available after checking files, but before runtime verification.6465Evidence:66User objected that no real test had been run; the first smoke test then failed.6768Target:69~/.codex/AGENTS.md, existing verification section7071Proposed patch:72Add one bullet: "For runtime-loaded integrations, do not claim visible/available until a fresh runtime path confirms it."7374Confidence:75High76```7778---79> Source: [jdeploys/rulewright](https://github.com/jdeploys/rulewright) — distributed by [TomeVault](https://tomevault.io).80<!-- tomevault:4.0:skill_md:2026-06-16 -->