moo.agent.brain.plans

Plan persistence helpers — traversal plan and build plan YAML I/O. See docs/source/explanation/agent-internals.md (Plan Persistence).

All functions accept config_dir (None → no-op), state, and an on_thought callback for diagnostic output.

Functions

clear_dispatch_state(config_dir)

Remove the persisted dispatch state file (used when a chain pass ends).

extract_room_names_from_yaml(text)

Extract top-level room names (2-space indent) from a build plan YAML string.

load_dispatch_state(config_dir, state, ...)

Restore token_dispatched_to / token_dispatched_at if recent.

load_latest_build_plan(config_dir, state, ...)

Reload room names from the most recent builds/*.yaml build plan.

load_traversal_plan(config_dir, state, ...)

Restore state.current_plan from builds/traversal_plan.txt.

save_build_plan(config_dir, state, ...)

Write a build plan to builds/YYYY-MM-DD-HH-MM.yaml.

save_dispatch_state(config_dir, state, ...)

Persist Foreman's current token-dispatch target to dispatch.json.

save_traversal_plan(config_dir, state, ...)

Persist state.current_plan to builds/traversal_plan.txt.