Skip to content

SEP-028: Plan content injection on compaction recovery #18

@samudzi

Description

@samudzi

SEP-028: Plan content injection on compaction recovery

Status: Open
Created: 2026-03-17
Project: .claude
Dependency: SEP-027 (compaction detection must exist before content can be conditionally injected)
Blocked by: SEP-025, SEP-026, SEP-027

Summary

When compaction is detected (SEP-027), the model knows the plan file path but hasn't read it. Recovering position requires a tool call to read the plan file — an extra round trip that may not happen if the model doesn't realize it needs to.

This SEP injects a condensed version of the plan's key sections directly into the WORKFLOW STATE block on compaction, so the model can recover its position without any tool calls.

Motivation

Even with compaction detection (SEP-027) telling the model to re-read the plan, there's a gap:

  • The model must make a tool call (Read) to get the plan content
  • The model may skip this step or misinterpret the instruction
  • The round trip costs a message turn and adds latency
  • If the plan is long, the model may not extract the right information

Injecting the essential plan content directly eliminates this failure mode. The model wakes up post-compaction already knowing what it's building, what files are in scope, and what success looks like.

Proposed Change

When compaction is detected, the injection should include a condensed version of the plan:

  1. Parse the approved plan file for key sections:

    • ## Objective — full text
    • ## Scope — full file list
    • ## Success Criteria — full text
    • ## Objective Verification — full text
    • Current implementation status (from PreCompact snapshot)
  2. Inject this as a structured block within the WORKFLOW STATE:

── PLAN RECOVERY (compaction detected) ──
Objective: [extracted from plan]
Scope:
  - file1.sh
  - file2.sh
Success Criteria: [extracted from plan]
Verification: [extracted from plan]
Implementation Status: [from PreCompact snapshot — files modified, phase, last action]
  1. Keep the full plan file path available for detailed reference if needed

Acceptance Criteria

  • On compaction, the WORKFLOW STATE injection includes Objective, Scope, Success Criteria, and Objective Verification from the approved plan
  • Implementation status from the PreCompact snapshot is included
  • The condensed plan is accurate (parsed from the actual plan file, not cached)
  • The injection is compact enough to not bloat the context window
  • Model can resume implementation without reading the plan file as a first action
  • Full plan file path is still included for detailed reference

Metadata

Metadata

Assignees

No one assigned

    Labels

    SEPSoftware Evolution Proposaldesign-gapSignificant design gapsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions