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>
Update the multi-agent workflow guidelines to explicitly specify that
agent sessions should not be stopped automatically upon receiving a PASS
verdict. Instead, they must remain in a standby (running) state, awaiting
further task instructions from the user, consistent with the project's
lifecycle charter.
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.
Correct scripts/generate-env.sh -> deploy/generate-env.sh and update shellcheck unlinted count in both English and Korean versions, as eb733cf already resolved the generate-env.sh lint gap.
Addresses Reviewer Claude's non-blocking nit.
- 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
- Update default ISOLATE value to 1 in create_session.sh
- Add --no-isolate option to allow opting out of directory isolation if desired
- Keep --isolate flag for legacy syntax compatibility
- Align step label languages to Korean (R-2)
- Reintroduce -r $UUID and --dangerously-skip-permissions to claude spawn (R-1)
- Add isolation environment path mapping caveats pointing back to authorative SKILL.md (R-3)
- Modify reconcile.sh mutation logic to clear delegate_job_id instead of calling tmux kill-session on 'completed' events
- Retain process termination behavior on 'error' events for safety
- Port .venv creation and dependency pip install bootstrap sequence from deploy/install.sh into scripts/install_mam.sh
- Include .env.example and scripts/generate-env.sh copies under rsync target deployment
- Add .venv/ to target gitignore list to prevent virtualenv bloating
- Add empty-UUID resume safety guard in INSTALL.md
- Sanitize clean_session in loop path report-final.md Output Report Path to prevent colon characters in folders
- Reconcile automated reports path token in MULTI_AGENT_RULES.md and .ko.md from <agent-session> to <agent_name> or <clean_session_name>
- 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
- Wrap inject_instructions with safe || rc=0 under set -e to prevent premature exit
- Ensure terminal error events are published on instruction injection failure
- Update 2-reviewers final review reports with Round 3 PASS verdicts
- 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