Skip to content

[Feature]: Support compaction.customInstructions for auto-compaction #10479

@p697

Description

@p697

Summary

Auto-compaction currently uses a hardcoded project-management style summary format (Goal/Progress/Done/Blocked/Key Decisions/Next Steps). This works great for coding workflows, but loses important context for casual conversation and companion use cases.

Problem

The compaction prompt is designed for task-oriented work. When compaction happens in a chat-focused session:

  • Personal details get dropped ("I'm watching The Dark Knight" → not a "Goal")
  • Emotional context disappears (not "Key Decisions")
  • Relationship moments are lost (not "Progress")

Current State

  • pi-coding-agent already supports customInstructions in generateSummary()
  • Manual /compact Focus on emotions works and passes customInstructions
  • But auto-compaction doesn't pass customInstructions (see src/agents/pi-embedded-runner/run.ts)
  • AgentCompactionConfig has no customInstructions field

Proposed Solution

  1. Add customInstructions?: string to AgentCompactionConfig in types.agent-defaults.ts
  2. Pass it through to compactEmbeddedPiSessionDirect() in the auto-compaction path
{
  agents: {
    defaults: {
      compaction: {
        customInstructions: "Focus on emotional context, personal stories, and relationship moments rather than project progress."
      }
    }
  }
}

Use Case

Users running OpenClaw as a daily companion/chat partner rather than a coding assistant. The current format optimizes for engineering workflows but alienates relationship-focused use cases.

Happy to help with a PR if there's interest.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions