cortexloop-reflect

A command for turning completed code fixes into reusable lessons and adding them to a project playbook. A playbook is a collection of practical rules and patterns for future work.

In plain words
What is it for?
Use it after fixes made outside the main review command, after an automatic reflection step was skipped, or when curating patterns from a successful fix session.
Why use it?
It preserves useful methods after a fix session instead of leaving the knowledge only in a code diff or in someone's memory.

Command

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 commands/whitequeen306/code-cortex-loop/cortexloop-reflect
Clone the repo
git clone --depth 1 https://github.com/whitequeen306/code-cortex-loop
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 429 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.00015 $0.00429
Opus 5 $0.00008 $0.00215
Sonnet 5 $0.00003 $0.00086
Haiku 4.5 $0.00002 $0.00043

Measured yesterday against content hash 68e04a2fbe2e, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

cortexloop-reflect 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 yesterday.

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.

commands/cortexloop-reflect.md · 61 lines

What it actually says

/cortexloop-reflect

Manually trigger reflect-and-learn — the automatic step that runs after Direct mode.

When to use

  • You applied fixes outside /cortexloop but want to capture reusable patterns
  • A Direct run completed but reflect was skipped
  • You want to curate playbook entries after reviewing a successful fix session

Prerequisites

  • Recent fixes with passing tests (or you clearly document what was fixed)
  • Ideally docs/cortexloop/report.json exists (before/after scores help)

Flow

1. Load context

Read:

  • skills/reflect/SKILL.md (installed reflect skill)
  • rules/learning-loop.mdc
  • cortexloop.config.jsonlearning block (if present)
  • docs/cortexloop/report.json and relevant git diff

2. Produce outputs

  1. Append section to docs/cortexloop/08-reflection.md (incremental log — use 运行时间 from run-meta, not ISO)
  2. .cortexloop/reflection.json — structured entries (max 3–5 generalizable patterns)

Follow curation rules in the reflect skill: methods not diffs, patterns not one-offs.

3. Record to playbook

From project root:

node scripts/playbook.mjs record .cortexloop/reflection.json

Add --global if learning.global is enabled in config.

4. Confirm

Report:

  • How many entries added vs updated
  • Playbook path(s) written
  • Reminder: playbook hits are suggestions — next run still verifies via refactor-safety + tests

Notes

  • This command does not re-run analysis or apply fixes
  • For a full pipeline with auto-reflect, use /cortexloop in Direct mode instead
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. yesterday First seen · 61 lines · 15 tokens per session scan A 68e04a2fbe2e

Subscribe to this mod's changes

cortexloop-reflect is a command published in the GitHub repository whitequeen306/code-cortex-loop (15 stars, last pushed 1mo ago), licensed MIT. It adds 15 tokens to every session and 429 once invoked, about $0.0001 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-30.