Minimal contract-driven coding-agent runtime + CLI
Project description
Hexi v0.3.0
Hexi is a minimal, contract-driven (hexagonal) coding-agent runtime and CLI. It runs exactly one agent step per invocation against a local git repository.
Test Drive (5 Minutes)
Run this in any local git repo you can safely modify.
- Install Hexi:
pip install -e .
Optional OpenRouter support:
pip install -e ".[openrouter]"
- Initialize Hexi files:
hexi init
- Onboard provider/model and key:
hexi onboard
When prompted, pick any provider. For OpenRouter providers, install the optional extra and provide OPENROUTER_API_KEY.
- Verify setup:
hexi doctor
Expected: provider/model printed and Doctor check passed.
- Run one agent step:
hexi run "Add one tiny test for an existing function and run pytest"
- Inspect what changed:
hexi diff
tail -n 20 .hexi/runlog.jsonl
- If you want to switch providers later:
hexi onboard
Re-run onboarding to update .hexi/local.toml.
What it is
- Python package (PyPI distribution):
hexicodes - Core contracts in
hexi.core - Side-effect adapters in
hexi.adapters - One-step execution with structured event logging to
.hexi/runlog.jsonl
What it is not
- No daemon, no background workers, no web UI
- No MCP server and no SQLite in v0.3.0
- No multi-agent orchestration
Install
pip install -e .
OpenRouter support (optional)
- HTTP adapter only (
openrouter_httpprovider):
pip install -e ".[openrouter-http]"
- SDK adapter only (
openrouter_sdkprovider):
pip install -e ".[openrouter-sdk]"
- Both OpenRouter adapters:
pip install -e ".[openrouter]"
Dev/test dependencies:
pip install -e ".[dev]"
Pythonic Task Automation (poe)
Hexi includes a project-local task runner using Poe the Poet, so you do not need to memorize long command chains.
Install dev tooling:
pip install -e ".[dev]"
Common tasks:
poe test # run pytest
poe docs # mkdocs serve (local docs server)
poe docs-build # mkdocs static build
poe check # tests + docs build
poe build # package build + twine check
poe release # build + twine check + tests + docs build
poe publish-testpypi # upload dist/* to TestPyPI via repository URL
poe publish-pypi # upload dist/* to PyPI
CLI
hexi --helporhexi help: show command helphexi -v .../hexi -vv ...: increase runtime verbosity (trace lines + richer event payloads)hexi --versionorhexi version: print installed versionhexi init: create.hexi/config.toml,.hexi/local.toml,.hexi/runlog.jsonlhexi onboard: interactive setup for provider/model and optional local key pastehexi new: scaffold a project from built-in Hexi templates (non-interactive by default)hexi demo: fancy interactive flow with random/model-generated ideas and template scaffoldinghexi run "<task>": execute one agent step and emit structured eventshexi apply --plan plan.json: execute a validated ActionPlan file directly (debug/replay mode)hexi diff: show current git diffhexi doctor: verbose diagnostics; use--probe-modelfor live “What model are you?” checkhexi plan-check --file plan.json: validate/troubleshoot ActionPlan JSON directly
Documentation (MkDocs + Read the Docs)
Build docs locally:
pip install -e ".[docs]"
mkdocs serve
Read the Docs config is in .readthedocs.yml.
CI runs on GitHub Actions and validates:
poe check(tests + docs build)- package smoke flow (build wheel, install wheel, verify templates, run
hexi new)
Configuration design choices
Hexi uses layered TOML configuration:
.hexi/config.toml(repo defaults).hexi/local.toml(local machine overrides)- Environment variables (recommended for secrets)
For secrets, env vars are preferred. hexi onboard can write keys to .hexi/local.toml for local/testing convenience.
Config shape (.hexi/config.toml)
[model]
provider = "openai_compat" # openrouter_http | openrouter_sdk | openai_compat | anthropic_compat
model = "gpt-4o-mini"
[providers.openrouter_http]
base_url = "https://openrouter.ai/api/v1"
api_style = "openai" # openai | anthropic
[providers.openrouter_sdk]
base_url = "https://openrouter.ai/api/v1"
[providers.openai_compat]
base_url = "https://api.openai.com/v1"
[providers.anthropic_compat]
base_url = "https://api.anthropic.com"
[policy]
allow_commands = ["git status", "git diff", "pytest", "python -m pytest"]
max_diff_chars = 4000
max_file_read_chars = 4000
Local override example (.hexi/local.toml)
[model]
provider = "openrouter_http"
model = "anthropic/claude-sonnet-4-6"
[providers.openrouter_http]
api_style = "anthropic"
[secrets]
openrouter_api_key = "..."
Env vars
OPENROUTER_API_KEYforopenrouter_httpandopenrouter_sdkOPENAI_API_KEYforopenai_compatANTHROPIC_API_KEYforanthropic_compat
Packaging
- Distribution name:
hexicodes - Console script:
hexi - Optional extras:
openrouter-httpopenrouter-sdkopenrouterdocsdev
Included example projects
examples/todo_refiner: minimal CLI-wrapper agent integrationexamples/embedded_step: direct embeddedRunStepServiceusageexamples/policy_loop: multi-step user-gated loop using repeatedhexi run
Example ActionPlans (hexi apply)
examples/action_plans/read_only.json: inspect file + emit progressexamples/action_plans/write_file.json: create a file in-repoexamples/action_plans/run_tests.json: runpytest -qexamples/action_plans/mixed_step.json: read + write + run + emitexamples/action_plans/list_files.json: list files by path/globexamples/action_plans/search_text.json: search text matches by path/glob
Try one now:
hexi plan-check --file examples/action_plans/mixed_step.json
hexi apply --plan examples/action_plans/mixed_step.json --task "ActionPlan debug run"
Included Hexi-native templates
templates/hexi-python-lib: tested library starter with Hexi wiringtemplates/hexi-fastapi-service: FastAPI service starter with Hexi wiringtemplates/hexi-typer-cli: Typer CLI starter with Hexi wiringtemplates/hexi-data-job: data job starter with dry-run and Hexi wiringtemplates/hexi-agent-worker: embedded Hexi runtime starter
Provenance
Made with ❤️ from 🇵🇪. El Perú es clave 🔑.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hexicodes-0.3.0.tar.gz.
File metadata
- Download URL: hexicodes-0.3.0.tar.gz
- Upload date:
- Size: 40.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0d584cb51cb812baea010682b374733592a717195d06f93b160c55aa61868a88
|
|
| MD5 |
83c6267bc36940b465e58e7a0823cc3d
|
|
| BLAKE2b-256 |
85baa8b487f3d2de6260e1a9aa3909fe71f454ee7656483a7c64ddf246cf0af8
|
File details
Details for the file hexicodes-0.3.0-py3-none-any.whl.
File metadata
- Download URL: hexicodes-0.3.0-py3-none-any.whl
- Upload date:
- Size: 44.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a71a676e0fefc4f0a8c3564505b6dd41851ca6a224814574c0de43c034c68ee
|
|
| MD5 |
8e8969ad7598fe37ba5102b44d0e40f9
|
|
| BLAKE2b-256 |
6658dec8d3f4918f0e6cc5d6df11ed30827768e9ade9015633b7a28c61fb57bf
|