Metadata-Version: 2.5
Name: capsule-hermes
Version: 0.5.0
Summary: Capsule plugin for Hermes — forwards hook events to the Capsule agentsecurity service for centralized policy enforcement and audit.
Project-URL: Homepage, https://github.com/capsulesecurity
Project-URL: Documentation, https://docs.capsulesecurity.io/guides/hermes
Author: Capsule Security
License: Capsule Security Commercial License
        
        Copyright (c) Capsule Security, Inc. All rights reserved.
        
        This software is licensed, not sold, and is made available solely to customers
        of Capsule Security, Inc. ("Capsule") under the terms of an active commercial
        agreement (the "Subscription Agreement") between the customer and Capsule.
        
        Subject to the Subscription Agreement, Capsule grants the customer a
        non-exclusive, non-transferable, non-sublicensable, revocable license to install
        and run this software in connection with the customer's authorized use of the
        Capsule platform, solely for the customer's internal business operations.
        
        Except as expressly permitted by the Subscription Agreement, you may not:
          (a) copy, modify, or create derivative works of the software;
          (b) reverse engineer, decompile, or disassemble the software;
          (c) redistribute, sublicense, sell, rent, lease, or otherwise transfer the
              software to any third party;
          (d) remove or alter any proprietary notices contained in the software; or
          (e) use the software except in connection with an active Subscription
              Agreement.
        
        Without a valid Subscription Agreement with Capsule, no rights are granted to
        use this software. Unauthorized use is prohibited.
        
        THE SOFTWARE IS PROVIDED "AS IS" AND CAPSULE DISCLAIMS ALL WARRANTIES, EXPRESS
        OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT. CAPSULE SHALL NOT BE
        LIABLE FOR ANY DAMAGES ARISING FROM OR RELATING TO USE OF THE SOFTWARE EXCEPT
        AS EXPRESSLY SET FORTH IN THE SUBSCRIPTION AGREEMENT.
        
        For licensing inquiries, contact: sales@capsulesecurity.io
License-File: LICENSE
Keywords: agent-security,capsule,hermes,hermes-plugin,policy,security
Classifier: License :: Other/Proprietary License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27
Description-Content-Type: text/markdown

# capsule-hermes

Capsule plugin for the [Hermes](https://nousresearch.com/hermes) autonomous AI agent runtime. Forwards Hermes hook events to the Capsule `agentsecurity` service for centralized policy enforcement and audit.

## Install

Hermes 0.21.6 and later load plugin code only from an environment Hermes builds itself, so a plain `pip install` is invisible to them. Create a plugin directory that declares this package as a dependency, then enable it:

```bash
D="${HERMES_HOME:-$HOME/.hermes}/plugins/capsule"
mkdir -p "$D"
cat > "$D/plugin.yaml" <<'EOF'
name: capsule
description: Capsule Security policy enforcement and audit for Hermes
python_dependencies:
  - "capsule-hermes>=0.5,<1"
EOF
echo 'from capsule_hermes import register' > "$D/__init__.py"
hermes plugins disable capsule
hermes plugins enable capsule
```

On Windows, run this in PowerShell instead:

```powershell
$H = if ($env:HERMES_HOME) { $env:HERMES_HOME } else { "$env:LOCALAPPDATA\hermes" }
$D = New-Item -ItemType Directory -Force -Path "$H\plugins\capsule"
Set-Content -Path "$D\plugin.yaml" -Value @'
name: capsule
description: Capsule Security policy enforcement and audit for Hermes
python_dependencies:
  - "capsule-hermes>=0.5,<1"
'@
Set-Content -Path "$D\__init__.py" -Value 'from capsule_hermes import register'
hermes plugins disable capsule
hermes plugins enable capsule
```

`hermes plugins enable` installs `capsule-hermes` from PyPI into the Hermes environment. The `disable` before it makes that happen even when `capsule` is already enabled, for example from an earlier `pip install`. Rerun the last two commands to upgrade.

On Hermes before 0.21.6, install the package into the Python environment that runs Hermes instead:

```bash
pip install capsule-hermes
hermes plugins enable capsule
```

Hermes plugins are opt-in, so the plugin stays inactive until it is enabled.

## Configure

Add the endpoint and token to `~/.hermes/.env`, which Hermes loads at startup:

```bash
CAPSULE_HERMES_ENDPOINT=https://agents.capsule.security/v1/hermes/hooks/events
CAPSULE_HERMES_TOKEN=<token>
```

The `endpoint` and `token` values are issued by Capsule when you install the Hermes integration in the Capsule portal (**Integrations → Hermes**). Every setting can also go in the `plugins.entries.capsule` block of Hermes' `config.yaml`; environment variables take precedence.

### Optional config

| Key             | Default | Description                                                                                                     |
| --------------- | ------- | --------------------------------------------------------------------------------------------------------------- |
| `block_on_risk` | `true`  | Apply server `block` verdicts. Set to `false` to run the plugin in observe-only mode.                           |
| `fail_open`     | `true`  | Allow the event through if Capsule is unreachable or returns a non-2xx response. Set to `false` to fail closed. |
| `timeout_ms`    | `5000`  | Per-request HTTP timeout in milliseconds.                                                                       |

## Hooks covered

The plugin registers handlers for the Hermes runtime hooks Capsule supports:

- **Blocking:** `pre_tool_call`
- **Observation:** `pre_llm_call`, `post_tool_call`, `post_llm_call`, `pre_approval_request`, `post_approval_response`, `subagent_stop`, `on_session_start`, `on_session_end`, `on_session_finalize`, `on_session_reset`, `on_skill_lifecycle`

The blocking hook awaits Capsule's verdict and returns `{"action": "block", "message": ...}` to Hermes when the server denies the action. Observation hooks dispatch fire-and-forget so telemetry never stalls the agent.

On the first hook of each session the plugin also sends `SOUL.md`, the project context file Hermes loads for the working directory, the `MEMORY.md` / `USER.md` memory store, and every installed `SKILL.md`.

## License

Apache-2.0.
