Auto-compaction — the percent setting, the CLI control, the between-turn compact, the first-turn window. A repository rule for apps/daemon/src/v1/agents/**/auto-compact*, apps/daemon/src/v1/agents/**/first-turn-window*, apps/daemon/src/v1/agents/**/compaction-rows*, apps/daemon/src/v1/agents/**/context-window*, apps/daemon/src/v1/agents/adapters/**/*context-window*, apps/daemon/src/v1/teams/**/team-executor*, apps/ui/src/renderer/chats/auto-compact*, apps/daemon/src/v1/agents/**/partial-strea...
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Rule Daemon Auto Compaction?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/geniro-io-rule-daemon-auto-compaction)
---
name: rule-daemon-auto-compaction
description: "Auto-compaction — the percent setting, the CLI control, the between-turn compact, the first-turn window. A repository rule for apps/daemon/src/v1/agents/**/auto-compact*, apps/daemon/src/v1/agents/**/first-turn-window*, apps/daemon/src/v1/agents/**/compaction-rows*, apps/daemon/src/v1/agents/**/context-window*, apps/daemon/src/v1/agents/adapters/**/*context-window*, apps/daemon/src/v1/teams/**/team-executor*, apps/ui/src/renderer/chats/auto-compact*, apps/daemon/src/v1/agents/**/partial-stream*; read it before editing a file there."
---
<!-- GENERATED by scripts/sync-agent-rules.mjs from .claude/rules/daemon-auto-compaction.md. DO NOT EDIT: edit the source, then run `pnpm sync:agent-rules`. -->
# Auto-compaction
- **AUTO-COMPACTION** — asked of the CLI where it has a control, performed by the daemon between turns where not. One number: `autoCompactPercent` (10–95, null = never) per chat or node.
- claude: `--autocompact <threshold + 33k buffer>` (not `CLAUDE_AUTOCOMPACT_PCT_OVERRIDE`). The window is the conversation's last reading (live, then row; the executor seeds `nodeWindows` from `node_state` each pass), and before any reading the turn's model's known window (`utils/first-turn-window.ts`), so the flag is there from turn one: the id the CLI runs the name as under that profile (`AgentAdapter.resolveModel`; claude asks its own `initialize`, cached per profile and version), then that id's measured window at the window choice, then the catalog's (models.dev `limit.context`) only where the adapter declares `listPrice.catalogWindows` (claude yes, codex no) and never for a `[1m]`-style variant. Never a number parsed from the window choice. A reading whose model is not the one the turn announced (a delegate out-spending it in `modelUsage`) is not the conversation's window and is never stored as one, in a turn or between turns (`PartialStreamService.isOwnReading`). It joins `sessionKey`; outside 100k–1M the flag is dropped. cursor has none.
- Between-turn rule (`utils/auto-compact.ts`): after a `completed` settle, it sends `/compact` through `sendMessage` and writes its row only once that has taken.
- A geniro-command turn never re-arms it.
- `compactingRuns` refuses follow-ups `RUN_BUSY` with a per-turn token.
- Baseline: the first reading after a compaction; no re-compaction until regrowth (`AUTO_COMPACT_REGROWTH_FRACTION`).
- A carried compaction retires (marks) the kept process. Its CLI reports no compaction, so the daemon announces `COMPACTING_ACTIVITY` for the whole of its turn.
- Team nodes compact right after the filling turn, inside the unit owning the session key (`launchNode` / `launchCalleeTurn` / `continueNode`), never before a resume and never inside `enqueue`. `compactingNodes` refuses follow-ups. cursor's carried summary is held per session key in memory.
- Never write `/compact` into a running turn's stdin.
- A CLI's own compaction (`context_compacted`, main thread only) announces `COMPACTING_ACTIVITY` (`utils/event-to-item.ts`) from `started` until its ending: a chat for the run, a team only for a member's own conversation (never a callee's: the run's phrase is drawn in the root flow), taken down at the turn's end too. Its `started` retires the owner's live tail, since codex drops a reply it was streaming when it compacts mid-turn and never completes that item.