Add Contexto Hermes context engine plugin#150
Merged
Conversation
Adds the v1 design for a Python context engine plugin that mirrors @ekai/contexto's remote mode for hermes-agent. Lives in the plugins/context_engine/<name>/ slot, uses the standard ContextEngine ABC without core changes, ingests on compact() and exposes a contexto_search tool for between-compaction recall.
Add the contexto-hermes Python package as a Hermes context engine plugin. The implementation is remote-only and uses env-var configuration, a fail-soft httpx backend, compaction-time ingestion/search, and the contexto_search engine tool. Include installer support for Hermes' bundled context_engine slot, plugin metadata, README/changelog, TS-parity fixtures, and unit/smoke tests. Also add Python artifact ignores so local venv/cache/build files stay out of commits.
Address remaining review findings on the contexto-hermes plugin: - #4: update_from_response() coerces provider token counts defensively (numeric strings like "1.5" handled; non-numeric preserves prior value instead of raising into Hermes' response path). - #6: env-var config is now bounds-checked — max_context_chars >= 1, max_results >= 1, min_score in [0,1], non-finite/NaN rejected; invalid values fall back to defaults with a WARNING. Truncation sites also guard against a non-positive cap so context never collapses to just "…". - #8: installer discovers Hermes' plugins/context_engine when it is a PEP-420 namespace package (origin is None -> submodule_search_locations); directory checks relaxed from __init__.py to is_dir(). - Docs: README documents the fail-closed ingest status counters and clarifies CONTEXTO_MAX_RESULTS (compaction recall) vs the contexto_search tool's own max_results (default 5); CHANGELOG updated. Tests: 209 passed, 3 skipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
contexto-hermes, a Python package that makes Contexto available as a native Hermes Agent context engine plugin.This PR includes:
api.getcontexto.comCONTEXTO_*httpxclient behavior with timeout, HTTP error, and rate-limit handlingContextEngineintegration with compaction-time ingest/searchcontexto_searchengine tool for proactive recall between compactionsplugins/context_engine/contextoslotLinked Issue
Closes #134
Testing
cd packages/contexto-py && .venv/bin/python -m pytest -q182 passed, 2 skippedhermes-agent:181 passed, 3 skippedSkipped tests are live smoke tests gated on
CONTEXTO_API_KEY, plus the optional Hermes ABC assertion whenhermes-agentis not available.Notes
No Hermes Agent core files are modified. Hermes-specific runtime assumptions are covered by the checked-in tests and the approved design spec on this branch.