- Update .agents/MULTI_AGENT_RULES.md & .ko.md to align with TMUX concepts
- Add .agents/INSTALL.md guide for MAM setup and workflows
- Clean up legacy markdown reports under .agents/reports/
- Refactor MAM scripts in .agents/skills/ (rename resolve_herdr_session to resolve_herdr_workspace)
- Improve workspace pane splitting/re-use logic in lib.sh
- Reduce paste safety sleep in send_keys_safe and support linking ~/.claude.json
Applies the P0-P3 fixes from the multi-agent-mux-loop audit
(.mam/jobs/ab686e47/claude-reports/report-final.md):
- P0-1: capture BASE_COMMIT before Phase 2 and diff against it, so reviewer
diffs stay non-empty and cumulative even after the Creator commits per the
documented DoD (bare `git diff` alone showed nothing once committed).
- P0-2: has_verdict now matches only the report's last non-blank line, so a
stray [VERDICT: ...] token quoted mid-report as a formatting example can no
longer flip the outcome.
- P1-1: replace the English-only refactor/complex/design/architect keyword
sniff (dead code against Korean-language reviewer reports) with an explicit
[ESCALATE: PLANNER] tag the reviewer prompt now asks for.
- P1-2: resolve_all_reviewers/resolve_agent_type/resolve_planner_session now
read through lib.sh's load_state_json single source of truth instead of
each hand-rolling its own SQLite+YAML lookup; resolve_agent_type's name
fallback matches exact hyphen segments instead of a substring `in` check.
- P2-1: warn when --all-reviewer and --reviewer are both given, since the
latter is silently discarded.
- P2-2: correct the SKILL.md CLI-mapping table row that overstated an
automated lint gate and an unconditional Planner feedback loop.
- P3: fix lib.sh shellcheck SC2164 (unguarded cd in start_watchdog) and
annotate the intentional SC2317 dual source/exec guard.
Verified: shellcheck clean on both scripts, bash -n syntax OK, and the
rewritten has_verdict/resolve_* functions were unit-tested against this
repo's live .mam/agent-sessions state.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Implement a clean_surrogates helper inside lib.sh's load_state_json function
to recursively replace lone surrogates (e.g. from partial TUI screen dumps)
with replacement chars before printing, preventing UnicodeEncodeError on stdout.
- Allow slow-starting node standalone CLI processes to boot without false-positive timeouts
- Mitigate disk I/O constraints on isolated DB provisioning
- Align symlink and copy paths directly under isolation root (no data/ intermediate directory)
- Correctly restore global settings and SQLite databases for standalone CLI execution
- Symlink all database files inside data/db/ under isolation root
- Prevent cline CLI from bouncing back to the initial Welcome provider selection screen
- Extract load_state_json centralized helper inside lib.sh to unify state querying
- Refactor status, resume, stop, and monitor scripts to fetch state via MAM_STATE_JSON env var to avoid stdin pipeline collisions
- Restructure delegate-job to provision .mam/jobs/<job_id>/brief.md and direct agents to it, minimizing token size and preventing TUI paste freezes
- Harden send_keys_safe submission loop with was_popup state capture and edge case guards, preventing timing spin false-positives
- Passed cross-verification approved PASS from Planner Claude session
- Add 'Resuming the full session' and 'Resume from summary' patterns to TUI validation constants
- Update handle_startup_dialogs to automatically submit the choice on large-session warnings, preventing start/resume lockups
- OP-1: Implement reactive _wait_session_gone in lib.sh and stop_session.sh with set -e || true guard
- OP-2: Event-driven MQTT subscribe handshake with sub_pid liveness in delegate-job
- OP-3: Replace CPU time.sleep(0.5) spin with threading.Event wait in reconcile.sh
- OP-4: Define mam_tmux dispatcher targeting resolved _REAL_TMUX_PATH to prevent recursion
- OP-6 & OP-7: Add token variables and bash version source check in lib.sh
- Integrate approved optimization plan and PASS review reports from all agents
- Introduce _pane_tail content helper to filter blank-padded lines in tmux captures
- Apply _pane_tail to _pane_dialog_open, handle_startup_dialogs, and send_keys_safe
- Fix rc status expansion logic in create_session.sh instructions injection check
- Include 3-agent final prompt-lock verification reports
- Add send_keys_safe + quiescence/dialog-detection helpers to lib.sh:
keys are sent on pane evidence, never fixed timers; distinct exit
codes 1-4; dialogs are never blindly Enter-ed
- inject_instructions delegates to send_keys_safe; create --submit-job
publishes a terminal error event on delivery failure (no zombie jobs)
- wait_for_tui_ready: drop dialog-ambiguous tokens, treat open dialogs
as not-ready, return 1 on timeout instead of proceeding
- delegate-job wrapper: replace copy-pasted raw paste/C-m block with
lib.sh send_keys_safe (restores single source of truth)
- resume: conditional signature-gated dialog handling replaces blind
Enter/Down/Enter; stop --graceful delivers exitkey safely, fallback
chain unchanged
- create SKILL: passive capture-pane probe instead of stray Enter
- Mark FW-W2 resolved; add 3-agent analysis/plan reports
- lib.sh: update atomic_dump_yaml to sync with YAML on any active session status change; set reader timeouts to 60.0s
- create_session.sh: add exit trap cleanup_tmux_on_error to rollback spawned tmux sessions on initialization failures
- reconcile.sh, update_yaml_resumed.sh, status.sh, stop_session.sh: align SQLite connection timeout values to 60.0s