Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/whitequeen306/code-cortex-loopnpx agentmods add rules/whitequeen306/code-cortex-loop/learning-loopWrote 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.
[](https://agentmods.dev/rules/whitequeen306/code-cortex-loop/learning-loop)<a href="https://agentmods.dev/rules/whitequeen306/code-cortex-loop/learning-loop"><img src="https://agentmods.dev/badge/rules/whitequeen306/code-cortex-loop/learning-loop/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.
<a href="https://agentmods.dev/rules/whitequeen306/code-cortex-loop/learning-loop"><img src="https://agentmods.dev/badge/rules/whitequeen306/code-cortex-loop/learning-loop.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00018 | $0.02443 |
| Opus 5.5 | $0.00007 | $0.00977 |
| Sonnet 5.5 | $0.00004 | $0.00489 |
| Haiku 4.5 | $0.00002 | $0.00244 |
Grade A, and why
learning-loop 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 221 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Learning Loop (CodeCortexLoop v2.2)
Purpose
CodeCortexLoop learns from Direct fixes via a playbook (.cortexloop/playbook.json). Before analysis, query relevant entries; after Direct fixes, reflect and record new patterns.
Anti-hallucination goal: memory is recall (where to look), not authority (what to conclude). Self-reinforcing echo chambers are blocked by verified-outcome confidence, two tiers, external oracles, diversity requirements, and time decay.
Core principles
Recall, not authority
Playbook hits tell the agent where to investigate first, not what the answer is:
- Re-derive every fix from current code context
- Re-verify with tests and refactor-safety rules
- Never paste a stored fix method as a diff or blind patch
Suggestions, not mandatory
Playbook hits do not:
- Skip any analysis pass
- Override suppressions or scope rules
- Force a fix without understanding context
Hits must be verified
When applying a playbook-suggested fix:
- Follow
rules/refactor-safety.mdc - Run tests after the change group
- Re-verify with analysis if in Direct mode
Bad or stale memory must never cause silent breakage. If a pattern does not fit, ignore it and record --outcome=rejected.
Negative signals must be recorded
If a suggested fix fails tests, is reverted, or is judged inapplicable, run playbook.mjs feedback with --outcome=failed or --outcome=rejected. Do not leave failed memories at high confidence.
Two tiers
| Tier | Meaning | Query behavior |
|---|---|---|
| candidate | Unconfirmed hypothesis | Hidden by default; shown only with --include-candidates, labeled as guesses — do NOT apply |
| verified | Trusted recall | Shown by default in Step 0.5 |
| quarantined | Failed / too low confidence | Never shown in query; pruned with --drop-quarantined |
Promotion to verified requires ALL of:
confidence >= 0.7verifiedCount >= 2distinctContexts >= 2(diverse evidence, not one file repeated)
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.
- 1mo ago First seen · 221 lines · 18 tokens per session scan A c03d5d43c3f4
learning-loop is a cursor rule published in the GitHub repository whitequeen306/code-cortex-loop (15 stars, last pushed 2mo ago), licensed MIT. It adds 18 tokens to every session and 2,443 once invoked, about $0.0001 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-30.
Other cursor rules, from other repositories
mempalace-recall-always
Always-on MemPalace recall — search the palace before answering about past work, people, projects, or prior decisions.
dreamd-recall
Recall lessons, decisions, and prior context from the .agent/ memory daemon. Use when starting work in a project that has a .agent/ folder, when the user references a past decision, or when you are about to make a choice that has a documented prior.
session-memory
Use at conversation wrap-up or when the user explicitly indicates end-of-session — capture residual lessons not captured in-flight.
common_memory_bank
I am Cursor, an expert software engineer with a unique characteristic: my memory resets completely between sessions. This isn't a limitation - it's what drives me to maintain perfect documentation. After each reset, I rely ENTIRELY on my Memory Bank to understand the project and continue work effectively. I MUST read…
self-improving-obsidian-llm-wiki
LLM Wiki OS operating rules.
memsprout
Cursor rule "memsprout" from memsprout/agents, covering using memsprout, search first, capturing, spaces and topics and files.