Metadata-Version: 2.5
Name: henzo
Version: 0.1.16
Summary: Henzo client: agent hooks for cloud recall and cloud learning
License: MIT
License-File: LICENSE
Requires-Python: >=3.11
Requires-Dist: cryptography>=42
Requires-Dist: httpx>=0.27
Requires-Dist: keyring>=25
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Description-Content-Type: text/markdown

# henzo

Python client for Henzo. Install once, store one API key, and run coding-agent hooks. Recall and learning both run on the Henzo cloud: the recall hook sends the turn to `POST /v1/recall` and injects the brief it returns; finished rounds are encrypted and sent to the cloud for learning. The client does no ranking and no learning.

## Install

```bash
uv tool install henzo
# or, from a checkout:
uv sync --extra dev
```

## Quick start

```bash
henzo login          # Google sign-in, pin the round key, hook every detected agent
                     # existing key: henzo login --stdin
                     # skip hooks: henzo login --no-hooks
henzo whoami         # tenant / profile / device (never prints the key)
henzo setup          # install hooks for every detected agent (or --agent NAME)
henzo logout
```

Headless hosts can set `HENZO_API_KEY` instead of using the store.

## Configuration

| Variable | Meaning | Default |
|---|---|---|
| `HENZO_API_KEY` | API key (overrides the store) | — |
| `HENZO_GATEWAY_URL` | Gateway base URL | `https://autodidact-learning-sync.guy-360.workers.dev` |
| `HENZO_DATA_ROOT` | Root for per-profile data | `~/.henzo` |
| `HENZO_CONFIG_DIR` | Config and key-file directory | `~/.config/henzo` |
| `HENZO_TOKEN_STORE` | `auto`, `keyring`, or `file` | `auto` |

Per-profile data lives under `~/.henzo/<profile>/` (outbox, synced items). The client never writes to `~/.autodidact`.

## Commands

- `henzo login` — Google sign-in at `HENZO_AUTH_URL` (default `https://auth.app.henzo.ai`). The token page `HENZO_TOKEN_URL` (default `https://app.henzo.ai/token`) holds the PropelAuth client id and mints the device key. `--stdin` and `--api-key-prompt` still accept an existing key. The key is never an argument. After a successful login the client pins the tenant round key (this is also the cloud connectivity check) and installs hooks for every supported agent it detects (Claude Code, Codex, Cursor, cursor-agent, Devin). Detection is structural (binary on PATH or a well-known config directory). Re-running login is idempotent and leaves foreign hooks in place. Pass `--no-hooks` to skip hook install. On WSL, a detected Windows agent is hooked in `%APPDATA%` or the Windows home with a `wsl.exe` bridge; Devin hooks go to `~/.config/devin/config.json` or `%APPDATA%\devin\config.json`, never `~/.devin`.
- `henzo logout` — clear the stored key
- `henzo whoami` — show tenant, profile and device parsed from the key
- `henzo setup [--agent <claude-code|codex|cursor|cursor-agent|devin>]` — install agent hooks (`--dry-run`, `--remove`). With no `--agent`, every supported agent detected on this machine is configured.
- `henzo doctor` — local health check (no network): login, round-key pin, hooks per agent (including Devin running henzo hooks twice through Claude Code's settings), and recent recall failures from `~/.config/henzo/recall-failures.jsonl`. `henzo setup` prints the same recall failure summary. The failure log holds time, hook event, and a short error code; never the prompt, the brief, or the key.
- `henzo hook <event> [--format claude|cursor|auto]` — agent hook entry point (reads JSON from stdin; always exits 0, including Stop/learn). On learn/stop it encrypts the round, queues it, and starts a detached background upload; the hook makes no network call itself. `--format claude` prints recall as `hookSpecificOutput.additionalContext`.
- `henzo round-key [--show]` — fetch the tenant round public key and pin it on first use (`round-key.json`, 0600); later fetches must match the pin or the command fails loudly. `login` and `setup` do this too when you are logged in
- `henzo rotate-round-key --confirm [--expect-kid KID]` — the only way to re-pin, after an announced rotation
- `henzo flush` — upload queued rounds now (412/409 count as already uploaded)
- `henzo sync pull [--json]` — pull learned-item deltas and apply them locally (replay-safe)

All gateway wire formats live in `src/henzo/wire.py`.

## Development

```bash
uv sync --extra dev
uv run pytest
```

See `TINY_CHECK.md` for the second-PC check plan and blockers.
