Skip to main content

Claude Code extension that watches agent tool calls and suggests structured alternatives

Project description

Kibitzer

The person watching your chess game who can't help offering opinions.

Kibitzer is a Claude Code extension that watches how agents use tools and suggests better alternatives. It enforces path protection per mode, intercepts bash commands that have structured alternatives, and coaches agents toward more effective tool usage — all without an LLM in the decision loop.

PyPI Python License Docs

Install

pip install kibitzer
cd your-project/
kibitzer init --hooks --mcp

This registers PreToolUse/PostToolUse hooks in .claude/settings.json and starts an MCP server with two tools the agent can call: ChangeToolMode and GetFeedback.

For richer coaching with Fledgling conversation analytics:

pip install kibitzer[fledgling]

What it does

Path protection

Each mode defines which paths the agent can write to. The path guard checks every Edit, Write, and NotebookEdit call — including absolute paths from Claude Code.

Mode        Writable            Use case
─────────── ─────────────────── ───────────────────────────
free        everything          prototyping, no guardrails
implement   src/, lib/          normal dev — tests protected
test        tests/, test/       writing tests — source protected
docs        docs/, README.md    documentation only
explore     nothing             read-only investigation

When a write is denied, the agent sees why and how to fix it:

Path 'tests/test_auth.py' is not writable in the current mode (writable: ['src/', 'lib/']).
Use the ChangeToolMode tool to switch modes.

In testing, agents consistently read this message and call ChangeToolMode to switch — no documentation or pre-training needed.

Interception

Interceptor plugins watch Bash calls for commands that have structured alternatives:

Bash command Suggested alternative Plugin
git add -A && git commit -m '...' jetsam save jetsam
pytest tests/ blq run test blq
grep -rn 'def handler' src/ FindDefinitions(...) fledgling

Three interception modes form a ratchet — start in observe (log silently), graduate to suggest (show alternative), then redirect (deny bash, require structured tool). Each graduation is a one-line config change.

Coaching

The coach fires every N tool calls and detects patterns from ~250 experimental runs. Suggestions only reference tools the agent actually has — discovered from .mcp.json at runtime.

State-based patterns (always available):

  • Repeated edit failures — "Edit failed 3 times on src/handler.py. Try Read() first to see exact content."
  • Edit streak without tests — "You've made 7 edits without running tests." (mentions blq run test if blq is available)
  • Sequential file reads — "You've read 5 files one at a time." (mentions FindDefinitions if fledgling is available)
  • Bash-heavy usage — "You've run 6 bash commands without using structured tools."
  • Analysis loop — "You've spent 18 turns reading without changes. Start with the most confident fix."
  • Semantic tool underuse — "FindDefinitions shows all functions in one call." (only fires if fledgling is available)
  • Mode oscillation — "Frequent mode switches. Consider using free mode."

TDD patterns:

  • Test overfit — "test_auth.py has been edited 4 times. Stabilize test expectations before adjusting further."
  • Implement before test — "You edited source before writing tests. Consider starting with a failing test."

Fledgling-powered patterns (when fledgling is installed):

  • Repeated search patterns — "You've searched for 'def handle_request' 4 times via Grep."
  • Replaceable bash commands — "You've run 'grep' 3 times. FindDefinitions provides structured output."

All patterns are mode-aware: the analysis loop doesn't fire in explore mode (not editing is correct there), edit-without-test doesn't fire in docs mode (docs don't need tests).

Auto-transitions

The mode controller watches for failure patterns:

  • 3+ consecutive failures → auto-switch to explore
  • 20+ turns in explore → auto-switch back to implement

An oscillation guard prevents rapid switching: if the agent just left a mode (< 5 turns), it won't auto-switch back. After 6+ total switches, auto-transitions stop.

MCP tools

The agent can call two tools explicitly:

ChangeToolMode(mode, reason?) — Switch modes. Returns the new mode's writable paths and strategy.

GetFeedback(status?, suggestions?, intercepts?) — Check current status, get coaching suggestions, and see which bash commands have been intercepted.

Configuration

Override defaults in .kibitzer/config.toml:

# Monorepo: widen writable paths
[modes.implement]
writable = ["packages/core/src/", "packages/api/src/"]

# Add custom modes
[modes.deploy]
writable = ["infra/", "deploy/"]
strategy = "Verify before applying."

# Graduate jetsam to suggest mode
[plugins.jetsam]
mode = "suggest"

# More aggressive coaching
[coach]
frequency = 3

Coordinates with

Kibitzer suggests but never wraps these tools — each is independent:

  • blq — structured build/test capture
  • jetsam — git workflow acceleration
  • Fledgling — AST-aware code intelligence

None are required. Kibitzer degrades gracefully — path guard and coach work with nothing else installed. When tools are available, suggestions reference them specifically. When they're not, suggestions give generic advice.

Documentation

Full docs at kibitzer.readthedocs.io:

  • Modes — path protection, switching, auto-transitions
  • Coach — all patterns, experimental evidence, model dependency
  • Interceptors — the observe/suggest/redirect ratchet
  • Configuration — full config.toml reference, resilience, optional deps
  • Architecture — how the pieces fit together
  • Integration — blq, jetsam, fledgling, superpowers

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kibitzer-0.2.0.tar.gz (82.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kibitzer-0.2.0-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file kibitzer-0.2.0.tar.gz.

File metadata

  • Download URL: kibitzer-0.2.0.tar.gz
  • Upload date:
  • Size: 82.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kibitzer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0f6c3eac5ae66757cdb767b41a033663f740fda7b8a1cf17adf7e7685891ef85
MD5 c9052cee8b044d6956da713659fdd4d7
BLAKE2b-256 42f00b3875cc79daa6ae15d880174de6930d8a3678ddbe735a1f8ee87b836555

See more details on using hashes here.

Provenance

The following attestation bundles were made for kibitzer-0.2.0.tar.gz:

Publisher: publish.yml on teaguesterling/kibitzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kibitzer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: kibitzer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kibitzer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d19a1c533bfa3aa54e2b638d77e4802c18000b087bd8d19fe03180dc5ce4ea39
MD5 55300197474104778a90ec39081957ed
BLAKE2b-256 b64658661f3a2d00f122600d8a7499569a601cca66b9fe499e5d70d4869045d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for kibitzer-0.2.0-py3-none-any.whl:

Publisher: publish.yml on teaguesterling/kibitzer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page