Skip to content

feat(dispatch): Compact Instructions block for lineage forks (closes #27) - #93

Open
Srinivasan8888 wants to merge 1 commit into
evo-hq:mainfrom
Srinivasan8888:fix/issue-27-compact-instructions
Open

Srinivasan8888 wants to merge 1 commit into
evo-hq:mainfrom
Srinivasan8888:fix/issue-27-compact-instructions

Conversation

@Srinivasan8888

Copy link
Copy Markdown

Problem

A lineage fork (evo dispatch forking from a committed parent experiment's own session) inherits the parent's transcript. The worker protocol therefore reaches the child only through that cached context. On long ancestor chains, Claude Code auto-compacts the older portion of the transcript and can summarize the protocol away.

The existing LINEAGE_EXECUTE_USER_PROMPT_TEMPLATE only hints at this — "re-read the protocol from <path> if you can no longer see it." As #27 notes, that's a hint, not a guarantee.

Fix

Add a # Compact Instructions block to the lineage execute prompt that marks the load-bearing context as preserve-on-summary, exactly as proposed in #27:

# Compact Instructions

Preserve when summarizing:
- current exp_id, hypothesis, parent_commit
- worker protocol; `evo run` is terminal
- pointer-trace references and gate semantics

May be discarded:
- older file reads (recoverable via `evo get` / Read)
- older benchmark output detail
- failed tool calls from prior attempts

The block is injected only into lineage forks (render_execute_prompt(..., lineage=True)). Fresh explorer children receive the protocol in the current turn and don't inherit a long transcript, so they intentionally do not carry the block.

Tests

Added tests/unit/test_compact_instructions.py (TDD — written failing first):

  • lineage prompt includes the Compact Instructions header + Preserve when summarizing
  • lineage prompt pins the specific load-bearing items (exp_id, hypothesis, parent_commit, worker protocol, evo run is terminal, gate)
  • non-lineage prompt omits the block

tests/unit (excluding the three Rust-evo-hook-drain-binary tests, which are environmental on a machine without a Rust toolchain): 801 passed, 4 skipped. All existing test_dispatch.py tests pass unchanged.

…ge forks

A lineage fork inherits the parent experiment's session, so the worker
protocol reaches the child only through the cached transcript. On long
ancestor chains Claude Code auto-compacts the older portion and can
summarize the protocol away; the existing lineage prompt only *hints*
that the child should re-read it.

Add a '# Compact Instructions' block to the lineage execute prompt that
marks the load-bearing context (exp_id/hypothesis/parent_commit, the
worker protocol, that 'evo run' is terminal, gate semantics) as
preserve-on-summary, so compaction keeps it. Injected only into lineage
forks -- fresh explorers get the protocol in-turn and are unaffected.

Closes evo-hq#27.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant