engineering / skill

Self Compact

A Pi coding-agent extension for context monitoring, agent-triggered compaction and handoff notes.

At a glance

Purpose
A Pi coding-agent extension for context monitoring, agent-triggered compaction and handoff notes.
Runs in
Local agent with shell
Operating systems
Not stated
Needs
Runtime: Node.js 24+ and just; Needs internet: Not stated; Needs accounts or API keys beyond your agent: Not stated
Files and data
Reads files: Yes; Writes files: Yes; Sends data to other services: Not stated
Tool type
Skill
Delivery
From GitHub
Version
Latest on the main branch
Access
Code on GitHub
Compatibility
According to the README, this is an extension for the Pi coding agent. It lists Pi v0.85.1, Node 24 or later and just as prerequisites, and it shows opening the repository in Claude Code (or Pi) to run /prime.
External costs
The repository is MIT-licensed and states no pricing. Live runs use the model provider whose key you put in .env, which may charge for usage. The README says the demo needs no API key and the unit and end-to-end suites have no API cost.
Permissions
The extension acts through Pi with the access you give it. The README's manual route globally installs the Pi npm package and asks you to create a project .env file containing your model-provider key. According to the README, the extension adds self_compact and view_context, supplies context guidance to model calls, saves a handoff note and requests session compaction. The README says the hard cutoff blocks tools other than self_compact.
Usage terms
MIT License, as stated in the repository. See its LICENSE file for the exact terms.

Code on GitHub

disler/self-compact-pi-agent

MIT

HTML71 stars19 forksLast pushed 20 Sept 2026 UTC

A Pi coding-agent extension that lets a long-running agent watch its own context and compact itself

Public GitHub data fetched · 0 days old

Skill folders in this repository (1)

Folders that contain a SKILL.md file, from GitHub's file list on .

View on GitHub ↗

What it does

Self Compact is an extension for the Pi coding agent. According to the README, it lets an agent monitor context usage and request compaction.

The README describes default thresholds of 10% for a notice, 20% for a warning and 30% for a hard cutoff. The README says the notice provides guidance, the warning asks for a handoff note, and the hard cutoff blocks tools other than self_compact. The README says compaction uses an editable prompt and returns the agent's note_to_self as the next message.

The README lists editable prompt files, justfile recipes, a Pi documentation bundle, the self_compact and view_context tools, and the /self-compact-info and /self-compact-now commands. The README describes a footer gauge for context usage.

Who it is for

People who run autonomous, long-running coding agents in Pi.

Example tasks

Run the demo to watch an agent move through notice, warning, forced and handoff with a scripted model and no API key.
Change the notice, warning and hard cutoff thresholds for a launch with the extension's flags.
Edit the summary prompt that compaction uses, which the README says is yours to edit.
Check live context numbers and thresholds with /self-compact-info inside Pi.
Run the unit and end-to-end suites, which the README says have no API cost.

Getting started

The README's Manual Install lists the prerequisites above. It shows npm install -g --ignore-scripts @earendil-works/pi-coding-agent for Pi, then cp .env.sample .env to create the .env file where you add OPENROUTER_API_KEY. It starts Pi with the extension through just run --model openrouter/deepseek/deepseek-v4.1-flash. The README also describes an agentic install that opens the repository in Claude Code (or Pi) and lists /prime and just demo. The README has the exact commands.

Limitations

It is an extension for the Pi coding agent, so it needs Pi. According to the README, the prerequisites are Pi v0.85.1, Node 24 or later and just. Live runs also need a provider key in .env, and the README recommends OPENROUTER_API_KEY. The demo needs no API key. The README's section on where it can still fail says usage is Pi's estimate, a single huge tool result can pass a threshold before the lock engages, tools already running when the note is saved finish on their own, a model can ignore the warning, and very small sessions have nothing to compact. It also says compaction quality is model quality. The repository can change at any time; check its README before you install.

Data practices

The README does not mention telemetry. The README says threshold guidance is injected into the next model call and dropped, and describes persistence of prompts and the returned handoff note. The README says every turn of an autonomous agent re-sends its whole history. Live runs send that history to the configured model provider; the README recommends OpenRouter.

Community experience

Not rated yet

Sign in to share your experience.

Comments 0

No comments yet.

Sign in to comment

Report a listing concern