Codex Task Pointer
Pre-compaction hooks + a CAS-guarded task pointer that keep Codex agents on-goal across context auto-compaction, no mainline drift, no duplicate work, no conflicting progress…
Install: git clone https://github.com/big0lives/codex-task-pointer
Works with Codex · 245 GitHub stars
Install
git clone https://github.com/big0lives/codex-task-pointerInstall command taken from the project's README or registry entry. Always review code before running it.
README excerpt
Read full README on GitHub →codex-task-pointer
Keep your Codex agent on-goal across context auto-compaction
Pre-compaction hooks · CAS task pointer · Windows installer · agent-deployable
English · 中文
Features
On mid-length tasks and long goal runs, Codex auto-compaction can wipe key milestones, drift the objective, redo finished work, or collide with it. This repo maintains a small, schema-checked task pointer through hooks: the pointer is persisted to disk when the agent publishes it and when you submit a prompt; when compaction fires, a hook confirms it is intact, and after compaction SessionStart re-injects it as the post-compaction reference background — so information loss stops turning into drift and rework.
- 🧭 Mainline survives compaction — when Codex compacts (auto or manual), the
SessionStart(compact)hook re-injects your "goal + next step" into the fresh context, so the model re-anchors instead of drifting. - ♻️ No redoing finished work — the pointer is an explicit "goal + next step" your agent publishes itself, so the post-compaction turn follows the real plan instead of continuing from a distorted node.
- ⚛️ CAS-guarded writes — every publish carries
generation+revision. Stale writes fail loudly (STALE_GENERATION/STALE_REVISION), and clearing rotates the generation so an old request can't resurrect state. - 🔒 Strict IO, fail closed — UTF-8-only stdin JSON, fixed field sets, duplicate-key rejection, per-session mutex, atomic write with read-back verification.
- 🪟 Windows installer with a rollback path —
-WhatIfpreview, owned-file backup, atomichooks.jsonmerge that preserves your other hooks, explicit-Rollback. - 🤖 Delegate deployment to your agent — AGENTS.md is a complete deployment playbook: send your agent the repo link and it installs, verifies and debugs on its own, asking you only where a human is actually required.
Why I Built This
Long Codex goal runs kept dying quietly: auto-compaction swallowed the plan, the next turn either drifted sideways or redid work that was already done — and I burned another prompt re-explaining where we were, losing tokens and time. So I built the smallest thing that survives "auto-compaction information loss": a schema-checked pointer file plus three root hooks that re-inject it at the right events. It has been running in my own Codex sessions ever since, and has saved me a lot of trouble.
It took me about a month and roughly 3 billion tokens on gpt-5.6-sol, iterating with Codex the whole way, to distill this little thing. I use it in every Codex session I run.
Impact
| Before | With codex-task-pointer |
|---|---|
| After every auto-compact: re-paste the plan, re-explain the current step, correct the execution node | The pointer (goal + next step) is re-injected into the fresh context automatically |
| The run drifts onto an unknown goal halfway through | SessionStart restores the mainline anchor before the next turn starts |
Hand-editing hooks.json, one syntax slip kills every hook |
The installer merges atomically, backs up first, and rolls back cleanly |
Quick Start
Prerequisites
Similar plugs
CLI proxy that reduces LLM token consumption by 60-90% on common dev commands. Single Rust binary, zero dependencies
Bash is all you need - A nano claude code, like 「agent harness」, built from 0 to 1
Documented system prompts from Anthropic - Claude Fable 5.1, Opus 5.5, Claude Design, Claude Code. OpenAI - ChatGPT GPT-6-Astra, Codex. Google - Gemini 3.8 Flash, 3.1 Pro…
A light-weight and powerful meta-prompting, context engineering and spec-driven development system for Claude Code by TÂCHES.