Compare commits
8 changed files with 25 additions and 60 deletions
17
CLAUDE.md
17
CLAUDE.md
|
|
@ -154,8 +154,7 @@ frontend/ npm workspaces (esbuild → static dist). Built
|
||||||
{index, stats, screen}.html + {app, stats}.js
|
{index, stats, screen}.html + {app, stats}.js
|
||||||
+ agent.css → dist/{*.html, static/*}.
|
+ agent.css → dist/{*.html, static/*}.
|
||||||
|
|
||||||
hive-ag3nt/ in-container harness crate; produces ONE `hive`
|
hive-ag3nt/ in-container harness crate; produces TWO binaries
|
||||||
binary (post-#598) picking role from `HIVE_ROLE` env
|
|
||||||
src/lib.rs re-exports + DEFAULT_SOCKET, DEFAULT_WEB_PORT
|
src/lib.rs re-exports + DEFAULT_SOCKET, DEFAULT_WEB_PORT
|
||||||
src/client.rs generic JSON-line request/response over unix socket
|
src/client.rs generic JSON-line request/response over unix socket
|
||||||
src/web_ui.rs per-container axum HTTP page (incl /api/cancel,
|
src/web_ui.rs per-container axum HTTP page (incl /api/cancel,
|
||||||
|
|
@ -193,14 +192,12 @@ hive-ag3nt/ in-container harness crate; produces ONE `hive`
|
||||||
`<!-- role:manager -->` markers per
|
`<!-- role:manager -->` markers per
|
||||||
`mcp::Flavor`; owns `write_system_prompt`
|
`mcp::Flavor`; owns `write_system_prompt`
|
||||||
(re-exported from turn.rs for callers).
|
(re-exported from turn.rs for callers).
|
||||||
src/bin/hive.rs unified harness main (Serve + Mcp + Wake
|
src/bin/hive-ag3nt.rs sub-agent main (Serve + Mcp subcommands)
|
||||||
subcommands); role from `HIVE_ROLE` env, picks
|
src/bin/hive-m1nd.rs manager main (Serve + Mcp subcommands)
|
||||||
agent or manager wire surface server-side. Wake
|
Static UI assets served by ServeDir from
|
||||||
currently agent-only (#693). Static UI assets
|
$HIVE_STATIC_DIR (= hyperhive.frontend
|
||||||
served by ServeDir from $HIVE_STATIC_DIR
|
.mergedDist — default agent dist + per-agent
|
||||||
(= hyperhive.frontend.mergedDist — default agent
|
extraFiles, set per the harness-base module).
|
||||||
dist + per-agent extraFiles, set per the
|
|
||||||
harness-base module).
|
|
||||||
prompts/ static role/tools/settings for claude (include_str!):
|
prompts/ static role/tools/settings for claude (include_str!):
|
||||||
system.md — unified system prompt; shared
|
system.md — unified system prompt; shared
|
||||||
sections plus `<!-- role:agent -->` /
|
sections plus `<!-- role:agent -->` /
|
||||||
|
|
|
||||||
18
README.md
18
README.md
|
|
@ -195,24 +195,6 @@ the container as environment variables. Common options:
|
||||||
See `nix/templates/harness-base.nix` for the full list of options and
|
See `nix/templates/harness-base.nix` for the full list of options and
|
||||||
their descriptions.
|
their descriptions.
|
||||||
|
|
||||||
## Operator CLI
|
|
||||||
|
|
||||||
`hivectl` is the operator-facing host CLI for ad-hoc administration that
|
|
||||||
doesn't go through the broker (built alongside `hive-c0re` when the host
|
|
||||||
module is enabled):
|
|
||||||
|
|
||||||
```sh
|
|
||||||
sudo hivectl forge create-user mara # provisions a forge user
|
|
||||||
sudo hivectl forge create-user mara --password # … with a fixed password
|
|
||||||
sudo hivectl matrix create-user mara # provisions a matrix user
|
|
||||||
sudo hivectl matrix create-user mara --password-stdin # … reading from stdin
|
|
||||||
```
|
|
||||||
|
|
||||||
For agent names (i.e., a `Coordinator::agent_state_root(name)` exists),
|
|
||||||
`hivectl` persists the resulting token to the agent's state dir like the
|
|
||||||
boot sweep does. For non-agent names (e.g. the operator's own forge/matrix
|
|
||||||
account), it prints the token to stdout and writes nothing.
|
|
||||||
|
|
||||||
## Build / deploy
|
## Build / deploy
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
|
|
||||||
|
|
@ -65,20 +65,17 @@ propagate in. Operators don't need to set anything on their side.
|
||||||
## Claude credentials are per-agent
|
## Claude credentials are per-agent
|
||||||
|
|
||||||
`/var/lib/hyperhive/agents/<name>/claude/` bind-mounts to
|
`/var/lib/hyperhive/agents/<name>/claude/` bind-mounts to
|
||||||
`/home/<name>/.claude` (RW; was `/root/.claude` pre-#658 when every
|
`/root/.claude` (RW). Sharing one dir across agents is NOT viable —
|
||||||
harness ran as root). Sharing one dir across agents is NOT viable —
|
|
||||||
OAuth refresh tokens rotate, so any sibling refresh invalidates all
|
OAuth refresh tokens rotate, so any sibling refresh invalidates all
|
||||||
the others. Login flow runs from the per-agent web UI; creds persist
|
the others. Login flow runs from the per-agent web UI; creds persist
|
||||||
across `destroy`/recreate (`--purge` wipes them).
|
across `destroy`/recreate (`--purge` wipes them).
|
||||||
|
|
||||||
## Persistent notes dir per agent
|
## Persistent notes dir per agent
|
||||||
|
|
||||||
`/var/lib/hyperhive/agents/<name>/state/` bind-mounts to
|
`/var/lib/hyperhive/agents/<name>/state/` bind-mounts to `/state`
|
||||||
`/agents/<name>/state` (RW; uniform for sub-agents + manager
|
(RW). System prompts tell agents to keep durable knowledge here
|
||||||
post-#604, was `/state` pre-#604). The harness exposes the same path
|
(`/state/notes.md`, anything else under `/state/`). The harness also
|
||||||
via `$HYPERHIVE_STATE_DIR`. System prompts tell agents to keep
|
writes its events log here (`/state/hyperhive-events.sqlite`).
|
||||||
durable knowledge here (`notes.md`, anything else). The harness also
|
|
||||||
writes its events log here (`hyperhive-events.sqlite`).
|
|
||||||
Survives `destroy`/recreate alongside the claude dir.
|
Survives `destroy`/recreate alongside the claude dir.
|
||||||
|
|
||||||
## Web UI ports collide on hash
|
## Web UI ports collide on hash
|
||||||
|
|
|
||||||
|
|
@ -136,13 +136,11 @@ Under `/var/lib/hyperhive/agents/<name>/`:
|
||||||
precise changes from the manager; RW into the manager via the
|
precise changes from the manager; RW into the manager via the
|
||||||
`/agents` tree bind.
|
`/agents` tree bind.
|
||||||
- `claude/` — claude OAuth credentials, bind-mounted RW to
|
- `claude/` — claude OAuth credentials, bind-mounted RW to
|
||||||
`/home/<name>/.claude` inside the container (post-#658 — was
|
`/root/.claude` inside the container.
|
||||||
`/root/.claude` pre-#658 when every harness ran as root).
|
|
||||||
- `state/` — durable notes, the events.sqlite db, and the
|
- `state/` — durable notes, the events.sqlite db, and the
|
||||||
turn-stats sqlite db. Bind-mounted to `/agents/<name>/state`
|
turn-stats sqlite db. Bind-mounted to `/agents/<name>/state`
|
||||||
inside the container (uniform for sub-agents + manager
|
inside the container (the manager still uses the legacy
|
||||||
post-#604). The `$HYPERHIVE_STATE_DIR` env var exposes the
|
`/state` mount point — same host path either way).
|
||||||
same path to in-container scripts.
|
|
||||||
|
|
||||||
Under `/var/lib/hyperhive/applied/<name>/` — the hive-c0re-only
|
Under `/var/lib/hyperhive/applied/<name>/` — the hive-c0re-only
|
||||||
applied repo. Tracks `flake.nix` (module-only boilerplate; never
|
applied repo. Tracks `flake.nix` (module-only boilerplate; never
|
||||||
|
|
|
||||||
|
|
@ -18,12 +18,8 @@ any file in the container that the nixbld user can read.
|
||||||
|
|
||||||
**What is NOT exposed**:
|
**What is NOT exposed**:
|
||||||
|
|
||||||
- `/home/<name>/.claude/` — mode `0700`, owned by the per-agent
|
- `/root/.claude/` — mode `0700`, owned by root. nixbld users cannot read it.
|
||||||
user `<name>` (post-#658 — was `/root/.claude` owned by root
|
- `/state/forge-token` — written at mode `0600` by `hive-c0re/src/forge.rs`.
|
||||||
pre-#658). nixbld users cannot read it.
|
|
||||||
- `$HYPERHIVE_STATE_DIR/forge-token` (= `/agents/<name>/state/forge-token`)
|
|
||||||
— written at mode `0600` by `hive-c0re/src/forge.rs` and chowned to the
|
|
||||||
per-agent uid:gid by `lifecycle::chown_to_agent` (post-#673/#678).
|
|
||||||
nixbld users cannot read it.
|
nixbld users cannot read it.
|
||||||
|
|
||||||
**Policy**: all credential files written to agent state directories MUST be mode
|
**Policy**: all credential files written to agent state directories MUST be mode
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,7 @@ claude has access to in return.
|
||||||
|
|
||||||
## The loop
|
## The loop
|
||||||
|
|
||||||
Each agent harness (`hive serve`, with role picked from `$HIVE_ROLE`
|
Each agent harness (`hive-ag3nt serve` or `hive-m1nd serve`) runs:
|
||||||
— `"agent"` for sub-agents, `"manager"` for the manager; post-#598
|
|
||||||
this is one binary not two) runs:
|
|
||||||
|
|
||||||
1. Long-poll `Recv` on its socket. The host-side broker
|
1. Long-poll `Recv` on its socket. The host-side broker
|
||||||
(`broker.rs::recv_blocking_batch`) returns immediately if there's
|
(`broker.rs::recv_blocking_batch`) returns immediately if there's
|
||||||
|
|
@ -265,12 +263,10 @@ External MCP servers (and any other in-container process) can
|
||||||
inject a wake-up event into the agent's inbox via the per-agent
|
inject a wake-up event into the agent's inbox via the per-agent
|
||||||
socket at `/run/hive/mcp.sock`. Two equivalent paths:
|
socket at `/run/hive/mcp.sock`. Two equivalent paths:
|
||||||
|
|
||||||
- **Shell out to `hive wake --from <label> --body <text>`**
|
- **Shell out to `hive-ag3nt wake --from <label> --body <text>`**
|
||||||
(use `--body -` to read body from stdin). Already on the
|
(use `--body -` to read body from stdin). Already on the
|
||||||
container's `PATH` since the harness binary is in
|
container's `PATH` since the harness binary is in
|
||||||
`systemPackages`. Convenient for shell-script integrations.
|
`systemPackages`. Convenient for shell-script integrations.
|
||||||
Agent-only today (refused when `HIVE_ROLE=manager`); see
|
|
||||||
[#693](http://localhost:3000/hyperhive/hyperhive/issues/693).
|
|
||||||
|
|
||||||
- **Speak the wire protocol directly** — JSON-line over the
|
- **Speak the wire protocol directly** — JSON-line over the
|
||||||
unix socket: `{"cmd":"wake","from":"matrix","body":"new dm
|
unix socket: `{"cmd":"wake","from":"matrix","body":"new dm
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ name = "hive-matrix-daemon"
|
||||||
path = "src/main.rs"
|
path = "src/main.rs"
|
||||||
|
|
||||||
# `hive-matrix-mcp` — thin stdio MCP bridge spawned by claude per turn.
|
# `hive-matrix-mcp` — thin stdio MCP bridge spawned by claude per turn.
|
||||||
# Forwards every tool call to the daemon over /run/hive-matrix/socket,
|
# Forwards every tool call to the daemon over /run/hive-matrix.sock,
|
||||||
# returns the daemon's response shape to claude. No matrix-sdk dep at
|
# returns the daemon's response shape to claude. No matrix-sdk dep at
|
||||||
# this entrypoint — the heavy crate only loads when the daemon binary
|
# this entrypoint — the heavy crate only loads when the daemon binary
|
||||||
# is invoked.
|
# is invoked.
|
||||||
|
|
|
||||||
|
|
@ -249,7 +249,7 @@ in
|
||||||
list_room_members, read_room) to claude via an auto-injected
|
list_room_members, read_room) to claude via an auto-injected
|
||||||
`extraMcpServers.matrix` entry. Claude spawns the stdio
|
`extraMcpServers.matrix` entry. Claude spawns the stdio
|
||||||
`hive-matrix-mcp` bridge per turn, which forwards each tool
|
`hive-matrix-mcp` bridge per turn, which forwards each tool
|
||||||
call to the daemon over `/run/hive-matrix/socket`.
|
call to the daemon over `/run/hive-matrix.sock`.
|
||||||
- wakes the agent on incoming room events via a short teaser
|
- wakes the agent on incoming room events via a short teaser
|
||||||
Wake signal (`[matrix] <sender> in <room>: <first 100c>…`)
|
Wake signal (`[matrix] <sender> in <room>: <first 100c>…`)
|
||||||
to the hyperhive control socket; the full event stays
|
to the hyperhive control socket; the full event stays
|
||||||
|
|
@ -386,11 +386,10 @@ in
|
||||||
description = ''
|
description = ''
|
||||||
Base URL of the hyperhive-managed Forgejo. Used at container
|
Base URL of the hyperhive-managed Forgejo. Used at container
|
||||||
boot by a oneshot systemd unit that calls
|
boot by a oneshot systemd unit that calls
|
||||||
`tea login add --url <this> --token "$(cat $HYPERHIVE_STATE_DIR/forge-token)"`
|
`tea login add --url <this> --token "$(cat /state/forge-token)"`
|
||||||
(= `/agents/<name>/state/forge-token`) so the agent's claude can
|
so the agent's claude can shell out to `tea` without an extra
|
||||||
shell out to `tea` without an extra auth dance. No-op when the
|
auth dance. No-op when `/state/forge-token` is missing (i.e.
|
||||||
forge-token file is missing (i.e. hive-forge isn't running on
|
hive-forge isn't running on the host).
|
||||||
the host).
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue