self-managed-context skill: let agents edit their own context file, 18k stars on GitHub

RulinShao · x · 2026-10-02

The self-managed-context skill from Agent-Skills-for-Context-Engineering (18.1k stars) lets the model—not the harness—manage its own context window: the live context becomes an editable file the agent rewrites with code tools, deciding what to keep, archive, update, or evict. Key invariants: keep system instructions and the original task outside the editable file, write labeled conversation messages to a file, read it back after each edit, and guard self-editing with pinned prefixes, edit gates, receipts, budget readouts, and rollback on overflow. It also covers prefix-cache costs of mid-context edits. Researchers praised it for making CLM context mechanics tangible.

Original post →

More from coding & agent

coding & agent channel →