Turn your AI agent into a cheaper hybrid — without changing what it does.
Leangetic maps your agent's model calls, replaces the steps that can be deterministic code with code, and tunes the rest (exact caching, prompt compaction, model routing). A judge proves the new hybrid is cheaper with equal-or-better quality on your own real traffic before you switch over with one command. Your original is never modified; rollback is instant.
This repository is the source-available client (published for transparency): the CLI and the local per-call engine that run on your machine. The mapping + synthesis service is hosted (see leangetic.com). Operated by Tendground Inc. (Delaware, USA).
# curl
curl -fsSL https://leangetic.com/downloads/leangetic.py -o ~/.local/bin/leangetic
chmod +x ~/.local/bin/leangetic
# or npm
npx @leangetic-ai/cli --helpleangetic start ./your-agent # listen locally (nothing changes); run your agent, then:
leangetic optimize ./your-agent # our servers map + build the hybrid (uses credits)
leangetic judge # prove cheaper + equal-or-better on your own traffic
leangetic promote # switch over (leangetic rollback to revert instantly)Full documentation: https://leangetic.com/docs · Security: https://leangetic.com/security
The client runs entirely on your machine and is safe to read (source-available — see LICENSE, not open-source):
leangetic.py— the CLI.leangetic_engine.py— the per-call engine: intercept (Anthropic/OpenAI/Gemini), record in SHADOW (hashes only), serve proven optimizations in ACTIVE, always fall back to your model.leangetic_transforms.py— the runtime that executes a synthesized transform spec.leangetic_judge.py— the local judge (cheaper + equal-or-better, zero regressions).leangetic_proxy.py,leangetic_claude.py,leangetic_mcp.py,leangetic_trace_import.py— the reverse proxy, the Claude CLI shim, the MCP server, and trace importers.
The optimization service (how candidates are discovered and code is synthesized) is a hosted, proprietary part of the product and is not in this repository.
By default only hashes and aggregate metrics are recorded locally; nothing is uploaded until
optimize, and even then only a redacted bundle (secrets stripped). Kill switch:
LEANGETIC_ENGINE=off. See https://leangetic.com/security.
See LICENSE.