Deterministic gate: blocks any commit whose diff reintroduces a documented team mistake.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Inspect callable tools, capabilities, and parameters exposed to AI agents by Hivelore.
get_briefingβ Project context + decisions + gotchas + ranked breadcrumbs in one call
mem_saveSave repo policy knowledge (decision, gotcha, convention, attempt, architecture)
mem_triedRecord a failed approach so future agents do not repeat it
mem_searchFull-text or semantic search across context records
mem_relevant_toRanked context records for a task when project context is already loaded
mem_getFetch one context record after a compact briefing/search result
The deterministic policy gate for agent-written code β it refuses the commit that repeats a mistake your team already paid for.
A repo-native context policy for coding-agent harnesses; the rules live as team memory. Formerly published as hAIve (@hiveai/*).
Hivelore is the enforcement layer inside an AI coding-agent harness. It briefs agents with the team's non-obvious knowledge before they act, then turns each hard-won lesson into a deterministic gate β in MCP, Git hooks, and CI β that blocks the change about to repeat it. Same diff, same verdict, on every machine. Memory is the substrate; the gate is the product.
A capable model already knows generic best practice. What it cannot guess is your team's arbitrary, repo-specific knowledge: that public ids are id + 100000 prefixed AC-, that the status field must be "OK"/"KO", that you never edit an applied migration. Left to itself, a confident agent invents a plausible answer - clean, tested, green, and wrong by policy. Hivelore carries that unguessable knowledge into the task and blocks the change that's about to violate it.
Hivelore's job is not to replace tests, linters, or observability. It makes the repo-specific knowledge those tools cannot infer available, auditable, and enforceable.
Capture a mistake β attach a validated guard β the commit that repeats it is refused. Same diff, same verdict, on every machine and in CI. Reproduce it in 60 seconds β
AI coding agents are powerful, but they often act with incomplete repo context. Compaction, parallel sessions, agent switches, and stale advisory docs all create the same failure mode: the agent changes code without carrying the team's current decisions into the work.
Most teams work around this with instructions and hope:
Those rules are easy to skip. Hivelore turns them into repo-native context policy.
hivelore init creates a .ai/ context policy layer in your repo.get_briefing β one MCP call that returns small default context plus deeper breadcrumbs ranked by task relevance.hivelore enforce check and CI enforcement block unsafe states: missing briefing, stale critical decisions, an anchored anti-pattern your diff is about to repeat, or uncaptured session knowledge.Memory is the substrate. Context enforcement is the product promise. AI changes should not enter the codebase without consulting the team's current knowledge.
Harness engineering is about the environment around the model: feedforward guidance before it acts, feedback sensors after it acts, and workflow gates that keep bad states from landing. Hivelore owns the repo-specific context policy part of that harness.
| Harness concern | Hivelore role |
|---|---|
| Feedforward guidance | get_briefing, module context, skills, decisions, gotchas, failed attempts |
| Feedback and gates | MCP ordering policy, pre_commit_check, Git hooks, CI enforcement, stale-anchor detection |
| Knowledge lifecycle | Git-native Markdown records, path/symbol anchors, confidence, retirement, linting |
| Boundaries | Hivelore complements unit/e2e tests, type checks, runtime traces, security scanners, and LLM evals; it does not try to replace them |
The narrow positioning is intentional: Hivelore is not a general memory database or an agent dashboard. It is the control layer that helps coding agents act with the validated, non-obvious knowledge of the team.
Harness engineering regulates three different things about agent-written code. Hivelore deliberately covers two of them and treats the third as out of scope, for now.
| Harness dimension | Question it answers | Hivelore today |
|---|---|---|
| Maintainability | Is the code clean? (patterns, footguns, conventions) | β Covered β executable sensors + anti-pattern gate |
| Architecture fitness | Does it respect the team's structural decisions? | π‘ Partly β anchored decision/architecture memories + decision-coverage gate |
| Behaviour | Does the code do the functionally correct thing? | π‘ Bridged β command sensors route your own tests to lessons (see below) |
Why no behaviour harness yet. Verifying functional correctness needs an oracle β an independent
source of truth for what the code should do β and that oracle problem (plus the trap of an agent
grading its own work) is the least-mature part of the field. That territory belongs to your tests,
property-based checks, and LLM-evals; Hivelore does not try to replace them. What Hivelore does do is carry
the unguessable intent a behaviour test would otherwise have to encode (status must be OK/KO,
public ids = id + 100000) as feedforward context and deterministic sensors β a partial, static slice
of behaviour control, not a runtime functional oracle.
The bridge exists (v0.33.0): command sensors. A lesson can carry a command instead of a regex β your own test or invariant script. When a diff touches the sensor's paths, the gate executes it and a non-zero exit refuses the commit with the lesson as the message. Hivelore does not invent the oracle (the unsolved problem); it routes the oracle your team already owns to the lesson it protects:
Rules that keep it honest: opt-in per repo (enforcement.runCommandSensors: true β it executes
repo-authored commands), a proposal whose oracle fails on the presumed-correct tree is rejected,
an oracle that is still a pending stub cannot arm a block sensor, and an unrunnable command
(not found, timeout) warns but never blocks β a broken harness must not masquerade as a failing test.
Commands run with a scrubbed environment (test-runner basics only β no cloud credentials or
tokens). And you can make the guarantee demonstrable: --red-ref <pre-fix-commit> replays the
incident in a scratch worktree and requires the oracle to FAIL there β the sensor then records
red_proven: true, shown in the prevention receipt. A crash is not a RED: if the oracle errors
before reaching its assertion on the incident state (the guarded code doesn't exist yet, an import
or syntax error, "no tests found"), the replay reports red-unrunnable and refuses to claim proof.
Full behaviour verification (test generation, LLM evals) remains your test suite's job.
Since v0.43.0, prove-RED is mandatory for a blocking shell/test sensor: an oracle without a
reproducible incident state remains warn. CI can also set commandSensorUnrunnable: "block" so a
missing required oracle fails as a broken harness, and sensorWeakeningGate: "block" so protection
cannot be silently demoted or removed.
The on-ramp (v0.36.0): scaffold the test from the incident. A command sensor needs a test to
route β so Hivelore generates the skeleton from the lesson. hivelore sensors scaffold <memory-id>
(or the scaffold_test MCP tool, so agents do it in-session) detects your test framework
(vitest / jest / pytest / go), writes a pending test carrying the incident's provenance in its
header, and prints the exact sensors propose --kind test line to arm it. It never arms a sensor
itself (propose_sensor stays the sole validated writer); the stub stays pending so the suite is
green until you write the assertion. In a monorepo, the framework and location come from the
package that owns the lesson's anchor paths (a lesson under packages/api/ scaffolds into
packages/api/tests/β¦), not the repo root β and a lesson that spans several packages scaffolds
one pending test per owning package, all armed by a single sensor whose oracle chains their run
commands. A scaffold left pending or never armed is an open loop: doctor and enforce finish
nudge it (post-incident-test-unarmed) until the oracle is routed.
Pass the incident and the stub writes itself around the fix (v0.46.0). Add --red-ref <pre-fix-commit>
and the scaffold names the symbols the fix (red_ref..HEAD) actually touched and pre-fills the example
around them β import { refund } β¦, expect(refund(/* incident input */)).toBe(/* post-fix expected */)
instead of a blank subjectUnderTest(). It stays a pending, commented stub (no live import, suite
stays green) β a deterministic head-start, never an LLM guessing your assertion.
Lower the cost of expressing the invariant (v0.48.0): --style. The behaviour harness leaves the
oracle to you β so the scaffold offers the two deterministic ways to make that cheaper (no LLM
guessing your assertion):
--style property β a fast-check / Hypothesis skeleton:
state the invariant once (refund(a, b) β€ b) and it is checked over many generated inputs.--style differential --reference <impl> β state no invariant at all: assert the subject
agrees with a reference implementation (a legacy version, a second impl) for all generated inputs.Both stay pending, commented stubs (the suite stays green) and arm through the same validated prove-RED path once you fill them in.
Measure the behaviour harness (v0.45.0). hivelore doctor reports, per main code area, how much of
the behaviour surface is guarded: Behaviour harness: X/N area(s) guarded by a behavioural oracle (K armed, P red-proven) β so the branch's progress is visible, not guesswork. The human stats receipt
prints the same line as a footer. Since v0.47.0 the finding closes the loop to action: for each
uncovered area it prints the exact hivelore sensors scaffold <lesson> --red-ref <pre-fix-commit>
command in its Suggested commands (or a memory tried β¦ then scaffold line when no lesson exists yet).
See
STABILITY.mdfor the frozen 1.0 surface andCONTRIBUTING.mdto extend Hivelore.
Some gotcha and attempt memories can now carry a sensor block: a deterministic guardrail that
scans the diff. Three shapes, one validation doctrine (silent on correct code, fires on the mistake):
stripe.paymentIntents.create($$$) with absent: idempotencyKey): comments and string literals
can never false-positive, and "X without Y" is expressed on the call itself. Needs the optional
@ast-grep/napi engine β without it the sensor is unrunnable (warn, never block).Sensors turn a documented lesson into a repeatable feedback signal, independent of embeddings or
model judgment. Autogenerated sensors start as warn; humans promote vetted ones to block. The
doctrine is also enforced against inversion: a block pattern that matches the lesson's own
recommended fix (its Instead, use: snippet) is refused (fires-on-correct) β it would block the
correct code and never the mistake.
Cheaper arming (--from-fix). Authoring a discriminating regex is the main cost between a
documented lesson and an enforced one β so let the fix write it. sensors propose --from-fix <pre-fix-ref> mines the pattern from the fix diff: the line the fix removed is the mistake
(pattern), the line it added is the correct marker (absent). You confirm a candidate instead of
authoring a regex β and it still passes the full validation (silent-on-current, fires-on-bad,
not-inverted) before it can block.
This is the exact flow shown in the demo above.
Memory tools remember; Hivelore's difference is that a remembered lesson can refuse the commit that repeats it. Try it on any git repo:
Same diff, same answer, on every machine and in CI β the gate is deterministic by design.
Everything lives as reviewable Markdown in .ai/, versioned with your code. rm -rf .ai undoes it all.
hivelore init now also runs agent setup. It writes project-level MCP configs, records the best available mode, and asks before changing user-level client configs. In non-interactive shells it skips global config and tells you how to finish setup.
Claude Code (~/.claude.json):
Cursor (~/.cursor/mcp.json):
VS Code:
In your AI client, invoke the bootstrap_project MCP prompt. The agent analyzes your codebase and writes .ai/project-context.md automatically.
Every session starts with one call:
The agent gets project context + relevant module contexts + ranked context breadcrumbs in one shot β no more grepping to rediscover what the team already knows.
For CLI agents without native MCP, wrap them:
Check the selected mode any time:
Where the gate blocks. At a local commit, only deterministic content findings block β an
anchored anti-pattern or a sensor firing on your diff. The process/state gates (briefing loaded,
bootstrap, session recap) are advisory there and enforce at the sharing points (pre-push, CI),
where the code leaves your machine. A passing commit-time gate prints one line; --verbose shows every
check. This keeps quick local iteration friction-free while the team's knowledge is still enforced
before anything is shared. If a git hook was left broken by an old install, hivelore doctor --fix
regenerates it.
hivelore --help shows only the commands you use day to day. Everything else (review, import,
diagnostics, benchmarks) is one hivelore --advanced --help away β the focused surface is deliberate,
not a missing feature.
| Stage | Command | What it does |
|---|---|---|
| Set up | hivelore init | Create .ai/, bridge files, MCP config, hooks, CI |
hivelore doctor | Check the install is healthy | |
hivelore agent setup | Wire your AI client (MCP, hooks) | |
| Before editing | hivelore briefing | Feedforward context β the CLI mirror of get_briefing |
| Capture knowledge | hivelore memory save | Record a decision / convention / gotcha |
hivelore memory tried | Record a failed approach so it isn't repeated | |
| (passive) | Session failures observed by the hooks are auto-distilled into proposed drafts at session end β review with memory list --status proposed; they never self-validate and never carry sensors | |
| Retrieve | hivelore memory search Β· get | Find, then read a record |
| Feedback | hivelore sensors check | Scan the diff against documented lessons |
| Gate | hivelore enforce finish | Exit gate before you call the task done |
| Sync | hivelore sync | Re-check stale anchors, refresh bridge files |
| Close | hivelore session end | Save a recap for the next session |
One vocabulary across CLI and MCP. The memory verbs mirror the MCP tool names, so an agent learns
them once: hivelore memory save/search/get/delete β mem_save/mem_search/mem_get/mem_delete
(the older add/query/show/rm still work as aliases).
Want to evaluate Hivelore on a real codebase that isn't a toy? It is non-destructive β everything it
writes lives under .ai/ plus a few bridge files, all removable.
To remove everything Hivelore added: rm -rf .ai CLAUDE.md AGENTS.md GEMINI.md .cursorrules .clinerules .continuerules .windsurfrules .rules CONVENTIONS.md .github/copilot-instructions.md and drop the
.github/workflows/hivelore-*.yml files. Feedback from a repo that isn't ours is the most valuable thing
you can send β please open an issue with what worked and what didn't.
| Gate | What it checks |
|---|---|
| First-agent bootstrap | On a cold corpus, the first agent is forced to fill the knowledge layer before its commit/finish can pass: a filled project-context, a module context per component, an anchored memory per main code area, and a sensor per main code area. The trigger is corpus state β once the baseline exists the gate is silent for every later agent. Tunable via enforcement.bootstrapGate (off Β· warn Β· block (default)); only bites when production code is in play |
| Briefing loaded | Agent loaded fresh context breadcrumbs before editing |
| Decision coverage | Changed files are covered by relevant anchored decisions in the last briefing |
| Anti-pattern matching | Anti-patterns relevant to the diff are surfaced at the gate; a validated block sensor that fires on the added lines blocks the commit. Hardness is tunable via enforcement.antiPatternGate (off Β· review Β· anchored (default) Β· strict) |
| Gate-surface integrity | A diff that weakens a sensor (blockβwarn demotion, changed/removed oracle, broadened suppression, deleted block-sensor memory) is surfaced for review (sensor-weakened) β the gate lives in .ai/, so weakening it must never sail through unmentioned |
| Stale anchors | Memories anchored to deleted/moved paths are flagged |
| Session recap | Agent captured what changed and what remains before closing |
| CI enforcement | Required check blocks merge on any gate failure |
What "block" means here. Hivelore's gate is deterministic by design: the only thing that hard-blocks a commit is a validated sensor firing on the added lines β same diff, same answer, on every machine and in CI. Anchor, literal-token, and semantic matches (however strong) are surfaced for review, never blocked: relevance signals vary across environments and co-occurrence is not reintroduction.
propose_sensoris the path from a captured lesson to a blocking guardrail. Tighten or loosen withenforcement.antiPatternGate; everything else is enforced as process (was the context loaded, were decisions surfaced, is the recap present).
An empty corpus is worth nothing, so hivelore init seeds from signals the repo already has β and every
seed passes a quality floor so cold-start never ships generic, guessable advice. A seed earns its
place only if it carries an enforceable sensor or is concrete and non-generic.
| Source | What it seeds | Quality gate |
|---|---|---|
| Stack packs | Detected-framework traps (Next/Nest/Prisma/Flask/Rails/Tailwind/Dockerβ¦ 20+ packs), with block sensors where high-signal | specificity floor β generic advice is dropped, audited in CI |
Git history (--seed, on by default) | Draft memories from revert/hotfix/workaround commits β your repo's real scars | noise-subject denylist (merge/bump/deps/wip/format dropped) |
Scanner findings (hivelore ingest) | SonarQube / SARIF / ESLint / npm audit findings as proposed, anchored memories with sensors | auto-fixable stylistic rules dropped (incl. Sonar numeric keys); --include-stylistic to keep |
Ingested and git-seeded memories land as proposed (warn-only sensors). Review them with
hivelore memory list --status proposed; promote vetted sensors to block with hivelore sensors promote.
For CLI/IDE agents without MCP, hivelore init generates native config files from the same corpus, so
the team's memories and block sensors travel to whatever agent a developer uses β not just an empty
template, the enforcement edge too. hivelore sync keeps them fresh; never hand-edit them (regenerate with
hivelore bridges sync).
| Agent | File | Agent | File |
|---|---|---|---|
| Claude Code | CLAUDE.md | Cline | .clinerules |
| Cursor | .cursor/rules/haive-memories.mdc | Windsurf | .windsurfrules |
| Codex / generic | AGENTS.md | Continue | .continuerules |
| GitHub Copilot | .github/copilot-instructions.md | Cody | .sourcegraph/cody-rules.md |
| Gemini CLI | GEMINI.md | Zed | .rules |
| Aider | CONVENTIONS.md | Roo | .roo/rules/haive.md |
| Type | Description |
|---|---|
decision | Architectural or design choices the team has locked in |
gotcha | Non-obvious constraints, known footguns, subtle invariants |
convention | Naming, patterns, style rules specific to this codebase |
attempt | Failed approaches β so agents don't repeat them |
architecture | Component boundaries, interfaces, data flow |
All records can be anchored to file paths and symbol names. When anchored code changes, Hivelore flags the record as potentially stale.
| Tool | Description |
|---|---|
get_briefing | β Project context + decisions + gotchas + ranked breadcrumbs in one call |
mem_save | Save repo policy knowledge (decision, gotcha, convention, attempt, architecture) |
mem_tried | Record a failed approach so future agents do not repeat it |
mem_search | Full-text or semantic search across context records |
mem_relevant_to | Ranked context records for a task when project context is already loaded |
mem_get | Fetch one context record after a compact briefing/search result |
code_map | Look up symbols without manual grep when code-map is indexed |
mem_verify | Check anchor freshness, detect stale records |
scaffold_test | Generate a pending post-incident test from a lesson + the sensors propose --kind test line to arm it (monorepo-aware) |
pre_commit_check | Diff against known gotchas, decisions, and stale anchors |
mem_session_end | Save end-of-session recap for the next agent |
MCP profiles keep the product focused:
HAIVE_TOOL_PROFILE=enforcement (default): compact coding-agent harness.HAIVE_TOOL_PROFILE=maintenance: corpus review, lifecycle, distillation, code-search, and project-context maintenance.HAIVE_TOOL_PROFILE=experimental / full: legacy aliases for maintenance (the experimental
diagnostics were removed in v0.32.0 β months of usage showed a single call across all of them).| Prompt | Description |
|---|---|
post_task | β Post-task checklist β capture learnings before closing every session |
bootstrap_repo | β First-agent bootstrap β fills the whole knowledge layer the bootstrap gate requires (project-context, module contexts, anchored memories, a validated sensor per main area). Tailors a concrete checklist from the current corpus state and drives bootstrap_project_save β mem_save β propose_sensor until ready |
bootstrap_project | Analyze the codebase and write .ai/project-context.md |
| Package | Install | Description |
|---|---|---|
@hivelore/cli | npm i -g @hivelore/cli | Main product: init, enforce, run agents, briefing, memory, sync, CI/Git hooks |
@hivelore/mcp | bundled into @hivelore/cli | Policy-aware MCP server |
@hivelore/core | dependency | Types, schema, anchors, policy primitives, token budgets |
@hivelore/embeddings | npm i -g @hivelore/embeddings | Optional: local semantic ranking (bge-small-en-v1.5, fully offline) |
Also in this repo: a VS Code extension (surfaces memories inline + a Strategic Cockpit over the CLI's observability) and a GitHub Action (posts relevant team memories as a PR comment so reviewers and agents never miss a non-obvious constraint).
The PR loop. Review feedback is team truth in the making: reply /hivelore remember <rule>
on any review thread and the Action acknowledges it with the exact persist command; or run
hivelore ingest --from github-pr <number> to turn a PR's human review instructions
("neverβ¦", "alwaysβ¦", "prefer X instead") into proposed, file-anchored memories β each one a
candidate for sensors propose, which is the step no inferential review bot can take.
With persist-review-learnings enabled (default), the Action creates a dedicated branch and PR
containing the proposed memory; when repository write permission is unavailable, it falls back to
the local ingest command. Top-level PR comments and review-thread replies follow the same path.
Structural sensors. sensors propose --kind ast accepts either a concise --pattern or a full
ast-grep --rule <json> (inside/has/not/all/any). JavaScript/TypeScript are built in;
Python, Go, Rust, and Java are optional language packages shipped with the CLI. Rules still pass
Hivelore's silent-on-current/fires-on-bad validation before they can block.
Nested relational rules are not recursive by default: add "stopBy":"end" when has or inside
must search every descendant, for example {"has":{"kind":"interpolation","stopBy":"end"}}.
A briefing only earns its place when it carries unguessable knowledge, so get_briefing returns
briefing_value: "high" | "low". When nothing team-specific matches the files/task, the auto-generated
project context is trimmed to a one-line note (config: adaptiveBriefing, default on) β so Hivelore
surfaces deeper context only when it actually knows something the model doesn't.
hivelore eval auto-synthesizes retrieval cases from anchored memories and, when present, also loads
.ai/eval/spec.json for labeled retrieval/sensor cases. This repo uses that file to keep executable
memory sensors in CI, so a broken guardrail is caught before release.
Committed regression baselines use only versioned team/module memories and deterministic
anchor/lexical ranking; local usage counters, personal memories, and optional embedding caches cannot
make a baseline pass locally but fail in a clean CI clone. Semantic search remains exercised by the
embeddings/search test suites and by a separate --semantic-ranking CI lane backed by
.ai/eval/semantic-baseline.json. That lane fails closed when the package or index is unavailable.
hivelore doctor reports local setup drift that can make agents misdiagnose the repo: missing pnpm,
stale workspace dist artifacts, global CLI/MCP version skew, outdated code-search indexes, and low
memory-anchor coverage.
For projects with multiple components (frontend/backend/microservices), create one module context per component. get_briefing auto-loads the relevant module context based on the files being edited.
Requires Node 20 LTS+, pnpm 9+.
Issues and PRs are welcome. Please open an issue before starting significant work so we can align on direction.
Apache 2.0 β see LICENSE.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/hivelore)<a href="https://allmcps.com/mcp/hivelore"><img src="https://allmcps.com/api/badge/hivelore?style=directory" alt="Hivelore on AllMCPs" /></a>