fix: use shared scratch helpers in dev-agent and action-agent to eliminate duplicates (#262)
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
8d9e216e33
commit
6405ac9837
3 changed files with 8 additions and 35 deletions
|
|
@ -24,6 +24,7 @@ export PROJECT_TOML="${2:-${PROJECT_TOML:-}}"
|
|||
|
||||
source "$(dirname "$0")/../lib/env.sh"
|
||||
source "$(dirname "$0")/../lib/agent-session.sh"
|
||||
source "$(dirname "$0")/../lib/formula-session.sh"
|
||||
# shellcheck source=../dev/phase-handler.sh
|
||||
source "$(dirname "$0")/../dev/phase-handler.sh"
|
||||
SESSION_NAME="action-${ISSUE}"
|
||||
|
|
@ -168,22 +169,8 @@ if [ -n "${_thread_id:-}" ]; then
|
|||
fi
|
||||
|
||||
# --- Read scratch file (compaction survival) ---
|
||||
SCRATCH_CONTEXT=""
|
||||
if [ -f "$SCRATCH_FILE" ]; then
|
||||
SCRATCH_CONTEXT="## Previous context (from scratch file)
|
||||
$(cat "$SCRATCH_FILE")
|
||||
"
|
||||
fi
|
||||
SCRATCH_INSTRUCTION="## Context scratch file (compaction survival)
|
||||
|
||||
Periodically (every 10-15 tool calls), write a summary of:
|
||||
- What you have discovered so far
|
||||
- Decisions made and why
|
||||
- What remains to do
|
||||
to: ${SCRATCH_FILE}
|
||||
|
||||
If you find this file exists when you start, read it first — it is your previous context.
|
||||
This file is ephemeral — not evidence or permanent memory, just a compaction survival mechanism."
|
||||
SCRATCH_CONTEXT=$(read_scratch_context "$SCRATCH_FILE")
|
||||
SCRATCH_INSTRUCTION=$(build_scratch_instruction "$SCRATCH_FILE")
|
||||
|
||||
# --- Build initial prompt ---
|
||||
PRIOR_SECTION=""
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ set -euo pipefail
|
|||
# Load shared environment
|
||||
source "$(dirname "$0")/../lib/env.sh"
|
||||
source "$(dirname "$0")/../lib/agent-session.sh"
|
||||
source "$(dirname "$0")/../lib/formula-session.sh"
|
||||
# shellcheck source=./phase-handler.sh
|
||||
source "$(dirname "$0")/phase-handler.sh"
|
||||
|
||||
|
|
@ -499,22 +500,8 @@ fi
|
|||
# =============================================================================
|
||||
# READ SCRATCH FILE (compaction survival)
|
||||
# =============================================================================
|
||||
SCRATCH_CONTEXT=""
|
||||
if [ -f "$SCRATCH_FILE" ]; then
|
||||
SCRATCH_CONTEXT="## Previous context (from scratch file)
|
||||
$(cat "$SCRATCH_FILE")
|
||||
"
|
||||
fi
|
||||
SCRATCH_INSTRUCTION="## Context scratch file (compaction survival)
|
||||
|
||||
Periodically (every 10-15 tool calls), write a summary of:
|
||||
- What you have discovered so far
|
||||
- Decisions made and why
|
||||
- What remains to do
|
||||
to: ${SCRATCH_FILE}
|
||||
|
||||
If you find this file exists when you start, read it first — it is your previous context.
|
||||
This file is ephemeral — not evidence or permanent memory, just a compaction survival mechanism."
|
||||
SCRATCH_CONTEXT=$(read_scratch_context "$SCRATCH_FILE")
|
||||
SCRATCH_INSTRUCTION=$(build_scratch_instruction "$SCRATCH_FILE")
|
||||
|
||||
# =============================================================================
|
||||
# BUILD PROMPT
|
||||
|
|
|
|||
|
|
@ -65,12 +65,11 @@ about CI health, issue staleness, agent status, and system conditions.
|
|||
## Project context
|
||||
${CONTEXT_BLOCK}
|
||||
${SCRATCH_CONTEXT:+${SCRATCH_CONTEXT}
|
||||
}
|
||||
}${SCRATCH_INSTRUCTION}
|
||||
|
||||
## Formula
|
||||
${FORMULA_CONTENT}
|
||||
|
||||
${SCRATCH_INSTRUCTION}
|
||||
|
||||
${PROMPT_FOOTER}"
|
||||
|
||||
# ── Run session ──────────────────────────────────────────────────────────
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue