Skip to content

Add Contexto Hermes context engine plugin#150

Merged
sm86 merged 7 commits into
mainfrom
docs/contexto-hermes-plugin-spec
May 26, 2026
Merged

Add Contexto Hermes context engine plugin#150
sm86 merged 7 commits into
mainfrom
docs/contexto-hermes-plugin-spec

Conversation

@sm86
Copy link
Copy Markdown
Contributor

@sm86 sm86 commented May 23, 2026

Summary

Adds contexto-hermes, a Python package that makes Contexto available as a native Hermes Agent context engine plugin.

This PR includes:

  • remote-only Contexto backend support using api.getcontexto.com
  • env-var-only configuration via CONTEXTO_*
  • fail-soft httpx client behavior with timeout, HTTP error, and rate-limit handling
  • Hermes ContextEngine integration with compaction-time ingest/search
  • contexto_search engine tool for proactive recall between compactions
  • installer support for Hermes' bundled plugins/context_engine/contexto slot
  • plugin metadata, README, changelog, TS-parity fixture generation, and Python artifact ignores

Linked Issue

Closes #134

Testing

  • cd packages/contexto-py && .venv/bin/python -m pytest -q
    • 182 passed, 2 skipped
  • Clean-checkout simulation without sibling hermes-agent:
    • 181 passed, 3 skipped

Skipped tests are live smoke tests gated on CONTEXTO_API_KEY, plus the optional Hermes ABC assertion when hermes-agent is 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.

sm86 added 7 commits May 22, 2026 23:27
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.
@sm86 sm86 merged commit 3ff9dcd into main May 26, 2026
2 checks passed
@sm86 sm86 deleted the docs/contexto-hermes-plugin-spec branch May 26, 2026 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[contexto]: Add native Hermes Agent support

1 participant