context-compaction

context-compaction is a skill for Claude Code, Codex from igovet/codex-cortex-orchestrator. It costs 32 tokens per session (1,044 once invoked), scanned A, original, MIT.

A recovery guide for continuing an internal task after context has been compressed or reset.

In plain words
What is it for?
Use it to restore project facts, task state, governance details, publication progress, and verification references during an ongoing Cortex task.
Why use it?
It preserves the important decisions, evidence, files, and next actions without keeping the entire conversation history.

Skill for Claude CodeCodex

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 skills/igovet/codex-cortex-orchestrator/context-compaction
Any agent
npx skills add igovet/codex-cortex-orchestrator --skill context-compaction
Clone the repo
git clone --depth 1 https://github.com/igovet/codex-cortex-orchestrator

Made for: Claude Code, 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 context-compaction

README.md
[![agentmods](https://agentmods.dev/badge/skills/igovet/codex-cortex-orchestrator/context-compaction.svg)](https://agentmods.dev/skills/igovet/codex-cortex-orchestrator/context-compaction)
Your own site
<a href="https://agentmods.dev/skills/igovet/codex-cortex-orchestrator/context-compaction"><img src="https://agentmods.dev/badge/skills/igovet/codex-cortex-orchestrator/context-compaction.svg" alt="Measured on agentmods" height="20"></a>
Per session 32 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,044 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.00032 $0.01044
Opus 5 $0.00016 $0.00522
Sonnet 5 $0.00006 $0.00209
Haiku 4.5 $0.00003 $0.00104

Measured 3d ago against content hash c6f4ae389243, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

context-compaction 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 3d 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.

plugins/cortex/skills/context-compaction/SKILL.md · 95 lines

How it starts

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

Durable Context Recovery

Do not preserve raw transcripts by default. A bounded handoff should retain the current outcome and acceptance criteria, verified project facts and source references, material decisions, changed files, decisive checks, open user questions, and the next evidence-backed action. Never include secrets, credentials, personal data, private logs, or raw tool streams.

For an active Cortex task, preserve the mandatory server-issued task anchor for ledger recovery, plus the absolute project root, governance mode, applicable knowledge paths and constraints, exact task/result contract, current plan/publication digest, and known initiative, assignment, evidence, and decision relations. Preserve each decision's subject, digest, supersession, and effect on the orchestration DAG revision. Preserve incomplete publication assembly state, continuation state, expected digest when known, and completed section manifest. Preserve verified plan/publication projection paths with their source revision and digest, but treat them as publishable only after fresh reverification. Task, decision, assignment, initiative, closure, governance, handoff, index, and timeline records have no Markdown paths. These references are not bearer capabilities.

Preserve every server-returned identifier, digest, and continuation token byte-for-byte as opaque immutable return data. Never recover one by parsing, concatenating, normalizing, reconstructing, or appending a remembered suffix; copy it from a successful retained response or fresh inspection.

Also retain known live native child handles, task names, mutation scopes, and last observed host status as bounded private host context. They are not ledger rows, must not enter durable reports or user-facing links, and do not prove that a worker is still running. Preserve an unconsumed returned native-dispatch payload byte-for-byte with its exact delegation association and whether its one allowed host spawn was attempted; never reconstruct or redispatch it from memory. After compaction:

  1. Use read_task with the known preserved task anchor to recover the task header and chronological frontier.
  2. Use assess_governance when mode history, initiative links, dependencies, or closure history affects the next decision.
  3. Use read_task and consume_assignment_evidence only for the specific details and evidence needed next. Resume bounded reads with the returned continuation state. Resume an assembling publication from its recorded continuation state; never restart or finalize from a guessed digest.
  4. Reverify any projection's containment, freshness, and digest before publishing it. A stored path alone is never sufficient.
  5. Recover the current orchestration DAG from the exact task contract, persisted initiative revision, immutable planner plan revision/digest, decisions, and report evidence; then continue safe work. Never reconstruct or author the project solution plan—the planner report remains its sole authority.

Only the initial task-opening operation receives the project root. Recovery calls use the preserved task anchor; do not resend the root as a tool argument. Keep the root only for native worker working-directory context and a self-contained fallback brief.

For the coordinator, recovery remains coordination-only: do not reopen target project files, search the repository, rerun commands, or reconstruct technical facts through direct analysis. Delegate any missing project discovery, implementation, or project verification and recover its evidence through a report ID.

Recovery never permits root discovery or project-local artifact/state probes. Git, manifests, caches, worktrees, existence/absence or unchanged-state, and project-local .codex must be checked by a worker and returned as evidence.

Do not promise identifier-less enumeration. If the task anchor was not preserved, do not claim that the ledger can rediscover the task from project root, filesystem, session, or other task content. Continue from safely preserved native evidence and self-contained worker briefs when possible, or disclose the ledger context loss. Never invent an ID or create a duplicate task merely to simulate recovery.

Read the full file on GitHub · 95 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. 3d ago First seen · 95 lines · 32 tokens per session scan A c6f4ae389243

Subscribe to this mod's changes

context-compaction is a skill published in the GitHub repository igovet/codex-cortex-orchestrator (1 stars, last pushed 3d ago), licensed MIT. It adds 32 tokens to every session and 1,044 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

bug-triage

Triage bugs reported in chat/issues, search for duplicates, file or update GitHub issues with full context, and push fix PRs.

Untrivial-ai/agent-orchestrator · 33 tokens

ao-desktop-dev

Launch, restart, or troubleshoot the real AO Electron desktop app from this repository; run a checkout against isolated or real local AO data; combine PR branches for local UI review; and diagnose stale Electron processes, port conflicts, or preload bridge mismatches. Use whenever asked to run, open, show, or visually…

Untrivial-ai/agent-orchestrator · 88 tokens

using-ao

Catalog of the AO (Agent Orchestrator) ao CLI: spawning workers, managing sessions and projects, sending messages, controlling the shared browser, previewing pages, and daemon control. Use when using the ao CLI, spawning workers, or managing AO sessions in an AO workspace.

Untrivial-ai/agent-orchestrator · 62 tokens

model-router

当需要调度不同模型执行子任务时使用。根据任务类型匹配模型能力,自动选择最优模型并生成调用指令。TRIGGER: 模型调度、model dispatch、选模型、分派任务、多模型协作、路由到模型.

rexleimo/aios · 60 tokens

goal-flight

Portable Goal Flight workflow for long-running repo work: planning, dispatch, review, recovery, file-backed resume.

simonrowland/goal-flight · 25 tokens

dev-flow

Use Dev Flow for bounded Codex software development tasks: implementation, bug fixes, refactoring, targeted testing, development delivery, and explicit parallel batches isolated in separate Git worktrees. It may be selected implicitly for those tasks or explicitly with $dev-flow-codex:dev-flow. Do not create a Dev…

Innocent-children/dev-flow · 84 tokens