feat(cli,registry): introduce --herdr-workspace option and decouple socket fallback chains

This commit is contained in:
2026-08-24 12:50:09 +09:00
parent 320f036575
commit e6e70dbb21
17 changed files with 1670 additions and 47 deletions
@@ -68,6 +68,7 @@ If any check fails → abort with a non-zero exit and report the reason (automat
When running multiple agent sessions alongside other workflows (e.g., cmux, background workers, manual herdr sessions), sharing the default herdr server can lead to session name conflicts, monitoring clutter, and accidental destruction of user sessions via global commands.
To prevent this, you can run this skill inside an **isolated herdr session** using the `HERDR_SESSION_NAME` environment variable or the `--herdr-session <name>` flag (opt-in; alias: `--herdr-server`; legacy env alias: `HERDR_SERVER_NAME`).
Additionally, you can specify `--herdr-workspace <name>` to record a distinct project workspace label in `.mam/agent-sessions.yaml` (default: workspace slug without `mam-` prefix). Note that `--herdr-workspace` is a metadata label only and never selects a herdr daemon socket.
Under the hood this maps to a real, separate herdr **session** (`herdr --session <name>` — its own socket, its own `agent list`/`workspace list`, completely invisible to the default session and vice versa), not just a workspace label inside the same server. `lib.sh`'s shim bootstraps the named session's server headlessly (`herdr --session <name> server`, backgrounded) the first time it's needed, and scopes every subsequent herdr call to it automatically — this headless bootstrap is what lets it work even when the skill itself is running from inside another herdr-managed pane (a plain interactive `herdr --session <name>` launch is blocked there by herdr's "nested herdr is disabled" guard; headless `server` mode isn't).
@@ -79,7 +80,7 @@ Under the hood this maps to a real, separate herdr **session** (`herdr --session
```
2. **Via Option Flag**:
```bash
bash scripts/create_session.sh --workspace /path/to/project --agent claude --role developer --herdr-session multi-agent-canary
bash scripts/create_session.sh --workspace /path/to/project --agent claude --role developer --herdr-session multi-agent-canary --herdr-workspace my-project
```
3. **Submit Job Integration**:
You can automatically register a delegated job with a prompt when creating a session: