@chankov/agent-fleet 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/.claude/commands/doctor-agent-fleet.md +1 -1
  2. package/.claude/commands/setup-agent-fleet.md +4 -4
  3. package/.opencode/commands/af-doctor-agent-fleet.md +2 -0
  4. package/.opencode/commands/af-setup-agent-fleet.md +1 -1
  5. package/.pi/agents/peers.yaml +4 -0
  6. package/.pi/agents/teams.yaml +2 -2
  7. package/.pi/harnesses/agent-hub/README.md +57 -4
  8. package/.pi/harnesses/agent-hub/index.ts +236 -80
  9. package/.pi/harnesses/agent-hub/research-retention.js +34 -0
  10. package/.pi/harnesses/ask-user-remote/README.md +2 -0
  11. package/.pi/harnesses/coms/README.md +11 -0
  12. package/.pi/prompts/doctor-agent-fleet.md +1 -1
  13. package/.pi/prompts/setup-agent-fleet.md +4 -4
  14. package/README.md +102 -540
  15. package/agents/architect.md +1 -1
  16. package/agents/planner.md +1 -1
  17. package/agents/security-auditor.md +1 -1
  18. package/bin/snapshot-version.js +17 -1
  19. package/codex/CONDUCTOR.md +148 -0
  20. package/docs/ARCHITECTURE.md +165 -0
  21. package/docs/agent-fleet-setup.md +1 -0
  22. package/docs/claude-code-coms-bridge.md +10 -0
  23. package/docs/codex-remote-conductor.md +170 -0
  24. package/docs/coms-hermes-bridge.md +121 -0
  25. package/docs/getting-started.md +14 -0
  26. package/docs/npm-install.md +2 -0
  27. package/docs/pi-setup.md +2 -0
  28. package/hermes/README.md +48 -0
  29. package/hermes/skills/hub-conductor/SKILL.md +84 -0
  30. package/hermes/skills/hub-liaison/SKILL.md +84 -0
  31. package/justfile +100 -13
  32. package/package.json +10 -3
  33. package/scripts/codex-conductor.ts +41 -0
  34. package/scripts/codex-remote-control.ts +167 -0
  35. package/scripts/coms-cli.ts +311 -199
  36. package/scripts/coms-hermes-bridge.ts +2 -2
  37. package/scripts/lib/codex-conductor.ts +88 -0
  38. package/scripts/lib/codex-remote-control.ts +480 -0
  39. package/scripts/lib/coms-envelope.ts +51 -6
  40. package/scripts/lib/herdr-layout.ts +18 -3
  41. package/scripts/lib/hermes-bridge-core.ts +4 -4
  42. package/scripts/lib/team-project.ts +85 -1
  43. package/scripts/team-up.ts +77 -18
  44. package/skills/guided-workspace-setup/SKILL.md +123 -97
  45. package/skills/guided-workspace-setup/companion-manifest.json +33 -0
  46. package/skills/peer-coms/SKILL.md +9 -0
  47. package/systemd/user/agent-fleet-codex-remote-control.service.in +23 -0
@@ -12,6 +12,6 @@ Also flag malformed peer entries in `.pi/agents/peers.yaml`: field lines (`perso
12
12
 
13
13
  Also validate `.ai/agent-fleet-overrides.md` when it exists, against the schema in `docs/agent-fleet-setup.md`: unknown sections, unknown keys in known sections, invalid values for the mechanically parsed `agent-hub` keys, missing `rules:` folders and `docs:` entry points, and `## env` `required:` names that are neither set nor declared in the root `.env`. These findings are advisory only — report them with fix "edit by hand", never edit the overrides file.
14
14
 
15
- Present findings as a `# | Path | Issue | Suggested fix` table and ask the user to pick which fixes to apply.
15
+ Present the findings per the skill's Step 1 interaction contract: print a short text summary (counts per kind, advisory findings as report-only text), then ask one `AskUserQuestion` multi-select — *"Which fixes should I apply now?"* — each option titled `<path> — <issue>` with the proposed fix as its description, chunked at ≤ 4 options per question; an empty selection applies nothing.
16
16
 
17
17
  Never overwrite a regular file — only act on symlinks whose target is missing. Report `repaired`, `deleted`, and `skipped` counts, and append a `## doctor-runs` line to `.ai/agent-fleet-setup.md` with the date, agent, phase (`standalone`), and counts.
@@ -10,9 +10,9 @@ Analyse the workspace. If prior install state is found (`.ai/agent-fleet-setup.m
10
10
 
11
11
  The Skills group draws from **two roots**: fleet-native `skills/` and the vendored upstream import `vendor/agent-skills-upstream/skills/` (see `docs/UPSTREAM-SKILLS.md`). On a name collision the native copy wins — never offer the vendored duplicate as a separate row.
12
12
 
13
- Then present the install menu as **one multi-select per group** — **7 groups** (4 shared: Skills, Agent personas, Commands/prompts, References & Hooks; 3 pi-only: pi extensions & runtime skills, pi harnesses, External pi packages — so a claude-code workspace sees just the 4 shared groups) with `★` marking recommendations. Multi-type groups carry a leading `Group` column labelling the sub-category (lifecycle phase for Skills, `rw`/`ro`/`pi-only` for personas, etc.). Each group renders as a `Pick | Item | Group | Status | Rec | Purpose` table; every row carries an explicit status text — `installed · up to date`, `installed · outdated`, `installed · modified`, `not installed`, or `broken · skipped in preflight`. Installed items are **pre-checked `[x]`** so unchecking = remove; not-installed items start `[ ]`. Per-group reply shortcuts: `all`, `recommended` (adds `★` items on top of the pre-selection — never unticks installed ones), `none`, `keep` (accept the pre-selection unchanged), or a list of picks. Never offer `setup`, `doctor`, or `guided-workspace-setup` — those are installer-only and live in the source agent-fleet repo.
13
+ Then present the install menu per the skill's Step 1 interaction contract — drive every decision through `AskUserQuestion`, never a printed table awaiting a free-text reply. Open with the **Express question** (fresh workspace: `Recommended ★` / `Everything` / `Custom — group by group` / `Nothing`; existing: `Keep as-is` / `Apply updates` / `Keep + add recommended ★` / `Custom`) — any answer but `Custom` skips all group screens. On `Custom`, run the **7 groups** (4 shared: Skills, Agent personas, Commands/prompts, References & Hooks; 3 pi-only — a claude-code workspace sees just the 4 shared groups): each opens as a single-select quick screen (`Recommended ★ (n)` / `Everything (m)` / `Customise` / `Skip group`, or the installed-state variants with `Remove some…`), and multi-select drill-ins appear only behind `Customise`, chunked by sub-category (lifecycle phase for Skills, `rw`/`ro` for personas, …) at ≤ 4 options per question. Option titles carry `name ★ [st]` (`ok`/`upd`/`mod`/`cflt`/`gone`/`new`/`—`/`brk`); descriptions carry the purpose plus the state in plain words (`mod` → warn that refreshing overwrites local edits). There is **no pre-checking** — installed state shows as counts on quick screens and words in descriptions; leaving an installed item unselected in a drill-in keeps it as-is. `recommended` adds `★` items on top of what is installed — it never removes; cancel = keep-as-is/skip. `cflt` rows are resolved only by showing the three-way diff and asking per row — never by Express or `Apply updates`. Never offer `setup`, `doctor`, or `guided-workspace-setup` — those are installer-only and live in the source agent-fleet repo.
14
14
 
15
- Unchecking an installed item means *remove it*, but **removal is scoped**: only act on items whose name is in the agent-fleet inventory **and** that are recorded in `## install-status` (or are symlinks resolving into the source repo). User-authored skills, custom commands, third-party plugins, and unrelated settings/env keys are left untouched and logged as "Skipped — not owned by agent-fleet".
15
+ Removal happens **only** on an explicit `Remove some…` multi-select (empty selection = remove nothing), and it is scoped: the screen lists only items whose name is in the agent-fleet inventory **and** that are recorded in `## install-status` (or are symlinks resolving into the source repo). User-authored skills, custom commands, third-party plugins, and unrelated settings/env keys are left untouched and logged as "Skipped — not owned by agent-fleet".
16
16
 
17
17
  **No cross-tool substitution.** Each row is offered only when the source file the chosen agent needs already exists — for `pi`, that means `.pi/prompts/<name>.md`, `.pi/extensions/<name>/`, etc. Never fall back to `.claude/commands/` (or another agent's tree) to satisfy a pi prompt request; items missing their per-agent source are filtered out of the menu entirely.
18
18
 
@@ -20,6 +20,6 @@ Unchecking an installed item means *remove it*, but **removal is scoped**: only
20
20
 
21
21
  **pi harness companions.** When the agent is `pi`, installing/refreshing/removing any harness also refreshes its companions — the `justfile` launch recipes, the `team-up`/`coms-net` scripts, the peer/team YAML, `.pi/damage-control-rules.yaml`, and `.pi/harnesses/package.json`. Refresh the `justfile` from the current source (rewriting only the `agent-fleet:harnesses` managed region so user recipes survive) so retired-harness recipes are pruned and new ones added; a stale `justfile` left after a harness change is the regression this prevents.
22
22
 
23
- **No mid-apply overwrite prompts.** The Step 6 status text already warns that `installed · modified` rows will have local edits overwritten if kept ticked. The user's tick is the consent; the Step 9 confirmation is the single gate. During apply, refresh ticked items unconditionally — never pause to ask "should I overwrite this file?". Genuine errors (permission denied, missing source) still stop and report.
23
+ **No mid-apply overwrite prompts.** The `mod` description already warns that refreshing overwrites local edits. The user's selection is the consent; the Step 9 confirmation is the single gate. During apply, refresh selected items unconditionally — never pause to ask "should I overwrite this file?". Genuine errors (permission denied, missing source) still stop and report.
24
24
 
25
- Offer override sections for the workspace's `.ai/agent-fleet-overrides.md` based on the analysis, and record what was installed in `.ai/agent-fleet-setup.md`. Summarise the full plan and wait for explicit confirmation before writing anything, then perform the setup, re-scan for any new breakage, and report what changed.
25
+ Offer override sections for the workspace's `.ai/agent-fleet-overrides.md` based on the analysis (print each draft, then `Accept` / `Edit` / `Skip` per section), and record what was installed in `.ai/agent-fleet-setup.md`. Print the plan as compact action-grouped lines (Add / Refresh / Remove / Keep-count / Records / Method), then confirm with one question whose options are `Apply — and remove the installer commands` (default) / `Apply — keep the installer commands` / `Adjust picks` / `Cancel` — write nothing until an Apply is chosen. Then perform the setup, re-scan for any new breakage, and report what changed.
@@ -12,4 +12,6 @@ Also flag malformed peer entries in `.pi/agents/peers.yaml`: field lines (`perso
12
12
 
13
13
  Also validate `.ai/agent-fleet-overrides.md` when it exists, against the schema in `docs/agent-fleet-setup.md`: unknown sections, unknown keys in known sections, invalid values for the mechanically parsed `agent-hub` keys, missing `rules:` folders and `docs:` entry points, and `## env` `required:` names that are neither set nor declared in the root `.env`. These findings are advisory only — report them with fix "edit by hand", never edit the overrides file.
14
14
 
15
+ Present the findings per the skill's Step 1 interaction contract: print a short text summary (counts per kind, advisory findings as report-only text), then ask one native multi-select — *"Which fixes should I apply now?"* — each option titled `<path> — <issue>` with the proposed fix as its description; an empty selection applies nothing. Without a widget, print a `# | Path | Issue | Suggested fix` table instead and take the picks as text.
16
+
15
17
  Never overwrite a regular file — only act on symlinks whose target is missing. Report `repaired`, `deleted`, and `skipped` counts, and append a `## doctor-runs` line to `.ai/agent-fleet-setup.md` with the date and counts.
@@ -8,7 +8,7 @@ Run the guided install for a target workspace. If the user passed a workspace pa
8
8
 
9
9
  The Skills group draws from **two roots**: fleet-native `skills/` and the vendored upstream import `vendor/agent-skills-upstream/skills/` (see `docs/UPSTREAM-SKILLS.md`). On a name collision the native copy wins — never offer the vendored duplicate as a separate row.
10
10
 
11
- Analyse the workspace, then present a checklist of installable artifacts as **7 grouped multi-selects** (4 shared: Skills, Agent personas, Commands/prompts, References & Hooks; 3 pi-only: pi extensions & runtime skills, pi harnesses, External pi packages — an opencode workspace sees just the 4 shared groups). Multi-type groups carry a `Group` column labelling the sub-category. Mark what is already installed (pre-checked `[x]`). On `pi`, installing/refreshing/removing any harness also refreshes its companions — the `justfile` launch recipes (managed region only, so user recipes survive), the `team-up` script, the peer/team YAML, `.pi/damage-control-rules.yaml`, and `.pi/harnesses/package.json` — refreshed from the current source so retired-harness recipes are pruned and new ones added.
11
+ Analyse the workspace, then present the install menu per the skill's Step 1 interaction contract: with a native select widget, open with the **Express question** (`Recommended ★` / `Everything` / `Custom — group by group`, or the installed-state variants), and on `Custom` run the **7 groups** (4 shared: Skills, Agent personas, Commands/prompts, References & Hooks; 3 pi-only — an opencode workspace sees just the 4 shared groups) as single-select quick screens with multi-select drill-ins only behind `Customise`, chunked by sub-category; installed state shows as counts and plain-words descriptions (no pre-checking), removal only via an explicit `Remove some…` selection, and cancel = keep-as-is. Without a widget, fall back to the skill's tabular format (pre-checked `[x]` tables with text replies). On `pi`, installing/refreshing/removing any harness also refreshes its companions — the `justfile` launch recipes (managed region only, so user recipes survive), the `team-up` script, the peer/team YAML, `.pi/damage-control-rules.yaml`, and `.pi/harnesses/package.json` — refreshed from the current source so retired-harness recipes are pruned and new ones added.
12
12
 
13
13
  **Personas are generated for opencode.** The personas group lists the full availability roster from `node <source-root>/bin/cli.js transform-persona --list --agent opencode` (pi-only personas — `bowser`, `orchestrator` — are excluded). The apply step installs them into `.opencode/agent/<name>.md` via `transform-persona --agent opencode --workspace <workspace> <name…>` — always a generated copy, even in symlink mode — and records the rows with `transformed: true`; status checks diff against the generated output, not the raw canonical source.
14
14
 
@@ -26,6 +26,10 @@
26
26
  # runner: claude-code
27
27
  # model: opus
28
28
 
29
+ # Hub-only workspace: `just hub-team base --project <name>` creates a Herdr
30
+ # workspace containing only the guarded hub, with no reusable coms peer panes.
31
+ base:
32
+
29
33
  full:
30
34
  - name: web-debugger
31
35
  persona: web-debugger
@@ -1,5 +1,5 @@
1
- # Първият team се активира при старт. Смяна: /agents-team
2
- # researcher / deep-researcher не се листват — винаги достъпни през spawn_research.
1
+ # The first team is activated at startup. Switch with: /agents-team
2
+ # researcher / deep-researcher are not listed — they are always available through spawn_research.
3
3
 
4
4
  default:
5
5
  - planner
@@ -13,10 +13,38 @@ another main agent** and **use a coms peer as a subagent**.
13
13
  > P2P layer from [`pi-vs-claude-code`](https://github.com/disler/pi-vs-claude-code) by
14
14
  > [disler](https://github.com/disler) (MIT). See the
15
15
  > [extension catalog](../../../docs/pi-extensions.md) and the
16
- > [design plan](../../../docs/plans/agent-hub-multi-agent-harness.md).
16
+ > [design plan](../../../docs/plans/agent-hub/).
17
+
18
+ **Optional phone control:** `just hub-team <team> --project <name>` can supply the live peers for the experimental [Codex Android conductor](../../../docs/codex-remote-conductor.md). Configure Codex for the same project; do not also launch a second `conductor-codex <team>` peer workspace. Hermes remains the inbound `ask_user` route, while Codex performs only human-confirmed, approval-gated outbound delegation.
17
19
 
18
20
  ## What it does
19
21
 
22
+ The whole dispatch loop, end to end:
23
+
24
+ ```mermaid
25
+ sequenceDiagram
26
+ autonumber
27
+ actor U as You
28
+ participant H as Hub (dispatcher)
29
+ participant S as Specialist (e.g. builder)
30
+ participant R as Research helper
31
+ participant D as Disk (.pi/agent-sessions/)
32
+
33
+ U->>H: task
34
+ H->>D: set_assertions — Verification Contract persisted
35
+ H->>S: dispatch_agent (task + advisory scope)
36
+ S-->>H: NEEDS_RESEARCH: how does X work?
37
+ H->>R: spawn_research (researcher / deep-researcher)
38
+ R->>D: write findings file
39
+ R-->>H: one-line notice + path
40
+ H->>S: resume with file paths — never raw findings
41
+ S-->>H: structured return + named evidence
42
+ H->>D: update_assertion
43
+ H-->>U: Assertions: 2✓ 1○ 1✗ · open: A4
44
+ ```
45
+
46
+ Every borrowed idea from another harness passes one test before it lands: *does this persistently enter the dispatcher context?* If yes, it goes to disk or a one-line status instead.
47
+
20
48
  `agent-hub` is the supported home for the former standalone dispatcher features:
21
49
 
22
50
  - **Dispatcher grid** — a live dashboard of fixed specialists from `.pi/agents/teams.yaml`.
@@ -25,6 +53,12 @@ another main agent** and **use a coms peer as a subagent**.
25
53
  `kind: research` personas ship by default: `researcher` (fast `gpt-5.3-codex-spark`) for simple
26
54
  reads and `deep-researcher` (`gpt-5.5` / xhigh) for hard, cross-cutting investigation. The
27
55
  orchestrator routes by persona; each persona's model + thinking level is shown in its catalog.
56
+ Finished helpers are **auto-pruned** so the research row doesn't grow without bound: auto-research
57
+ pipe helpers disappear as soon as they finish (their findings persist as `findings/*.md` files and
58
+ their handles are never resumed), while manual/persona helpers keep only the `research-keep` most
59
+ recently finished (default 4 — resumable via `/agents-cont rN`; older cards, and their session
60
+ files, are dropped oldest-first). Set `research-keep: <n>|all` in the overrides file to change
61
+ the cap. Running helpers are never pruned and `rN` handles are never reused.
28
62
  - **Human handoff path** — `ask_user` is exposed by the `ask-user-remote` wrapper (capturing stock
29
63
  `pi-ask-user` and optionally racing a `user-remote` bridge), so specialists can bubble decisions
30
64
  back through the dispatcher.
@@ -82,7 +116,15 @@ another main agent** and **use a coms peer as a subagent**.
82
116
  - **Agent controls** — `/zoom` inspects a live agent timeline; `/agents-history` replays the run as a
83
117
  timeline (orchestrator turns, dispatches, research helpers) with per-agent durations, parallel-run
84
118
  markers, and a grand total; kill/restart controls manage running child agents; per-agent `model:`
85
- fields select models from team config. Restartable team specialists at or above 70% context render
119
+ fields select models from team config. The `agents-*` commands address **both target kinds** —
120
+ team specialists by persona name, research helpers by `rN` handle (mirroring `/zoom`):
121
+ `/agents-kill <name|rN|all>` SIGTERMs a specialist (keeping its standing card), while on a
122
+ research helper it kills **and removes** the card + session — helpers are disposable by design
123
+ (`all` clears every helper); `/agents-restart <name|rN>` re-runs the last task fresh (a research
124
+ helper must be finished first); `/agents-cont rN <prompt>` resumes a finished helper's session.
125
+ The old `/research-rm` and `/research-clear` spellings remain as aliases of the kill semantics,
126
+ `/research-cont` of `/agents-cont`.
127
+ Restartable team specialists at or above 70% context render
86
128
  their context percentage with a warning marker/color in dashboard and compact views, and their next
87
129
  `dispatch_agent` result adds a `/agents-restart <persona>` hint. Research helpers are not warned,
88
130
  and the hub never restarts specialists automatically.
@@ -280,9 +322,20 @@ task and follow their links instead of bulk-reading doc trees. The code-reviewer
280
322
  changes that alter documented behavior without a doc update; the documenter treats the entry
281
323
  points and the trees they link as the documentation it maintains.
282
324
 
325
+ The same section also tunes research-helper retention:
326
+
327
+ ```markdown
328
+ ## agent-hub
329
+ research-keep: 8
330
+ ```
331
+
332
+ `research-keep:` caps how many **finished** manual/persona research helpers stay resumable
333
+ (LRU by finish time, default 4; `all` disables the cap). Auto-research pipe helpers are
334
+ always pruned as soon as they finish, regardless of this key.
335
+
283
336
  Paths that don't exist produce a session-start warning, never an error. The full key list for
284
- `## agent-hub` (models, sub-roles, depth budgets, persona gate) is documented in
285
- `docs/agent-fleet-setup.md`.
337
+ `## agent-hub` (models, sub-roles, depth budgets, persona gate, research retention) is
338
+ documented in `docs/agent-fleet-setup.md`.
286
339
 
287
340
  ## The coms layer
288
341