cortex-reroute

A command for correcting the most recent Cortex routing decision and recording the route the user actually wanted.

In plain words
What is it for?
It helps mark a routing choice as corrected, save the preferred system or agent, and optionally record a new linked routing decision.
Why use it?
It preserves the correction as feedback so future routing can learn from a mismatch between the chosen and preferred route.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/amitvijapur/cortex/cortex-reroute
Any agent
npx skills add amitvijapur/cortex --skill cortex-reroute
Clone the repo
git clone --depth 1 https://github.com/amitvijapur/cortex

Made for: Claude Code, Codex.

Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 612 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00052 $0.00612
Opus 5 $0.00026 $0.00306
Sonnet 5 $0.00010 $0.00122
Haiku 4.5 $0.00005 $0.00061

Measured 2d ago against content hash e05f7c31a03c, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cortex-reroute scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/cortex-reroute/SKILL.md · 66 lines

How it starts

The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/cortex-reroute

Flag the most recent entry in ~/.claude/cortex-log.jsonl as outcome=corrected and record the route the user wanted instead. This is the highest-quality training signal for Phase 3 (similarity bias) when it activates.

When to invoke

  • User types /cortex-reroute "<corrected route>" explicitly
  • User says "reroute" / "actually use X" / "we should've used Y" right after a routing line
  • User says "the right route was..." / "should've been..." / "redo with..."
  • Any clear post-hoc correction of the last logged route

What to do

Step 1 — Mark the last entry as corrected

python3 ~/.claude/bin/cortex reroute --to "<the route the user wanted>"

The CLI:

  • Sets outcome=corrected on the last log entry
  • Stores the user's preferred route in user_correction
  • Prints the before → after delta

Step 2 — Log the new route

If the user wants the corrected route to actually run now, log it as a fresh entry with --redirect-from so the two are linked:

python3 ~/.claude/bin/cortex log \
  --task "<same task as before>" \
  --class <class> \
  --system <new system> \
  --pattern <new pattern> \
  --agent "<new agent>" \
  --tier <new tier> \
  --tier-reason "<...>" \
  --system-reason "User redirected from <old route>" \
  --redirect-from "<old route>"

The redirect_from field links the corrected entry to the new one — Phase 3 uses this to learn "Cortex picked X, user wanted Y" deltas.

Step 3 — Course-correct the work

Carry out the user's preferred route. Don't argue with the correction unless there's a safety reason — the correction signal is sacred.

Quote format for the --to argument

<System> > <Pattern> [> <Agent>] @ L<n>  [optional bracketed tags]

Do NOT

  • Do not invoke this for routes that ran fine — only for explicit corrections
  • Do not modify older log entries; this only touches the most recent
  • Do not skip step 2 if the user wants the corrected route to run — without --redirect-from, the link between old and new is lost
  • Do not push back on the correction — the user's choice wins

Read the full file on GitHub · 66 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 66 lines · 52 tokens per session scan A e05f7c31a03c

Subscribe to this mod's changes

cortex-reroute is a skill published in the GitHub repository amitvijapur/cortex (5 stars, last pushed 2d ago), licensed MIT. It adds 52 tokens to every session and 612 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

systematic-debugging

Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.

obra/superpowers · 21 tokens

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements and design before implementation.

obra/superpowers · 37 tokens

chat-pet-sprite-creation

Use when creating or changing VS Code chat pet sprite art, sprite sheets, state animations, eye treatments, Stable/Insiders variants, or pet transitions under src/vs/workbench/contrib/chat/browser/widget/media/chatPet.

microsoft/vscode · 53 tokens

cpu-profile-analysis

Analyze V8/Chrome CPU profiles (.cpuprofile) and DevTools trace files (Trace-.json). Use when: profiling performance, investigating slow functions, comparing code paths, finding bottlenecks, analyzing timeToRequest, understanding call trees from sampling profiler data, analyzing layout/paint/rendering, investigating…

microsoft/vscode · 71 tokens

agent-host-chat-contributions

Build and review cross-cutting agent-host chat behavior through lifecycle contributions. Use when adding turn lifecycle side effects, prompt or context injection, restored-history transformation, protocol-action observation, or when reviewing changes that add code to AgentSideEffects or AgentService.

microsoft/vscode · 56 tokens

auto-perf-optimize

Run agent-driven VS Code performance or memory investigations. Use when asked to launch Code OSS, automate a VS Code scenario, run the Chat memory smoke runner, capture renderer heap snapshots, take workflow screenshots, compare run summaries, or drive a repeatable scenario before heap-snapshot analysis.

microsoft/vscode · 62 tokens