Skip to content

About

A typed, bounded command line for humans and AI agents — JSON Lines pipes, parallel branches, AI pipes behind an egress guard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

stilhawt-cli

A typed, bounded command line for humans and AI agents — with AI pipes you can trust.

Made by StilHawt · collects anonymous usage statistics — what, and how to turn it off

Every command is declared in a grammar (a YAML file): what it does, the keys of the objects it outputs, and its effect (read, network, write…). Commands emit JSON Lines; pipes filter, sort, group, join and draw them — and two of them ask a model. A line is checked before anything runs: unknown stages, effects that are not allowed, unbounded repetitions and ungranted commands are refused with the reason and the correct form.

stilhawt 'data read examples/reviews.csv | jev "Is this review positive?" --options yes,no --on text --pan texte | group jev.choice'

One line: read a file, ask a model to decide for each row — sending only the text field — and count the answers. The quotes matter: in your shell an unquoted | starts another program, so a whole line goes in ONE quoted argument (the form used on this page, the same in bash, zsh and PowerShell). Inside the interactive shell (stilhawt alone) type the line without them; and stilhawt data read f | stilhawt where … — one process per stage, JSON Lines in between — works too. The rest of this page is what makes that line safe, bounded and composable.

Install

Python 3.10 or later, and git — to get the package (both ways below use it) and for git status (fs files uses git when it is there, a plain walk otherwise). The package is not on PyPI: install it from the repository — clone it, since the examples below read examples/:

git clone https://github.com/StilHawt/stilhawt-cli
cd stilhawt-cli
pip install .                         # or ".[shell]" for tables and completion
stilhawt --version
stilhawt --check                      # lints the grammar: 0 grievance
stilhawt help

(pip install git+https://github.com/StilHawt/stilhawt-cli installs the command alone, without the examples.)

stilhawt alone, in a terminal, opens an interactive shell (stilhawt[local]>): type lines without quotes. With the shell extra (pip install ".[shell]"), Tab completes namespaces, commands and pipes (not field names), and the history is kept in ~/.stilhawt_history; without it the shell still works, without completion. Outside a terminal (a pipe, a file, an agent) a command's output is JSON Lines; --json / --text force either one. help, --check and --version print text for a human, wherever they go.

Keys: Groq and Jev

The two AI pipes use your keys, read from the environment at the moment of the call — never stored by the CLI, never printed.

Pipe What it does Variable Where to get a key
groq generates a short text per object (or one answer with --all) GROQ_API_KEY console.groq.com
jev decides: picks one of your options per object, with probabilities TYPESAFE_API_KEY typesafe.ai

Set a key for the current session:

export GROQ_API_KEY="<your key>"            # macOS / Linux
$env:GROQ_API_KEY = "<your key>"            # Windows PowerShell

To keep it across sessions, put it in your shell profile, or on Windows setx GROQ_API_KEY "<your key>" (new terminals only). To change a key, set the variable again — the next call uses the new value; to revoke one, remove the variable and revoke it at the provider. Never commit a key: a .env file that git ignores, or your system's secret store, is the right place.

Check without ever showing a value:

stilhawt ai keys          # which variables are set
stilhawt ai probe         # one tiny read call per key: valid, refused, unreachable

Models: STILHAWT_GROQ_MODEL (default openai/gpt-oss-20b), STILHAWT_JEV_MODEL (default jev-1.13.0). Providers retire models: if a pipe answers 404 while ai probe says valid, the key is fine and the model is gone — set the variable to one the provider serves today.

The AI pipes — the essence

A model is one stage of a pipeline like any other, with three things a raw API call does not give you.

1. You choose what leaves — field by field. --on names the fields sent; nothing else is. Private keys (starting with _) never leave — even if --on names them, the line is refused. What an earlier model added leaves only when --on names it on purpose (that is how two models are chained).

stilhawt 'data read examples/reviews.csv | select id product text'
stilhawt 'data read examples/reviews.csv | groq "What is the complaint, in five words?" --on text --pan texte | select id groq'

2. You say what it is — and the guard decides. Every command declares the pan of what it produces (texte, code, donnees = raw data, personne, image). data read produces raw data, so without more the egress guard refuses to send it:

stilhawt 'data read examples/reviews.csv | groq "Summarise"'

is refused before any call. So is --on naming a field no object carries — a typo never sends nulls. --on text --pan texte is you asserting: this field is prose. The shipped guard sends texte and code, refuses the rest, and does not pretend to anonymise. With no guard registered, every model pipe is refused (fail-closed).

3. Decide, then filter on the margin. jev writes no text: it picks one of your options and returns {choice, margin, p}. The margin (top − second probability) is what to filter on:

stilhawt 'data read examples/reviews.csv | jev "Is this review positive?" --options yes,no --on text --pan texte | where jev.margin gt 0.5 | group jev.choice'

And the two compose — generate, then judge what was generated:

stilhawt 'data read examples/reviews.csv | groq "Name the main problem in two words" --on text --pan texte | jev "Is this a quality problem?" --options yes,no --on groq --pan texte | select id groq jev.choice'

Bounded, and visible before it runs. Each model pipe declares a maximum number of objects (one call each); --all makes one call for the whole set. explain shows the plan — stages, effects, where data goes, how many calls at most — without calling anything:

stilhawt 'explain data read examples/reviews.csv | jev "positive?" --options yes,no --on text --pan texte'

The answer of a model is data: added as a field, never executed.

A call that fails does not stop the line. Without a key, or when the provider refuses, each object keeps flowing with groq: null and the reason in groq_refused (for jev: jev.refused), and one line on stderr says how many were not answered and why — e.g. groq: 12/12 object(s) not answered — GROQ_API_KEY is not set. select id groq groq_refused shows it per object.

Navigate a DSL

A DSL here is a YAML (or JSON) document with a closed vocabulary. The CLI reads it as data:

stilhawt dsl tree examples/service.yaml --depth 2
stilhawt dsl read examples/service.yaml "rules[?effect=='write'].id"
stilhawt 'dsl read examples/service.yaml rules | groq "Is this rule risky? One word." --on value --pan texte'

dsl tree lists every node with its dotted path — exactly what where, select and an AI pipe's --on take — so you find the field, then send only it. dsl read selects with JMESPath (jmespath.org): a string literal takes single quotes ('write'); in double quotes JMESPath reads a field name, and the selection is empty.

Draw it

view turns any stream into a local page — nothing leaves your machine. The CLI can draw itself:

stilhawt 'tools commands | where kind eq command | view graph namespace command --mode contains'
stilhawt 'data read examples/reviews.csv | view bar product stars'

The CLI's own grammar, drawn by the CLI

view graph takes two field names and links the value of the first to the value of the second; --mode contains makes each first value a frame around its second values (a grammar, a folder tree), the default draws edges. --engine mermaid writes text you can paste into a Markdown file. STILHAWT_VIEW_NO_OPEN=1 writes the page without opening it. The interactive graph needs Cytoscape.js (STILHAWT_CYTOSCAPE_JS=<path to cytoscape.min.js>); without it the page says so and shows the static SVG.

The language in five minutes

Stage What it does Example
where keep objects matching one condition where stars gt 3
select / sort / head project, order, cut sort -lines | head 10
grep keep objects where the text appears in any value (-v: the inverse) grep refund
count / sum / avg / min / max / group aggregates made by the TOOL group language sum lines
flatten one object per element of a list field tools commands | flatten options
extract / replace sed-like, into fields, no model extract text "^(?P<first>\w+)"
tee … join parallel branches, merged by key tee (where stars gt 3) (where stars lt 3) | join id
each one READ command per object, {} = its value git status . | each repo (fs files {})
diff what changed since the last snapshot, by key diff reviews --key id
view a local page: table, bars, tree, graph, document, diff view bar product stars
notify a local desktop notification (says not sent when no notifier answers) notify "repos behind"
open opens the files the objects name, inside the current project fs search TODO | head 3 | open
groq / jev generate / decide, per object or --all see above

Generic tools

Command What it gives
fs files [dir] one row per file: language, kind (code · markup · config/data · doc), lines, vendored
fs search <text> a typed grep: file, line, text
data read <file> JSON, JSON Lines, CSV, TSV or YAML as rows
git status [dir] every git repository below: branch, modified, untracked, conflicts, ahead, behind (needs git)
git hunks [range] one row per hunk of the current repository's diff: file, change, line counts, the raw hunk, its language (--staged for the index)
http get <url> status, time, type, size, title
dsl read / dsl tree navigate a YAML / JSON document
ai keys / ai probe the model keys: set or not, valid or not — never a value

Count the code of a project: stilhawt 'fs files . | where vendored eq false | where kind eq code | group language sum lines'.

Review a change hunk by hunk, folded: stilhawt 'git hunks main...HEAD | view diff' — or keep a page that re-reads the working tree as you edit: stilhawt 'git hunks | view diff --live'.

Adding your own commands

A command maps a tool verb. A tool is a Python module that declares its verbs once:

from stilhawt_cli.tool import Arg, Toolset

tools = Toolset("mypkg.inventory")

@tools.verb("hosts", output=["name", "role", "up"], types={"name": "str", "role": "str", "up": "bool"},
            args=[Arg("--role", help="only this role")])
def hosts(role):
    """the hosts of my inventory"""
    return [{"name": "web-1", "role": "web", "up": True}]


if __name__ == "__main__":
    raise SystemExit(tools.main())   # `python -m mypkg.inventory --describe` prints the schema

and the grammar names it (kind: tool, tool: mypkg.inventory:hosts, its effect, its output). The grammar is stilhawt_cli/commandes.dsl.yaml: to extend it, work in your clone and install it editable (pip install -e .), so the file you edit is the one the CLI reads. stilhawt tools list finds the tools of the package and of the directories in STILHAWT_TOOL_ROOTS (;-separated) — mapped_to: unmapped for a verb no command names yet. stilhawt --check verifies that every command maps a real verb, and that the verb's declared output matches. Transports, the egress guard, the key declarations and where the CLI writes its files are extension points (stilhawt_cli.ext), filled by the modules the grammar names under extensions: — this package ships stilhawt_cli.ext_models.

Agents: mandates

An agent can be held to a mandate (STILHAWT_MANDAT=<id>): a declared list of the commands and pipes it may run. A line using anything else is refused before it runs — the barrier is the grant, not an instruction in a prompt. Example: stilhawt_cli/mandats.dsl.yaml.

Snippets are named lines (@dirty-repos) an agent — or you — can run instead of retyping them; snip list shows each one with its intent and how often it ran, snip uses every recorded run. Examples: stilhawt_cli/snippets/snippets.dsl.yaml.

How we use it — and why yours will differ

This package is the core of the CLI we run every day on our own workspace (a few dozen projects, a fleet of machines, many contracts). There, most commands are ours: they read our declarations, our repositories, our services. They are not in this package, and would be of no use as they are — they show the kind of thing the grammar is for. Take the pattern, write your own:

What we type What it answers, for us
git status (our overlay) the workspace's root and every nested repository, wherever we stand
ws search, ws files, ws projects search, line counts, the project census — across all repositories
key find, key get, dsl get, dsl walk any identifier of our registries; a contract by its trigram; its lineage
plan show, plan list the state of a plan, COMPUTED from proofs rather than ticked by hand
fleet map, svc health, svc logs our machines, the health of our services, their logs (secrets masked)
sec report the validity and expiry of every declared secret — never a value
gov who, gov check which session touched a file; every contract's own check
conv find, dlg thread our past conversations with agents; the dialogue between them
oss check, oss push how this very package was generated, checked and published

Named lines (snippets) are the same idea one level up: @loc ships as an example (stilhawt_cli/snippets/snippets.dsl.yaml) — lines of code per language here, vendored code left out; ours runs it across every project.

The point is not these commands: it is that each gesture we used to improvise became one declared, typed, bounded line — for us, and for the agents working with us.

Telemetry

stilhawt sends anonymous usage statistics so we can tell whether anyone actually uses it — a clone count cannot tell a person from a robot. What leaves, and nothing else:

  • the command words of the grammar — namespace, command, pipe names (for a line that reads a CSV and asks Jev: the words data, read and jev), never their arguments: no path, no prompt, no file name, no data. A word the grammar does not know is sent as <other>;
  • the exit code and duration, the package version, the OS family, the Python major.minor;
  • a random identifier drawn on your first run and stored in your config directory, renewed every the period the contract declares (identity.rotate_days, set by the French regulator's recommendation for audience measurement) — no hardware identifier (MAC, serial) is ever read. It counts installations, not people.

Your IP address is not stored: the collector's route is excluded from the server logs. The run that shows the notice sends nothing. Everything above is a closed list, declared in stilhawt_cli/telemetry.dsl.yaml and re-applied by the collector.

Turn it off — any one of these:

export STILHAWT_TELEMETRY=0          # PowerShell: $env:STILHAWT_TELEMETRY = "0"
export DO_NOT_TRACK=1                # the consoledonottrack.com convention
python -m stilhawt_cli.telemetry off # persistent; `status` and `on` too

It is also off in continuous integration (CI, GITHUB_ACTIONS…). Questions: stilhawt.com.

Tests

Every module carries its own self-test, including cases that must fail:

python -m stilhawt_cli --selftest
python -m stilhawt_cli.std --selftest
python -m stilhawt_cli.ext --selftest
python -m stilhawt_cli.ext_models --selftest
python -m stilhawt_cli.tool --selftest
python -m stilhawt_cli.snippets --selftest
python -m stilhawt_cli.mandat --selftest
python -m stilhawt_cli.diffview --selftest
python -m stilhawt_cli.telemetry --selftest

License

Apache License 2.0 — see LICENSE. Copyright 2026 StilHawt.

About

A typed, bounded command line for humans and AI agents — JSON Lines pipes, parallel branches, AI pipes behind an egress guard.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages