Long Run Agent
Overview
Use one worker subagent as the only place where substantial task state accumulates. Keep the main thread limited to loading this skill, creating or naming the run directory, spawning the worker, and reporting the .agent/live.md path.
Create exactly one subagent total: the main thread creates the worker, and the worker must not create any additional subagents.
Keep the parent turn alive when the host provides a subagent wait or mailbox mechanism. A durable control plane preserves state, but it does not by itself create a new user-visible chat message after the parent turn ends.
File edits cannot literally interrupt the model. Treat .agent/live.md as a mailbox: the worker runs the watcher script and checks it at startup, after each meaningful batch of work, before risky changes, and whenever it is waiting for user input.
Mission Harness
For long runs that need durable truth preservation, use the minimal mission
harness:
python3 <skill-path>/scripts/install_skill.py --json
python3 <skill-path>/scripts/mission_harness.py --root <project-root> init
python3 <skill-path>/scripts/mission_harness.py --root <project-root> run start --goal "bounded task"
python3 <skill-path>/scripts/mission_harness.py --root <project-root> claim add --id <claim-id> --claim "..." --source-path <path> --source-kind <kind> --status tested
python3 <skill-path>/scripts/mission_harness.py --root <project-root> claim disprove --id <claim-id> --evidence-artifact <artifact-id> --notes "..."
python3 <skill-path>/scripts/mission_harness.py --root <project-root> claim history --id <claim-id>
python3 <skill-path>/scripts/mission_harness.py --root <project-root> relation add --source-type artifact --source-id <artifact-id> --relation supports --target-type claim_revision --target-id <revision-id>
python3 <skill-path>/scripts/mission_harness.py --root <project-root> relation list --endpoint-type claim --endpoint-id <claim-id>
python3 <skill-path>/scripts/mission_harness.py --root <project-root> run close --outcome "..." --command "..." --test "..." --next-action "..."
python3 <skill-path>/scripts/mission_harness.py --root <project-root> friction add --category verification_gap --description "..." --impact "..." --proposed-harness-need "..."
python3 <skill-path>/scripts/mission_harness.py --root <project-root> friction settle --id <friction-id> --status consolidated --root-cause-id <root-id> --release-disposition deferred --rationale "..."
python3 <skill-path>/scripts/mission_harness.py --root <project-root> friction report --fail-on-ambiguous-open
python3 <skill-path>/scripts/mission_harness.py --root <project-root> state preflight
python3 <skill-path>/scripts/mission_harness.py --root <project-root> state compact-live
python3 <skill-path>/scripts/mission_harness.py --root <project-root> validate
python3 <skill-path>/scripts/mission_harness.py --root <project-root> state summarize
python3 <skill-path>/scripts/mission_harness.py --root <project-root> index rebuild
python3 <skill-path>/scripts/mission_harness.py --root <project-root> index search "query terms"
python3 <skill-path>/scripts/mission_harness.py --root <project-root> index status
python3 <skill-path>/scripts/mission_records_recent.py --root <project-root> claims --limit 5
python3 <skill-path>/scripts/mission_records_recent.py --root <project-root> relations --limit 5
python3 <skill-path>/scripts/mission_artifact_materialize.py --root <project-root> --id <artifact-id>
python3 <skill-path>/scripts/mission_artifact_materialize.py --root <project-root> --path <new-evidence-path>
python3 <skill-path>/scripts/mission_artifact_materialize.py --root <project-root> --path <input-path> --stage-copy /private/tmp/<stable-input>
python3 <skill-path>/scripts/watch_live_file.py <project-root>/.agent/live.md --create --interval 1
python3 <skill-path>/scripts/reveal_live_file.py <project-root>/.agent/live.md --skip-if-open
When a local MCP client is available, long-run-agent-mcp exposes the same
authoritative harness through namespaced mission_* tools. Prefer
mission_control_read at startup and before major steps; pass its previous
SHA-256 so unchanged live.md content is not repacked into context. A composed
MCP server may register these tools with
long_run_agent_skill.mcp_tools.register_mission_tools, but .agent/ remains
the only mission truth store.
The harness creates a .agent/ directory with a human-readable control plane
(live.md), durable Markdown state (current_state.md, constitution.md,
known_failures.md, decisions.md), and portable structured records
(runs.jsonl, claims.json, artifacts.json, friction.jsonl,
evidence_relations.jsonl).
Use it when a run needs to preserve claims, artifacts, failures, verification,
and process friction over time. Do not use it to add ceremony. If a piece of
state matters after compaction or handoff, record it outside live.md.
Operational rules:
- At the beginning of substantial work, read
.agent/live.md,
.agent/current_state.md, .agent/known_failures.md,
.agent/decisions.md, .agent/claims.json,
.agent/evidence_relations.jsonl, and recent .agent/runs.jsonl records
when they exist.
- Before major or hard-to-unwind steps, re-read
.agent/live.md.
- At run close, record commands, tests, files changed, failures, claims,
artifacts, evidence relationship ids, and next actions with
run close.
- Record process or tooling pain with
friction add instead of burying it in
chat-only notes. If the pain repeats a known pattern, attach
--root-cause-id or settle the old item instead of creating another
disconnected open item.
- Run
validate before treating the harness state as reliable.
- During an open run,
state summarize copies the active goal, failures, and
next actions from live.md into current_state.md; keep those sections current.
- On macOS, initialized state operations automatically request any evicted
File Provider state before reading; use
state preflight when a diagnostic
readiness report is needed.
- If an open run makes
live.md too large to serve as a control plane, first
record durable claims/artifacts/friction, then run state compact-live.
It validates those durable references and archives the verbose snapshot
before replacing evidence-list sections with a typed archive pointer. Run
close recovers genuine verification and claim/artifact references through
archive chains.
- If an evidence path may be File Provider-backed or a verification read
stalls, run
mission_artifact_materialize.py --id <artifact-id> for a
recorded artifact, or --path <new-evidence-path> before registration.
This verifies availability only; it does not interpret evidence or upgrade
a claim.
- If a long-running verifier must consume an evictable regular-file artifact,
add
--stage-copy <new-local-path> and pass the verified staged copy to the
verifier. The command will not overwrite an existing staged path.
- When previous work becomes hard to rediscover with direct file reads, run
index rebuild and index search. Treat the SQLite database as a derived
convenience index only; durable truth remains in Markdown, JSON, and JSONL.
- When you need the latest claims, artifacts, friction, or runs, use
mission_records_recent.py instead of hand-parsing state files and
guessing each JSON shape.
- Before release, handoff, or a long run closeout, run
friction report.
Ambiguous open friction means the ledger needs triage. Preserve repeated
evidence, but consolidate it around root causes, release dispositions, and
verification paths so future agents can tell repeated evidence from
independent unresolved issues.
- Treat claims as append-only revisions. Reuse the stable claim id with
claim add to advance it; inspect claim history rather than overwriting
prior conclusions. When evidence disproves a claim, register that evidence
as uniquely identified artifacts and use claim disprove. Never use a
generic status edit that severs the disproval from its evidence.
- Use
relation add for explicit support, refutation, corroboration,
contradiction, derivation, reproduction, documentation, causation,
supersession, or retraction. Both typed endpoints must resolve, and an
artifact endpoint must have a unique id.
Main-Thread Workflow
- Pick a run directory outside the chat context. Default to
~/Documents/codex-long-runs/<YYYYMMDD-HHMMSS>-<slug>/.
- Initialize the mission harness in that directory and use
<run-dir>/.agent/live.md as the only active steering file.
- Spawn exactly one worker subagent for the actual task. Use
fork_context=false when available so the worker starts from the minimal prompt instead of inheriting the main chat history.
- Do not spawn any other subagents. The worker also must not spawn child subagents.
- Pass the worker:
- the user's task verbatim,
- this skill path,
- the run directory,
- the live control path,
- the instruction that all orchestration, exploration, implementation, and verification belong inside the worker context without creating more subagents.
- Do not duplicate the worker's work in the main thread. Do not stream detailed progress back into the main thread. If the user sends steering in chat, append or forward only that steering to
live.md or the worker.
- Tell the user where
live.md is and that they can edit it to steer, answer questions, stop, or request status.
- If the host provides a subagent wait or mailbox mechanism, keep the parent turn active with that mechanism. Prefer long event-driven waits over busy polling. Do not send a final response merely because the worker has started.
- When the worker reports completion, a blocker, or a question requiring user input, immediately send the user a self-contained status message. The user must not need to ask for progress to surface an already-recorded terminal state.
- If the host cannot keep the parent turn active or wake it after return, state before returning that automatic chat notification is unavailable and that
live.md is the status source. Do not promise a later chat message.
- Do not treat apparent task completion as the end of the durable worker session. The worker should go dormant and wait for the next
live.md update unless the user explicitly directs it to stop.
Worker prompt template:
Use the long-run-agent skill at <skill-path> as the operating procedure.
Task:
<verbatim user task>
Run directory: <run-dir>
Live control: <run-dir>/.agent/live.md
You are the only worker for this long run. Keep the main thread thin: do all substantive orchestration, research, implementation, verification, and state tracking in your own context and artifacts. Do not spawn, delegate to, or request any additional subagents. Create and maintain `.agent/live.md`. Run the watcher script from the skill and check it regularly. If you need user input, write the question into `live.md` and wait for the user's reply there. Treat STOP or PAUSE directives in `live.md` as higher priority than the original task.
Before becoming dormant or waiting for user input, send the parent agent a concise completion, blocked, or question message using the host's subagent mailbox when available. Recording state in `live.md` remains mandatory and is not replaced by the message.
Worker Workflow
- Create the run directory.
- Initialize the mission harness, then start the watcher so it creates
live.md if needed:
python3 <skill-path>/scripts/mission_harness.py --root <run-dir> init
python3 <skill-path>/scripts/watch_live_file.py <run-dir>/.agent/live.md --create --interval 1
- At the start of the session, reveal
live.md in Finder, Windows File Explorer, or the local file manager unless it already appears to be open:
python3 <skill-path>/scripts/reveal_live_file.py <run-dir>/.agent/live.md --skip-if-open
- Keep the watcher session running. Poll its output after each batch of work and before decisions that would be hard to unwind.
- Do not create child subagents. Complete the long run in this worker context, using local tools and durable run-directory artifacts instead of delegation.
- Maintain
.agent/live.md with the stable sections created by init.
- If blocked on a user decision, update
Agent Questions, set Run Status to waiting, notify the parent through the host mailbox when available, and wait for a file change before continuing.
- If
live.md says STOP, stop after making the workspace consistent and write a brief status. If it says PAUSE, stop taking new actions and wait for RESUME.
- Save durable artifacts in the run directory: notes, logs, generated files, validation outputs, and final summaries that would otherwise bloat the main chat.
- When the current task appears complete, do not exit. Update
Agent Status to dormant, write the completion summary and artifact paths into live.md or durable run records, notify the parent through the host mailbox when available, then wait for the next file update.
- End the worker only when the user gives an explicit termination directive such as
STOP or FINALIZE AND STOP. A plain FINALIZE means write a concise final summary and then return to dormant waiting.
- Keep final responses concise. Point to the run directory and the important artifact paths instead of pasting long logs.
Live File Rules
Use plain Markdown. Keep the newest user instruction as authoritative when it conflicts with earlier instructions.
Never rely on chat-only steering during the worker run. If important direction arrives in chat, copy it into .agent/live.md so the worker's state remains self-contained.
Recommended initial file:
# Live Control
## User Updates
- Add steering here. Newer instructions override older conflicting instructions.
## Current Goal
- Add the active goal here.
## Constraints
- Add constraints here.
## Agent Status
- Status: starting
## Interrupts / Corrections
- None recorded yet.
## Decisions Made This Run
- None recorded yet.
## Commands Run
- None recorded yet.
## Tests / Verification
- None recorded yet.
## Failures / Blockers
- None recorded yet.
## Claims Touched
- None recorded yet.
## Artifacts Produced
- None recorded yet.
## Friction Observed
- None recorded yet.
## Next Actions
- None recorded yet.
Watcher Script
Use scripts/watch_live_file.py to create live.md and print the full file whenever it changes. The script is intentionally simple and portable; it uses file hashing plus polling instead of OS-specific file events.
Typical worker usage:
python3 /path/to/long-run-agent/scripts/watch_live_file.py /path/to/project/.agent/live.md --create --interval 1
For one-shot checks in scripts or diagnostics:
python3 /path/to/long-run-agent/scripts/watch_live_file.py /path/to/project/.agent/live.md --create --once
File Manager Reveal Script
Use scripts/reveal_live_file.py once at session startup. On macOS it runs open -R to reveal live.md in Finder. On native Windows it runs File Explorer with /select. Under WSL it converts the path with wslpath -w and then opens Windows File Explorer. On other Linux environments it opens the containing folder with xdg-open when available.
With --skip-if-open, it first makes a best-effort open-file check. macOS, Linux, and WSL use lsof when present. Native Windows uses Sysinternals handle.exe or handle64.exe when present; otherwise it cannot reliably detect already-open files and will still reveal the file.
python3 /path/to/long-run-agent/scripts/reveal_live_file.py /path/to/project/.agent/live.md --skip-if-open
1---2name: long-run-agent3description: Run long Codex tasks through a worker subagent so the main chat stays thin and avoids automatic compaction. Use when the user wants a long-running, autonomous, steerable task with a shared `.agent/live.md` control plane for user direction, agent questions, and user replies; when orchestration should happen in subagents rather than the main thread; or when the user explicitly asks to prevent main-thread context growth during extended work.4---56# Long Run Agent78## Overview910Use one worker subagent as the only place where substantial task state accumulates. Keep the main thread limited to loading this skill, creating or naming the run directory, spawning the worker, and reporting the `.agent/live.md` path.1112Create exactly one subagent total: the main thread creates the worker, and the worker must not create any additional subagents.1314Keep the parent turn alive when the host provides a subagent wait or mailbox mechanism. A durable control plane preserves state, but it does not by itself create a new user-visible chat message after the parent turn ends.1516File edits cannot literally interrupt the model. Treat `.agent/live.md` as a mailbox: the worker runs the watcher script and checks it at startup, after each meaningful batch of work, before risky changes, and whenever it is waiting for user input.1718## Mission Harness1920For long runs that need durable truth preservation, use the minimal mission21harness:2223```bash24python3 <skill-path>/scripts/install_skill.py --json25python3 <skill-path>/scripts/mission_harness.py --root <project-root> init26python3 <skill-path>/scripts/mission_harness.py --root <project-root> run start --goal "bounded task"27python3 <skill-path>/scripts/mission_harness.py --root <project-root> claim add --id <claim-id> --claim "..." --source-path <path> --source-kind <kind> --status tested28python3 <skill-path>/scripts/mission_harness.py --root <project-root> claim disprove --id <claim-id> --evidence-artifact <artifact-id> --notes "..."29python3 <skill-path>/scripts/mission_harness.py --root <project-root> claim history --id <claim-id>30python3 <skill-path>/scripts/mission_harness.py --root <project-root> relation add --source-type artifact --source-id <artifact-id> --relation supports --target-type claim_revision --target-id <revision-id>31python3 <skill-path>/scripts/mission_harness.py --root <project-root> relation list --endpoint-type claim --endpoint-id <claim-id>32python3 <skill-path>/scripts/mission_harness.py --root <project-root> run close --outcome "..." --command "..." --test "..." --next-action "..."33python3 <skill-path>/scripts/mission_harness.py --root <project-root> friction add --category verification_gap --description "..." --impact "..." --proposed-harness-need "..."34python3 <skill-path>/scripts/mission_harness.py --root <project-root> friction settle --id <friction-id> --status consolidated --root-cause-id <root-id> --release-disposition deferred --rationale "..."35python3 <skill-path>/scripts/mission_harness.py --root <project-root> friction report --fail-on-ambiguous-open36python3 <skill-path>/scripts/mission_harness.py --root <project-root> state preflight37python3 <skill-path>/scripts/mission_harness.py --root <project-root> state compact-live38python3 <skill-path>/scripts/mission_harness.py --root <project-root> validate39python3 <skill-path>/scripts/mission_harness.py --root <project-root> state summarize40python3 <skill-path>/scripts/mission_harness.py --root <project-root> index rebuild41python3 <skill-path>/scripts/mission_harness.py --root <project-root> index search "query terms"42python3 <skill-path>/scripts/mission_harness.py --root <project-root> index status43python3 <skill-path>/scripts/mission_records_recent.py --root <project-root> claims --limit 544python3 <skill-path>/scripts/mission_records_recent.py --root <project-root> relations --limit 545python3 <skill-path>/scripts/mission_artifact_materialize.py --root <project-root> --id <artifact-id>46python3 <skill-path>/scripts/mission_artifact_materialize.py --root <project-root> --path <new-evidence-path>47python3 <skill-path>/scripts/mission_artifact_materialize.py --root <project-root> --path <input-path> --stage-copy /private/tmp/<stable-input>48python3 <skill-path>/scripts/watch_live_file.py <project-root>/.agent/live.md --create --interval 149python3 <skill-path>/scripts/reveal_live_file.py <project-root>/.agent/live.md --skip-if-open50```5152When a local MCP client is available, `long-run-agent-mcp` exposes the same53authoritative harness through namespaced `mission_*` tools. Prefer54`mission_control_read` at startup and before major steps; pass its previous55SHA-256 so unchanged `live.md` content is not repacked into context. A composed56MCP server may register these tools with57`long_run_agent_skill.mcp_tools.register_mission_tools`, but `.agent/` remains58the only mission truth store.5960The harness creates a `.agent/` directory with a human-readable control plane61(`live.md`), durable Markdown state (`current_state.md`, `constitution.md`,62`known_failures.md`, `decisions.md`), and portable structured records63(`runs.jsonl`, `claims.json`, `artifacts.json`, `friction.jsonl`,64`evidence_relations.jsonl`).6566Use it when a run needs to preserve claims, artifacts, failures, verification,67and process friction over time. Do not use it to add ceremony. If a piece of68state matters after compaction or handoff, record it outside `live.md`.6970Operational rules:71721. At the beginning of substantial work, read `.agent/live.md`,73 `.agent/current_state.md`, `.agent/known_failures.md`,74 `.agent/decisions.md`, `.agent/claims.json`,75 `.agent/evidence_relations.jsonl`, and recent `.agent/runs.jsonl` records76 when they exist.772. Before major or hard-to-unwind steps, re-read `.agent/live.md`.783. At run close, record commands, tests, files changed, failures, claims,79 artifacts, evidence relationship ids, and next actions with `run close`.804. Record process or tooling pain with `friction add` instead of burying it in81 chat-only notes. If the pain repeats a known pattern, attach82 `--root-cause-id` or settle the old item instead of creating another83 disconnected open item.845. Run `validate` before treating the harness state as reliable.856. During an open run, `state summarize` copies the active goal, failures, and86 next actions from `live.md` into `current_state.md`; keep those sections current.877. On macOS, initialized state operations automatically request any evicted88 File Provider state before reading; use `state preflight` when a diagnostic89 readiness report is needed.908. If an open run makes `live.md` too large to serve as a control plane, first91 record durable claims/artifacts/friction, then run `state compact-live`.92 It validates those durable references and archives the verbose snapshot93 before replacing evidence-list sections with a typed archive pointer. Run94 close recovers genuine verification and claim/artifact references through95 archive chains.969. If an evidence path may be File Provider-backed or a verification read97 stalls, run `mission_artifact_materialize.py --id <artifact-id>` for a98 recorded artifact, or `--path <new-evidence-path>` before registration.99 This verifies availability only; it does not interpret evidence or upgrade100 a claim.10110. If a long-running verifier must consume an evictable regular-file artifact,102 add `--stage-copy <new-local-path>` and pass the verified staged copy to the103 verifier. The command will not overwrite an existing staged path.10411. When previous work becomes hard to rediscover with direct file reads, run105 `index rebuild` and `index search`. Treat the SQLite database as a derived106 convenience index only; durable truth remains in Markdown, JSON, and JSONL.10712. When you need the latest claims, artifacts, friction, or runs, use108 `mission_records_recent.py` instead of hand-parsing state files and109 guessing each JSON shape.11013. Before release, handoff, or a long run closeout, run `friction report`.111 Ambiguous open friction means the ledger needs triage. Preserve repeated112 evidence, but consolidate it around root causes, release dispositions, and113 verification paths so future agents can tell repeated evidence from114 independent unresolved issues.11514. Treat claims as append-only revisions. Reuse the stable claim id with116 `claim add` to advance it; inspect `claim history` rather than overwriting117 prior conclusions. When evidence disproves a claim, register that evidence118 as uniquely identified artifacts and use `claim disprove`. Never use a119 generic status edit that severs the disproval from its evidence.12015. Use `relation add` for explicit support, refutation, corroboration,121 contradiction, derivation, reproduction, documentation, causation,122 supersession, or retraction. Both typed endpoints must resolve, and an123 artifact endpoint must have a unique id.124125## Main-Thread Workflow1261271. Pick a run directory outside the chat context. Default to `~/Documents/codex-long-runs/<YYYYMMDD-HHMMSS>-<slug>/`.1282. Initialize the mission harness in that directory and use `<run-dir>/.agent/live.md` as the only active steering file.1293. Spawn exactly one worker subagent for the actual task. Use `fork_context=false` when available so the worker starts from the minimal prompt instead of inheriting the main chat history.1304. Do not spawn any other subagents. The worker also must not spawn child subagents.1315. Pass the worker:132 - the user's task verbatim,133 - this skill path,134 - the run directory,135 - the live control path,136 - the instruction that all orchestration, exploration, implementation, and verification belong inside the worker context without creating more subagents.1376. Do not duplicate the worker's work in the main thread. Do not stream detailed progress back into the main thread. If the user sends steering in chat, append or forward only that steering to `live.md` or the worker.1387. Tell the user where `live.md` is and that they can edit it to steer, answer questions, stop, or request status.1398. If the host provides a subagent wait or mailbox mechanism, keep the parent turn active with that mechanism. Prefer long event-driven waits over busy polling. Do not send a final response merely because the worker has started.1409. When the worker reports completion, a blocker, or a question requiring user input, immediately send the user a self-contained status message. The user must not need to ask for progress to surface an already-recorded terminal state.14110. If the host cannot keep the parent turn active or wake it after return, state before returning that automatic chat notification is unavailable and that `live.md` is the status source. Do not promise a later chat message.14211. Do not treat apparent task completion as the end of the durable worker session. The worker should go dormant and wait for the next `live.md` update unless the user explicitly directs it to stop.143144Worker prompt template:145146```text147Use the long-run-agent skill at <skill-path> as the operating procedure.148149Task:150<verbatim user task>151152Run directory: <run-dir>153Live control: <run-dir>/.agent/live.md154155You are the only worker for this long run. Keep the main thread thin: do all substantive orchestration, research, implementation, verification, and state tracking in your own context and artifacts. Do not spawn, delegate to, or request any additional subagents. Create and maintain `.agent/live.md`. Run the watcher script from the skill and check it regularly. If you need user input, write the question into `live.md` and wait for the user's reply there. Treat STOP or PAUSE directives in `live.md` as higher priority than the original task.156Before becoming dormant or waiting for user input, send the parent agent a concise completion, blocked, or question message using the host's subagent mailbox when available. Recording state in `live.md` remains mandatory and is not replaced by the message.157```158159## Worker Workflow1601611. Create the run directory.1622. Initialize the mission harness, then start the watcher so it creates `live.md` if needed:163164```bash165python3 <skill-path>/scripts/mission_harness.py --root <run-dir> init166python3 <skill-path>/scripts/watch_live_file.py <run-dir>/.agent/live.md --create --interval 1167```1681693. At the start of the session, reveal `live.md` in Finder, Windows File Explorer, or the local file manager unless it already appears to be open:170171```bash172python3 <skill-path>/scripts/reveal_live_file.py <run-dir>/.agent/live.md --skip-if-open173```1741754. Keep the watcher session running. Poll its output after each batch of work and before decisions that would be hard to unwind.1765. Do not create child subagents. Complete the long run in this worker context, using local tools and durable run-directory artifacts instead of delegation.1776. Maintain `.agent/live.md` with the stable sections created by `init`.1787. If blocked on a user decision, update `Agent Questions`, set `Run Status` to waiting, notify the parent through the host mailbox when available, and wait for a file change before continuing.1798. If `live.md` says `STOP`, stop after making the workspace consistent and write a brief status. If it says `PAUSE`, stop taking new actions and wait for `RESUME`.1809. Save durable artifacts in the run directory: notes, logs, generated files, validation outputs, and final summaries that would otherwise bloat the main chat.18110. When the current task appears complete, do not exit. Update `Agent Status` to `dormant`, write the completion summary and artifact paths into `live.md` or durable run records, notify the parent through the host mailbox when available, then wait for the next file update.18211. End the worker only when the user gives an explicit termination directive such as `STOP` or `FINALIZE AND STOP`. A plain `FINALIZE` means write a concise final summary and then return to dormant waiting.18312. Keep final responses concise. Point to the run directory and the important artifact paths instead of pasting long logs.184185## Live File Rules186187Use plain Markdown. Keep the newest user instruction as authoritative when it conflicts with earlier instructions.188189Never rely on chat-only steering during the worker run. If important direction arrives in chat, copy it into `.agent/live.md` so the worker's state remains self-contained.190191Recommended initial file:192193```markdown194# Live Control195196## User Updates197- Add steering here. Newer instructions override older conflicting instructions.198199## Current Goal200- Add the active goal here.201202## Constraints203- Add constraints here.204205## Agent Status206- Status: starting207208## Interrupts / Corrections209- None recorded yet.210211## Decisions Made This Run212- None recorded yet.213214## Commands Run215- None recorded yet.216217## Tests / Verification218- None recorded yet.219220## Failures / Blockers221- None recorded yet.222223## Claims Touched224- None recorded yet.225226## Artifacts Produced227- None recorded yet.228229## Friction Observed230- None recorded yet.231232## Next Actions233- None recorded yet.234```235236## Watcher Script237238Use `scripts/watch_live_file.py` to create `live.md` and print the full file whenever it changes. The script is intentionally simple and portable; it uses file hashing plus polling instead of OS-specific file events.239240Typical worker usage:241242```bash243python3 /path/to/long-run-agent/scripts/watch_live_file.py /path/to/project/.agent/live.md --create --interval 1244```245246For one-shot checks in scripts or diagnostics:247248```bash249python3 /path/to/long-run-agent/scripts/watch_live_file.py /path/to/project/.agent/live.md --create --once250```251252## File Manager Reveal Script253254Use `scripts/reveal_live_file.py` once at session startup. On macOS it runs `open -R` to reveal `live.md` in Finder. On native Windows it runs File Explorer with `/select`. Under WSL it converts the path with `wslpath -w` and then opens Windows File Explorer. On other Linux environments it opens the containing folder with `xdg-open` when available.255256With `--skip-if-open`, it first makes a best-effort open-file check. macOS, Linux, and WSL use `lsof` when present. Native Windows uses Sysinternals `handle.exe` or `handle64.exe` when present; otherwise it cannot reliably detect already-open files and will still reveal the file.257258```bash259python3 /path/to/long-run-agent/scripts/reveal_live_file.py /path/to/project/.agent/live.md --skip-if-open260```