mx
A Swiss army knife for Claude Code and multi-agent toolkits.
A Rust CLI providing encoded git operations, a SurrealDB-backed knowledge graph, session archival, GitHub sync, and emotional state tensors. Designed for use with Claude Code, but works with any multi-agent workflow that needs persistent memory, encoded commits, or session management.
Installation
Or from source:
Requires Rust 2024 edition. The binary is named mx.
Quick Start
Encoded Git Commits
mx commit wraps git commit but encodes the message using base-d. The commit title is hashed and the body is compressed, each encoded through a randomly selected dictionary. The result looks like hieroglyphs in git log but decodes cleanly with mx log.
# Stage all and commit with an encoded message
# Stage all, commit, and push
# See what the encoding produces without committing
Decoded Git Log
mx log has full parity with git log -- every display flag, format preset, and filter option works with transparent decoding.
# Last 10 commits, decoded (default)
# Last 3 commits (-N shorthand, like git log -3)
# One-line format with ref decorations
# Full details with diffstat
# Format presets: short, medium, full, fuller
# Filter by author, date, path
# Full patch output
Decoded Git Show
mx show is a drop-in replacement for git show that transparently decodes encoded commit messages. All git show flags work as expected.
# Show the latest commit, decoded
# Show a specific commit with diffstat
# Show just the commit message, no diff
# View a file at a specific revision (passes through to git show)
Knowledge / Memory
The memory system is a knowledge graph backed by SurrealDB (or embedded SurrealKV). Entries have categories, tags, resonance levels, embeddings, and relationships.
# Search knowledge entries
# Semantic (vector) search
# Add a knowledge entry
# Show a specific entry
# List entries filtered by category
# Statistics
Default categories: pattern, technique, insight, gotcha, reference, decision, bloom, session. Categories are customizable per-deployment -- run mx memory categories list to see available categories.
KV Store
Fast local key-value state per agent. Counters, strings, lists, timestamped history, and structured state fields -- all backed by a TOML schema file and a JSON data file. No networking, no database.
# Basic operations
# Batch set multiple state fields at once
|
# Auto-create a key in the schema and push in one step
# Structured data on entries
# Query by structured data with --where
# Time-range queries on history/list keys
# Time range composes with --count (filter first, then limit)
# Entry lookup by numeric index or entry ID
# Remove by entry ID
# Random sampling from history/list keys
# Update an entry's value or structured data in-place
# Migrate entries to match current schema data definitions
# Rename a key (preserves all entries, IDs, and data)
# Per-entry memory links (bridge KV entries to the knowledge graph)
# JSON output for scripting and jq piping
|
|
|
Every entry gets a stable entry ID (e.g. kv-A3fB) alongside its numeric index. Push prints both: kv-A3fB (42). Anywhere a numeric index works, an entry ID also works -- --id kv-A3fB, mixed comma lists, remove. Ranges remain numeric only. Old data files are back-filled on first load.
Entries can carry structured JSON data via --data on push or update. Query entries by data fields with --where key=value (available on search, last, random, count). Multiple --where flags are ANDed. Supports exact string match, array-contains, and numeric/boolean comparison on top-level fields.
Individual entries can link to the memory graph via --memory kn-xxx on push (at creation) or set --id --memory (on existing entries). Per-entry memory wins over key-level fallback. Pass --memory on read commands (get, last, since, search, random, dump) to resolve linked knowledge entries.
Time-range flags (--day, --month, --week, --since, --from/--to) are available on last, search, count, and random. All dates are UTC. The --since flag accepts relative times (30d, 1w, 2h, 30m) and ISO-8601 timestamps. For a standalone relative-time query on history keys, use mx kv since.
PR Merge
# Squash merge (default) with encoded commit message
# Rebase merge
# Standard merge commit
Session Archival (Codex)
Archives Claude session JSONL files to permanent storage with transcripts, extracted images, and manifests.
# Archive the current session
# Archive with clean markdown transcript only (no raw JSONL)
# Archive all unarchived sessions
# List archived sessions
# Read an archived session
# Search across all archives
GitHub Sync
Pull and push issues/discussions as local YAML files.
Configuration
Everything mx writes lives under a single base directory: $MX_HOME, default
~/.mx/. Each subsystem owns a subdirectory (kv/, state/, memory/,
codex/, ...). Move the whole tree by setting MX_HOME, or override one
subsystem at a time with vars like MX_SURREAL_ROOT, MX_CODEX_PATH,
MX_KV_SCHEMA, MX_KV_DATA, MX_ISOLATE_MODELS.
Two env vars were removed in the path-alignment refactor (#259):
MX_MEMORY_PATH-- useMX_SURREAL_ROOTinstead. Setting the old name now emits a one-line stderr note and is otherwise ignored.MX_STATE_SCHEMA(deprecated) -- replaced by themx state ... --schema {id|path}CLI flag. The default schema ID is nowtensor(wascrewu). Note:mx stateitself is deprecated; usemx kvwith structured data instead.
For the full layout, the complete env-var reference (including SurrealDB connection vars, GitHub App auth, and tuning), legacy-fallback behavior, and worked examples, see the filesystem layout.
Documentation
For the complete command reference, configuration guide, and architecture docs, see the full documentation.
Build Notes
tract-linalg and tract-data are patched via [patch.crates-io] in Cargo.toml to fix ARM64 NEON assembly compilation on aarch64-pc-windows-msvc. MSVC's cl.exe silently ignores GAS-syntax .S files (D9024/D9027, exit 0), producing no object files. The patch forces clang as the assembler for this target and excludes it from x86 MASM template transformations. The patch lives in coryzibell/tract; an upstream PR is pending.
Status
Published on crates.io. The API surface is evolving.
Licensed under Apache 2.0.