Skip to content

Commit 3955553

Browse files
author
Baudbot
committed
extensions: lower idle-compact threshold to 25% and prioritize recency in compaction
When truly idle (no dev agents, no todos, no recent turns), there's no reason to keep a fat context. Lower default from 40% to 25%. Update compaction instructions to prioritize recent conversations, task results, and decisions over older history.
1 parent a21b5cd commit 3955553

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

CONFIGURATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ Set during `setup.sh` / `baudbot install` via env vars:
169169
| Variable | Description | Default |
170170
|----------|-------------|---------|
171171
| `IDLE_COMPACT_DELAY_MS` | Idle time before checking for compaction (milliseconds, min 60000) | `300000` (5 min) |
172-
| `IDLE_COMPACT_THRESHOLD_PCT` | Context usage % to trigger compaction (10–90) | `40` |
172+
| `IDLE_COMPACT_THRESHOLD_PCT` | Context usage % to trigger compaction (10–90) | `25` |
173173
| `IDLE_COMPACT_ENABLED` | Set to `0`, `false`, or `no` to disable idle compaction | enabled |
174174

175175
### Bridge

pi/extensions/idle-compact.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
* Configuration (env vars):
1616
* IDLE_COMPACT_DELAY_MS — idle time before checking (default: 300000 = 5 min)
17-
* IDLE_COMPACT_THRESHOLD_PCT — context % to trigger (default: 40)
17+
* IDLE_COMPACT_THRESHOLD_PCT — context % to trigger (default: 25)
1818
* IDLE_COMPACT_ENABLED — set to "0" or "false" to disable
1919
*/
2020

@@ -25,7 +25,7 @@ import { homedir } from "node:os";
2525
import * as net from "node:net";
2626

2727
const DEFAULT_IDLE_DELAY_MS = 5 * 60 * 1000; // 5 minutes
28-
const DEFAULT_THRESHOLD_PCT = 40;
28+
const DEFAULT_THRESHOLD_PCT = 25;
2929
const MIN_IDLE_DELAY_MS = 60 * 1000; // 1 minute minimum
3030

3131
const CONTROL_DIR = join(homedir(), ".pi", "session-control");
@@ -194,10 +194,10 @@ export default function idleCompactExtension(pi: ExtensionAPI): void {
194194
compacting = true;
195195
lastCtx.compact({
196196
customInstructions:
197-
"This is an idle-period compaction. Preserve all operational context: " +
198-
"active session names, repo paths, Slack thread references (channel + thread_ts), " +
199-
"any pending user requests, and memory file locations. Be thorough — the full " +
200-
"conversation history won't be available after this.",
197+
"Prioritize recency: the most recent conversations, task results, and decisions " +
198+
"are more important than older history. Preserve active Slack thread references " +
199+
"(channel + thread_ts), in-progress work context, recent user requests, and " +
200+
"current operational state. Older completed tasks can be summarized briefly.",
201201
onComplete: () => {
202202
compacting = false;
203203
},

0 commit comments

Comments
 (0)