# @whalent/agent

Unified CLI agent for [Whalent Memory](https://memory.whalent.com).

Protocol reference:

- [Agent Communication Protocol v3](docs/agent-protocol-v3.md)

## Install

```bash
npm install -g @whalent/agent
```

Requires Node.js 20 or newer:

```bash
npm install -g @whalent/agent --prefer-online --registry=https://registry.npmjs.org
```

Node.js 20 LTS is still the safest choice on older Linux hosts. Newer Node.js
releases can force native `node-pty` fallback builds that need newer C++
compilers when prebuilt binaries are unavailable.

Codex SQLite history reads require the Whalent sqlite helper.
The helper is a small Go binary cached under `~/.whalent-agent/helpers/sqlite`;
if it is missing or cannot run, Codex history import is treated as unavailable
instead of falling back to native npm sqlite bindings or `history.jsonl`. Set
`WHALENT_SQLITE_HELPER_BASE_URL` to a release/CDN directory containing
`sqlite-helper-0.1.3-manifest.json`, or set `WHALENT_SQLITE_HELPER_MANIFEST_URL`
directly.

By default the daemon asks Platform's release API whether `sqlite-helper` has a
newer published version, then downloads the returned manifest. Helper releases
are independent from daemon/npm releases and are tagged as
`sqlite-helper-vX.Y.Z`.

## Start Daemon

```bash
whalent --token <YOUR_TOKEN>
```

The daemon connects to the Whalent Memory platform, fetches agent configurations, and auto-starts workers marked with `auto_restart`. It also accepts remote commands (upgrade, restart) via the gateway.

To specify a custom gateway:

```bash
whalent --token <YOUR_TOKEN> --gateway wss://your-server/gw/sdk/ws
```

## License

Copyright © 2025 Whalent. All rights reserved.
