codex-context-guard

codex-context-guard is a skill for Codex from stark-ai-de/agent-skills. It costs 65 tokens per session (771 once invoked), scanned A, original, Apache-2.0.

A context-management guide for long coding-agent sessions involving many files, logs, or repeated tool results. It helps preserve the important decisions and current state when the conversation becomes large.

In plain words
What is it for?
Use it to inspect work in small pieces, record changed files and validation results, prepare a compact handoff, and choose the next bounded task.
Why use it?
It lowers the risk of losing relevant details or exhausting the conversation's working context during refactors, audits, migrations, and debugging.

Skill for Codex

Written for Codex: agents/openai.yaml present. Also seen: mentions Codex.

Good fit Use it to inspect work in small pieces, record changed files and validation results, prepare a compact handoff, and choose the next bounded task.

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

Made for: 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 codex-context-guard

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

Your own site · 80×15
<a href="https://agentmods.dev/skills/stark-ai-de/agent-skills/codex-context-guard"><img src="https://agentmods.dev/badge/skills/stark-ai-de/agent-skills/codex-context-guard.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 771 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.00065 $0.00771
Opus 5 $0.00032 $0.00385
Sonnet 5 $0.00013 $0.00154
Haiku 4.5 $0.00006 $0.00077

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

Security

Grade A, and why

codex-context-guard 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.

incubator/skills/codex-operations/codex-context-guard/SKILL.md · 107 lines

How it starts

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

Codex Context Guard

Goal

Keep a long Codex session useful by reducing unnecessary context growth, preserving decisions in a compact handoff, and choosing bounded next steps before the thread becomes hard to continue.

Trigger conditions

  • The task has many files, logs, diffs, generated outputs, or repeated tool calls.
  • The user asks whether to compact, summarize, or continue in a new thread.
  • The agent is about to inspect broad files without a specific need.

When to use

  • Use when context budget, log volume, or file-reading scope is becoming a risk.
  • Use before compacting a long session or moving work to another thread.

When not to use

  • Do not use for short, self-contained tasks that have no context pressure.
  • Do not use as a substitute for actually validating completed work.

Inputs to inspect

  • Current objective, recent user instructions, changed files, validation output, and unresolved blockers.
  • Use git status --short and git diff --stat before reading large diffs.

Rules

  • Prefer targeted rg, sed, git diff --stat, and small file ranges over whole-file dumps.
  • Keep one bounded objective active at a time.
  • Store durable state in a handoff artifact when the work will outlive the current context.
  • Summarize large outputs instead of pasting them back to the user.
  • Tell the user when a compaction or handoff would preserve momentum.

Workflow

  1. Identify the current objective, latest decision, and next blocking question.
  2. Replace broad exploration with a targeted search plan.
  3. Track changed files, validation commands, and open risks in a compact note.
  4. Use references only when they solve the immediate context problem.
  5. When context is high, prepare a handoff and recommend /compact or a new thread.

Commands

Useful low-context commands:

git diff --stat
git status --short
rg -n "pattern" path
sed -n '1,120p' path/to/file

Safety rules

  • Do not hide failed validation behind a summary.
  • Do not discard unresolved blockers when compacting.
  • Do not paste secrets or full large logs into handoff text.

Read the full file on GitHub · 107 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 107 lines · 65 tokens per session scan A 0d4444b1494f

Subscribe to this mod's changes

codex-context-guard is a skill published in the GitHub repository stark-ai-de/agent-skills (5 stars, last pushed yesterday), licensed Apache-2.0. It adds 65 tokens to every session and 771 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

levelup-specify

Extract Context Directive Records (CDRs) from the current session after completing work. Identifies reusable patterns (rules, personas, examples, evals) and captures directive compliance cases for team-ai-directives.

tikalk/adlc-team-skills · 46 tokens

change-publish

Promote accepted Change Decision Records (ChDRs) from drafts to project memory at .adlc/memory/chdr/, write OKF-style frontmatter, and regenerate the boot-facing .adlc/memory/chdr.md index that team-boot injects at session start. Use after /change-clarify has accepted ChDRs.

tikalk/adlc-team-skills · 73 tokens

captain-recall

Use when the user asks WHY or WHAT-HAPPENED questions about this system — historical decisions, past incidents, why code/config is shaped a certain way, where something is deployed, who decided what, or the state of work in flight. Queries the tsubasa knowledge graph for cited answers.

ramarahmanda/tsubasa · 65 tokens

captain-inject

Use when the user STATES A FACT about the system or tells the captain to remember/learn something — "update your knowledge", "remember this", "we dropped X for Y", "the outage was caused by Z", environment URLs, team contacts, deployment flows, tribal knowledge, corrections to what the Captain believes. Validates…

ramarahmanda/tsubasa · 85 tokens

decision

Single entry point for all decision operations: capture, search, manage. Routes based on natural language intent.

zimalabs/code-decisions · 23 tokens

capture-mcp-context

Record durable context from MCP servers and design or project tools into repository memory as proposed. Use when working with an MCP server like Figma, Linear, Jira, or Sentry, or after pulling design, ticket, or error context, to persist it for future sessions.

Karthick-Ramachandran/persist-os · 59 tokens