Skip to content

feat(hermes): add offload context engine#376

Open
RerankerGuo wants to merge 1 commit into
TencentCloud:mainfrom
RerankerGuo:feat/hermes-context-engine-102
Open

feat(hermes): add offload context engine#376
RerankerGuo wants to merge 1 commit into
TencentCloud:mainfrom
RerankerGuo:feat/hermes-context-engine-102

Conversation

@RerankerGuo

Copy link
Copy Markdown
Contributor

Description | 描述

Add a standalone Hermes ContextEngine plugin for TencentDB short-term offload under hermes-plugin/context_engine/tencentdb_offload.

This is a narrow runtime follow-up to the Hermes short-term memory gap:

  • Adds TencentdbOffloadContextEngine with the expected name, should_compress, compress, and update_from_response methods.
  • Keeps the implementation HTTP-only so it does not import TencentDB TypeScript internals or the existing Hermes memory provider.
  • Sends remote compaction requests to POST /v2/offload/compact and accepts either messages or compacted_messages response shapes.
  • Sends best-effort ingest payloads to POST /v2/offload/ingest on a daemon thread so the user path is not blocked.
  • Provides a local tail-truncation fallback that preserves system messages and recent conversation context if the remote service is down or returns an unsupported response.
  • Documents environment variables and the expected remote contract.
  • Adds stdlib unit tests for threshold decisions, remote compaction, fallback behavior, and async ingest scheduling.

I intentionally did not change the TypeScript Gateway routes in this PR. The plugin defines the Hermes-side adapter and remote HTTP contract first; Gateway-side /v2/offload/* implementation can remain a follow-up if maintainers want it in this repository rather than an external offload service.

Related Issue | 关联 Issue

Related to #102

Change Type | 修改类型

  • Bug fix | Bug 修复
  • New feature | 新功能
  • Documentation update | 文档更新
  • Code optimization | 代码优化

Self-test Checklist | 自测清单

  • Verified locally | 本地验证通过
  • No existing features affected | 无影响现有功能

Verification | 验证

  • python3 hermes-plugin/context_engine/tencentdb_offload/tests/test_context_engine.py
  • python3 -m py_compile hermes-plugin/context_engine/tencentdb_offload/__init__.py hermes-plugin/context_engine/tencentdb_offload/client.py hermes-plugin/context_engine/tencentdb_offload/fallback.py hermes-plugin/context_engine/tencentdb_offload/tests/test_context_engine.py
  • npm test
  • npm run build
  • git diff --check

Additional Notes | 其他说明

The scope is deliberately conservative: it makes the Hermes ContextEngine slot usable and failure-tolerant without changing the existing memory_tencentdb provider or the OpenClaw/offload TypeScript runtime.

Signed-off-by: Ziyang Guo <121015044+RerankerGuo@users.noreply.github.com>
@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thanks for your attention! We’ll review this and get back to you as soon as possible.

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