Dedup near-identical claude-code + codex hivemind-goals SKILL.md via generator

Open Beginner friendly
#200 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
node.js, typescript

Research direction

Start by checking package.json build/pretest scripts, then compare current claude-code/skills/hivemind-goals/SKILL.md and codex/skills/hivemind-goals/SKILL.md. Next inspect src/skills/hivemind-goals/ and scripts/build-skills.mjs for how the shared body and agents.json map to emitted files. Run npm run build and node scripts/build-skills.mjs --check; completion means the two Path-A SKILL files are regenerated from one template with matching output while hermes/... and openclaw/... remain untouched.

Written by the indexing model from the issue text.

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:

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).

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.

Dominant language
TypeScript
Stars
1.6k
Forks
107
Avg merge
19h 25m
Merged PRs (30d)
12

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from activeloopai/hivemind

All issues in activeloopai/hivemind

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.