# "Self-Compact Pi Agent: ZERO HYPE Agentic Coding Devlog"
<!--
ref: @content/youtube/indy-dev-dan/self-compact-pi-agent-zero-hype-agentic-coding-devlog
tags: [context window management, self-compaction, Pi coding agent, agentic coding, prompt engineering, agent harness, long-running agents]
version: 2
updated_at: 2026-11-22T12:58:20.929Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=3b0U4_02bAE)**

# Self-Compact Pi Agent: ZERO HYPE Agentic Coding Devlog

*Synthesized from IndyDevDan, 2026-09-21.*

IndyDevDan presents a solo coding devlog. The transcript is a rough machine translation, so some terms (the "F3 plan" skill, "self-sealing", model names) may be garbled.

## Core Thesis
IndyDevDan argues that because agents can now see their own context usage, they should decide when to compact rather than rely on a harness default that fires at a fixed level. He builds this into the open-source Pi coding agent, which he prefers because it is customizable and owned by the user, and shows that a three-threshold, agent-callable compaction tool works across several models.

## Key Insights
- **Why it matters.** His swarm system runs 10 to hundreds of agents for hours; long contexts degrade productivity and waste money, so awareness of context is needed for agents to keep working.
- **Design of the self-compaction feature.** A tool the agent can call to compact its own context; three threshold levels (notification, warning, forced compaction); a context panel showing cache tokens, free context and the three markers; custom user prompts for the soft and warning messages; a "note to self" the agent writes that is added to the summary prompt; and human-in-the-loop commands to inspect thresholds and force compaction (self-compact info, self-compact now, alongside the regular compact command).
- **Overriding the default.** The Pi harness lets him replace the default compaction prompt, which he says can also be done in Codex but not in Claude Code.
- **Default thresholds.** Aimed at a GPT-6 Astra swarm: soft warning at 225k tokens, hard warning at 250k, forced compaction at 270k, because he says GPT pricing doubles past the 270k mark. Flags accept thousands, millions or percentages (for example a 90% limit).
- **Plan writing.** He drafts the plan by hand in a markdown file (problem, solution, workflow plan-build-verify, variables, flags) and says the detail in the prompt sets the ceiling on the agent's output.
- **Definition of done and grading.** Each plan includes a definition of done plus a grading rubric, since models are trained against graders. His rubric lists instant failures, such as writing outputs outside the plan directory or reading another agent's spec files, so agents running side by side stay in their own folders.
- **Model comparison.** A justfile launched Claude Code, Codex and Pi in parallel. GLM 5.2 exploded to 98% of its context and failed; Fable 5.1 took about 50 minutes and used roughly 500k tokens of a 1 million window; Codex with GPT-6 Astra took 21 minutes with about 136 thousand tokens. He judged Fable the better author of the compaction hint messages.
- **Live test.** With thresholds at 10%, 20% and 30%, an agent reading a large file in 40 KB chunks received the soft warning, then the warning, wrote a note to itself and compacted, then continued.
- **Large gap before the warning.** He wants a big gap before the warning and a small gap between warning and forced compaction, so the agent chooses its own moment.
- **Tools.** He says he picks several tools ("and" not "or") rather than declaring a winner, and notes Claude Code later copied features like a plugin system from tools such as Pi.

## Actionable Takeaways
1. Give long-running agents a context-aware compaction tool plus soft, warning and forced thresholds instead of a single automatic level.
2. Set thresholds before a pricing cliff (for example 225k, 250k and 270k for a model that doubles at 270k).
3. Let the agent write a note to itself that is carried into the post-compaction summary.
4. Write plans by hand with a problem, solution, workflow, definition of done and a grading rubric with explicit instant-failure rules.
5. Run the same plan across multiple harnesses and models in parallel and compare time, token use and context peak.
6. Use human-in-the-loop commands to inspect and force compaction when testing.

## Notable Quotes
> "We teach them when to squeeze, what to keep, and how to keep going." — IndyDevDan

> "If you master the agent, you master knowledge work, right?" — IndyDevDan

> "Anyone can write code. Anyone can build software" — IndyDevDan

---

*Related: `@content/youtube/yifan-bth/i-reverse-engineered-claude-code-learn-these-agent-tricks` · `@content/youtube/yifan-bth/windsurf-vs-cursor-in-depth-ai-code-editor-comparison` · `@content/youtube/david-ondrej/build-anything-with-tmux-here-s-how` · `@content/youtube/david-ondrej/hermes-agent-is-crazy-180-000-github-stars` · `@content/youtube/sirio-berati/i-built-a-6-node-ai-workflow-here-s-what-s-actually-happening`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*