Skip to main content
Glama

claude-gladiator-mcp

An Model Context Protocol (MCP) server that helps Claude Code learn from its own mistakes. Observe patterns during work, then reflect to get recommendations for updating your rules, hooks, and skills.

claude-gladiator-mcp

npm version License: MIT TypeScript Node.js Claude GitHub stars


Inspired by the continuous learning experiments for Claude Code: Everything Claude Code by Affaan-m, Claudeception by blader, and Homunculus by humanplane. Research foundations: Voyager (Wang et al., 2023) and Reflexion (Shinn et al., 2023).

install

Requirements:

Claude Code

From shell:

claude mcp add claude-gladiator-mcp -- npx claude-gladiator-mcp

From inside Claude (restart required):

Add this to our global mcp config: npx claude-gladiator-mcp

Install this mcp: https://github.com/Vvkmnn/claude-gladiator-mcp

From any manually configurable mcp.json: (Cursor, Windsurf, etc.)

{
  "mcpServers": {
    "claude-gladiator-mcp": {
      "command": "npx",
      "args": ["claude-gladiator-mcp"],
      "env": {}
    }
  }
}

There is no npm install required -- no external dependencies or local databases, only clustering algorithms.

However, if npx resolves the wrong package, you can force resolution with:

npm install -g claude-gladiator-mcp

Related MCP server: Claude Soul

skill

Optionally, install the skill to teach Claude when to proactively observe and reflect:

npx skills add Vvkmnn/claude-gladiator-mcp --skill claude-gladiator --global
# Optional: add --yes to skip interactive prompt and install to all agents

This makes Claude automatically observe tool failures, user corrections, and codebase patterns. The MCP works without the skill, but the skill improves discoverability.

plugin

For automatic observation hooks and session-end reflection prompts, install from the claude-emporium marketplace:

/plugin marketplace add Vvkmnn/claude-emporium
/plugin install claude-gladiator@claude-emporium

The claude-gladiator plugin provides:

Hooks (targeted, zero overhead on success):

  • After Bash/Edit/Write errors → Observe failure pattern via gladiator_observe

  • Before session ends → Reflect on unprocessed observations via gladiator_reflect

Requires the MCP server installed first. See the emporium for other Claude Code plugins and MCPs.

features

MCP server that gives Claude a learning loop. Observe patterns, cluster them, evolve your configuration.

gladiator_observe

Record a pattern worth learning from -- tool failures, corrections, conventions, decisions. Deduplicates by SHA-256 hash of summary.

gladiator_observe summary=<summary> tags=<tags> context=<context>
  > "Edit failed on config.ts -- 3 identical import blocks, fixed by including surrounding context"
  > "User wanted tests in __tests__/ not next to source -- project convention"
  > "All API routes use zod validation middleware -- schema in routes/schemas/"
┌─ ⚔ ───────────────────────────────────────────────────── Recorded ─┐
│ Edit failed on config.ts -- 3 identical import blocks              │
│ Recommend (rule): Next time: included 3 lines above                │
│ Tags: edit, disambiguation                                         │
│ Backlog: 3 unprocessed of 12 total                                 │
└────────────────────────────────────────────────────────────────────┘
{
  "id": "obs_1738012345_a7f3",
  "ts": "2025-01-27T18:32:25.000Z",
  "summary": "Edit failed on config.ts -- 3 identical import blocks",
  "recommendation": "Next time: included 3 lines above",
  "artifact_type": "rule",
  "context": {
    "tool": "Edit",
    "error": "old_string not unique",
    "before": "used import line only",
    "after": "included 3 lines above"
  },
  "tags": ["edit", "disambiguation"],
  "processed": false
}

gladiator_reflect

Cluster unprocessed observations, scan existing ~/.claude/rules/, ~/.claude/hooks/, and ~/.claude/skills/, and recommend whether to update an existing artifact or create a new one.

gladiator_reflect
  > "I've accumulated 5 observations about edit failures -- what patterns emerge?"
  > "Review what I've learned this session before it's lost"

gladiator_reflect query="testing"
  > "Search past observations about testing conventions"

Cluster mode (unprocessed observations exist):

┌─ ⚔ ──────────────────────────────────────────────────── Reflected ─┐
│ 5 observations → 2 groups                                          │
│ 8 existing artifacts scanned (IDF-weighted)                        │
│                                                                    │
│ UPDATE avoid: edit-disambiguation (3 obs)                          │
│   - Next time: included 3 lines above                              │
│   - Include surrounding function context for disambiguation        │
│   - Check for duplicate imports before editing                     │
│ NEW rule: testing-convention (2 obs)                               │
│   - Next time: moved to __tests__/utils.test.ts                    │
│   - Use __tests__/ directory for all test files                    │
└────────────────────────────────────────────────────────────────────┘
{
  "observations_analyzed": 5,
  "groups_found": 2,
  "existing_artifacts_scanned": 8,
  "groups": [
    {
      "suggested_name": "edit-disambiguation",
      "artifact_type": "rule",
      "tags": ["edit", "disambiguation", "old_string"],
      "action": "update",
      "update_targets": [{ "type": "rule", "name": "avoid", "path": "~/.claude/rules/avoid.md" }],
      "observations": ["..."]
    },
    {
      "suggested_name": "testing-convention",
      "artifact_type": "rule",
      "tags": ["convention", "testing"],
      "action": "create",
      "update_targets": [],
      "observations": ["..."]
    }
  ],
  "actions": [
    "PREFER updating existing artifacts over creating new ones",
    "Consolidate related observations into a single change when possible",
    "Only create new artifacts when no existing one covers the topic"
  ]
}

Stats mode (nothing unprocessed):

┌─ ⚔ ──────────────────────────────────────────────────────── Stats ─┐
│ Observations: 12 total, 0 unprocessed                              │
│   rule: 8                                                          │
│   skill: 3                                                         │
│   hook: 1                                                          │
└────────────────────────────────────────────────────────────────────┘

Query mode (gladiator_reflect query="edit"):

┌─ ⚔ ──────────────────────────────────────────────────────── Found ─┐
│ "edit" -- 4 observations                                           │
│   Edit failed on config.ts -- 3 identical import (2h ago)          │
│   Edit old_string matched wrong function in uti (1d ago)           │
│   Edit succeeded after adding file_path context (3d ago)           │
│   Edit conflict on package.json -- concurrent wr (5d ago)          │
└────────────────────────────────────────────────────────────────────┘

methodology

How claude-gladiator-mcp works:

gladiator_observe(summary, tags, context)
      │
      ├─ dedup ─── SHA-256(summary) vs last 100 ─── duplicate? → skip
      ├─ classify ─ tags + context → rule | skill | hook | agent
      ├─ recommend  context.after → "Next time: ..."
      └─ append ─── → observations.jsonl


gladiator_reflect(query?, limit?)
      │
      ├─ query? ──────── search all by summary/tags/error → return matches
      │
      ├─ 0 unprocessed ─ return stats: total, by_type, recent 5
      │
      └─ N unprocessed ─┐
          │              │
          ├─ cluster ─── Jaccard(tags) > 0.3 → merge into groups
          │              majority-vote artifact_type per group
          │
          ├─ scan ────── rules/*.md + hooks/* + skills/*/SKILL.md
          │              extract keywords (>3 chars) per artifact
          │
          ├─ score ───── IDF: 1/docFreq(word) per shared keyword
          │              filter words in >40% of artifacts
          │              name match bonus: +5
          │              threshold: >= 3.0 → "update"
          │
          ├─ mark ────── processed = true
          │
          └─ return ──── per cluster: action, targets, observations

Core algorithms:

Design principles:

  • Two-phase learning -- observe first, reflect later; never modify artifacts in real-time

  • Update over create -- prefers updating existing rules/hooks/skills over creating new ones

  • Append-only storage -- JSONL format, each observation self-contained, never mutated

  • Zero dependencies -- only @modelcontextprotocol/sdk, zod

  • Offline -- never leaves your machine, no network calls

File access:

  • Reads/writes: ~/.claude/gladiator/observations.jsonl (JSONL, each line is a self-contained JSON object with timestamp, summary, tags, context, and processing state)

  • Scans (read-only): ~/.claude/rules/, ~/.claude/hooks/, ~/.claude/skills/

development

git clone https://github.com/Vvkmnn/claude-gladiator-mcp && cd claude-gladiator-mcp
npm install && npm run build
npm test

Package requirements:

  • Node.js: >=20.0.0 (ES modules)

  • Runtime: @modelcontextprotocol/sdk, zod

  • Zero external databases -- works with npx

Development workflow:

npm run build          # TypeScript compilation with executable permissions
npm run dev            # Watch mode with tsc --watch
npm run start          # Run the MCP server directly
npm run lint           # ESLint code quality checks
npm run lint:fix       # Auto-fix linting issues
npm run format         # Prettier formatting (src/)
npm run format:check   # Check formatting without changes
npm run typecheck      # TypeScript validation without emit
npm run test           # Lint + type check
npm run prepublishOnly # Pre-publish validation (build + lint + format:check)

Git hooks (via Husky):

  • pre-commit: Auto-formats staged .ts files with Prettier and ESLint

Contributing:

  • Fork the repository and create feature branches

  • Follow TypeScript strict mode and MCP protocol standards

Learn from examples:

license

MIT

Pollice Verso by Jean-Léon Gérôme (1872). "Ave Imperator, morituri te salutant." Claudius replied "Aut non" (or not).

Available Tools

2 tools
gladiator_observeObserve PatternB
Idempotent

Record a pattern worth learning from, with optional recommendation and artifact type. Deduplicates by summary hash.

Inputs: summary (required), tags, source, context, +3 more.

gladiator_reflectReflect on PatternsA
Read-onlyIdempotent

Query and cluster observations. No args = stats overview. With query = filtered search. Unprocessed observations are clustered by tag overlap with recommendations.

Inputs: limit, query.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 2 tools

    Disambiguation5/5

    The two tools split cleanly along a write/read axis: gladiator_observe records a pattern, gladiator_reflect queries and clusters them. There is no plausible scenario where an agent would confuse the two, and the descriptions make the boundary explicit.

    Naming Consistency5/5

    Both names follow a uniform pattern of a server prefix plus a single verb (gladiator_observe, gladiator_reflect), all snake_case with matching namespace. Fully predictable and readable.

    Tool Count3/5

    Two tools is at the thin end of the range for a pattern-learning/memory server; the whole surface is one write and one read. It is coherent but leaves no room for targeted operations like fetching or retiring a specific observation.

    Completeness3/5

    Create and query are covered, including deduplication and clustering, but there is no update, delete/forget, or get-by-id operation, so an agent cannot correct or prune an observation it recorded badly. The record-and-recall loop works, but the lifecycle is truncated.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      Self-improving learning engine for Claude Code. Extracts signals from sessions (corrections, successes,confusion), runs periodic reflections, and evolves behavioral frameworks through evidence. 9 MCP tools, automatichooks, local-only.
      15
      94
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives Claude Code persistent memory across sessions, detecting and classifying user corrections, and evolving behavioral frameworks from accumulated evidence. Exposes 15 MCP tools for semantic memory search, signal recording, self-evaluation, and reflection cycles that run locally alongside automatic hooks.
      6 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Gives Claude Code a persistent identity and cross-session memory with semantic search over saved facts, decisions, and journals. It also detects and classifies user corrections into behavioral patterns with lifecycle trends, reflecting periodically to promote or retire working frameworks.
      6 npm
      MIT