Skip to content
Skills Library
AI & agents · Automation

codex-context-guard

/codex-context-guard

Prevent Codex context-window exhaustion during long-running refactors, repo audits, migrations, debugging sessions, or tasks with large logs, many file reads, or repeated tool output. Use when Codex context is getting high, /compact may be needed, or the user asks for context-efficient workflows.

Licence
Apache-2.0
Last repository change
21.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
4
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.

What it does and when to use it

Prevent Codex context-window exhaustion during long-running refactors, repo audits, migrations, debugging sessions, or tasks with large logs, many file reads, or repeated tool output. Use when Codex context is getting high, /compact may be needed, or the user asks for context-efficient workflows.

Original author description

Prevent Codex context-window exhaustion during long-running refactors, repo audits, migrations, debugging sessions, or tasks with large logs, many file reads, or repeated tool output. Use when Codex context is getting high, /compact may be needed, or the user asks for context-efficient workflows.

How it works

  1. Goal
  2. Trigger conditions
  3. When to use
  4. When not to use
  5. Inputs to inspect
  6. Rules
  7. Workflow
  8. Commands
  9. Safety rules
  10. References
Original SKILL.md headings · 97 lines, 497 words
SKILL.md preview
---
name: codex-context-guard
description: Prevent Codex context-window exhaustion during long-running refactors, repo audits, migrations, debugging sessions, or tasks with large logs, many file reads, or repeated tool output. Use when Codex context is getting high, /compact may be needed, or the user asks for context-efficient workflows.
license: Apache-2.0
metadata:
  internal: true
  author: stark-ai-de
  category: codex-operations
  version: "0.1.0"
---

# 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:

```bash
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.

## References

Read only when needed:

- `references/context-budgeting.md` for large task tactics.
- `references/handoff-template.md` when writing a handoff file.

## Scripts

No bundled scripts.

## Output format

Return:

1. Current objective
2. Context risks
3. What to keep in active context
4. What to move to a handoff
5. Recommended next bounded action

## Completion criteria

- The active objective and next action are clear.
- Large context sources have been summarized or moved to a handoff.
- Validation failures and blockers remain visible.

## Failure modes

- If context is already overloaded, stop broad reads and produce a compact state summary.
- If important evidence is missing, name the missing command or file instead of guessing.

## Recovery behavior

If the thread is already overloaded, stop broad exploration, write a compact state summary, name the most recent verified command result, and recommend continuing from the handoff.
Files in this package (4)
  • SKILL.md 3 KB
  • agents/openai.yaml 1 KB
  • references/context-budgeting.md 1 KB
  • references/handoff-template.md 1 KB

Versions

The database has no other skills named codex-context-guard.

Database snapshot: 13.11.2026 · package version 8b2c17455479 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100context-budget
    Context window management for AI agents. Optimize context usage, prevent overflow, and ensure critical information is always available. Use when working with large codebases or long sessions.
  • 86principle-guard-the-context-window
    Apply when context is filling up: large outputs, long files, repeated reads, fan-out planning. Route bulk to subagents; keep summaries in the main thread, not raw payloads.
  • 100context-window-management
    Manage LLM context budgets—prioritization, summarization, compaction, and what to load vs reference. Use for long sessions, large repos, or multi-doc tasks. Triggers: "context window", "too long", "summarize context", "token budget".
  • 90principle-guard-the-context-window
    Apply when context is filling up: large outputs, long files, repeated reads, fan-out planning. Route bulk to subagents; keep summaries in the main thread, not raw payloads.
  • 100guard
    Protect Claude Code sessions from context overflow by running a background daemon that monitors session size and auto-prunes before compaction hits. Use when the user says "guard", "protect session", "context getting long", "prevent compaction", "session management", or is…
  • 90z-token
    Slash command and mode controller for Z-Token (compact context, oversized-read guard, capped search, lean builds, and visual telemetry dashboard). Triggered by /z-token [on|lite|ultra|off|status|dashboard].

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.