Refactor Speed-Bump
First-time setup: project-local skills are loaded at Codex session start. If this skill doesn't fire on rejected-pattern keywords right after pulling this repo, restart Codex to register.
Lightweight pattern check before proposing or implementing a refactor. Encodes the discipline of AGENTS.md's ## Rejected refactors section so it survives across sessions.
What this skill does
- Match the user's refactor request against rejected patterns. The patterns:
- "replace lateBinding" / "event bus" / "pub/sub for system"
- "extract createSystem" / "split createSystem into phases" / "boot phase functions"
- "MCP/REST parity" / "tool surface unification" / "audit MCP vs REST tools"
- "revive artifacts" / "artifact system" / "workspace pane" / "task list pane" / "polls" / "shared documents"
- On match, print a one-line warning with the file/line of the rejection in AGENTS.md.
- Suggest: "If you have new evidence (a real bug, a second consumer, a measurable benefit), invoke
Codex-toolbox:stress-testto evaluate. Otherwise, leave it alone."
What this skill does NOT do
- Does NOT block the refactor. The user can override.
- Does NOT require written justification.
- Does NOT log the override.
- Does NOT critique the refactor on its merits (that's stress-test's job).
- Does NOT cover refactors not on the rejected list (those proceed normally).
Implementation
Read AGENTS.md, locate the ## Rejected refactors section. For each bullet:
- Extract the headline phrase (e.g. "Replacing
lateBindinginmain.tswith an event bus"). - Match the user's request against the headline + body keywords.
Print:
⚠️ This refactor matches a rejected pattern in AGENTS.md:36+
"<headline of the matched bullet>"
Per AGENTS.md: revisit only if you can demonstrate a *significant* new
benefit (a bug traced to the pattern, a second-consumer use case, a
measurable performance/correctness gain).
If you have such evidence: run `Codex-toolbox:stress-test` next.
Otherwise: leave this alone.
Then continue with normal flow. The user decides whether to proceed.
Why a speed-bump and not a gate
The rejected list is human judgment, not algorithmic. A gate that demanded written justification would either:
- get rubber-stamped (everyone clicks "yes I have evidence" without thinking), or
- become bureaucracy that gets bypassed.
A one-line warning with a AGENTS.md pointer forces a 5-second pause and re-read. That's enough for an honest "oh right, that's why" without becoming friction theater.
Source: michaelhil/samsinn — distributed by TomeVault.