Watch
0
0
Fork
You've already forked hyperhive
0

hive-agent: keep an own /knowledge clone current from the swarm knowledge event

This commit is contained in:
damocles 2026-11-22 17:09:48 +01:00 • committed by mara
commit 989d1d578c

View file

@ -66,6 +66,24 @@ read token when it has one (see
[forge-accounts.md](forge-accounts.md#how-a-hive-reads-the-forge)) and clones the public
repo anonymously otherwise.
### The agent's own clone
Each agent harness also keeps its own shallow clone of `internal/knowledge`
(`hive-agent/src/knowledge_sync.rs`), under the harness dir as `knowledge/`,
without going through the hive. The agent's queue token may subscribe to
`$SWARM.knowledge` (and not publish it), so the harness hears the same event
as the hive: on it, once at start and hourly as a fallback, it fetches and
resets the clone to the remote head (`GIT_TERMINAL_PROMPT=0`, a five-minute
limit per git command, anonymous because the repo is public). When the head
moved it raises one keyed `knowledge` todo carrying the `git diff --stat`, so
a second change before the agent reads the first updates the same row; the
first clone raises nothing. A failed or timed-out sync logs a warning, and the
next trigger retries it.
This runs next to the host mount for now: `/knowledge` is still the host's
bind mount and the `/knowledge updated` broadcast above still goes out, until
a later change removes the host side.
## State
<!-- vale write-good.Passive = NO -->