69 lines
3.4 KiB
Markdown
69 lines
3.4 KiB
Markdown
# hx
|
|
|
|
Minimal Rust coding agent. Uses your existing subscriptions, no API keys.
|
|
|
|
```sh
|
|
cargo build --release
|
|
hx login claude # Claude Pro/Max
|
|
hx login codex # ChatGPT Plus/Pro
|
|
hx # interactive TUI
|
|
hx -p "hello" # one-shot, Claude
|
|
hx --provider codex -p "hello" # one-shot, Codex
|
|
hx -c # continue last session in this directory
|
|
```
|
|
|
|
TUI: `enter` send, `alt-enter`/`ctrl-j` newline, `esc` abort, `ctrl-o` expand tool output, `tab` completes `@file`
|
|
(mentioned files are attached), `pgup`/`pgdn` scroll. Commands: `/model <name>`, `/provider claude|codex`,
|
|
`/compact`, `/clear`, `/quit`. Messages typed while the agent works are queued.
|
|
|
|
Config: `~/.hx/config.toml`, overridden per project by `.hx/config.toml`:
|
|
|
|
```toml
|
|
provider = "claude" # or "codex"
|
|
claude_model = "claude-sonnet-4-5"
|
|
codex_model = "gpt-5-codex"
|
|
compact_at = 150000 # auto-compact threshold (estimated tokens)
|
|
max_tokens = 16384
|
|
# system_prompt = "..." # replaces built-in prompt; AGENTS.md still appended
|
|
|
|
[lsp]
|
|
mode = "turn_end" # turn_end | agent_end | off
|
|
disable = ["clangd"]
|
|
enable_runners = ["clippy"] # opt-in (slow): clippy
|
|
disable_runners = ["rustfmt"] # any of: ruff, biome, eslint, ast-grep, rustfmt, ruff-format, biome-format
|
|
tests = "turn_end" # affected tests: turn_end | agent_end | off
|
|
# [[lsp.servers]] # add or override (same id replaces built-in)
|
|
# id = "zls"
|
|
# language = "zig"
|
|
# extensions = ["zig"]
|
|
# command = ["zls"]
|
|
# roots = ["build.zig"]
|
|
```
|
|
|
|
## Lens
|
|
|
|
After every tool round, hx asks the language server about files the agent wrote or edited and appends
|
|
errors/warnings to the next request, so the model fixes them without being told. Built in:
|
|
rust-analyzer, typescript-language-server, pyright, gopls, clangd (used when on `PATH`). The `lsp` tool gives
|
|
the model diagnostics, definition, references, hover and symbols on demand. `/lsp` in the TUI shows server status,
|
|
missing tools and triage marks.
|
|
|
|
Besides the language server, changed files go through (when installed and the project uses them):
|
|
ruff (Python), biome (with `biome.json`), eslint (with an eslint config), ast-grep (rules in `.hx/rules/*.yml`),
|
|
and clippy (opt-in). Formatters run only when configured for the project (`rustfmt.toml`, `ruff.toml`, `biome.json`);
|
|
their changes don't trip the read-guard. Files edited outside hx are picked up at the next turn.
|
|
|
|
`diag_mark` lets the model silence a finding (`false_positive` = forever, `defer` = until the file changes),
|
|
stored in `~/.hx/projects/<project>/triage.json`. Runner timings go to `~/.hx/latency.log`.
|
|
|
|
Affected tests run after each tool round that changed files; only failures are injected (plus one
|
|
"all pass now" notice after they're fixed). Supported: cargo, pytest, vitest, jest, `go test`. Selection is
|
|
a heuristic: Rust runs the changed crate and crates depending on it; Go the changed package and importers;
|
|
Python/JS the test files that are changed or import a changed file (up to 3 hops). Rust/Go therefore
|
|
over-select (whole crates/packages); dynamic imports, fixtures and data files are not tracked.
|
|
|
|
Existing Claude Code (`~/.claude/.credentials.json`) and Codex CLI (`~/.codex/auth.json`) logins are picked up automatically.
|
|
Credentials are stored in `~/.hx/auth.json` (mode 0600) and refreshed automatically.
|
|
|
|
On a headless box, open the printed URL elsewhere and paste the final redirect URL back into the terminal.
|