Skip navigation
New skill: self-managed-context
0:00 / 0:31

New skill: self-managed-context

Muratcan Koylan

@muratcan23K followers

Visit on X
116 likesDownloadOriginal post

15,687 views

New skill: self-managed-context (make the agent's context an editable file) It explains how to build agents that decide what to keep, update, or remove from the information they use to do their work. It can archive a long log while keeping the exact error, update its progress notes, or remove outdated information. Those edits then change what the model sees on its next turn. 1- Keep the system instructions and original task protected, outside the editable file. 2- Write the remaining conversation to a file, with labels for each message. 3- Let the agent edit that file using its usual code tools. 4- After each command, read the file back and use the updated messages for the next model call. Loading the skill ( alone into a fixed harness won't create live context editing, but it can help an agent build and then operate a harness that supports it. I gave the skill to a coding agent and had it build the harness itself. The task is a long stream of server logs that doesn't fit in the window. The agent reads it in 18 chunks, about 10k tokens in total, with a 5.5k budget. It has to report one incident ticket exactly and the final value of every config key. Same model & budget, three setups: 1- Model manages its own context 2- Harness forces a summary at 75% full 3- Keeps everything The video shows a real GPT-5.4 run. - Self-managed solved it 3 out of 3. - Keep-everything overflowed 3 out of 3. - Forced summary also solved it 3 out of 3. On GPT-5.4 the self-managed agent re-processed about 24% fewer prompt tokens than the forced summary. When it edited, it cut hard, so little was left after the edit to re-process (one edit took 5,537 tokens down to 771). On GPT-4.1 it saved nothing. It edited near the top of its context but kept most of what was below, and every edit forces everything after it to be re-processed. This is a small test at about 2x context pressure. The paper goes up to 24x, but imho the video below and the skill are a good way to start understanding the technique.

5 Comments

Comments from the original post on X (Twitter)

  • Shahid🇵🇸's profile picture

    @shahidcodes

    forced summary also going 3/3 makes sense at 2x, it only fires a few times. where i'd expect them to split is when summaries stack and a config value has been paraphrased twice over. the same task at 6-8x would say more about the exact-value advantage

    1 like

  • Jatin Garg's profile picture

    @jatingargiitk

    programmatic context management gives you full control and visibility into what gets kept or dropped, which matters when debugging failures. learned policies adapt faster to new patterns but the edit decisions become a black box you can't inspect when something goes wrong.

    1 like

  • Nathan's profile picture

    @donottrack2022

    Can the latest Claude code mods system achieve this effect?

  • AI Quanting's profile picture

    @AIQuanting

    The archiving is the easy half. Knowing which error you'll need in an hour is the part models get wrong.

  • Bessi S's profile picture

    @LLMpsycho

    need self-managed-context before the next 80k dump