Optimization Cron Builder
Overview
Build a repository-local optimization research pipeline. Continuously apply a
user-supplied design philosophy to one stage blueprint, derive a bounded AR
checklist, write one research doc per item, track progress, run parallel tmux
workers through the selected agent runner, and remove the cron setup when the
AR blueprint is complete. Product-code implementation stays outside this
pipeline.
AR means Architecture Refinement. The pipeline supports any stage-specific
optimization blueprint.
Output Discipline And Anti-Slop Contract
- Start with the requested AR artifact, design decision, evidence, action,
validation result, or executable instruction.
- Give each sentence one concrete payload: design constraint, repository fact,
optimization item, decision, action, result, evidence, or consequence.
- State verification through its result, evidence, and consequence.
Omit process narration, opening meta-commentary, routine check narration,
motivational filler, restatements, and closing recaps.
- Use direct, positive statements when they preserve the truth conditions. Keep
technical negation that defines scope exclusions, permissions, disk and log
gates, failure behavior, cleanup safety, or acceptance rules.
- Omit relationship or causal claims unsupported by repository, research, or
validator evidence. Handle material uncertainty under the next rule; leave no
speculative transition or placeholder.
- When unresolved uncertainty changes correctness, safety, legality, an AR
decision, or the available action, state the exact unknown, condition, and
consequence.
- Keep the response body within 10% above or below an explicit target length.
Without a target, use the shortest complete form that preserves required AR
artifacts, evidence, decisions, actions, and consequences.
- Include a boundary statement only when it changes correctness, safety,
legality, or the available action. Name the exact constraint and permitted
path.
- Before delivery, silently inspect every character for filler, duplicated
safeguards, unsupported claims, vague predicates, stale placeholders,
fabricated evidence, section completeness, and length.
- Treat state marks, paths, environment variables, commands, thresholds,
platform names, stage names, and validator-dependent strings as contract
data; preserve their exact spelling.
Shared b3ehive Contract
Follow ../looper-cron-builder/references/b3ehive-bridge-contract.md for route
selection, estimator decisions, nested calls, evidence handoff, looper_log
capture, ROI, and self-evolution.
Local obligations:
- Optimization docs and AR items remain
[_] evidence until the owning master
lane accepts them.
- Nontrivial automatic item-count, worker-grouping, route, research-depth, and
simplification choices should leave
EstimatorPolicy and RouteDecision
evidence.
- Recurring skill text bloat,
scaffold overdesign, validator/hook drift, prompt-block sprawl, route waste,
or tool-integration friction produces a
looper_log.
- Each
looper_log must identify the refined TargetObject and the
signal-producing InstrumentObject: AR grain, design rule, route, validator,
scaffold, prompt/hook artifact, tool, or skill composition.
- Optimization may propose simplification or instrument improvements. Every
looper-log-derived change to skill text, policy, scaffold, or tooling requires
EvidenceLint, ROI, ParetoGate, rollback, and master
[x].
Workflow
- Inspect the target repository and identify the stage's single authoritative
blueprint source.
- Capture the user-supplied design philosophy in one short stable sentence.
- Generate one authoritative
Docs/Stage_*_AR_Blueprint.md with:
- a bounded checklist count;
- exactly one item per optimization topic;
- no more than 100 items;
- worker-ownable grouped sections.
- Gate every
[ ] item on a corresponding doc under
Docs/researches/Stage_*_AR/. The doc must cover only that item, follow the
design philosophy, use stable SOTA or mature frontier practice, and give
concrete recommendations for the repository.
- Add repo-local
.ops/ and .cron/ helpers; hide them from git where
appropriate.
- Create AR blueprint tools, a daily todo generator, an optimization guard, a
cron space/log guard, a worker runner, an install script, and a cleanup
script.
- Run the guard once in
VALIDATE_ONLY=1.
- Install cron only after validate-only succeeds and the disk/log budget guard
passes.
- Start parallel
tmux workers with disjoint section ownership.
- After each worker batch, reconcile section snapshots into the authoritative
AR blueprint and refresh today's todo.
- At full AR completion, remove cron entries and stop
tmux sessions. Remove
repo-local cron helpers when cleanup is requested.
Required Components
AR Blueprint
- Use exactly one authoritative AR blueprint file.
- Keep total checklist items
<= 100.
- Set the research grain so one item maps to one optimization doc.
- Put stable repository-relative output paths in checklist items when useful.
- Group checklist items into worker-ownable sections.
Per-Item Research Output
- Output root:
Docs/researches/Stage_*_AR/
- One doc per checklist item.
- Keep every doc inside its topic boundary.
- Filter every recommendation through the user design philosophy.
- Prioritize stable SOTA or mature frontier practice over unvalidated novelty.
- Favor decisions that reduce complexity, cognitive load, and future rework.
Optimization Guard
- Maintain
.cron/*state, logs, progress, heartbeat, last-message files.
- Enforce disk/log safety on every tick before worker spawn:
- default
MIN_FREE_GB=30; when the Data/root volume has less free space,
run cleanup and refuse to start new workers;
- default
DANGER_FREE_GB=15; below this threshold, write state
blocked_disk_space, run lightweight cleanup, and exit immediately;
- default
MAX_LOG_MB=20 for worker logs and MAX_KEEPALIVE_MB=5 for
keepalive/scheduler logs; retain only the tail after a file exceeds its cap;
- default
LOG_RETENTION_DAYS=3; delete old .log, .out, and .err files
under the cron root;
- default
WORKSPACE_TTL_HOURS=48; remove only stale, non-live
.cron/automation_repo* or .cron/**/workspaces/slot* directories;
- default
MAX_CRON_ROOT_GB=30; refuse new worker spawn when the cron root
remains above this threshold after cleanup;
- preserve every workspace whose path is referenced by a live selected
agent-runner process,
tmux, shell, or lock/pid file;
- record cleanup decisions in a bounded janitor log, never an unbounded cron log.
- Support parallel
tmux workers.
- Give each worker a disjoint, section-owned write scope.
- Reconcile worker section snapshots back into the main AR blueprint.
- Refresh today's todo after each successful merge.
- Classify empty or off-topic docs as failure.
- Clean up cron when all AR items are checked.
Cron Space Guard
Every generated optimization cron must include a repo-local janitor script, such as
.cron/scripts/cron_space_guard.sh. The optimization guard calls it from the
top of the guard, before any tmux or agent-runner launch.
Minimum behavior:
- Derive the cron root from the script path, independent of the caller's current
directory.
- Cap active logs by preserving the last
MAX_LOG_MB with tail -c, a temp
file, and atomic mv.
- Rotate or truncate scheduler redirection targets such as
keepalive.log
before appending output.
- Clean old logs and stale workspaces before checking the cron-root budget.
- Verify live worker paths with self-match-safe process checks before deleting
any automation repo or workspace.
- Return a distinct nonzero code for "budget exceeded"; exit without marking
optimization progress.
- Keep every default overrideable through environment variables.
Cleanup
- Remove only this repo's optimization cron line.
- Stop guard and worker
tmux sessions.
- With cleanup-on-complete enabled, remove repo-local
.cron/ and .ops/
artifacts created only for the optimization run.
- Keep the authoritative blueprint and completed research docs.
Agent Platform Compatibility
Generated optimization cron code must support Codex, Claude Code, Cursor,
Grok Build, opencode, OpenClaw, and Hermes via a single agent-runner
abstraction.
Default platform selection:
B3EHIVE_AGENT_PLATFORM=codex uses one independent interactive Codex TUI
process in a task-local tmux server with a private writable CODEX_HOME and
exactly one submitted and authenticated /goal for each admitted worker
generation. The target repository selects bounded executions or a persistent
worker pool. Bounded results stop their TUI; persistent goals remain live and
dead generations are replaced back to the exact target without exceeding its
hard cap. Every request remains attributed and capped. codex app-server,
shared Codex daemons, codex exec, and Codex without tmux are forbidden.
Nested agents are forbidden unless the target repository explicitly enables
and budgets them; every enabled child is an independent execution and consumes
the same global transport, turn, request-rate, in-flight, and outstanding-
request limits rather than hiding behind its parent worker.
B3EHIVE_AGENT_PLATFORM=claude uses claude -p.
B3EHIVE_AGENT_PLATFORM=cursor uses scripts/run_cursor_agent.py.
B3EHIVE_AGENT_PLATFORM=grok uses grok --always-approve --prompt-file.
B3EHIVE_AGENT_PLATFORM=opencode uses opencode run.
B3EHIVE_AGENT_PLATFORM=openclaw uses openclaw agent.
B3EHIVE_AGENT_PLATFORM=hermes uses hermes chat.
B3EHIVE_AGENT_PLATFORM=auto may choose the first installed CLI from Codex,
then Claude Code, then Cursor, then Grok Build, then opencode, then
OpenClaw, then Hermes.
Default command templates:
# Codex interactive TUI
codex_argv=(codex -C "$WORKER_REPO" -c features.goals=true --no-alt-screen)
[[ -n "${CODEX_MODEL:-}" ]] && codex_argv+=(-m "$CODEX_MODEL")
[[ -n "${CODEX_REASONING_EFFORT:-}" ]] && \
codex_argv+=(-c "model_reasoning_effort=$CODEX_REASONING_EFFORT")
[[ -n "${CODEX_SERVICE_TIER:-}" ]] && \
codex_argv+=(-c "service_tier=$CODEX_SERVICE_TIER")
tmux -S "$TASK_ROOT/tmux.sock" -f /dev/null new-session -d \
-s "$SESSION" -c "$WORKER_REPO" \
env CODEX_HOME="$TASK_ROOT/codex-home" "${codex_argv[@]}"
# Wait for the composer, paste one short /goal with a claim-specific final
# token, poll joined composer text until that token is visible, submit once,
# then authenticate route/cwd/thread/goal before counting this lane as live.
tmux -S "$TASK_ROOT/tmux.sock" set-buffer -b goal \
"/goal $GOAL Integrity token: $GOAL_COMPLETION_TOKEN"
tmux -S "$TASK_ROOT/tmux.sock" paste-buffer -b goal -t "$SESSION" -d
# Generated controller polls `capture-pane -p -J`; timeout fails without Enter.
tmux -S "$TASK_ROOT/tmux.sock" send-keys -t "$SESSION" C-m
# Claude Code
claude -p --model "${CLAUDE_MODEL:-sonnet}" --effort "${CLAUDE_EFFORT:-max}" \
--permission-mode "${CLAUDE_PERMISSION_MODE:-auto}" \
--add-dir "$WORKER_REPO" < "$PROMPT_FILE" > "$OUTPUT_FILE"
# Cursor
python3 "$B3EHIVE_ROOT/scripts/run_cursor_agent.py" \
--workspace "$WORKER_REPO" --prompt-file "$PROMPT_FILE" > "$OUTPUT_FILE"
# Grok Build
GROK_TELEMETRY_ENABLED=0 GROK_TELEMETRY_TRACE_UPLOAD=0 \
grok --always-approve --cwd "$WORKER_REPO" --prompt-file "$PROMPT_FILE" \
${GROK_MODEL:+-m "$GROK_MODEL"} ${GROK_EFFORT:+--effort "$GROK_EFFORT"} \
> "$OUTPUT_FILE"
# opencode
opencode run --dir "$WORKER_REPO" ${OPENCODE_MODEL:+--model "$OPENCODE_MODEL"} \
${OPENCODE_VARIANT:+--variant "$OPENCODE_VARIANT"} \
${OPENCODE_AGENT:+--agent "$OPENCODE_AGENT"} \
< "$PROMPT_FILE" > "$OUTPUT_FILE"
# OpenClaw
openclaw ${OPENCLAW_PROFILE:+--profile "$OPENCLAW_PROFILE"} agent --local \
${OPENCLAW_AGENT:+--agent "$OPENCLAW_AGENT"} \
${OPENCLAW_THINKING:+--thinking "$OPENCLAW_THINKING"} \
--message "$(cat "$PROMPT_FILE")" > "$OUTPUT_FILE"
# Hermes
hermes chat ${HERMES_MODEL:+--model "$HERMES_MODEL"} \
--toolsets "${HERMES_TOOLSETS:-skills,terminal}" \
${HERMES_SKILLS:+-s "$HERMES_SKILLS"} \
-q "$(cat "$PROMPT_FILE")" > "$OUTPUT_FILE"
Validate-only output must print the selected platform and resolved runner. If
B3EHIVE_AGENT_RUNNER is set, use it instead of the default template.
Batch Rules
- Prefer exactly 5 workers when the blueprint partitions cleanly into 5 sections.
- Each worker owns one section only.
- Workers may update only:
- their owned section in the clone-local AR blueprint
- their owned output directory under
Docs/researches/Stage_*_AR/
- Only the guard merge step updates the main repo's authoritative blueprint.
- State the design philosophy, completion rules, and owned output scope in every
worker prompt.
Validation
Readiness requires:
bash -n on all created shell scripts
- one authoritative AR blueprint generation pass
- one daily todo generation pass
- one
VALIDATE_ONLY=1 guard run
crontab -l verification after install
tmux ls verification after worker launch
- non-empty output verification for completed items
Repair Rules
For an incorrect AR blueprint:
- Stop workers.
- Regenerate the blueprint from the same design philosophy and source scope.
- Preserve existing
[x] marks only when the corresponding research docs
still exist and remain non-empty.
- Regenerate today's todo before resuming.
For a broad, non-item-pure worker doc:
- Keep the item incomplete.
- Split the checklist item or narrow the doc title and scope.
- Rerun only the affected section.
Looper Embed Rules
When embedded in looper-cron-builder, optimization runs operate only inside
an active ResourceLease with a ParentLeaseRef. Use nested optimization for
periodic architecture refinement, design-philosophy research refresh, or
strategy/blueprint bridge refinement.
Nested optimization runs cannot write [x] or escape the parent lease budget;
they produce reward candidates only. They should attach to a looper
BridgeSurface with bridge_level=strategy or bridge_level=blueprint. Output
must change a real decision surface before it can count as reward.
Reusable instrument improvements for skills, scaffolds, validators, prompt/hook
engineering, route policy, or coding-tool adapters should produce looper_log
refs. Logs should separate target feedback from instrument feedback so review
can distinguish design-target difficulty from optimization-machinery complexity.
Local References
Read only the references required by the current task:
references/optimization-pattern.md
references/repair-playbook.md
1---2name: optimization-cron-builder3description: Build or repair a design-idea-guided optimization cron for a repository. Use when the user provides a design philosophy and wants a Stage_*_AR_Blueprint.md with at most 100 checklist items, per-item SOTA optimization research docs under Docs/researches/Stage_*_AR/, parallel tmux workers, Codex, Claude Code, Cursor, Grok Build, opencode, OpenClaw, or Hermes agent-runner batches, and cleanup-on-complete.4---56# Optimization Cron Builder78## Overview910Build a repository-local optimization research pipeline. Continuously apply a11user-supplied design philosophy to one stage blueprint, derive a bounded AR12checklist, write one research doc per item, track progress, run parallel `tmux`13workers through the selected agent runner, and remove the cron setup when the14AR blueprint is complete. Product-code implementation stays outside this15pipeline.1617`AR` means `Architecture Refinement`. The pipeline supports any stage-specific18optimization blueprint.1920## Output Discipline And Anti-Slop Contract2122- Start with the requested AR artifact, design decision, evidence, action,23 validation result, or executable instruction.24- Give each sentence one concrete payload: design constraint, repository fact,25 optimization item, decision, action, result, evidence, or consequence.26- State verification through its result, evidence, and consequence.27 Omit process narration, opening meta-commentary, routine check narration,28 motivational filler, restatements, and closing recaps.29- Use direct, positive statements when they preserve the truth conditions. Keep30 technical negation that defines scope exclusions, permissions, disk and log31 gates, failure behavior, cleanup safety, or acceptance rules.32- Omit relationship or causal claims unsupported by repository, research, or33 validator evidence. Handle material uncertainty under the next rule; leave no34 speculative transition or placeholder.35- When unresolved uncertainty changes correctness, safety, legality, an AR36 decision, or the available action, state the exact unknown, condition, and37 consequence.38- Keep the response body within 10% above or below an explicit target length.39 Without a target, use the shortest complete form that preserves required AR40 artifacts, evidence, decisions, actions, and consequences.41- Include a boundary statement only when it changes correctness, safety,42 legality, or the available action. Name the exact constraint and permitted43 path.44- Before delivery, silently inspect every character for filler, duplicated45 safeguards, unsupported claims, vague predicates, stale placeholders,46 fabricated evidence, section completeness, and length.47- Treat state marks, paths, environment variables, commands, thresholds,48 platform names, stage names, and validator-dependent strings as contract49 data; preserve their exact spelling.5051## Shared b3ehive Contract5253Follow `../looper-cron-builder/references/b3ehive-bridge-contract.md` for route54selection, estimator decisions, nested calls, evidence handoff, `looper_log`55capture, ROI, and self-evolution.5657Local obligations:5859- Optimization docs and AR items remain `[_]` evidence until the owning master60 lane accepts them.61- Nontrivial automatic item-count, worker-grouping, route, research-depth, and62 simplification choices should leave `EstimatorPolicy` and `RouteDecision`63 evidence.64- Recurring skill text bloat,65 scaffold overdesign, validator/hook drift, prompt-block sprawl, route waste,66 or tool-integration friction produces a `looper_log`.67- Each `looper_log` must identify the refined `TargetObject` and the68 signal-producing `InstrumentObject`: AR grain, design rule, route, validator,69 scaffold, prompt/hook artifact, tool, or skill composition.70- Optimization may propose simplification or instrument improvements. Every71 looper-log-derived change to skill text, policy, scaffold, or tooling requires72 EvidenceLint, ROI, ParetoGate, rollback, and master `[x]`.7374## Workflow75761. Inspect the target repository and identify the stage's single authoritative77 blueprint source.782. Capture the user-supplied design philosophy in one short stable sentence.793. Generate one authoritative `Docs/Stage_*_AR_Blueprint.md` with:80 - a bounded checklist count;81 - exactly one item per optimization topic;82 - no more than 100 items;83 - worker-ownable grouped sections.844. Gate every `[ ]` item on a corresponding doc under85 `Docs/researches/Stage_*_AR/`. The doc must cover only that item, follow the86 design philosophy, use stable SOTA or mature frontier practice, and give87 concrete recommendations for the repository.885. Add repo-local `.ops/` and `.cron/` helpers; hide them from git where89 appropriate.906. Create AR blueprint tools, a daily todo generator, an optimization guard, a91 cron space/log guard, a worker runner, an install script, and a cleanup92 script.937. Run the guard once in `VALIDATE_ONLY=1`.948. Install cron only after validate-only succeeds and the disk/log budget guard95 passes.969. Start parallel `tmux` workers with disjoint section ownership.9710. After each worker batch, reconcile section snapshots into the authoritative98 AR blueprint and refresh today's todo.9911. At full AR completion, remove cron entries and stop `tmux` sessions. Remove100 repo-local cron helpers when cleanup is requested.101102## Required Components103104### AR Blueprint105106- Use exactly one authoritative AR blueprint file.107- Keep total checklist items `<= 100`.108- Set the research grain so one item maps to one optimization doc.109- Put stable repository-relative output paths in checklist items when useful.110- Group checklist items into worker-ownable sections.111112### Per-Item Research Output113114- Output root: `Docs/researches/Stage_*_AR/`115- One doc per checklist item.116- Keep every doc inside its topic boundary.117- Filter every recommendation through the user design philosophy.118- Prioritize stable SOTA or mature frontier practice over unvalidated novelty.119- Favor decisions that reduce complexity, cognitive load, and future rework.120121### Optimization Guard122123- Maintain `.cron/*state`, logs, progress, heartbeat, last-message files.124- Enforce disk/log safety on every tick before worker spawn:125 - default `MIN_FREE_GB=30`; when the Data/root volume has less free space,126 run cleanup and refuse to start new workers;127 - default `DANGER_FREE_GB=15`; below this threshold, write state128 `blocked_disk_space`, run lightweight cleanup, and exit immediately;129 - default `MAX_LOG_MB=20` for worker logs and `MAX_KEEPALIVE_MB=5` for130 keepalive/scheduler logs; retain only the tail after a file exceeds its cap;131 - default `LOG_RETENTION_DAYS=3`; delete old `.log`, `.out`, and `.err` files132 under the cron root;133 - default `WORKSPACE_TTL_HOURS=48`; remove only stale, non-live134 `.cron/automation_repo*` or `.cron/**/workspaces/slot*` directories;135 - default `MAX_CRON_ROOT_GB=30`; refuse new worker spawn when the cron root136 remains above this threshold after cleanup;137 - preserve every workspace whose path is referenced by a live selected138 agent-runner process, `tmux`, shell, or lock/pid file;139 - record cleanup decisions in a bounded janitor log, never an unbounded cron log.140- Support parallel `tmux` workers.141- Give each worker a disjoint, section-owned write scope.142- Reconcile worker section snapshots back into the main AR blueprint.143- Refresh today's todo after each successful merge.144- Classify empty or off-topic docs as failure.145- Clean up cron when all AR items are checked.146147### Cron Space Guard148149Every generated optimization cron must include a repo-local janitor script, such as150`.cron/scripts/cron_space_guard.sh`. The optimization guard calls it from the151top of the guard, before any `tmux` or agent-runner launch.152153Minimum behavior:154- Derive the cron root from the script path, independent of the caller's current155 directory.156- Cap active logs by preserving the last `MAX_LOG_MB` with `tail -c`, a temp157 file, and atomic `mv`.158- Rotate or truncate scheduler redirection targets such as `keepalive.log`159 before appending output.160- Clean old logs and stale workspaces before checking the cron-root budget.161- Verify live worker paths with self-match-safe process checks before deleting162 any automation repo or workspace.163- Return a distinct nonzero code for "budget exceeded"; exit without marking164 optimization progress.165- Keep every default overrideable through environment variables.166167### Cleanup168169- Remove only this repo's optimization cron line.170- Stop guard and worker `tmux` sessions.171- With cleanup-on-complete enabled, remove repo-local `.cron/` and `.ops/`172 artifacts created only for the optimization run.173- Keep the authoritative blueprint and completed research docs.174175## Agent Platform Compatibility176177Generated optimization cron code must support Codex, Claude Code, Cursor,178Grok Build, opencode, OpenClaw, and Hermes via a single agent-runner179abstraction.180181Default platform selection:182- `B3EHIVE_AGENT_PLATFORM=codex` uses one independent interactive Codex TUI183 process in a task-local tmux server with a private writable `CODEX_HOME` and184 exactly one submitted and authenticated `/goal` for each admitted worker185 generation. The target repository selects bounded executions or a persistent186 worker pool. Bounded results stop their TUI; persistent goals remain live and187 dead generations are replaced back to the exact target without exceeding its188 hard cap. Every request remains attributed and capped. `codex app-server`,189 shared Codex daemons, `codex exec`, and Codex without tmux are forbidden.190 Nested agents are forbidden unless the target repository explicitly enables191 and budgets them; every enabled child is an independent execution and consumes192 the same global transport, turn, request-rate, in-flight, and outstanding-193 request limits rather than hiding behind its parent worker.194- `B3EHIVE_AGENT_PLATFORM=claude` uses `claude -p`.195- `B3EHIVE_AGENT_PLATFORM=cursor` uses `scripts/run_cursor_agent.py`.196- `B3EHIVE_AGENT_PLATFORM=grok` uses `grok --always-approve --prompt-file`.197- `B3EHIVE_AGENT_PLATFORM=opencode` uses `opencode run`.198- `B3EHIVE_AGENT_PLATFORM=openclaw` uses `openclaw agent`.199- `B3EHIVE_AGENT_PLATFORM=hermes` uses `hermes chat`.200- `B3EHIVE_AGENT_PLATFORM=auto` may choose the first installed CLI from Codex,201 then Claude Code, then Cursor, then Grok Build, then opencode, then202 OpenClaw, then Hermes.203204Default command templates:205206```bash207# Codex interactive TUI208codex_argv=(codex -C "$WORKER_REPO" -c features.goals=true --no-alt-screen)209[[ -n "${CODEX_MODEL:-}" ]] && codex_argv+=(-m "$CODEX_MODEL")210[[ -n "${CODEX_REASONING_EFFORT:-}" ]] && \211 codex_argv+=(-c "model_reasoning_effort=$CODEX_REASONING_EFFORT")212[[ -n "${CODEX_SERVICE_TIER:-}" ]] && \213 codex_argv+=(-c "service_tier=$CODEX_SERVICE_TIER")214tmux -S "$TASK_ROOT/tmux.sock" -f /dev/null new-session -d \215 -s "$SESSION" -c "$WORKER_REPO" \216 env CODEX_HOME="$TASK_ROOT/codex-home" "${codex_argv[@]}"217# Wait for the composer, paste one short /goal with a claim-specific final218# token, poll joined composer text until that token is visible, submit once,219# then authenticate route/cwd/thread/goal before counting this lane as live.220tmux -S "$TASK_ROOT/tmux.sock" set-buffer -b goal \221 "/goal $GOAL Integrity token: $GOAL_COMPLETION_TOKEN"222tmux -S "$TASK_ROOT/tmux.sock" paste-buffer -b goal -t "$SESSION" -d223# Generated controller polls `capture-pane -p -J`; timeout fails without Enter.224tmux -S "$TASK_ROOT/tmux.sock" send-keys -t "$SESSION" C-m225226# Claude Code227claude -p --model "${CLAUDE_MODEL:-sonnet}" --effort "${CLAUDE_EFFORT:-max}" \228 --permission-mode "${CLAUDE_PERMISSION_MODE:-auto}" \229 --add-dir "$WORKER_REPO" < "$PROMPT_FILE" > "$OUTPUT_FILE"230231# Cursor232python3 "$B3EHIVE_ROOT/scripts/run_cursor_agent.py" \233 --workspace "$WORKER_REPO" --prompt-file "$PROMPT_FILE" > "$OUTPUT_FILE"234235# Grok Build236GROK_TELEMETRY_ENABLED=0 GROK_TELEMETRY_TRACE_UPLOAD=0 \237 grok --always-approve --cwd "$WORKER_REPO" --prompt-file "$PROMPT_FILE" \238 ${GROK_MODEL:+-m "$GROK_MODEL"} ${GROK_EFFORT:+--effort "$GROK_EFFORT"} \239 > "$OUTPUT_FILE"240241# opencode242opencode run --dir "$WORKER_REPO" ${OPENCODE_MODEL:+--model "$OPENCODE_MODEL"} \243 ${OPENCODE_VARIANT:+--variant "$OPENCODE_VARIANT"} \244 ${OPENCODE_AGENT:+--agent "$OPENCODE_AGENT"} \245 < "$PROMPT_FILE" > "$OUTPUT_FILE"246247# OpenClaw248openclaw ${OPENCLAW_PROFILE:+--profile "$OPENCLAW_PROFILE"} agent --local \249 ${OPENCLAW_AGENT:+--agent "$OPENCLAW_AGENT"} \250 ${OPENCLAW_THINKING:+--thinking "$OPENCLAW_THINKING"} \251 --message "$(cat "$PROMPT_FILE")" > "$OUTPUT_FILE"252253# Hermes254hermes chat ${HERMES_MODEL:+--model "$HERMES_MODEL"} \255 --toolsets "${HERMES_TOOLSETS:-skills,terminal}" \256 ${HERMES_SKILLS:+-s "$HERMES_SKILLS"} \257 -q "$(cat "$PROMPT_FILE")" > "$OUTPUT_FILE"258```259260Validate-only output must print the selected platform and resolved runner. If261`B3EHIVE_AGENT_RUNNER` is set, use it instead of the default template.262263## Batch Rules264265- Prefer exactly 5 workers when the blueprint partitions cleanly into 5 sections.266- Each worker owns one section only.267- Workers may update only:268 - their owned section in the clone-local AR blueprint269 - their owned output directory under `Docs/researches/Stage_*_AR/`270- Only the guard merge step updates the main repo's authoritative blueprint.271- State the design philosophy, completion rules, and owned output scope in every272 worker prompt.273274## Validation275276Readiness requires:277278- `bash -n` on all created shell scripts279- one authoritative AR blueprint generation pass280- one daily todo generation pass281- one `VALIDATE_ONLY=1` guard run282- `crontab -l` verification after install283- `tmux ls` verification after worker launch284- non-empty output verification for completed items285286## Repair Rules287288For an incorrect AR blueprint:2892901. Stop workers.2912. Regenerate the blueprint from the same design philosophy and source scope.2923. Preserve existing `[x]` marks only when the corresponding research docs293 still exist and remain non-empty.2944. Regenerate today's todo before resuming.295296For a broad, non-item-pure worker doc:2972981. Keep the item incomplete.2992. Split the checklist item or narrow the doc title and scope.3003. Rerun only the affected section.301302## Looper Embed Rules303304When embedded in `looper-cron-builder`, optimization runs operate only inside305an active `ResourceLease` with a `ParentLeaseRef`. Use nested optimization for306periodic architecture refinement, design-philosophy research refresh, or307strategy/blueprint bridge refinement.308309Nested optimization runs cannot write `[x]` or escape the parent lease budget;310they produce reward candidates only. They should attach to a looper311`BridgeSurface` with `bridge_level=strategy` or `bridge_level=blueprint`. Output312must change a real decision surface before it can count as reward.313314Reusable instrument improvements for skills, scaffolds, validators, prompt/hook315engineering, route policy, or coding-tool adapters should produce `looper_log`316refs. Logs should separate target feedback from instrument feedback so review317can distinguish design-target difficulty from optimization-machinery complexity.318319## Local References320321Read only the references required by the current task:322323- `references/optimization-pattern.md`324- `references/repair-playbook.md`