[FEATURE] Customize /compact strategy

Resolved 💬 3 comments Opened Dec 11, 2025 by PerishCode Closed Dec 14, 2025

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

First, thanks for the great work, i've writtern 10x more code than before.

And here is my problem:

I have my own strategy to reserve necessary info between sessions, it's much faster than the default "/compact", so i'm expecting for a hook that can takeover the default "compact", and compact in my way.

Proposed Solution

Maybe a hook within the behavior (or other possible endpoint):

  1. Triggered when current context almost reach the limit
  2. Simply apply a custom prompt like "Update the task info."
  3. When the response completes, just start a new session.

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

CLI commands and flags

Use Case Example

I've configured user global CLAUDE.md to manage my own task in different projects, it works well for me.
Especially, i just need to tell "Update task info" and start a new session rather than waiting for the long-time-taking builtin compact.
But sometimes i just forgot to give the command, so I really need a automation for this scene.

The prompt is like:

Core Rules

  • Always read .task folder to understand task context at the beginning.
  • If .task folder doesn't exist or MAIN.md content is empty/uninitialized, ask user to clarify task objectives before proceeding.
  • Only update .task when user specifically requests, or ask user whether to update when you think it's necessary.

.task Documentation System

Core Philosophy

  • MAIN.md is the task control panel: see at a glance what's being done, progress, and why
  • Other documents are deep-dive materials, accessed when needed
  • Goal: minimize context switching cost

Document Structure

MAIN.md (required, entry point):

  • Status: Branch + Current Phase + Next 3-5 items
  • Phase History: Reverse chronological, most recent first, 5-10 line summary each
  • Related Docs: One per line, describe what you'll find inside

DECISIONS.md (create when recording "why"):

  • Motivation and trade-offs for technical choices and architecture decisions
  • Must include: Context + Alternatives + Decision + Trade-offs

**PHASE_.md* (split when single Phase description exceeds half screen):

  • Detailed change descriptions, code comparisons, design rationale
  • Keep 3-5 line summary + link in MAIN.md

Phase Format Specification

MAIN.md is the source of truth. Phase content is manually edited by AI.

Required format:

## Phase N: <title> <emoji>

**Changes**:
- What changed
- Why it changed (if not obvious)

**Modified Files**: file1.ts, file2.ts

Optional fields:

**Commit**: abc1234
**Reference**: [Details](PHASE_N.md)

Status Emoji:
| Emoji | Status |
|-------|--------|
| 🔄 | in progress |
| ✅ | completed |
| ⏭️ | skipped |

Iteration Guidelines

Task Execution Flow

  1. Understand the task - Read .task/MAIN.md to understand current progress
  2. Plan Phases - Confirm task scope with user, break down into Phases
  3. Execute Phase by Phase
  • perish phase start <title> to begin
  • Implement functionality
  • Edit MAIN.md to fill in Phase content (Changes, Modified Files)
  • perish phase done -m <message> to complete and commit
  • Request user confirmation after each Phase completion
  1. Issue handling - Immediately confirm with user when encountering problems

Commit Convention

| Format | Description |
|--------|-------------|
| WIP[0]: message | Task initialization commit |
| WIP[N]: message | Phase N completion commit |

Additional Context

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗