refactor(skills): convert absolute paths to workspace-relative + relocate agent-sessions.yaml to .hermes/

Changes:
- skills/lib.sh: AGENT_SESSIONS_YAML default moved from ~/PuKi/lab/.../agent-sessions.yaml
  to <workspace_root>/.hermes/agent-sessions.yaml (relative via BASH_SOURCE)
- 6 SKILL.md: descriptions + 'Single source of truth' lines updated to .hermes/agent-sessions.yaml
- 6 SKILL.md: bash examples (~/PuKi/lab/agent_sessions/skills/...) → relative paths
- SKILL.md file:// links converted from absolute to relative (resolves workspace tool warnings)
- tmux-agent-orchestrate-create/SKILL.md: removed outdated wrapper template reference
- lib.sh internal comments: removed /home/godopu16/PuKi/lab example
- All scripts: internal source/path references use relative resolution

Verified on isolated server -L agy-relative-path-test (kill-server after):
- syntax check PASS
- E2E: create_session.sh auto-creates .hermes/agent-sessions.yaml at new location
- status.sh reads new location correctly
- 0 leftover absolute path references
- Global skill non-interference verified
- Main isolated server -L multi-agent-canary untouched
This commit is contained in:
2026-06-19 23:41:05 +00:00
parent e8eebe5eb1
commit ad7be264e7
7 changed files with 38 additions and 35 deletions
@@ -1,6 +1,6 @@
---
name: tmux-agent-orchestrate-monitor
description: "Run a long-lived Kanban worker that polls ~/PuKi/lab/agent_sessions/agent-sessions.yaml against the actual tmux/agent runtime state and reconciles them. Use when you want live visibility into which agent sessions are running, which are dead, which have stale YAML entries, and which have new session ids that haven't been recorded yet. Designed to be dispatched as a Kanban goal_mode task (--goal) so it keeps running until the user stops it."
description: "Run a long-lived Kanban worker that polls .hermes/agent-sessions.yaml against the actual tmux/agent runtime state and reconciles them. Use when you want live visibility into which agent sessions are running, which are dead, which have stale YAML entries, and which have new session ids that haven't been recorded yet. Designed to be dispatched as a Kanban goal_mode task (--goal) so it keeps running until the user stops it."
version: 1.0.0
author: godopu
license: MIT
@@ -16,7 +16,7 @@ metadata:
# Agent Sessions Monitor — Live Reconciliation via Kanban Worker
> **Companion skills**: `tmux-agent-orchestrate-create` / `tmux-agent-orchestrate-resume` / `tmux-agent-orchestrate-delete` (mutators); this skill is the **observer**.
> **Single source of truth**: `~/PuKi/lab/agent_sessions/agent-sessions.yaml`.
> **Single source of truth**: `./.hermes/agent-sessions.yaml`.
## What this skill does
@@ -68,7 +68,7 @@ hermes kanban create \
--body "$(cat <<'EOF'
You are the agent-sessions monitor. Every 30 seconds, do:
1. Read ~/PuKi/lab/agent_sessions/agent-sessions.yaml
1. Read .hermes/agent-sessions.yaml
2. Run `tmux ls` and `tmux list-panes -F 'session=#{session_name} pid=#{pane_pid} cmd=#{pane_current_command} cwd=#{pane_current_path}'`
3. For each session in the YAML, check the corresponding tmux state
4. For each tmux session matching `*-creator-claude` or `*-creator-agy` that's not in the YAML, register it
@@ -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.
Use the helper script at ~/PuKi/lab/agent_sessions/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 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
)"
```
@@ -124,7 +124,7 @@ tmux: no session
```
tmux: session=lab-paper-pdf2md-creator-agy, pid=...,
cmd=agy, cwd=/home/godopu16/PuKi/lab/paper-pdf2md
cmd=agy, cwd=$WORKSPACE_ROOT/paper-pdf2md
YAML: no such session
→ register as new entry: status=running, last_visible_status=auto-registered
→ comment: "lab-paper-pdf2md-creator-agy: tmux found but not in YAML. Auto-registered."
@@ -169,7 +169,7 @@ The `--body` of the dispatched task IS the worker's behavior spec. Here's a test
## Loop (every 30s)
1. Read agent-sessions.yaml
2. Bash: `bash ~/PuKi/lab/agent_sessions/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff`
2. Bash: `bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff`
3. Parse the JSON diff from stdout
4. If `drifts` is non-empty:
- For each drift, call `kanban_comment` with the diff message
@@ -200,7 +200,7 @@ If `$HERMES_KANBAN_TASK` card has any comment containing "stop" or "stop monitor
```bash
# Run reconcile once and inspect output
bash ~/PuKi/lab/agent_sessions/skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff --once \
bash skills/tmux-agent-orchestrate-monitor/scripts/reconcile.sh --emit-diff --once \
| python3 -m json.tool
```