The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
Revert "fix: rewire DCP context engine to current main architecture"
kshitij0647bf988954
diff --git a/agent/agent_init.py b/agent/agent_init.pyindex d71cfd6471f..0cb21e94465 100644--- a/agent/agent_init.py+++ b/agent/agent_init.py@@ -31,7 +31,6 @@ from typing import Any, Callable, Dict, List, Optionalfrom urllib.parse import parse_qs, urlparse, urlunparsefrom agent.context_compressor import ContextCompressor-from agent.dcp_context_engine import DCPContextEnginefrom agent.iteration_budget import IterationBudgetfrom agent.memory_manager import StreamingContextScrubberfrom agent.session_activity import ActivityProvenance@@ -2412,14 +2411,7 @@ def init_agent(except Exception:pass- if _engine_name == "dcp":- _selected_engine = DCPContextEngine(- config=_ctx_cfg.get("dcp", {}) if isinstance(_ctx_cfg, dict) else {},- model=agent.model,- provider=agent.provider,- quiet_mode=agent.quiet_mode,- )- elif _engine_name != "compressor":+ if _engine_name != "compressor":# Try loading from plugins/context_engine/<name>/try:from plugins.context_engine import load_context_enginediff --git a/agent/context_engine.py b/agent/context_engine.pyindex 12393b42116..b772125c0cb 100644--- a/agent/context_engine.py+++ b/agent/context_engine.py@@ -382,39 +382,6 @@ class ContextEngine(ABC):"""return True- # -- Optional: API-call-time transform ----------------------------------- def transform_api_messages(- self,- api_messages: List[Dict[str, Any]],- *,- canonical_messages: List[Dict[str, Any]],- system_prompt: str,- tools: List[Dict[str, Any]] | None,- api_call_count: int,- model: str,- provider: str | None,- session_id: str | None,- ) -> List[Dict[str, Any]]:- """Transform the provider-bound API-call copy of the transcript.-- Default returns ``api_messages`` unchanged. Engines may override this- to add ephemeral refs, compression placeholders, or other context- layers without mutating ``canonical_messages``.-- Contract:- - Receives the API-call copy, not authoritative history.- - Must not mutate ``canonical_messages``.- - Must preserve valid OpenAI message ordering.- - Must not separate an assistant ``tool_calls`` message from its- required tool results.- - Should run before prompt-cache marker placement so caching logic- sees the actual outgoing request.- - Should avoid churning the stable prefix on every call to preserve- prompt-cache hit rates.- """- return api_messages-# -- Optional: session lifecycle ---------------------------------------def on_session_start(self, session_id: str, **kwargs) -> None:diff --git a/agent/conversation_loop.py b/agent/conversation_loop.pyindex 596e9b6e07a..2ab35ec945e 100644--- a/agent/conversation_loop.py+++ b/agent/conversation_loop.py@@ -1981,34 +1981,6 @@ def run_conversation(# the OpenAI SDK. Sanitizing here prevents the 3-retry cycle._sanitize_messages_surrogates(api_messages)- # Let the active context engine transform the API-call copy.- # DCP uses this to add refs, compression block placeholders, and- # nudges without mutating the canonical messages transcript.- # Runs after sanitization/normalization so the transform sees the- # final wire shape, and before prompt-cache marker placement so- # caching logic sees the actual outgoing request.- _ctx_engine = getattr(agent, "context_compressor", None)- if _ctx_engine is not None:- _transform_hook = getattr(_ctx_engine, "transform_api_messages", None)- if callable(_transform_hook):- try:- api_messages = _transform_hook(- api_messages,- canonical_messages=messages,- system_prompt=effective_system,- tools=agent.tools,- api_call_count=api_call_count,- model=agent.model,- provider=agent.provider,- session_id=agent.session_id,- )- except Exception as _ctx_err:- request_logger.warning(- "Context engine transform_api_messages failed (session=%s): %s",- getattr(agent, "session_id", None) or "-",- _ctx_err,- )-# NOTE (empty-content class fix): no send-time pad loop here. The# single owner for "never send a turn strict wire validation rejects# as empty" is ``repair_empty_non_final_messages``, which runs insidediff --git a/hermes_cli/config_defaults.py b/hermes_cli/config_defaults.pyindex 276570461c0..b3073d9517a 100644--- a/hermes_cli/config_defaults.py+++ b/hermes_cli/config_defaults.py@@ -1665,32 +1665,6 @@ DEFAULT_CONFIG = {# a plugin in plugins/context_engine/<name>/ or ~/.hermes/plugins/."context": {"engine": "compressor",- # DCP context engine config — only active when engine == "dcp".- "dcp": {- "enabled": True,- "compress": {- "mode": "range",- "permission": "allow",- "maxContextLimit": 100000,- "minContextLimit": 50000,- "nudgeFrequency": 5,- "iterationNudgeThreshold": 15,- "nudgeForce": "soft",- },- "strategies": {- "deduplication": {- "enabled": True,- },- "purgeErrors": {- "enabled": True,- "turns": 4,- },- },- "turnProtection": {- "enabled": False,- "turns": 4,- },- },# Return freed glibc allocator pages after long-running agent/TUI# cleanup boundaries. Unsupported platforms are safe no-ops."memory_trim": {