refactor: migrate skills/ directory to .agents/skills/
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
# atomic_dump_yaml. Never `open(yaml_path, 'w')` anywhere else.
|
# atomic_dump_yaml. Never `open(yaml_path, 'w')` anywhere else.
|
||||||
|
|
||||||
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
WORKSPACE_ROOT="$(cd "$SKILL_DIR/.." && pwd)"
|
WORKSPACE_ROOT="$(cd "$SKILL_DIR/../.." && pwd)"
|
||||||
AGENT_SESSIONS_YAML="${AGENT_SESSIONS_YAML:-$WORKSPACE_ROOT/.hermes/agent-sessions.yaml}"
|
AGENT_SESSIONS_YAML="${AGENT_SESSIONS_YAML:-$WORKSPACE_ROOT/.hermes/agent-sessions.yaml}"
|
||||||
|
|
||||||
# Workspace-relative defaults with environment overrides (Phase Z)
|
# Workspace-relative defaults with environment overrides (Phase Z)
|
||||||
@@ -28,7 +28,7 @@ LOCAL_BIN="${LOCAL_BIN:-$HOME/.local/bin}"
|
|||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# Paths to exclude when resolving the real tmux binary (shim/wrapper dirs).
|
# Paths to exclude when resolving the real tmux binary (shim/wrapper dirs).
|
||||||
_TMUX_SHIM_DIR_PATTERN="${_TMUX_SHIM_DIR_PATTERN:-/multi-agent-tmux-shim/}"
|
_TMUX_SHIM_DIR_PATTERN="${_TMUX_SHIM_DIR_PATTERN:-/multi-agent-tmux-shim/}"
|
||||||
_TMUX_SKILLS_BIN_PATTERN="${_TMUX_SKILLS_BIN_PATTERN:-/skills/.bin}"
|
_TMUX_SKILLS_BIN_PATTERN="${_TMUX_SKILLS_BIN_PATTERN:-/.agents/skills/.bin}"
|
||||||
|
|
||||||
TMUX_SERVER_NAME="${TMUX_SERVER_NAME:-default}"
|
TMUX_SERVER_NAME="${TMUX_SERVER_NAME:-default}"
|
||||||
|
|
||||||
@@ -652,7 +652,7 @@ PYEOF
|
|||||||
# skill tree is relocatable — no hardcoded absolute paths (review item 6).
|
# skill tree is relocatable — no hardcoded absolute paths (review item 6).
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
# _delegate_py_bin — echo the virtualenv python (walk up from skills/), else python3.
|
# _delegate_py_bin — echo the virtualenv python (walk up from .agents/skills/), else python3.
|
||||||
_delegate_py_bin() {
|
_delegate_py_bin() {
|
||||||
# Return cached result if available (shell variable, not exported — avoids cross-workspace pollution)
|
# Return cached result if available (shell variable, not exported — avoids cross-workspace pollution)
|
||||||
if [ -n "${AGENT_PYTHON_BIN:-}" ] && [ -x "$AGENT_PYTHON_BIN" ]; then
|
if [ -n "${AGENT_PYTHON_BIN:-}" ] && [ -x "$AGENT_PYTHON_BIN" ]; then
|
||||||
@@ -672,7 +672,7 @@ _delegate_py_bin() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# _delegate_script <name> — echo the path to a tmux-agent-orchestrate-delegate-job script, resolved
|
# _delegate_script <name> — echo the path to a tmux-agent-orchestrate-delegate-job script, resolved
|
||||||
# relative to skills/ (lib.sh dir). Empty if not found.
|
# relative to .agents/skills/ (lib.sh dir). Empty if not found.
|
||||||
_delegate_script() {
|
_delegate_script() {
|
||||||
local name="$1" skill_dir cand
|
local name="$1" skill_dir cand
|
||||||
skill_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
skill_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
@@ -690,7 +690,7 @@ delegate_submit_job() {
|
|||||||
py_bin="$(_delegate_py_bin)"
|
py_bin="$(_delegate_py_bin)"
|
||||||
registry_py="$(_delegate_script registry.py)"
|
registry_py="$(_delegate_script registry.py)"
|
||||||
if [ -z "$registry_py" ] || [ ! -f "$registry_py" ]; then
|
if [ -z "$registry_py" ] || [ ! -f "$registry_py" ]; then
|
||||||
echo "ERROR: tmux-agent-orchestrate-delegate-job registry.py not found under skills/" >&2
|
echo "ERROR: tmux-agent-orchestrate-delegate-job registry.py not found under .agents/skills/" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
"$py_bin" "$registry_py" register \
|
"$py_bin" "$registry_py" register \
|
||||||
@@ -723,7 +723,7 @@ delegate_publish_event() {
|
|||||||
start_watchdog() {
|
start_watchdog() {
|
||||||
local job_id="$1"
|
local job_id="$1"
|
||||||
local workdir="${2:-$PWD}"
|
local workdir="${2:-$PWD}"
|
||||||
local watchdog_script="$workdir/skills/tmux-agent-orchestrate-monitor/scripts/watchdog.sh"
|
local watchdog_script="$workdir/.agents/skills/tmux-agent-orchestrate-monitor/scripts/watchdog.sh"
|
||||||
local log_file="$workdir/.hermes/jobs/${job_id}.watchdog.log"
|
local log_file="$workdir/.hermes/jobs/${job_id}.watchdog.log"
|
||||||
|
|
||||||
if [ ! -x "$watchdog_script" ]; then
|
if [ ! -x "$watchdog_script" ]; then
|
||||||
+2
-2
@@ -98,7 +98,7 @@ tmc ls # Lists only your multi-agent sessions
|
|||||||
```bash
|
```bash
|
||||||
WORKSPACE=/path/to/project
|
WORKSPACE=/path/to/project
|
||||||
AGENT=claude # or agy
|
AGENT=claude # or agy
|
||||||
source skills/lib.sh
|
source .agents/skills/lib.sh
|
||||||
SESSION_NAME="$(derive_session_name "$WORKSPACE" "$AGENT")"
|
SESSION_NAME="$(derive_session_name "$WORKSPACE" "$AGENT")"
|
||||||
|
|
||||||
# 1. If session already alive, fail fast
|
# 1. If session already alive, fail fast
|
||||||
@@ -172,7 +172,7 @@ After spawn, append a new `tmux_sessions[]` entry to `.hermes/agent-sessions.yam
|
|||||||
Use the `agent-sessions-yaml-edit` script in `scripts/` to safely append (preserves comments + format):
|
Use the `agent-sessions-yaml-edit` script in `scripts/` to safely append (preserves comments + format):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash skills/tmux-agent-orchestrate-create/scripts/create_session.sh \
|
bash .agents/skills/tmux-agent-orchestrate-create/scripts/create_session.sh \
|
||||||
--workspace "$WORKSPACE" --agent "$AGENT" --session "$SESSION_NAME"
|
--workspace "$WORKSPACE" --agent "$AGENT" --session "$SESSION_NAME"
|
||||||
```
|
```
|
||||||
|
|
||||||
+1
-1
@@ -102,7 +102,7 @@ propagated to the agent"). When you need finer control, the manual flow is:
|
|||||||
```bash
|
```bash
|
||||||
# Manual 5-step (same outcome, more knobs)
|
# Manual 5-step (same outcome, more knobs)
|
||||||
PY=.venv/bin/python
|
PY=.venv/bin/python
|
||||||
SKILL=./skills/tmux-agent-orchestrate-delegate-job/scripts
|
SKILL=./.agents/skills/tmux-agent-orchestrate-delegate-job/scripts
|
||||||
|
|
||||||
# 1) register
|
# 1) register
|
||||||
JID=$($PY "$SKILL/registry.py" register \
|
JID=$($PY "$SKILL/registry.py" register \
|
||||||
+7
-7
@@ -79,7 +79,7 @@ If the user comments `stop` or `stop monitoring` on this card, call `kanban_bloc
|
|||||||
|
|
||||||
If you find that a Claude session's `claude_session_id_own` is null but there's a new *.jsonl in the project dir, read the sessionId from the first line and update the YAML.
|
If you find that a Claude session's `claude_session_id_own` is null but there's a new *.jsonl in the project dir, read the sessionId from the first line and update the YAML.
|
||||||
|
|
||||||
Use the helper script at skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh for the YAML updates — it handles all the merge logic and writes a structured comment to this card.
|
Use the helper script at .agents/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh for the YAML updates — it handles all the merge logic and writes a structured comment to this card.
|
||||||
EOF
|
EOF
|
||||||
)"
|
)"
|
||||||
```
|
```
|
||||||
@@ -94,17 +94,17 @@ The worker calls this script every 30s. It:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Reconcile + auto-update YAML (atomic, flock-guarded). Emits JSON drift to stdout.
|
# Reconcile + auto-update YAML (atomic, flock-guarded). Emits JSON drift to stdout.
|
||||||
bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --once --emit-diff
|
bash .agents/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --once --emit-diff
|
||||||
|
|
||||||
# Read-only: compute drift WITHOUT writing the YAML (use for "what's running?" checks).
|
# Read-only: compute drift WITHOUT writing the YAML (use for "what's running?" checks).
|
||||||
bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --once --emit-diff --dry-run
|
bash .agents/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --once --emit-diff --dry-run
|
||||||
|
|
||||||
# Push-based MQTT Monitor: listen to delegated job events on the broker and update the YAML instantly.
|
# Push-based MQTT Monitor: listen to delegated job events on the broker and update the YAML instantly.
|
||||||
# Bounded run that exits after 5 min idle, or 1 h wall-clock; falls back to polling if the broker is down.
|
# Bounded run that exits after 5 min idle, or 1 h wall-clock; falls back to polling if the broker is down.
|
||||||
bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --subscribe --idle-timeout 300 --timeout 3600
|
bash .agents/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --subscribe --idle-timeout 300 --timeout 3600
|
||||||
|
|
||||||
# Persistent monitor (no timeouts): runs until interrupted; still polls if the broker is unreachable.
|
# Persistent monitor (no timeouts): runs until interrupted; still polls if the broker is unreachable.
|
||||||
bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --subscribe --idle-timeout 0
|
bash .agents/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --subscribe --idle-timeout 0
|
||||||
```
|
```
|
||||||
|
|
||||||
Flags: `--once` (single pass), `--emit-diff` (print JSON), `--dry-run` (P1-E — no mutation), `--subscribe` (push-based MQTT subscription monitoring). `--subscribe` sub-flags: `--timeout N` (exit after N seconds of wall-clock; `0` = no limit, default), `--idle-timeout N` (exit after N seconds with no message; default `3600`, `0` = never idle-out). On a broker connection failure (connect error **or** non-zero CONNACK), `--subscribe` falls back to a polling loop that re-runs `--once --emit-diff` every `RECONCILE_POLL_INTERVAL` (default 15) seconds until `--timeout`. Terminal-event YAML updates are written through `lib.sh::atomic_dump_yaml` (flock + schema-validate + `.bak`). There are **no** `--workspace` / `--agent` / `--comment-card` flags; the worker turns the emitted JSON `drifts[]` into `kanban_comment` calls itself.
|
Flags: `--once` (single pass), `--emit-diff` (print JSON), `--dry-run` (P1-E — no mutation), `--subscribe` (push-based MQTT subscription monitoring). `--subscribe` sub-flags: `--timeout N` (exit after N seconds of wall-clock; `0` = no limit, default), `--idle-timeout N` (exit after N seconds with no message; default `3600`, `0` = never idle-out). On a broker connection failure (connect error **or** non-zero CONNACK), `--subscribe` falls back to a polling loop that re-runs `--once --emit-diff` every `RECONCILE_POLL_INTERVAL` (default 15) seconds until `--timeout`. Terminal-event YAML updates are written through `lib.sh::atomic_dump_yaml` (flock + schema-validate + `.bak`). There are **no** `--workspace` / `--agent` / `--comment-card` flags; the worker turns the emitted JSON `drifts[]` into `kanban_comment` calls itself.
|
||||||
@@ -180,7 +180,7 @@ The `--body` of the dispatched task IS the worker's behavior spec. Here's a test
|
|||||||
## Loop (every 30s)
|
## Loop (every 30s)
|
||||||
|
|
||||||
1. Read agent-sessions.yaml
|
1. Read agent-sessions.yaml
|
||||||
2. Bash: `bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff`
|
2. Bash: `bash .agents/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff`
|
||||||
3. Parse the JSON diff from stdout
|
3. Parse the JSON diff from stdout
|
||||||
4. If `drifts` is non-empty:
|
4. If `drifts` is non-empty:
|
||||||
- For each drift, call `kanban_comment` with the diff message
|
- For each drift, call `kanban_comment` with the diff message
|
||||||
@@ -226,7 +226,7 @@ When using `--subscribe` with the default PoC public broker
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run reconcile once and inspect output
|
# Run reconcile once and inspect output
|
||||||
bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff --once \
|
bash .agents/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff --once \
|
||||||
| python3 -m json.tool
|
| python3 -m json.tool
|
||||||
```
|
```
|
||||||
|
|
||||||
+1
-1
@@ -74,7 +74,7 @@ else:
|
|||||||
d = os.getcwd()
|
d = os.getcwd()
|
||||||
while d and d != '/':
|
while d and d != '/':
|
||||||
hit = None
|
hit = None
|
||||||
for sub in (('skills', 'tmux-agent-orchestrate-delegate-job', 'scripts'), ('tmux-agent-orchestrate-delegate-job', 'scripts')):
|
for sub in (('.agents', 'skills', 'tmux-agent-orchestrate-delegate-job', 'scripts'), ('skills', 'tmux-agent-orchestrate-delegate-job', 'scripts'), ('tmux-agent-orchestrate-delegate-job', 'scripts')):
|
||||||
p = os.path.join(d, *sub)
|
p = os.path.join(d, *sub)
|
||||||
if os.path.isdir(p):
|
if os.path.isdir(p):
|
||||||
hit = p
|
hit = p
|
||||||
+2
-2
@@ -24,7 +24,7 @@ log "watchdog started for JOB=$JOB_ID workdir=$WORKDIR"
|
|||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
# 1) Get current job status with robust Python parsing
|
# 1) Get current job status with robust Python parsing
|
||||||
STATUS=$(cd "$WORKDIR" && .venv/bin/python skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py get --job "$JOB_ID" 2>/dev/null | python3 -c '
|
STATUS=$(cd "$WORKDIR" && .venv/bin/python .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py get --job "$JOB_ID" 2>/dev/null | python3 -c '
|
||||||
import sys, json
|
import sys, json
|
||||||
try:
|
try:
|
||||||
data = json.load(sys.stdin)
|
data = json.load(sys.stdin)
|
||||||
@@ -48,7 +48,7 @@ except Exception:
|
|||||||
log "starting subscriber (2min hard limit, log: $LOG_FILE)"
|
log "starting subscriber (2min hard limit, log: $LOG_FILE)"
|
||||||
|
|
||||||
(
|
(
|
||||||
cd "$WORKDIR" && timeout 120 .venv/bin/python skills/tmux-agent-orchestrate-delegate-job/scripts/job_subscriber.py \
|
cd "$WORKDIR" && timeout 120 .venv/bin/python .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/job_subscriber.py \
|
||||||
--job "$JOB_ID" --timeout 120 --idle-timeout 999999 --registry-dir .hermes/jobs > "$LOG_FILE" 2>&1
|
--job "$JOB_ID" --timeout 120 --idle-timeout 999999 --registry-dir .hermes/jobs > "$LOG_FILE" 2>&1
|
||||||
echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] subscriber exited" >> "$LOG_FILE"
|
echo "[$(date -u +'%Y-%m-%dT%H:%M:%SZ')] subscriber exited" >> "$LOG_FILE"
|
||||||
) &
|
) &
|
||||||
+3
-3
@@ -65,7 +65,7 @@ AGENT=claude # or agy or hermes
|
|||||||
SESSION_NAME=<workspace>-creator-<agent> # same convention as tmux-agent-orchestrate-create
|
SESSION_NAME=<workspace>-creator-<agent> # same convention as tmux-agent-orchestrate-create
|
||||||
|
|
||||||
# 1. Resolve the session id
|
# 1. Resolve the session id
|
||||||
UUID=$(bash skills/tmux-agent-orchestrate-resume/scripts/resolve_session_id.sh \
|
UUID=$(bash .agents/skills/tmux-agent-orchestrate-resume/scripts/resolve_session_id.sh \
|
||||||
--workspace "$WORKSPACE" --agent "$AGENT")
|
--workspace "$WORKSPACE" --agent "$AGENT")
|
||||||
|
|
||||||
if [ -z "$UUID" ]; then
|
if [ -z "$UUID" ]; then
|
||||||
@@ -74,7 +74,7 @@ if [ -z "$UUID" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Resolve the isolated tmux server name
|
# Resolve the isolated tmux server name
|
||||||
source skills/lib.sh
|
source .agents/skills/lib.sh
|
||||||
export TMUX_SERVER_NAME="$(resolve_tmux_server "$SESSION_NAME")"
|
export TMUX_SERVER_NAME="$(resolve_tmux_server "$SESSION_NAME")"
|
||||||
|
|
||||||
# 2. If tmux is alive, attach. Done.
|
# 2. If tmux is alive, attach. Done.
|
||||||
@@ -108,7 +108,7 @@ esac
|
|||||||
|
|
||||||
# 4. Update agent-sessions.yaml: status running, last_visible_status
|
# 4. Update agent-sessions.yaml: status running, last_visible_status
|
||||||
# (Also automatically publishes a `progress --detail "resumed"` event to the tmux-agent-orchestrate-delegate-job registry if a delegate_job_id exists)
|
# (Also automatically publishes a `progress --detail "resumed"` event to the tmux-agent-orchestrate-delegate-job registry if a delegate_job_id exists)
|
||||||
bash skills/tmux-agent-orchestrate-resume/scripts/update_yaml_resumed.sh \
|
bash .agents/skills/tmux-agent-orchestrate-resume/scripts/update_yaml_resumed.sh \
|
||||||
--session "$SESSION_NAME" --uuid "$UUID"
|
--session "$SESSION_NAME" --uuid "$UUID"
|
||||||
|
|
||||||
# 5. Attach
|
# 5. Attach
|
||||||
+1
-1
@@ -38,7 +38,7 @@ If `agent-sessions.yaml` doesn't exist or is malformed → print clear error, ex
|
|||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
bash skills/tmux-agent-orchestrate-status/scripts/status.sh [--json]
|
bash .agents/skills/tmux-agent-orchestrate-status/scripts/status.sh [--json]
|
||||||
```
|
```
|
||||||
|
|
||||||
The script:
|
The script:
|
||||||
+2
-2
@@ -24,9 +24,9 @@ if [ "$JSON" = "1" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Project root (parent of skills/) holds the tmux-agent-orchestrate-delegate-job .hermes registry.
|
# Project root (parent of .agents/) holds the tmux-agent-orchestrate-delegate-job .hermes registry.
|
||||||
# Resolved relative to this script — no hardcoded absolute path (review item 6).
|
# Resolved relative to this script — no hardcoded absolute path (review item 6).
|
||||||
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../../../" && pwd)"
|
||||||
|
|
||||||
DRIFT_JSON="$DRIFT_JSON" env_python "$AGENT_SESSIONS_YAML" PROJECT_ROOT="$PROJECT_ROOT" <<'PYEOF'
|
DRIFT_JSON="$DRIFT_JSON" env_python "$AGENT_SESSIONS_YAML" PROJECT_ROOT="$PROJECT_ROOT" <<'PYEOF'
|
||||||
import os, json, glob
|
import os, json, glob
|
||||||
+3
-3
@@ -65,16 +65,16 @@ fi
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Stop gracefully (default — captures ID, shuts down safely, status=stopped)
|
# 1. Stop gracefully (default — captures ID, shuts down safely, status=stopped)
|
||||||
bash skills/tmux-agent-orchestrate-stop/scripts/stop_session.sh \
|
bash .agents/skills/tmux-agent-orchestrate-stop/scripts/stop_session.sh \
|
||||||
--session "$SESSION_NAME"
|
--session "$SESSION_NAME"
|
||||||
|
|
||||||
# 2. Stop gracefully + record a custom stop reason
|
# 2. Stop gracefully + record a custom stop reason
|
||||||
bash skills/tmux-agent-orchestrate-stop/scripts/stop_session.sh \
|
bash .agents/skills/tmux-agent-orchestrate-stop/scripts/stop_session.sh \
|
||||||
--session "$SESSION_NAME" --reason api_error
|
--session "$SESSION_NAME" --reason api_error
|
||||||
|
|
||||||
# 3. Stop gracefully + clean up on-disk conversation (DANGEROUS)
|
# 3. Stop gracefully + clean up on-disk conversation (DANGEROUS)
|
||||||
# — this prevents any future resume (status=terminated, resumable=false).
|
# — this prevents any future resume (status=terminated, resumable=false).
|
||||||
bash skills/tmux-agent-orchestrate-stop/scripts/stop_session.sh \
|
bash .agents/skills/tmux-agent-orchestrate-stop/scripts/stop_session.sh \
|
||||||
--session "$SESSION_NAME" --purge-conversation
|
--session "$SESSION_NAME" --purge-conversation
|
||||||
```
|
```
|
||||||
|
|
||||||
+2
-2
@@ -19,5 +19,5 @@ __pycache__/
|
|||||||
!.env.example
|
!.env.example
|
||||||
|
|
||||||
# 빌드/배포 HTML 산출물
|
# 빌드/배포 HTML 산출물
|
||||||
skills/tmux-agent-orchestrate-delegate-job/USER_MANUAL.html
|
.agents/skills/tmux-agent-orchestrate-delegate-job/USER_MANUAL.html
|
||||||
skills/tmux-agent-orchestrate-delegate-job/mqtt-broker-setup.html
|
.agents/skills/tmux-agent-orchestrate-delegate-job/mqtt-broker-setup.html
|
||||||
+6
-6
@@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
본 프로젝트를 새로운 환경에 복제(Clone)한 후, 핵심 구성 요소들의 위치와 역할을 먼저 파악해야 합니다.
|
본 프로젝트를 새로운 환경에 복제(Clone)한 후, 핵심 구성 요소들의 위치와 역할을 먼저 파악해야 합니다.
|
||||||
|
|
||||||
* `skills/`: 멀티 에이전트 구동 및 비동기 잡 처리를 수행하는 셸 스크립트 모음
|
* `.agents/skills/`: 멀티 에이전트 구동 및 비동기 잡 처리를 수행하는 셸 스크립트 모음
|
||||||
* `lib.sh`: 오케스트레이션의 핵심 셸 함수 및 가상환경(venv) 자동 연동 라이브러리
|
* `lib.sh`: 오케스트레이션의 핵심 셸 함수 및 가상환경(venv) 자동 연동 라이브러리
|
||||||
* `tmux-agent-orchestrate-create/`: 격리된 tmux 에이전트 세션을 시작하는 스크립트
|
* `tmux-agent-orchestrate-create/`: 격리된 tmux 에이전트 세션을 시작하는 스크립트
|
||||||
* `tmux-agent-orchestrate-stop/`: 세션을 정상적으로 중지하고 상태를 업데이트하는 스크립트
|
* `tmux-agent-orchestrate-stop/`: 세션을 정상적으로 중지하고 상태를 업데이트하는 스크립트
|
||||||
@@ -84,7 +84,7 @@ source .venv/bin/activate
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 의존성 패키지(pyyaml, paho-mqtt 등) 설치
|
# 의존성 패키지(pyyaml, paho-mqtt 등) 설치
|
||||||
pip install -r skills/tmux-agent-orchestrate-delegate-job/requirements.txt
|
pip install -r .agents/skills/tmux-agent-orchestrate-delegate-job/requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -122,7 +122,7 @@ Python 스크립트 및 venv 라이브러리가 올바르게 로드되는지 확
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 가상환경(.venv) 파이썬 인터프리터를 사용하여 실행
|
# 가상환경(.venv) 파이썬 인터프리터를 사용하여 실행
|
||||||
.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py list
|
.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py list
|
||||||
```
|
```
|
||||||
* **출력 기대 결과**: 에러 메시지 없이 빈 JSON 배열 `[]` 또는 현재 등록된 pending/running 잡 목록이 성공적으로 출력되어야 합니다.
|
* **출력 기대 결과**: 에러 메시지 없이 빈 JSON 배열 `[]` 또는 현재 등록된 pending/running 잡 목록이 성공적으로 출력되어야 합니다.
|
||||||
|
|
||||||
@@ -131,20 +131,20 @@ Python 스크립트 및 venv 라이브러리가 올바르게 로드되는지 확
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. 테스트용 임시 잡 등록 및 발급된 8자리 Hex 잡 ID 획득
|
# 1. 테스트용 임시 잡 등록 및 발급된 8자리 Hex 잡 ID 획득
|
||||||
JID=$(.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py register \
|
JID=$(.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py register \
|
||||||
--agent "test-agent" \
|
--agent "test-agent" \
|
||||||
--prompt "Bootstrap check command" \
|
--prompt "Bootstrap check command" \
|
||||||
--timeout 120)
|
--timeout 120)
|
||||||
echo "Generated Job ID: $JID"
|
echo "Generated Job ID: $JID"
|
||||||
|
|
||||||
# 2. 획득한 잡 ID에 대해 백그라운드 이벤트 구독기(Subscriber) 구동
|
# 2. 획득한 잡 ID에 대해 백그라운드 이벤트 구독기(Subscriber) 구동
|
||||||
.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/job_subscriber.py --job "$JID" &
|
.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/job_subscriber.py --job "$JID" &
|
||||||
|
|
||||||
# 3. 구독자의 MQTT Broker 소켓 연결 및 수신부 초기화 완료를 보장하기 위해 2초 대기
|
# 3. 구독자의 MQTT Broker 소켓 연결 및 수신부 초기화 완료를 보장하기 위해 2초 대기
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# 4. 테스트 시작 이벤트 발행 (Subscribe-before-Publish 원칙 준수)
|
# 4. 테스트 시작 이벤트 발행 (Subscribe-before-Publish 원칙 준수)
|
||||||
.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/publish_event.py \
|
.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/publish_event.py \
|
||||||
--job "$JID" \
|
--job "$JID" \
|
||||||
--event started \
|
--event started \
|
||||||
--detail "Bootstrap MQTT verification connection check"
|
--detail "Bootstrap MQTT verification connection check"
|
||||||
|
|||||||
+6
-6
@@ -10,7 +10,7 @@ A new agent can follow the steps in this guide sequentially to establish a stabl
|
|||||||
|
|
||||||
Before cloning this project into a new environment, you must first understand the locations and roles of its core components:
|
Before cloning this project into a new environment, you must first understand the locations and roles of its core components:
|
||||||
|
|
||||||
* `skills/`: A collection of shell scripts that execute multi-agent coordination and asynchronous job processing.
|
* `.agents/skills/`: A collection of shell scripts that execute multi-agent coordination and asynchronous job processing.
|
||||||
* `lib.sh`: The core orchestration shell functions and virtual environment (venv) auto-loading library.
|
* `lib.sh`: The core orchestration shell functions and virtual environment (venv) auto-loading library.
|
||||||
* `tmux-agent-orchestrate-create/`: Script to launch isolated tmux agent sessions.
|
* `tmux-agent-orchestrate-create/`: Script to launch isolated tmux agent sessions.
|
||||||
* `tmux-agent-orchestrate-stop/`: Script to gracefully stop agent sessions and update states.
|
* `tmux-agent-orchestrate-stop/`: Script to gracefully stop agent sessions and update states.
|
||||||
@@ -84,7 +84,7 @@ Install the required packages listed in `requirements.txt` under `tmux-agent-orc
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Install dependencies (pyyaml, paho-mqtt, etc.)
|
# Install dependencies (pyyaml, paho-mqtt, etc.)
|
||||||
pip install -r skills/tmux-agent-orchestrate-delegate-job/requirements.txt
|
pip install -r .agents/skills/tmux-agent-orchestrate-delegate-job/requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -122,7 +122,7 @@ Verify that the Python scripts and virtual environment libraries load correctly
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Run using the python interpreter in the virtual environment
|
# Run using the python interpreter in the virtual environment
|
||||||
.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py list
|
.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py list
|
||||||
```
|
```
|
||||||
* **Expected Output**: The command should exit successfully and print an empty JSON array `[]` (or a list of pending/running jobs if any exist) without any python traceback errors.
|
* **Expected Output**: The command should exit successfully and print an empty JSON array `[]` (or a list of pending/running jobs if any exist) without any python traceback errors.
|
||||||
|
|
||||||
@@ -131,20 +131,20 @@ Test the end-to-end communication through the broker to verify that events are p
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# 1. Register a temporary test job and capture its 8-character Hex Job ID
|
# 1. Register a temporary test job and capture its 8-character Hex Job ID
|
||||||
JID=$(.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py register \
|
JID=$(.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py register \
|
||||||
--agent "test-agent" \
|
--agent "test-agent" \
|
||||||
--prompt "Bootstrap check command" \
|
--prompt "Bootstrap check command" \
|
||||||
--timeout 120)
|
--timeout 120)
|
||||||
echo "Generated Job ID: $JID"
|
echo "Generated Job ID: $JID"
|
||||||
|
|
||||||
# 2. Run the background event subscriber (Subscriber) for this Job ID
|
# 2. Run the background event subscriber (Subscriber) for this Job ID
|
||||||
.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/job_subscriber.py --job "$JID" &
|
.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/job_subscriber.py --job "$JID" &
|
||||||
|
|
||||||
# 3. Wait 2 seconds to allow the Subscriber to establish its MQTT socket connection
|
# 3. Wait 2 seconds to allow the Subscriber to establish its MQTT socket connection
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
# 4. Publish a start event (adhering to the Subscribe-before-Publish rule)
|
# 4. Publish a start event (adhering to the Subscribe-before-Publish rule)
|
||||||
.venv/bin/python3 skills/tmux-agent-orchestrate-delegate-job/scripts/publish_event.py \
|
.venv/bin/python3 .agents/skills/tmux-agent-orchestrate-delegate-job/scripts/publish_event.py \
|
||||||
--job "$JID" \
|
--job "$JID" \
|
||||||
--event started \
|
--event started \
|
||||||
--detail "Bootstrap MQTT verification connection check"
|
--detail "Bootstrap MQTT verification connection check"
|
||||||
|
|||||||
+2
-2
@@ -337,7 +337,7 @@ graph LR
|
|||||||
This project manages **two distinct state domains** that are often confused:
|
This project manages **two distinct state domains** that are often confused:
|
||||||
|
|
||||||
### Session States (YAML — `.hermes/agent-sessions.yaml`)
|
### Session States (YAML — `.hermes/agent-sessions.yaml`)
|
||||||
Managed by `skills/lib.sh` and the 6 `tmux-agent-orchestrate-*` skills.
|
Managed by `.agents/skills/lib.sh` and the 6 `tmux-agent-orchestrate-*` skills.
|
||||||
Valid values (see `lib.sh` valid-status set):
|
Valid values (see `lib.sh` valid-status set):
|
||||||
|
|
||||||
| State | Meaning | Set by |
|
| State | Meaning | Set by |
|
||||||
@@ -348,7 +348,7 @@ Valid values (see `lib.sh` valid-status set):
|
|||||||
| `archived` | soft-stopped via `--mode soft`; tmux left alive, YAML-only update | `stop` (soft mode) |
|
| `archived` | soft-stopped via `--mode soft`; tmux left alive, YAML-only update | `stop` (soft mode) |
|
||||||
|
|
||||||
### Job States (Registry — `.hermes/jobs/<id>.json`)
|
### Job States (Registry — `.hermes/jobs/<id>.json`)
|
||||||
Managed by `skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py`.
|
Managed by `.agents/skills/tmux-agent-orchestrate-delegate-job/scripts/registry.py`.
|
||||||
Valid values:
|
Valid values:
|
||||||
|
|
||||||
| State | Meaning | Set by |
|
| State | Meaning | Set by |
|
||||||
|
|||||||
Reference in New Issue
Block a user