activeloopai / activeloopai/hivemind
Dedup near-identical claude-code + codex hivemind-goals SKILL.md via generator
- Dominant language
- TypeScript
- Stars
- 1.6k
- Forks
- 107
- Avg merge
- 17h 30m
- Merged PRs (30d)
- 6
Description
## Context
PR #193 ships the goals + KPI cross-agent feature. Each of the four plugin-enabled agents (claude-code / codex / hermes / openclaw) has its own `skills/hivemind-goals/SKILL.md` because each runtime's skill loader reads from its own per-agent directory.
Three of the four files are genuinely different (different write paths require different bodies — Path A vs Path B vs Path C, see PR #193 body). The fourth pair, however, is near-duplicated:
```
claude-code/skills/hivemind-goals/SKILL.md ── 6249 bytes
codex/skills/hivemind-goals/SKILL.md ── 6233 bytes
```
`diff` between the two:
```diff
4c4
< allowed-tools: Read Write Edit Bash # claude-code
> allowed-tools: Bash # codex
```
**Body is bit-identical** (~6.2 kB of workflow / path conventions / examples). They diverge only on the `allowed-tools` frontmatter line because the two runtimes expose different tool name namespaces for the same Path-A workflow.
Surfaced by @kaghni in [#193 (comment)](https://github.com/activeloopai/hivemind/pull/193#discussion_r3290700132).
## Problem
Editing the workflow now requires **two synchronized edits**. The body has already drifted once during PR #193 development (caught at review). As the feature evolves (new statuses, KPI shape changes, new examples) the drift risk compounds.
The other agents (`hermes/`, `openclaw/`) are not part of this problem — their bodies are intentionally different (CLI-only warning, registered-tool semantics).
## Proposed approach
Single shared body source + per-agent frontmatter, emitted by a small build step:
```
src/skills/hivemind-goals/
body.md # the 6 kB workflow body (single source of truth)
agents.json # { "claude-code": "Read Write Edit Bash", "codex": "Bash" }
scripts/build-skills.mjs # reads body.md + agents.json,
# emits claude-code/.../SKILL.md and codex/.../SKILL.md
# runs in `npm run build` (pre-bundle), idempotent
```
Acceptance:
- [ ] `npm run build` regenerates both `claude-code/skills/hivemind-goals/SKILL.md` and `codex/skills/hivemind-goals/SKILL.md` from the single template.
- [ ] CI guard (or `pretest` step) verifies the two generated files are in sync with the template (`diff` against `<(node scripts/build-skills.mjs --check)` exits zero).
- [ ] `hermes/skills/hivemind-goals/SKILL.md` and `openclaw/skills/hivemind-goals/SKILL.md` are NOT touched by this dedup — they remain hand-authored variants because their bodies are substantively different (Path B / Path C semantics).
- [ ] One additional `agents.json` entry per future Path-A runtime if more come online (e.g. if cursor ever exposes a Write-tool intercept it joins the generator instead of hand-authoring).
## Out of scope (explicit non-goals)
- Cross-runtime dedup of the SessionStart-injected text — that already lives at `src/hooks/shared/goals-instructions.ts` as the single source of truth (`GOALS_INSTRUCTIONS` + `GOALS_INSTRUCTIONS_CLI`).
- Merging hermes / openclaw SKILL.md into a shared body — they describe genuinely different workflows (CLI vs tool calls). The hermes one carries a hard "do not use write_file" warning that is incorrect for VFS-enabled agents and vice versa.
- Other skills (`hivemind-memory`, `hivemind-login`, etc.) — out of scope; if they have similar near-duplicate pairs they get the same treatment in separate PRs.
## Effort estimate
~1 hour. Pure mechanical refactor — body content stays byte-identical; only the build step is new.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.