feat: persistent session state and experiment attempt logging for session execution agent (experiment runner agent)) - #98
feat: persistent session state and experiment attempt logging for session execution agent (experiment runner agent))#98bimu233 wants to merge 5 commits into
Conversation
|
Tested this end-to-end (interrupt + resume on the ml_regularization_test idea). The resume logic itself works — but as-is the PR is a no-op against the current Docker image, and actively misleads the agent. Requesting changes on one item. 🔴 Blocker: runner.py change doesn't run, so STATE.md is never created ✅ researcher.txt changes go live (templates are mounted) → the agent is told "STATE.md is present in your workspace (created by the pipeline)" Please make sure this PR is accompanied by a Docker image rebuild (and note it in the description), otherwise it ships as "prompt promises a file that's never there." Also, the creation code silently no-ops if the template is missing: if state_template.exists(): 🟡 Minor: phase-status table can lag the prose sections ✅ What works |
|
Thanks for catching that. The issue only happens when using ./neurico option, there's no bug when using uv run and docker run. I will fix it for ./neurico option. |
Summary
Adds durable inter-phase memory to the session executor so that interrupted sessions (rate limit, token exhaustion, 5-hour Claude Code session limit) can resume without repeating completed work or re-encountering already-fixed bugs.
Problem
The session executor runs all 6 phases in a single continuous session. When that session is interrupted mid-run, all in-session context is lost. On the next run, the agent restarts from Phase 0, repeats phases it already completed, and re-discovers errors it already fixed — wasting tokens and time. This is common when users share their Claude Code session with other work.
Changes
templates/base/researcher.txtStatus: RUNNINGto STATE.md before each experiment run, then updates toFAILED(with exact error and fix) orSUCCESS(with metrics and output files) immediately after. A hard constraint blocks code changes until the current attempt entry is resolved — preventing the agent from batching all error writes to the end of the session.templates/base/deliverables/state_template.md# Current State(phase status table),# Worklog,# Research Specification,# Files and Resources,# Workflow,# Experiment Design,# Learnings,# Experiment Results,# Experiment Attempts.# Experiment Attemptsis the append-only per-run log. Each entry records the command, error, fix applied, and output files — giving the agent a complete anti-repetition record on resume.Why researcher.txt
researcher.txtis always injected at{{ prompt }}by Jinja2 regardless of domain override. Placing STATE.md write instructions here means all domains get consistent phase logging without needing to duplicate instructions in everydomains/X/session_instructions.txt.Verified
Tested on L2 regularization experiment. STATE.md was updated in-time at each phase transition and after each failed attempt — including exact error messages, fixes applied, and metric values. Confirmed successful resume from correct phase without repeating prior work.