agentleFS
last9last9/mithai/CLAUDE.md

mithai

CLAUDE.md20 starsChanged 5 months agoApache-2.0View on GitHub

An AI agent framework for infrastructure operations. It gives teams an AI-powered ops agent (backed by Claude) that lives in Slack, Telegram, and a terminal simultaneously. The agent uses skills (plugins) to take actions and Human MCP for human-in-the-loop approval of risky operations. Engine (src/mithai/core/engine.py) — Central orchestrator. Builds system prompt from skill prompts, runs the LLM tool-use loop with Human MCP checks. Adapter-agnostic: the adapter is passed per-call so one engine can serve multiple adapters. ToolRouter (src/mithai/core/tool_router.py) — Namespaces…

  • Reads credentials
  • Installs packages

The file

We split this CLAUDE.md into the rules it gives an agent

1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    When bumping the CA bundle (certifi), prove the change with a TLS handshake through a CONNECT proxy: the new bundle rejects the distrusted …

    line 83

≈ “Common” is an estimate: at least 1 in 5 of the 26,980 CLAUDE.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

What is mithai

An AI agent framework for infrastructure operations. It gives teams an AI-powered ops agent (backed by Claude) that lives in Slack, Telegram, and a terminal simultaneously. The agent uses skills (plugins) to take actions and Human MCP for human-in-the-loop approval of risky operations.

Common Commands

# Install dependencies (uses uv)
uv pip install -e ".[dev]"

# Run all tests
uv run pytest

# Run a single test file
uv run pytest tests/test_engine_images.py

# Run a single test by name
uv run pytest tests/test_tool_router.py -k "test_route_calls_handler"

# Lint
uv run ruff check src/ tests/

# Format
uv run ruff format src/ tests/

# Build native binary
make build-binary

Architecture

Core Loop

Adapter (Slack/Telegram/CLI) → Engine → LLM (Claude API)
                                  ↓            ↓
                              ToolRouter    Tool calls
                                  ↓       (skill__tool namespacing)
                              Skill handler or MCP server
                                  ↓
                              HumanMCP (approve/confirm/auto)

Engine (src/mithai/core/engine.py) — Central orchestrator. Builds system prompt from skill prompts, runs the LLM tool-use loop with Human MCP checks. Adapter-agnostic: the adapter is passed per-call so one engine can serve multiple adapters.

ToolRouter (src/mithai/core/tool_router.py) — Namespaces tools as skill_name__tool_name (double underscore separator). Routes LLM tool calls back to the correct skill handler or MCP server. Enforces allowed_tools for multi-agent mode.

Adapters (src/mithai/adapters/) — Platform-specific message transport. All extend Adapter base class. IncomingMessage and OutgoingMessage are platform-agnostic dataclasses.

HumanMCP (src/mithai/human/mcp.py) — Human-in-the-loop protocol. Tools declare their level: None (auto), "approve", "confirm", or "dynamic" (resolved at runtime by skill's resolve_human() function). Config overrides in config.yaml can escalate or de-escalate.

Skills

Each skill is a folder under skills/ with:

  • SKILL.md — system prompt fragment telling the LLM what the skill does
  • tools.py — exports TOOLS list (tool definitions) and handle(name, input, ctx) function

Optional exports: resolve_human() for dynamic approval, startup() for initialization, bind() for adapter binding, mcp_tools list for MCP server delegation.

Skills are loaded dynamically by skill_loader.py via importlib.

Config

config.yaml + .env — Parsed by src/mithai/core/config.py using Pydantic models. Environment variable substitution via ${VAR} syntax in YAML values.

Key Subsystems

  • Memory (src/mithai/memory/) — Persistent memory backend (MEMORY.md file or other backends). Shared across channels.
  • State (src/mithai/state/) — State backend for conversation/session persistence.
  • Session (src/mithai/core/session.py) — Session management per channel.
  • MCP Manager (src/mithai/core/mcp_manager.py) — Manages external MCP server connections for skills that delegate to them.
  • Telemetry (src/mithai/telemetry/) — OpenTelemetry integration (optional).
  • UI (src/mithai/ui/) — Web UI adapter (optional).

Testing

Tests use pytest with pytest-asyncio (async mode = "auto"). Test fixtures for skills and config are in tests/conftest.py. Tests create temporary skill directories with SKILL.md + tools.py to test the full skill loading pipeline.

When bumping the CA bundle (certifi), prove the change with a TLS handshake through a CONNECT proxy: the new bundle rejects the distrusted host, the old bundle accepts it, and a normal host still passes.

Documented Solutions

docs/solutions/ — documented solutions to past problems (bugs, integration issues, patterns), organized by category with YAML frontmatter (module, tags, problem_type). Relevant when implementing or debugging in documented areas.

Project Config

  • Python 3.11+, managed with uv
  • Build system: hatchling
  • Linter/formatter: ruff (line-length 100, target py311)
  • Package source: src/mithai/ (src layout)
  • CLI entry point: mithai → src/mithai/cli/main.py:cli (Click-based)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.