Skip to main content
Glama

pre_commit_check

Analyze a staged diff and affected file paths to detect anti-patterns, stale memory anchors, and violated conventions. Returns a block recommendation and summary to prevent problematic commits before they are finalized.

Instructions

One-shot 'should I block this commit?' check. Combines three signals, all run internally by this one call — you do not invoke them separately:

  1. anti_patterns_check — known gotchas/attempts that match the diff

  2. mem_for_files — conventions/decisions anchored to touched files

  3. mem_verify — memories whose anchors are stale (knowledge may be wrong)

This is the COMBINED diff-scan layer — sensors, anti-patterns and stale anchors in a single call. hivelore enforce check is the git-hook gate that runs the same combination at commit time.

USE FROM A GIT HOOK or before finalizing a non-trivial change.

PARAMETERS: diff — raw unified diff text (e.g. git diff --cached) paths — affected file paths (project-relative) block_on — 'any' | 'high-confidence' (default) | 'never' semantic — use embeddings in anti_patterns_check (default true)

RETURNS: { should_block, summary, warnings, relevant_memories, stale_anchors }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
diffNoRaw unified diff text to scan. If omitted, only `paths` is used. When called from a pre-commit hook, pipe the output of `git diff --cached`.
pathsNoProject-relative paths affected by the change. At least one of `diff` or `paths` should be provided.
block_onNoWhen to set should_block=true: 'any' = any warning blocks; 'high-confidence' = only warnings from authoritative/trusted memories block; 'never' = report only, never block.high-confidence
semanticNoEnable semantic search in anti_patterns_check (requires embeddings index).
anchored_blocksNoWhen true, ALSO block a high-confidence anti-pattern (attempt/gotcha) that is anchored to a touched file AND corroborated by the diff (literal token overlap, or semantic >= 0.45) — not just very strong semantic matches. Powers the 'anchored' enforcement gate. Config/docs-only commits are still downgraded. Default false preserves the soft, semantic-only blocking behavior.
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It transparently explains that the tool combines three internal signals (anti_patterns_check, mem_for_files, mem_verify) without invoking them separately, and clarifies the meaning of parameters like `block_on` and `anchored_blocks`. However, it does not mention side effects on state (e.g., whether memories are modified), auth requirements, or rate limits. It does not contradict any annotations since none exist.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with a clear lead sentence, bulleted list of internal signals, and parameter definitions. It is front-loaded with the core purpose. The description of the return value is brief but adequate. The only minor inefficiency is perhaps repeating the phrase 'anti_patterns_check' in the semantic parameter description, but overall it is efficient and scannable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (5 parameters, 3 internal signals), the description covers the purpose, usage, parameter semantics, and output format. No output schema exists, so the description provides a clear return structure (`should_block`, `summary`, etc.). It lacks details on edge cases (e.g., what happens if both `diff` and `paths` are omitted) and does not specify cost or latency implications of the three internal checks, which could be useful for an agent deciding whether to call this tool. Still, it is largely complete for most usage scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 5 parameters, including defaults and enums. The description adds value by explaining the blocking logic for `block_on` (e.g., 'any' blocks on any warning) and the `anchored_blocks` detailed behavior (token overlap, semantic threshold). This goes beyond the schema by providing the agent with decision guidance, earning a score above baseline 3.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'One-shot should I block this commit? check', specifying the verb ('check'), resource ('commit'), and scope ('combines three signals'). It distinguishes itself from siblings by noting that the internal signals (anti_patterns_check, mem_for_files, mem_verify) are not invoked separately, making it clear this is a composite tool rather than a memory or code search tool.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly states when to use this tool: 'USE FROM A GIT HOOK or before finalizing a non-trivial change.' It also hints that `hivelore enforce check` is an alternative for git-hook gates, providing context but not confusing the agent. No direct sibling tool does the same thing, so the guidelines are clear and no exclusions are needed beyond what's stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Doucs91/hivelore'

If you have feedback or need assistance with the MCP directory API, please join our Discord server