cortex-learn

cortex-learn is a skill for Claude Code, Codex from amitvijapur/cortex. It costs 45 tokens per session (684 once invoked), scanned A, original, MIT.

A tool for finding repeated routing decisions in Cortex's log and proposing reusable shortcuts for its cortex.md configuration. Cortex appears to be a system that routes tasks according to stored rules.

In plain words
What is it for?
Use it to inspect routing patterns, tune Cortex defaults, and create candidate Decision Shortcuts after a pattern appears at least three times.
Why use it?
It helps turn repeated manual choices into documented defaults, while leaving a person to approve, change, or reject each proposal.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to inspect routing patterns, tune Cortex defaults, and create candidate Decision Shortcuts after a pattern appears at least three times.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/amitvijapur/cortex/cortex-learn
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.

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

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cortex-learn

README.md
[![agentmods](https://agentmods.dev/badge/skills/amitvijapur/cortex/cortex-learn/github.svg)](https://agentmods.dev/skills/amitvijapur/cortex/cortex-learn)
Your own site
<a href="https://agentmods.dev/skills/amitvijapur/cortex/cortex-learn"><img src="https://agentmods.dev/badge/skills/amitvijapur/cortex/cortex-learn/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for cortex-learn

Your own site · 80×15
<a href="https://agentmods.dev/skills/amitvijapur/cortex/cortex-learn"><img src="https://agentmods.dev/badge/skills/amitvijapur/cortex/cortex-learn.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 45 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 684 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00045 $0.00684
Opus 5.5 $0.00018 $0.00274
Sonnet 5.5 $0.00009 $0.00137
Haiku 4.5 $0.00005 $0.00068

Measured 6d ago against content hash 47c4338cc1d2, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

cortex-learn 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 6d 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-learn/SKILL.md · 58 lines

How it starts

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

/cortex-learn

Run pattern detection on the active state's cortex-log.jsonl. Surface groups of routing decisions that repeated ≥3 times as candidate Decision Shortcuts for cortex.md.

When to invoke

  • User types /cortex-learn explicitly
  • User asks "what patterns is cortex seeing"
  • User asks "are there routes I should codify"
  • User says "tune cortex based on usage"
  • Session-start check (via cortex learn --check) surfaced a pending pattern

What to do

Step 1 — Run pattern detection

Resolve the state directory from CORTEX_HOME, then CLAUDE_DIR, then $HOME/.claude, matching the CLI and installer. Keep a custom override exported in the agent's environment. Use that directory's cortex.md for registry edits.

cortex_state_dir="${CORTEX_HOME:-${CLAUDE_DIR:-$HOME/.claude}}"
python3 "$cortex_state_dir/bin/cortex" learn

Optional:

  • --threshold N — change minimum count (default 3)
  • --check — terse one-liner for session-start use (no review flow)
  • --no-proposals — skip writing markdown proposal files

Step 2 — Review the proposals

For each detected pattern, the tool writes a markdown proposal file with frontmatter status pending. The user should:

  1. Read each proposal
  2. Decide: approve, modify, or reject
  3. If rejected: persist status: rejected in that exact proposal's YAML frontmatter and write a one-line reason in Notes. A checkbox or a chat acknowledgement alone does not persist the decision.
  4. If approved (including an approved modification): add the agreed shortcut to cortex.md → Decision Shortcuts table, then persist status: approved in the proposal. Keep class, system, and pattern as the original detection identity; put approved changes in the candidate row and Notes.
  5. Read back the edited file before confirming the decision. If the write fails, report that it was not saved. Do not claim suppression based only on the user's reply.

Approved, rejected and superseded tuples are excluded from ordinary future suggestions, even if their counts grow. cortex learn --include-actioned explicitly includes them again. Do not promise automatic reconsideration on growth. With --no-proposals, report only; there is no proposal decision to persist unless the user requests one.

Read the full file on GitHub · 58 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. 6d ago Changed · +7 lines 47c4338cc1d2
  2. 1mo ago First seen · 51 lines · 45 tokens per session scan A 7a20b56cd527

Subscribe to this mod's changes

cortex-learn is a skill published in the GitHub repository amitvijapur/cortex (5 stars, last pushed 3d ago), licensed MIT. It adds 45 tokens to every session and 684 once invoked, about $0.0002 per session on Opus 5.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.