feat(#2067): choom uses a fresh named session, drop --fresh flag

This commit is contained in:
damocles 2026-06-27 23:06:32 +02:00 committed by mara
commit 09b83c9d1e
3 changed files with 41 additions and 114 deletions

View file

@ -379,22 +379,14 @@ Generate the federation peer-config block for THIS hive — the nix a peer opera
Open an interactive Claude session inside an agent container.
Replaces the current process with `machinectl shell <name>@h-<name>` running `claude --continue` from the agent's state dir — drops the operator straight into the agent's live Claude session with its full loaded context and persona. Requires root (same as all machinectl shell operations) and the container must be running.
Execs `machinectl shell <name>@h-<name>` running claude as the agent user from its state dir, with the same settings / MCP config / system prompt the harness uses. Each launch starts a fresh, named ("choom") session so it never collides with the harness's live session in the same project dir. Requires root + a running container.
To match the harness exactly, choom enters **as the agent user** (not root) so claude reads the OAuth credentials from the agent's `/home/<name>/.claude`; runs from the agent's state dir (`/agents/<name>/state`) so `--continue` resumes the right per-project session and `CLAUDE.md` loads; and passes the same `--settings` / `--mcp-config` / `--system-prompt-file` the harness writes to `/run/hive-config/` (settings, MCP tools, role prompt). Entering as root (the `machinectl shell` default) loses all of it.
Pass `--fresh` to start a new Claude session instead of continuing the most recent one.
**Usage:** `hivectl choom [OPTIONS] <NAME>`
**Usage:** `hivectl choom <NAME>`
###### **Arguments:**
* `<NAME>` — Agent name (e.g. `damocles`, `iris`)
###### **Options:**
* `--fresh` — Start a fresh Claude session instead of continuing the most recent one. Without this flag `--continue` is passed to Claude so the operator joins the agent's ongoing session context
## `hivectl stop`

View file

@ -123,17 +123,17 @@ reported at the end rather than aborting mid-run.
Drop into an interactive Claude session inside an agent container.
Replaces the current process with `machinectl shell <name>@h-<name>`
running `claude --continue` from the agent's state dir. Requires root
(same as all `machinectl shell` operations).
running claude from the agent's state dir. Requires root (same as all
`machinectl shell` operations).
```bash
hivectl choom iris # join iris's ongoing Claude session (--continue)
hivectl choom iris --fresh # start a new Claude session instead
hivectl choom iris # fresh Claude session named "choom" in iris's container
```
Without `--fresh`, `--continue` is passed so the operator joins the
agent's live context window. With `--fresh` a clean session starts.
The container must be running.
Each launch starts a fresh session named `choom` (claude mints its own
id), so it never collides with the harness's live session in the same
project dir. The operator can rejoin a prior choom session later with
`claude --resume choom`. The container must be running.
choom reproduces the harness's own claude invocation so the operator
lands in a faithful copy of the agent's environment:
@ -143,14 +143,13 @@ lands in a faithful copy of the agent's environment:
agent's `/home/<name>/.claude` where its OAuth credentials live. choom
prefixes the machine with `<name>@` (the meta-flake sets the agent's
unix user name to its label).
- **from `/agents/<name>/state`**: `--continue` resolves the session for
that project dir and `CLAUDE.md` (the persona) loads from the cwd.
- **from `/agents/<name>/state`**: the session and `CLAUDE.md` (the
persona) resolve against the right project dir.
- **with the harness flags**: `--settings`, `--mcp-config`, and
`--system-prompt-file` from `/run/hive-config/` — the same files the
harness writes each turn — so the operator gets the agent's settings,
the hyperhive/matrix MCP tools (which `--continue` needs to replay a
tool-using history), and the role prompt. Each flag is included only
when its file exists.
the hyperhive/matrix MCP tools, and the role prompt. Each flag is
included only when its file exists.
## Open