Background
PR #30077 added per-message Honcho identity-mapping cache-busting to GatewayRunner._extract_cache_busting_config(). The implementation calls HonchoClientConfig.from_global_config() on every gateway message:
https://github.com/NousResearch/hermes-agent/blob/main/gateway/run.py#L14677-L14695
try:
from plugins.memory.honcho.client import HonchoClientConfig
hcfg = HonchoClientConfig.from_global_config()
...
from_global_config() unconditionally does path.read_text() + json.loads() on ~/.hermes/honcho.json (or ~/.honcho/config.json) and reconstructs the full HonchoClientConfig dataclass — every parse rule, every alias merge, every dialectic field — every time.
Problem
-
Disk read on every gateway message. Even for users who don't use Honcho. honcho.json is small so each call is microseconds, but the work is unconditional and runs in the hot path before agent dispatch.
-
Full config reparse to extract 5 fields. The cache-bust block only reads peer_name, ai_peer, pin_peer_name, runtime_peer_prefix, user_peer_aliases — but from_global_config() parses ~40 fields including dialectic levels, write frequency, context tokens, save flags, observation config, etc.
Proposed fix
Two options, not mutually exclusive:
Option A: gate on active memory provider. Skip the block entirely when memory.provider != "honcho". This is the cheapest win and handles the largest cohort (non-Honcho users).
Option B: mtime-based memoization. Cache the parsed HonchoClientConfig keyed by (path, st_mtime_ns) of honcho.json. os.stat() is much faster than parsing JSON. Bust on mtime change. Lifetime = process lifetime; small dict, no eviction needed because the path set is bounded.
Both together gives Honcho users the mtime-fast-path and everyone else the no-op skip.
If #33381 lands first, this issue becomes a non-problem for non-Honcho users automatically (only the active provider's hook runs). In that case only Option B remains — memoize inside the plugin's cache_busting_signature().
Acceptance criteria
Notes
This is low-priority — the disk read is genuinely microsecond-scale on a hot SSD, and most gateways are network-bound, not disk-bound. Filing for completeness so the architectural intent is preserved. Pairs naturally with #33381.
Background
PR #30077 added per-message Honcho identity-mapping cache-busting to
GatewayRunner._extract_cache_busting_config(). The implementation callsHonchoClientConfig.from_global_config()on every gateway message:https://github.com/NousResearch/hermes-agent/blob/main/gateway/run.py#L14677-L14695
from_global_config()unconditionally doespath.read_text()+json.loads()on~/.hermes/honcho.json(or~/.honcho/config.json) and reconstructs the fullHonchoClientConfigdataclass — every parse rule, every alias merge, every dialectic field — every time.Problem
Disk read on every gateway message. Even for users who don't use Honcho.
honcho.jsonis small so each call is microseconds, but the work is unconditional and runs in the hot path before agent dispatch.Full config reparse to extract 5 fields. The cache-bust block only reads
peer_name,ai_peer,pin_peer_name,runtime_peer_prefix,user_peer_aliases— butfrom_global_config()parses ~40 fields including dialectic levels, write frequency, context tokens, save flags, observation config, etc.Proposed fix
Two options, not mutually exclusive:
Option A: gate on active memory provider. Skip the block entirely when
memory.provider != "honcho". This is the cheapest win and handles the largest cohort (non-Honcho users).Option B: mtime-based memoization. Cache the parsed
HonchoClientConfigkeyed by(path, st_mtime_ns)ofhoncho.json.os.stat()is much faster than parsing JSON. Bust on mtime change. Lifetime = process lifetime; small dict, no eviction needed because the path set is bounded.Both together gives Honcho users the mtime-fast-path and everyone else the no-op skip.
If #33381 lands first, this issue becomes a non-problem for non-Honcho users automatically (only the active provider's hook runs). In that case only Option B remains — memoize inside the plugin's
cache_busting_signature().Acceptance criteria
_extract_cache_busting_config()does not readhoncho.jsonfrom disk when memory provider is not Honchohoncho.jsonmtime hit a memoized resultTestAgentConfigSignatureUserIdtests still passtests/perf/showing the per-message overhead dropNotes
This is low-priority — the disk read is genuinely microsecond-scale on a hot SSD, and most gateways are network-bound, not disk-bound. Filing for completeness so the architectural intent is preserved. Pairs naturally with #33381.