diff --git a/docs/tools/hivectl-cli.md b/docs/tools/hivectl-cli.md index 5100315c..809fc9aa 100644 --- a/docs/tools/hivectl-cli.md +++ b/docs/tools/hivectl-cli.md @@ -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 @h-` 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 @h-` 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//.claude`; runs from the agent's state dir (`/agents//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] ` +**Usage:** `hivectl choom ` ###### **Arguments:** * `` — 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` diff --git a/docs/tools/hivectl.md b/docs/tools/hivectl.md index 519e8953..9dbed3b5 100644 --- a/docs/tools/hivectl.md +++ b/docs/tools/hivectl.md @@ -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 @h-` -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//.claude` where its OAuth credentials live. choom prefixes the machine with `@` (the meta-flake sets the agent's unix user name to its label). -- **from `/agents//state`**: `--continue` resolves the session for - that project dir and `CLAUDE.md` (the persona) loads from the cwd. +- **from `/agents//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 diff --git a/hive-c0re/src/bin/hivectl.rs b/hive-c0re/src/bin/hivectl.rs index aa44c9e6..be5399eb 100644 --- a/hive-c0re/src/bin/hivectl.rs +++ b/hive-c0re/src/bin/hivectl.rs @@ -110,34 +110,15 @@ enum Cmd { }, /// Open an interactive Claude session inside an agent container. /// - /// Replaces the current process with `machinectl shell - /// @h-` running claude from the agent's state dir — drops - /// the operator into a private Claude session in the agent's project, - /// with its full settings, MCP tools, and persona. Requires root (same - /// as all machinectl shell operations) and the container must be - /// running. - /// - /// To match the harness exactly, choom enters **as the agent user** - /// (not root) so claude reads the OAuth credentials from the agent's - /// `/home//.claude`; runs from the agent's state dir - /// (`/agents//state`) so the session is scoped to the right - /// project 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. - /// - /// choom pins its OWN session id (not a bare `--continue`) so it never - /// resumes or corrupts the harness's live session in the same project - /// dir; re-running choom rejoins that private session. Pass `--fresh` - /// to reset it and start clean. + /// Execs `machinectl shell @h-` 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. Choom { /// Agent name (e.g. `damocles`, `iris`). name: String, - /// Reset choom's dedicated Claude session and start it clean. - /// Without this flag choom resumes its own prior session (separate - /// from the harness's live session), creating it on first use. - #[arg(long)] - fresh: bool, }, /// Stop containers hive-wide in one operator action. Bare `hivectl /// stop` stops **everything** — all sub-agents plus the ci, forge, @@ -644,7 +625,7 @@ async fn main() -> Result<()> { Cmd::Subvol { cmd } => match cmd { SubvolCmd::Upgrade { name, yes } => subvol_upgrade(&socket, &name, yes).await, }, - Cmd::Choom { name, fresh } => choom(&name, fresh), + Cmd::Choom { name } => choom(&name), Cmd::Quota { cmd } => match cmd { QuotaCmd::Enable => quota_enable().await, QuotaCmd::Show { name } => quota_show(name.as_deref()).await, @@ -1037,45 +1018,25 @@ fn agent_exists(name: &str) -> Result { /// Drop into an interactive Claude session in the agent container. /// -/// Replaces the current process (exec) with `machinectl shell -/// @h- /bin/sh -lc '