context-discipline

context-discipline is a skill for Claude Code from anhnguyen0905/codex-mcp. It costs 31 tokens per session (1,023 once invoked), scanned A, original, MIT.

A set of rules for managing an agent's context on large software projects. Context is the information the agent can keep available while working.

In plain words
What is it for?
It is for setting read limits, summarizing large diffs and logs, compacting context at phase boundaries, and preserving useful project guidance in AGENTS.md files.
Why use it?
It reduces repeated file reading and oversized logs that can crowd out the evidence needed for the current task.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin. Also seen: mentions subagents; mentions AGENTS.md; mentions Codex.

Part of the codex-flow plugin — 61 skills, 1 command, 1 MCP server shipped together

Good fit It is for setting read limits, summarizing large diffs and logs, compacting context at phase boundaries, and preserving useful project guidance in AGENTS.md files.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/anhnguyen0905/codex-mcp/context-discipline
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 anhnguyen0905/codex-mcp --skill context-discipline
Clone the repo
git clone --depth 1 https://github.com/anhnguyen0905/codex-mcp

Made for: Claude Code.

Or install codex-flow, the plugin that ships this one along with the rest of its 61 skills, 1 command, 1 MCP server.

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 context-discipline

README.md
[![agentmods](https://agentmods.dev/badge/skills/anhnguyen0905/codex-mcp/context-discipline/github.svg)](https://agentmods.dev/skills/anhnguyen0905/codex-mcp/context-discipline)
Your own site
<a href="https://agentmods.dev/skills/anhnguyen0905/codex-mcp/context-discipline"><img src="https://agentmods.dev/badge/skills/anhnguyen0905/codex-mcp/context-discipline/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 context-discipline

Your own site · 80×15
<a href="https://agentmods.dev/skills/anhnguyen0905/codex-mcp/context-discipline"><img src="https://agentmods.dev/badge/skills/anhnguyen0905/codex-mcp/context-discipline.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 31 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,023 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.00031 $0.01023
Opus 5 $0.00015 $0.00511
Sonnet 5 $0.00006 $0.00205
Haiku 4.5 $0.00003 $0.00102

Measured 9d ago against content hash 6ab256df778e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

context-discipline 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 9d 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/context-discipline/SKILL.md · 89 lines

How it starts

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

Context Discipline

Why

Protect the orchestrator's working context across long backlogs. Repeated exploration, large diffs, and verbose logs crowd out current-task evidence. Keep bulk evidence outside the orchestrator and bring back only anchored conclusions. Write durable state to disk so a fresh session can resume without hidden context.

Recitation

At every phase boundary and immediately before each codex_execute, re-state all three in one concise line: the current phase, the current task ID + title, and the next pending gate. Recite the run position from current durable state; do not re-read control files solely for this recitation.

No-raw-read rules (orchestrator)

  • For a diff over 400 lines, delegate a conformance summary to a subagent, then directly read only targeted critical hunks.
  • For test or build logs, run them via a script and inspect only tail output or grep matches. Delegate full-log analysis to a subagent.
  • During Phase 2 exploration, use Explore subagents. Require conclusions with paths and line anchors; never bulk-dump files into the orchestrator.

Tiered read-back

  • Have the orchestrator and Codex read budgeted derived slices instead of whole control files: .codex-flow/CONTEXT-T<n>.md (≤ 4000 estimated tokens using the chars/4 heuristic) for each task and .codex-flow/RESUME.md (≤ 8000 estimated tokens using the chars/4 heuristic) on resume.
  • Keep full .codex-flow/PLAN.md as the durable source of truth on disk. Read it in full only to resolve a disputed finding, follow a slice's omitted-pointer line to a needed section, or as the standalone fallback when the slice helper is unavailable.
  • Treat derived slice files as generated views. Regenerate them; never hand-edit them.
  • Check the generation anchor recorded in each slice header. Re-check every [verify]-stamped block against the current code before relying on it.

Safe compaction points

  • Phase 2 boundary: wait until the plan is approved, PLAN.md and planning.md are written, and the AGENTS.md guidance commit is complete. TASKS.md does not exist yet and is not required.
  • Sequential task boundary: wait until the task passes review and its Decision log schema block is on disk. If checkpoint commits are enabled, wait for that commit too.
  • Parallel wave boundary: wait until every task commit is merged, the integration review passes, and the coordinator appends the per-task Decision log schema blocks.
  • At an allowed boundary, verify the required durable state is on disk. Tell the user this is a safe compaction point and suggest running /compact; the orchestrator cannot run that client command. With state on disk, an auto-compaction landing at or after the boundary is lossless.
  • NEVER compact mid-task.
  • Phase 5 step 0 re-reads the task's generated context slice and TASKS.md entry from disk after compaction; read full PLAN.md only under the Tiered read-back rules.

Read the full file on GitHub · 89 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. 9d ago First seen · 89 lines · 31 tokens per session scan A 6ab256df778e

Subscribe to this mod's changes

context-discipline is a skill published in the GitHub repository anhnguyen0905/codex-mcp (3 stars, last pushed yesterday), licensed MIT. It adds 31 tokens to every session and 1,023 once invoked, about $0.0002 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

media-ingest

Ingest video, audio, PDF, book, screenshot, and GitHub repo content into the brain. Multi-format handling with entity extraction and backlink propagation. Covers video-ingest, youtube-ingest, and book-ingest subtypes.

garrytan/gbrain · 52 tokens

mem0-oss-to-platform

Plan and then execute a migration of a project from the mem0 open-source / self-hosted SDK (the local Memory class) to the mem0 Platform / hosted / managed SDK (the MemoryClient class). Use this whenever a developer wants to move, switch, or migrate their mem0 usage off OSS/self-hosted to the hosted API — e.g.…

mem0ai/mem0 · 273 tokens

Cortex

Operate Cortex, the LifeOS memory system — the typed Knowledge Archive (People, Companies, Ideas, Research with typed related: links) plus recall of prior work sessions, ISAs, and conversations. Search, add, harvest, develop, ingest, distill, graph-navigate, recall. USE WHEN cortex, knowledge, knowledge base, search…

danielmiessler/LifeOS · 196 tokens

memory

Use when the user asks to remember, recall, forget, update, search, or inspect durable OpenSquilla memory, including profile facts in USER.md and long-term notes in MEMORY.md or memory//.md.

opensquilla/opensquilla · 44 tokens

ha-data-stores

Map of Hope Agent's local data stores and safe read-only query workflow. Use when the user asks where Hope Agent stores data, wants to inspect sessions/messages/memory/logs/background jobs/knowledge indexes/settings, asks the model to query local app data, or debugging requires checking persisted state. Trigger…

shiwenwen/hope-agent · 115 tokens

establishing-project-context

Use when the user asks to establish shared project language, or project work exposes a conflicting, renamed, or deprecated domain term that needs active semantic modeling. Routine small tasks stay on the fast path.

GanyuanRan/Aegis · 45 tokens