Worktree hive
Skill rmems/worktree-hive
Spawn multiple subagents to handle issues into PRs and babysits the PR under isolated Git Worktrees. Side note this repo has gotten messy from mulitple git worktrees so it's going to be a while till I get this codebase verify and quality.
npx -y skills add rmems/worktree-hiveAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 29 days oldThe repository was created 29 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.8 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
worktrees-hives Skill
Installable agent skill for the worktrees-hives hybrid orchestrator.
When to use
Use this skill when:
- Discovering work from GitHub or Linear issues
- Spawning worker subagents for code changes
- Babysitting pull requests through CI
- Reporting results back to the operator
Safety Guardrails
These rules are NON-NEGOTIABLE. No agent, orchestrator, or platform override may relax them.
Deny-list (never execute)
| Command / Operation | Reason |
|---|---|
gh pr merge | Agents never merge PRs. A human must merge. |
gh pr merge --auto | Same prohibition; auto-merge is a merge. |
git push --force (bare) | Destructive; loses history. Use --force-with-lease only. |
git push -f (bare) | Short form of the same destructive push. |
GraphQL mergePullRequest | Merge via API is still a merge. |
REST PUT /repos/.../merge | Merge via REST is still a merge. |
| Any merge commit creation | git merge in working tree to combine PR branches. |
Allow-list for force-with-lease
git push --force-with-lease is permitted only when:
- The agent is rebasing its own feature branch onto an updated base.
- The agent is fixing a force-push that failed due to a stale remote ref.
- The operator explicitly instructs a force-push.
Before using --force-with-lease, the agent MUST:
- Verify the current branch is the assigned worktree branch (not
main,master, or another agent's branch). - Confirm the remote ref is what the agent expects (no unexpected pushes from others).
Fix-cap semantics
Rule: Each PR gets a maximum of 3 code-fix commits per babysit cycle.
- What counts: Commits that change source code, tests, configuration, or documentation that affects behavior.
- What does not count: Merge commits from rebasing, CI-triggered commits (e.g., lock file updates), reply comments on the PR.
- When the cap is hit: The agent MUST stop committing and report residual issues as PR comments. The agent continues to reply to review comments and monitor CI, but does not push new code changes.
- Residual reporting: When the cap is reached, the agent posts a comment listing: remaining CI failures, unresolved review threads, and recommended next steps for a human or next cycle.
- Reset: The cap resets when the operator starts a new babysit cycle (explicit restart, not automatic).
Branch/worktree pre-edit checklist
Before making any code change, the agent MUST verify:
- Worktree isolation:
pwdis inside the assigned worktree path ({worktree_root}/{owner}/{repo}/{job_id}). - Branch correctness:
git branch --show-currentmatches the assigned feature branch. - Clean state:
git statusshows no uncommitted changes from other work. - Remote alignment:
git fetch && git statusconfirms the branch tracks the expected remote. - No cross-boundary edits: No file outside the worktree is modified (no
../paths, no absolute paths outside the worktree root).
If any check fails, the agent MUST abort and report the mismatch.
Final status guidance
When a babysit cycle ends (successfully or at cap), the agent reports:
- PR status: Open / Ready for review / Blocked
- Fix count: Number of code-fix commits pushed in this cycle (e.g., "2/3")
- Residual issues: List of unresolved CI failures, review comments, or blockers
- Agent attribution: Every PR comment and commit message includes agent identification
The agent MUST NOT claim it merged the PR. If the PR appears merged, the agent reports "PR was merged by a human" and stops.
Platform-neutral worker prompt template
When spawning a worker subagent, include these safety instructions in the prompt:
SAFETY RULES (non-negotiable):
- NEVER merge a PR or invoke any merge API/CLI
- NEVER use bare `git push --force` or `git push -f`
- `git push --force-with-lease` is allowed only for rebasing your own branch
- NEVER edit files outside your assigned worktree
- NEVER commit more than 3 code-fix commits per babysit cycle
- Before editing, verify: worktree path, branch name, clean state
- After pushing, reply with SHA and agent attribution
- When at cap, report residual issues; do not push more code
Enforcement layers
These guardrails are enforced at multiple layers:
- Agent skill (this file): Portable documentation and prompt templates. Not a security boundary — agents may bypass if not constrained by the platform.
- Python orchestrator: Policy enforcement via the subprocess bridge. Counts fix commits, validates paths, and blocks deny-listed commands before they reach Rust.
- Rust core (
wh-core): Hard enforcement. Rejects unsafe git/GitHub operations at the process boundary. This is the authoritative safety layer.
Defense in depth: all three layers enforce the same rules. A failure in one layer is caught by another.
What ships with it: 61 files
705.7 KB alongside SKILL.md, 28 of them executable
.claude/
- settings.json389 B
crates/
- wh/Cargo.toml363 B
- wh-core/Cargo.toml469 B
- wh-core/src/contract.rs2.1 KB
- wh-core/src/error.rs3.9 KB
- wh-core/src/git_safe.rs67.7 KB
- wh-core/src/lib.rs448 B
- wh-core/src/paths.rs9.1 KB
- wh-core/src/state.rs3.8 KB
- wh-core/src/status.rs9.8 KB
- wh-core/src/supervisor.rs43.2 KB
- wh-core/src/worktree.rs22.0 KB
- wh/src/main.rs37.3 KB
docs/
- examples/bootstrap.json100 B
- examples/error-force-push.json318 B
- examples/error-merge-forbidden.json293 B
- examples/error-policy.json206 B
- examples/state-add.json475 B
- examples/state-show.json564 B
- examples/worktree-create.json257 B
- examples/worktree-list.json371 B
- json-contract.md7.1 KB
- status-schema.md6.5 KB
python/
- pyproject.toml1.9 KB
- qodana.yaml629 B
- src/worktrees_hives/attribution.pyruns4.6 KB
- src/worktrees_hives/babysit.pyruns37.5 KB
- src/worktrees_hives/bridge.pyruns8.6 KB
- src/worktrees_hives/ci_taxonomy.pyruns11.5 KB
- src/worktrees_hives/claim.pyruns11.8 KB
- src/worktrees_hives/cli.pyruns9.4 KB
- src/worktrees_hives/contract.pyruns4.4 KB
- src/worktrees_hives/discover.pyruns21.8 KB
- src/worktrees_hives/errors.pyruns1.6 KB
- src/worktrees_hives/__init__.pyruns3.1 KB
- AGENTS.md13.3 KB
- Cargo.toml530 B
- CLAUDE.md2.2 KB
- .gitignore5.3 KB
- LICENSE11.1 KB
21 more files not listed here. See all 61 in the repository.