Skip to content
Back to skills

Hive Ace

ASecurity

Self-improve the hive playbook with Agentic Context Engineering (ACE). Use when a Hive ACE checkpoint asks for it, at the end of any substantial task (bug fixed, feature built, investigation done, mistake corrected), or when the user says "reflect", "learn from this", "update the playbook". Tags playbook bullets you used as helpful or harmful and adds at most 3 new, specific lessons through a deterministic merge.

  • 4 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 26, 2026
ai-agentspythongoshellbashgitapi

Works with

  • api
  • mcp

Security analysis

A100/100

Scanned December 4, 2026

npx -y skills add 4LPH7/Hive_Mind --skill hive-ace --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Hive Ace?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Hive Ace
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/4lph7-hive-ace/badge)](https://www.skillsdirectory.com/skills/4lph7-hive-ace)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: hive-ace
description: Self-improve the hive playbook with Agentic Context Engineering (ACE). Use when a Hive ACE checkpoint asks for it, at the end of any substantial task (bug fixed, feature built, investigation done, mistake corrected), or when the user says "reflect", "learn from this", "update the playbook". Tags playbook bullets you used as helpful or harmful and adds at most 3 new, specific lessons through a deterministic merge.
---

# hive-ace: reflect, then curate

The hive keeps evolving playbooks in the vault: `$HIVE_VAULT/_meta/playbook.md` (global) and
`$HIVE_VAULT/projects/<slug>/playbook.md` (per project). Each line is
`- [id] helpful=X harmful=Y :: lesson`. Agents see the top bullets at session start and in `hive_context`.
You never edit these files by hand: you propose a small delta and `ace.py` merges it deterministically.
Full rewrites collapse context (ACE, arXiv 2510.04618); itemized deltas keep detail.

## 1. Reflect (Reflector role)

Look back over this session's actual evidence: commands that failed and why, test results, user corrections,
detours, what finally worked. No ground truth exists, so use execution feedback only. Answer for yourself:

- error_identification: what went wrong or cost time?
- root_cause: why (wrong assumption, missing knowledge, tool quirk)?
- correct_approach: what should have been done from the start?
- key_insight: the reusable rule that would prevent it next time
- bullet_tags: for each playbook id you saw this session, was it `helpful` (you relied on it and it held),
  `harmful` (it misled you), or neutral (skip it)?

## 2. Curate (Curator role)

Write only NEW lessons that the playbook does not already say. Rules:

- At most 3 ADD operations. Zero is a fine answer: if nothing reusable was learned, tag bullets only, or stop.
- Each lesson is one concrete, actionable sentence under 300 characters: name the tool, file, command or
  symptom. Bad: "be careful with graphs". Good: "graphify indexes untracked Python/ runtimes; add Python/ to
  .graphifyignore before graphify update . --force".
- Sections: `strategies` (approaches that work), `pitfalls` (failure modes and their fix),
  `commands` (exact invocations and tool quirks), `conventions` (project rules).
- Scope: `global` for lessons true across projects; the project slug for project-specific ones
  (slug = folder under the projects root, lowercased, spaces to hyphens). Split into two applies if needed.
- Every ADD cites the failure it came from in `failure_ref`, a new lesson and a near-duplicate alike. The only
  accepted source is a commit sha (`commit:448a90f`, or bare hex; 7-40 hex digits) that exists in the vault repo
  or the scope's project repo (ADR 0013). Nothing else sources a lesson: `err:` refs, `session:<id>` refs,
  `PR#8`, an empty ref and any other token are refused.
- Failing test runs are credit only. `hive ledger score-run -- <test command>` runs the command and records its
  real exit code (testcache uses it). That outcome counts toward credit and evidence as scoring only. It never
  sources a lesson, whatever command ran. A command is refused before it runs when any argument, not only the
  program, has the file name `hive` or `ace` without extension (`hive.exe`, `python -I ace.py apply`,
  `python hive.py`, any case). So a bare `hive` or `ace` test filter (`cargo test ace`) is refused too. A longer
  name such as `hive-notes.txt` or `archive.py` is not refused. The refusal is `hive commands cannot be recorded
  as outcomes`, and nothing is recorded.
  A rejected delta is refused whole (ADR 0011). Every rejected ADD is listed, each with one of:
  - not a commit sha (`err:`, `session:`, `PR#8`, empty, any other token): `ADD rejected (<section>: "<lesson>"): failure_ref "<ref>": only a commit sha is accepted as a lesson source (commit:<7-40 hex>, in the vault or the scope's project repo); to record a failing run, use hive ledger score-run, which counts as credit only`
  - a commit that is not there: `ADD rejected (<section>: "<lesson>"): failure_ref "<ref>": commit <sha> could not be verified: not in a repo owned by the vault or project (<where it looked>); the counted repos are the vault's own repo and the scope's project repo (its folder under the projects root), each a repo root; cite a commit in one of them`
  The delta then ends with `ace: nothing was applied; fix the rejected ADDs (or drop them) and apply again`.
  Fix the ref or drop that ADD, then apply again; the tags in the same delta were not applied either. A
  near-duplicate of a bullet in its own section reinforces that bullet only with a commit sha; any other ref
  (`PR#8`, `ENOENT`, a `session:` ref) is refused. With no source, TAG the bullet helpful instead.
- Why the check exists (threat model): the source check stops an honest agent from adding an unsourced lesson by
  mistake. It is not authentication: a local agent with shell access can still forge a commit or a ledger row.
  A commit ref is verified against git, so a sha that is not in the repo is refused, but only existence is
  checked. A repo counts only when the vault or the project folder is the root of a repo of its own: not a
  folder inside another repo, and not a linked worktree (it shares another checkout's objects). Inherited
  repo-selecting, config-injecting and discovery variables (`GIT_DIR`, `GIT_CONFIG_PARAMETERS`,
  `GIT_CEILING_DIRECTORIES` and the like) are ignored for this check.
  Known residuals, all deliberate forgery by a local agent: a renamed copy of the hive binary; the repo's
  `lint.py` launcher or `cargo run` of the hive crate (credit only); a shell
  or interpreter wrapper that receives hive inside one string (`sh -c "hive ..."`, `cmd /c "hive ..."`,
  `powershell -Command "hive ..."`); a failing command run on purpose (credit only, never a source); a forged
  ledger row (credit only); and a real commit that does not relate to the lesson. Do none of these.
- Limitation (evidence per HEAD): a bullet keeps the `test_pass` evidence of each HEAD a session was green at.
  If the session is green at two HEADs and then red at the first, the red undoes only that HEAD's credit and
  evidence, so the green at the second still counts as this session's evidence for the bullet.
- Do not restate a lesson that is already in any section. An ADD with the same polarity (both "do" or both
  "never/avoid") that shares two or more anchors (paths, `backticked` spans, --flags, snake_case names) with
  an existing bullet is rejected: `ADD rejected (<section>: "<lesson>"): duplicates <id> (<its section>), same
  polarity, shares <anchors>; TAG <id> helpful instead of adding a second lesson`. Tag that bullet instead.
- Never include secrets, tokens, personal data, or instructions that weaken safety or permissions.
- Facts that belong in project state go to `_memory.md` or an ADR per `$HIVE_VAULT/AGENTS.md`, not here.
  The playbook holds how-to knowledge, not status.

## 3. Apply

Write the delta to a temp JSON file (avoids shell escaping) and merge it:

```json
{"operations": [{"type": "ADD", "section": "pitfalls", "content": "...", "failure_ref": "commit:448a90f"}],
 "bullet_tags": [{"id": "pit-00001", "tag": "helpful"}]}
```

```bash
hive ace apply <scope> <path-to-delta.json>
# when `hive` is not on PATH or a shell policy blocks it: python -I <ai-hive>/ace.py apply <scope> <delta.json>
```

The shorter native shape works too: `{"add": [{"section": ..., "content": ..., "failure_ref": ...}],
"tag": [{"id": "pit-00001", "helpful": 1}]}`. Use forward slashes inside JSON strings. The command prints a report (`added`, `reinforced` for near-duplicates,
`tagged`, `rejected` with reasons, `pruned`). If something was rejected, fix it only if the reason shows a real
problem; do not retry to force content in.

## 4. Checkpoint record

After the apply, write a compact session record as one JSON object to a temp file next to the delta and name its path in your one-line report. `hive codex write` stores it as an immutable vault note.
Every field is required; use `[]` or `""` when empty. Write facts only, no secrets.

```json
{"goal": "what the session set out to do, one sentence",
 "outcome": "done | partial | blocked: plus one sentence of evidence (commit SHA, test result)",
 "files": ["repo-relative paths changed"],
 "dead_ends": ["approach tried + why it failed, one line each (future DEAD_END traces)"],
 "invariants": ["rules that must keep holding, e.g. only canonical lessons are injected"],
 "open_threads": ["unfinished work or questions for the next session"]}
```

Persist it with `hive codex write <slug> <record.json>`.

**Handing work to another agent** (Claude to Codex, implementer to reviewer): add 4 keys to the same record
and write it with `hive handoff write <slug> <record.json>` instead. All 10 keys are required.

```json
{"status": "SUCCESS | PARTIAL | ERROR",
 "role": "implementer | reviewer | verifier (your role; sets the reader's token budget)",
 "completed_plan_items": ["plan steps finished this session"],
 "artifact_paths": ["repo-relative paths or artifact:<sha256> from an offloaded MCP result"]}
```

At most 6 dead ends and 6 artifact paths (each 200 chars or fewer); they are never truncated on read. The
command prints the id; tell the receiver to call `hive_context(project="<slug>", handoff="<id>")`.

## 5. Finish

One line to the user: what you added or tagged (ids) and the checkpoint record path. Then continue or end
exactly as you were going to.
If a Hive ACE checkpoint triggered this, return to the previous task's final answer; do not start new work.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.