Metadata-Version: 2.4
Name: crystalbrain-hermes
Version: 0.1.1
Summary: CrystalBrain memory for Hermes Agent: recall before each turn, conversations saved, one memory per user.
Project-URL: Homepage, https://crystalbrain.ai/tools/hermes-agent-memory
License-Expression: MIT
License-File: LICENSE
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.10
Description-Content-Type: text/markdown

# CrystalBrain memory for Hermes Agent

A memory provider plugin that gives [Hermes Agent](https://github.com/NousResearch/hermes-agent) a long-term memory per
user, kept in [CrystalBrain](https://crystalbrain.ai).

- **Recall before each turn**: the user's message is searched in CrystalBrain and what fits (memories, document
  passages) is added to that message. Hermes adds it to the copy sent to the model, never to the stored conversation.
- **Saved when the session ends**: the conversation (user and assistant text only) goes to CrystalBrain, which turns
  it into memories (facts, preferences, decisions…) and refuses near-duplicates. A session with fewer than 2 real user
  messages is not saved. Cron runs and subagents never save.
- **Two tools**: `crystalbrain_search` (another question than the current message) and `crystalbrain_save`
  (save one thing now, when the user asks to remember it).
- **One memory per person**: on a messaging gateway (Telegram, Discord, Slack…), each Hermes user becomes the
  CrystalBrain end user `hermes:<platform>:<user_id>`, created on its first save. On the CLI, the user named by
  `CRYSTALBRAIN_USER`, or your own account's memory when it is unset.

Hermes' own `MEMORY.md` / `USER.md` stay active beside it; only one external provider can be active at a time.
Tested with Hermes Agent 0.19.0.

## Install

You need a CrystalBrain API key: dashboard, Connections › API keys (the Free plan is enough to start).

**One command** (Linux, macOS, WSL; needs `python3`):

```bash
curl -fsSL https://crystalbrain.ai/hermes/install.sh | bash
```

**Or from PyPI**:

```bash
pip install crystalbrain-hermes
crystalbrain-hermes install
```

**On Windows**, with Hermes installed on Windows (in PowerShell; with Hermes in WSL, use the one command in WSL):

```powershell
py -m pip install crystalbrain-hermes
py -m crystalbrain_hermes.installer install
```

They copy the plugin to Hermes' folder (`~/.hermes`, or `%LOCALAPPDATA%\hermes` on Windows) under
`plugins/crystalbrain/`, save the key in its `.env` and select the provider (`memory.provider: crystalbrain`). For
another profile, add `--profile <name>` (with the script: `| bash -s -- --profile <name>`). Then restart Hermes and
its gateway, and check with `hermes memory status`.

**By hand**: copy the three files of this folder (`__init__.py`, `plugin.yaml`, `README.md`, also served at
`https://crystalbrain.ai/hermes/crystalbrain/<file>`) to `$HERMES_HOME/plugins/crystalbrain/`, add
`CRYSTALBRAIN_API_KEY=…` to the profile's `.env`, and set in its `config.yaml`:

```yaml
memory:
  provider: crystalbrain
```

Optional, in the same `.env`: `CRYSTALBRAIN_USER` (the CrystalBrain user for CLI sessions) and
`CRYSTALBRAIN_BASE_URL` (default `https://crystalbrain.ai`).

**Uninstall**: `crystalbrain-hermes uninstall` (or `curl -fsSL https://crystalbrain.ai/hermes/install.sh | bash -s -- uninstall`).
Hermes goes back to its built-in memory; what CrystalBrain saved stays in your dashboard.

## What is sent to CrystalBrain

- Each non-trivial user message (as the search query), with the user ID above and the model name.
- At session end: the user and assistant messages as text. System prompts, tool calls and tool results are not sent.
  Long conversations keep their last 50,000 characters.

## Costs and limits

Each saved session is tidied by CrystalBrain's AI and counts against the workspace's monthly AI credit; each gateway
user counts as a tracked user (plan quota). CrystalBrain accepts at most 60 AI-written memories per user in 10 minutes.

The plugin uses the Python standard library only: nothing to install in Hermes' environment.
