mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
docs: context engine plugin system + unified hermes plugins UI
New page: - developer-guide/context-engine-plugin.md — full guide for building context engine plugins (ABC contract, lifecycle, tools, registration) Updated pages (11 files): - plugins.md — plugin types table, composite UI documentation with screenshot-style example, provider plugin config format - cli-commands.md — hermes plugins section rewritten for composite UI with provider plugin config keys documented - context-compression-and-caching.md — new 'Pluggable Context Engine' section explaining the ABC, config-driven selection, resolution order - configuration.md — new 'Context Engine' config section with examples - architecture.md — context_engine.py and plugins/context_engine/ added to directory trees, plugin system description updated - memory-provider-plugin.md — cross-reference tip to context engines - memory-providers.md — hermes plugins as alternative setup path - agent-loop.md — context_engine.py added to file reference table - overview.md — plugins description expanded to cover all 3 types - build-a-hermes-plugin.md — tip box linking to specialized plugin guides - sidebars.ts — context-engine-plugin added to Extending category
This commit is contained in:
parent
436dfd5ab5
commit
79198eb3a0
12 changed files with 312 additions and 11 deletions
|
|
@ -3,10 +3,37 @@
|
|||
Hermes Agent uses a dual compression system and Anthropic prompt caching to
|
||||
manage context window usage efficiently across long conversations.
|
||||
|
||||
Source files: `agent/context_compressor.py`, `agent/prompt_caching.py`,
|
||||
`gateway/run.py` (session hygiene), `run_agent.py` (search for `_compress_context`)
|
||||
Source files: `agent/context_engine.py` (ABC), `agent/context_compressor.py` (default engine),
|
||||
`agent/prompt_caching.py`, `gateway/run.py` (session hygiene), `run_agent.py` (search for `_compress_context`)
|
||||
|
||||
|
||||
## Pluggable Context Engine
|
||||
|
||||
Context management is built on the `ContextEngine` ABC (`agent/context_engine.py`). The built-in `ContextCompressor` is the default implementation, but plugins can replace it with alternative engines (e.g., Lossless Context Management).
|
||||
|
||||
```yaml
|
||||
context:
|
||||
engine: "compressor" # default — built-in lossy summarization
|
||||
engine: "lcm" # example — plugin providing lossless context
|
||||
```
|
||||
|
||||
The engine is responsible for:
|
||||
- Deciding when compaction should fire (`should_compress()`)
|
||||
- Performing compaction (`compress()`)
|
||||
- Optionally exposing tools the agent can call (e.g., `lcm_grep`)
|
||||
- Tracking token usage from API responses
|
||||
|
||||
Selection is config-driven via `context.engine` in `config.yaml`. The resolution order:
|
||||
1. Check `plugins/context_engine/<name>/` directory
|
||||
2. Check general plugin system (`register_context_engine()`)
|
||||
3. Fall back to built-in `ContextCompressor`
|
||||
|
||||
Plugin engines are **never auto-activated** — the user must explicitly set `context.engine` to the plugin's name. The default `"compressor"` always uses the built-in.
|
||||
|
||||
Configure via `hermes plugins` → Provider Plugins → Context Engine, or edit `config.yaml` directly.
|
||||
|
||||
For building a context engine plugin, see [Context Engine Plugins](/docs/developer-guide/context-engine-plugin).
|
||||
|
||||
## Dual Compression System
|
||||
|
||||
Hermes has two separate compression layers that operate independently:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue