Skip to content

Support for Claude Code#4

Merged
sm86 merged 1 commit into
mainfrom
claude-code
Sep 3, 2025
Merged

Support for Claude Code#4
sm86 merged 1 commit into
mainfrom
claude-code

Conversation

@sm86
Copy link
Copy Markdown
Contributor

@sm86 sm86 commented Sep 3, 2025

Problem

  • Previously used OpenAI format as internal standard, causing double transformation (Anthropic → OpenAI → Anthropic)
  • Information loss during format translations (especially system messages, content arrays)

Solution

  • Introduced canonical format as neutral intermediate representation
  • Direct bidirectional adapters (Anthropic ↔ Canonical, OpenAI ↔ Canonical)
  • Preserves all format-specific features in metadata
  • Reduces transformation overhead

Testing

  • Verified all endpoints (/v1/messages, /v1/chat/completions, /v1/models, /usage)
  • Tested client compatibility with both Anthropic and OpenAI formats

The refactor also improves maintainability by separating concerns: adapters handle format conversion, providers handle API communication, and the service layer manages routing logic.

@sm86 sm86 requested a review from RamAnanth September 3, 2025 12:48
@sm86 sm86 merged commit 8d2075b into main Sep 3, 2025
sm86 added a commit that referenced this pull request May 24, 2026
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 added a commit that referenced this pull request May 26, 2026
* docs: design spec for Contexto × Hermes context engine plugin

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.

* feat: add Contexto Hermes plugin

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.

* fix: harden contexto hermes fail-soft paths

* fix: surface fail-closed ingest state

* fix: add preflight compression fallback

* fix: harden config validation, token coercion, and namespace install

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.

* docs: tighten contexto-hermes README config/status notes
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.

2 participants