
Korg Ledger
io.github.New1DirectionPublished by GitHub account New1Directionv0.6.3Updated Oct 26, 2026
Verifiable cognition: prove a session ledger is tamper-evident; audit & import any agent's logs.
Overview
Exposes korgex's tamper-evident ledger over stdio so an assistant can verify, audit and import agent session logs.
- What you can do
- Verify a korg-ledger journal and prove it is tamper-evident-intact
- Audit the host agent's own Claude Code logs by importing and verifying them
- Import a vendor session transcript into a verifiable hash-chained ledger
- Work against a JSONL journal on disk, optionally HMAC-keyed for tamper-proofing
- When to use it
- Useful when you want an assistant to check that a recorded agent session was not altered, to turn existing Claude Code or other vendor transcripts into a verifiable chain, or to produce audit evidence for compliance or debugging.
- Requirements
- Runs as a local stdio process started with the korgex command and the mcp-server argument, installed from PyPI (korgex) with Python 3.10 or newer. Reads a JSONL journal whose location is set by KORG_JOURNAL_PATH (default .korg/journal.jsonl); optionally set KORG_LEDGER_HMAC_KEY to key the chain.
Installation
In SourceWeft
- Open Korg Ledger in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
[korgex — the verifiable coding agent]
[PyPI version] [PyPI downloads] [Python versions] [CI] [tests] [MCP registry] [License: MIT]
korgex
An AI coding teammate for your terminal — that keeps the receipts.
Tell korgex what you want in plain English — "fix the failing test," "add a healthcheck endpoint" — and it reads your code, makes the change, runs the tests, and shows you exactly what it did. It's free and open-source, and it works with whatever AI you prefer (Claude, ChatGPT, Gemini, Grok, or a private model running on your own computer), so you're never locked to one company.
Why it's different: everything korgex does is saved to a tamper-proof record you can check later. If anyone alters that record — even by a single character — korgex can prove it. It's a coding assistant you can audit, not just hope to trust.
For developers: terminal-native, plan-first, speaks both the Anthropic and OpenAI tool-use protocols, runs on any OpenAI- or Anthropic-compatible model (incl. local via Ollama), connects to any MCP server, streams live, and records every run to a hash-chained causal ledger you can check with korgex verify. MIT-licensed.
Table of Contents
- Install
- Quickstart
- The REPL — live in it
- How it works
- Verifiable cognition
- Tools
- Capabilities
- Safety & sandboxing
- CLI reference
- Environment variables
- Multi-model routing
- MCP integration
- Plugins
- Streaming TUI
- Architecture
- Project structure
- Development & testing
- Building & releasing
- Troubleshooting
- Known limitations
- License
Install
From PyPI (recommended)
Requires Python ≥ 3.10 (tested on 3.10, 3.11, 3.12, 3.13).
From source / latest main
Quickstart
Run bare korgex with no prompt to drop into the interactive REPL.
The REPL — live in it
Run bare korgex for a streaming, multi-turn session. It connects your MCP servers, reads your project rules, and keeps a per-session rewind log.
Slash commands
Inline shortcuts
@path/to/file— mention a file and its contents are pulled into the turn:refactor @src/auth.py to use @src/db.py.!command— run a shell command right there:!git status,!pytest -q.
Project rules. korgex init scaffolds an AGENTS.md; korgex auto-reads it — plus any nested AGENTS.md up the tree and .korgex/rules/*.md — every session, so it follows your house style.
Prompt caching keeps the system prompt + tools warm across turns (automatic on OpenAI/Gemini/Grok/DeepSeek; cache_control breakpoints on Claude/Qwen). Set KORGEX_CACHE_STATS=1 to see per-turn cache hits — and every hit is recorded on the ledger, so korgex cost prices cached tokens at their real discounted rate (and shows what the cache saved you), provable with korgex verify.
How it works
The agent is provider-agnostic by design: tool schemas are translated per provider ({name, description, input_schema} for Anthropic, {type:"function", function:{…}} for OpenAI), responses are normalized into a common shape, and tool results are formatted in whichever message structure the provider expects. Every tool call — built-in, MCP, or CodeAct — is recorded to the ledger as it happens.
Verifiable cognition
In plain terms: korgex keeps a logbook of everything it does — every file it reads, every command it runs. Each entry is sealed to the one before it, like links in a chain, so if anyone later changes, adds, or removes even one entry, the chain visibly breaks. The result is honest, checkable proof of what the AI actually did — for audits, compliance, debugging, or simple peace of mind. As far as we know, no other coding agent does this.
Under the hood: every run is recorded to a tamper-evident causal ledger, not an opaque log. Each event is hash-linked (prev_hash/entry_hash) to the previous one and causally linked (triggered_by) to what caused it — so a whole session can be cryptographically proven intact, and any edit, deletion, reorder, or splice is detected and localized to the offending event.
Memory drift. A remembered fact is anchored to a sha256 baseline of its source, so when the source moves on the staleness is an exact signal — and the keep/refresh/discard reconcile decision is itself recorded to the ledger.
Audit logs you already have — and share the proof. korgex audit imports a session you already ran (auto-discovers your Claude Code logs) into a verifiable chain. Add --html and you get a single self-contained file that re-verifies itself in the recipient's browser — including a live tamper test that breaks the chain on purpose so anyone can feel the evidence. No setup, no buy-in, no network calls.
Hand someone a receipt. korgex receipt mints a single portable file that proves what a run did — the events (so it checks offline), a plain-language --claim, a summary, and an optional --sign that attests who with your own key. The recipient confirms it with korgex receipt verify <file> (exit 0/1), or just opens the --html and watches it re-verify itself. A provable deliverable, not a screenshot.
Gate it in CI. Drop the verify-ledger GitHub Action into any repo to fail the build if an agent's ledger or receipt doesn't verify — zero trust in the tool that produced it:
See Self-Coding Bench for live reliability data across models.
Tools
The agent sees 23 high-level, model-facing tools (Claude-Code style), each with a deep description covering usage, edge cases, and anti-patterns. Under the hood they route to ~60 internal handlers (src/tools_impl.py).
Capabilities
Beyond the core file/shell/search loop, korgex ships several deeper systems. The riskier ones are opt-in and off by default (a single env var), and every one of them records to the verifiable ledger.
- CodeAct — code as the action space (
KORGEX_CODEACT_ENABLE=1). A persistent, fuel-metered Python kernel where the model writes code that calls tools as functions — denser than one-tool-call-per-turn. The nested execution trace is recorded to the ledger. When enabled, the kernel is OS-sandboxed by default where a backend exists — bubblewrap on Linux, Seatbelt on macOS — confining it to no-network + write-only-workspace (KORGEX_CODEACT_ISOLATION=auto/required/off). - Multi-agent orchestration (
KORGEX_PARALLEL_AGENTS, plus theOrchestratetool). Run a DAG of sub-agents concurrently — ledger-native and verifiable, with hard one-level nesting and each sub-run chained under its parent. - Auditable network capture (
KORGEX_NETCAPTURE_ENABLE=1). Run an app/script you wrote under a local CA-signing capture proxy and get a structured, redacted trace of every HTTP(S) exchange. Process-scoped, capture-only, secrets masked before they're recorded. - Verifiable browser (
KORGEX_BROWSER_STEALTH,KORGEX_BROWSER_EVAL). CDP-driven snapshot→act browser automation, ledger-recorded; opt-in stealth. - Remote signing (
KORGEX_REMOTE_SIGNER_*). Sign a ledger tip via an HTTP signer you own and control, so the signing key can live off the agent host (a separate box, an HSM). Fail-closed: bearer token, host allowlist, optional pubkey pinning, local signature verification. - Verifiable agent bus (
korgex bus,KORG_BUS_*). Agents coordinate over an Ed25519-signed, tamper-evident korg-ledger journal — "who said what" is a signature, not a claim. - Recall + memory — cross-session memory that is drift-checked against source baselines (Verifiable cognition).
- Local models (
korgex local). Hardware-aware advisor (CPU/RAM/GPU/VRAM → ranked, fit-scored picks via llmfit, optional) that can wire a local Ollama model as your default. On Apple Silicon,korgex local --omlxtargets a running omlx MLX server (OpenAI-compatible, continuous batching + tiered KV cache): bare lists the models it's serving,--omlx --use <model-id>wires it as your default (add--omlx-urlfor a non-default port). korgex doesn't reimplement inference — it just points at the local endpoint.
Safety & sandboxing
- Destructive-command guard (on by default;
KORGEX_COMMAND_GUARD). A whitelist-first, quote/comment-aware floor overBash(and the CodeAct bridge) that refuses obviously destructive commands; a block is a tamper-evidentcommand_guard.blockevent in the ledger. - Egress / exfil guard (on by default in flag mode;
KORGEX_EGRESS=off|flag|redact|block). Shape-based inspection of data leaving the box via outbound tools (WebFetch/WebSearch/BusSend/browser_navigate/MCP/networkBash): detects secret shapes (reusing the ledger redactor's patterns) and large encoded blobs.flagwarns + records anegress.flagverdict but never alters or blocks (additive);redactmasks the secret in the outbound payload before it leaves;blockrefuses. Every detection is a tamper-evident ledger verdict carrying the finding's shape only — the raw secret is redacted from the record, so the shareable ledger never becomes the exfil channel. Opt-in destination control viaKORGEX_EGRESS_ALLOW/KORGEX_EGRESS_DENY(comma-separated hosts). - Bash sandbox (
KORGEX_SANDBOX=modal|docker|direct|auto). Controls isolation for shell execution. - CodeAct OS isolation — sandbox-by-default (Linux/bubblewrap · macOS/Seatbelt) for the code kernel;
KORGEX_CODEACT_ISOLATION=requiredto fail closed,=offto disable. - Edit confirmation. Diffs for
Edit/Writeon critical files prompt[y/N]in the TUI; the edit policy is configurable viaKORGEX_EDIT_POLICY. - Opt-in by default for anything powerful. CodeAct, NetCapture, remote signing, and browser stealth are all off until you turn them on.
CLI reference
Any non-subcommand argument is treated as a prompt: korgex "create hello.txt with 'hi'".
Flags
Subcommands
Drive korgex from your editor (ACP)
korgex speaks the open Agent Client Protocol as an agent, so an ACP-capable editor can drive it directly — one verifiable, cross-vendor agent in your editor's agent panel. In Zed, add korgex as an external agent in settings.json:
Zed requires
"type": "custom"on each external agent — without it Zed rejects the wholeagent_serversblock ("missing fieldtype") and korgex won't appear. If Zed can't findkorgexon its (minimal GUI)PATH, use the full binary path as thecommand(e.g.~/.local/bin/korgex). After editing settings, Zed hot-reloads; if korgex still doesn't show, fully quit and reopen Zed.
Then pick korgex from the Agent Panel's New Thread menu. As it works, the editor shows live tool_call activity (read/edit/run/search cards, with an inline diff preview for edits) and streams the reply text — backed by the same tamper-evident ledger, so the whole session stays provable with korgex verify. (Editor handles a prompt turn per message; embedded @file context and pasted resources are accepted.)
By default korgex acts freely. To have the editor approve edits (a session/request_permission prompt with Allow / Allow-don't-ask-again / Reject), run it with KORGEX_EDIT_POLICY=ask:
Environment variables
Core
Capabilities (opt-in)
Ledger & bus
Provider-detection rule: if the model id contains "claude" or starts with "anthropic/", the Anthropic SDK is used; otherwise the OpenAI-compatible SDK (OpenAI, OpenRouter, Ollama, DeepSeek, vLLM, …). Set KORGEX_PROVIDER=openai to drive a claude/anthropic/* id through an OpenAI-compatible endpoint (e.g. Claude via OpenRouter).
Multi-model routing
--mode picks a model appropriate for the work type:
Explicit --model always wins over --mode. Default (neither set) is Sonnet 4.6.
MCP integration
Plain version: MCP is an open "app-store" standard for AI — it lets korgex plug into outside services (GitHub, your files, a database, …) without custom glue.
korgex includes a native MCP (Model Context Protocol) client. Any MCP server in your mcp.json becomes part of the agent's tool surface. Manage them from the CLI with korgex mcp (add/list/remove stdio or remote url+auth servers), and korgex mcp catalog / korgex mcp add <alias> for one-command presets. One worth knowing: korgex mcp add mise wires in mise's own agent-facing server — the agent gets your project's tool versions, env vars, and runnable tasks (plus run_task), all verifiable through the ledger.
korgex is an MCP server too
korgex mcp-server exposes the verifiable-cognition substrate over JSON-RPC/stdio so any MCP host (Claude Desktop, Cursor, …) can call:
korg_verify— prove a korg-ledger journal is tamper-evident-intact;korg_audit— audit the host agent's own Claude Code logs (import + verify), zero-config;korg_import— import a vendor session transcript into a verifiable chained ledger.
Listed in the MCP Registry — mcp-name: io.github.New1Direction/korg-ledger.
Configure & use
The agent discovers each server's tools at startup, registers them into the user-facing tool list, and routes calls back to the originating server. Server failures are logged and skipped — they never crash the agent.
Plugins
Extend korgex without forking it. Drop a .py file into ~/.korgex/plugins/ (global) or <repo>/.korgex/plugins/ (project-local) that defines a register(registry) function, and it hooks into the agent loop at startup.
Lifecycle hooks: on_user_prompt (each turn starts), pre_tool (before a tool runs), post_tool (after it returns), on_stop (run finishes). Plugins run in-process with full access — install only ones you trust — and are fail-safe: one that fails to import, lacks register, or raises is recorded and skipped without crashing startup.
Streaming TUI
When stdout is a TTY, the agent streams output live via Rich: thinking blocks in dimmed italic (Anthropic), text character-by-character, tool calls with a transient spinner (⠋ Read(file_path=src/foo.py)), [y/N] diff confirmation on critical edits, and graceful Ctrl+C interrupt (double to force-kill). Streaming auto-disables when stdout is piped, in CI, or with --quiet. OpenAI/OpenRouter streaming pipes through the same renderer; tool-call deltas are accumulated across chunks.
Architecture
System overview
Tool routing — stable model-facing names → internal handlers
The router (src/tool_abstraction.py) looks up the name in _TOOL_ROUTING, applies a param_map or a custom adapter, filters kwargs the handler doesn't accept, auto-injects context={'repo_root': cwd}, and catches exceptions into {"error": ...} so a single tool failure never kills the loop. MCP-sourced tools bypass _TOOL_ROUTING and dispatch through MCPServerManager.call_tool().
The agent loop
The plan-first system prompt directs the agent to plan, verify, diagnose-before-changing, and never modify build artifacts (SYSTEM_PROMPT in src/agent.py). The ledger lives in native Python (src/korg_ledger.py, src/ledger_spec.py) — no external runtime required.
Project structure
Development & testing
pyproject.toml is the package dependency source of truth. requirements.txt is
kept as a compatibility mirror for source checkouts and legacy automation; prefer
editable installs with extras for development.
The suite is 1,600+ tests with no live LLM calls (everything is unit-tested) and runs on Linux CI across Python 3.10, 3.11, 3.12, 3.13 on every push and PR. Major areas: the agent loop (routing, provider schemas, mode/model resolution, loop guards, the stall classifier, compaction), tools (fuzzy Edit, edit-freshness, background Bash, web), the verifiable ledger (hash-chain + causal DAG, redaction, the Ed25519 signed bus), CodeAct (kernel isolation, fuel, the tool bridge), MCP (namespaced multi-server router, OAuth refresh, full round-trip), prompt caching, skills (trust tiers, self-learning, the curator), and the REPL.
Building & releasing
Releases are automated. Bump version in pyproject.toml, update CHANGELOG.md, merge to main, then cut a GitHub Release — the PyPI publish workflow fires on release: published and uploads via OIDC Trusted Publishing (with digital attestations). No manual token handling.
To build locally for inspection: python -m build then python -m twine check dist/*.
Troubleshooting
korgex: No API key found — set one of ANTHROPIC_API_KEY, OPENAI_API_KEY, or KORGEX_API_KEY (with KORGEX_API_URL for non-OpenAI endpoints), or run korgex setup.
ModuleNotFoundError: No module named 'anthropic' (or openai, rich) — the deps weren't installed: pip install -e . (picks up everything from pyproject.toml).
Agent loops forever on tool calls — lower the cap: export KORGEX_MAX_ITERATIONS=10, and use --quiet to see only the final state.
--mcp is slow to start — the client connects to each server synchronously and waits for the handshake; unreachable entries in mcp.json each time out before being skipped. Remove dead servers or use korgex mcp to manage them.
verify reports a break — that's the point: it found and localized an altered/spliced event. The reported seq_id is where the chain diverges.
Known limitations
These exist today; PRs welcome.
- OpenAI streaming has fewer rendered events than Anthropic. Anthropic emits thinking blocks and message-delta usage; OpenAI emits only text and tool-call chunks. Both render correctly, but the TUI is richer for Anthropic.
- Dashboard authentication is not implemented. It binds to
127.0.0.1by default; don't setKORGEX_DASHBOARD_HOST=0.0.0.0without an auth-terminating reverse proxy in front. - The VS Code sidecar is a legacy companion to the dashboard; korgex's primary interface is the terminal REPL.
License
MIT — see LICENSE.
Related projects
- Model Context Protocol — the open MCP standard korgex implements (as both client and server).
- korg · korgchat — the broader ecosystem around the korg-ledger.
- llmfit — the hardware-aware local-model advisor
korgex localbuilds on (optional).
Source: README.md at commit b233132
Tools
0Version history
1- v0.6.3LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts