Skip to content

fix(honcho): enforce contextTokens budget on prefetched Honcho context#3265

Closed
erosika wants to merge 2 commits into
NousResearch:mainfrom
erosika:eri/honcho-context-budget-refresh
Closed

fix(honcho): enforce contextTokens budget on prefetched Honcho context#3265
erosika wants to merge 2 commits into
NousResearch:mainfrom
erosika:eri/honcho-context-budget-refresh

Conversation

@erosika

@erosika erosika commented Mar 26, 2026

Copy link
Copy Markdown
Contributor

Refreshes #1878 onto current main. Credit to @AzothZephyr for the original fix and for identifying the issue.

Problem

Honcho's context(tokens=...) parameter only constrains message history retrieval -- the peer_representation and peer_card fields grow unbounded. Setting contextTokens in config had no effect on those blocks, which regularly hit 4000-5000+ tokens.

Fix

Client-side truncation in _honcho_prefetch(): assemble the full Honcho context block, then trim to the configured context_tokens budget with a truncation marker when needed. Factored into small helpers instead of inline logic.

Test plan

  • 3 passed: truncation-focused tests
  • 17 passed: broader Honcho/run_agent coverage

@erosika erosika force-pushed the eri/honcho-context-budget-refresh branch from 88c9a08 to 367e875 Compare March 27, 2026 21:28
erosika added a commit to erosika/hermes-agent that referenced this pull request Apr 2, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
teknium1 pushed a commit that referenced this pull request Apr 3, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- #3265: token budget enforcement in prefetch()
- #4053: cron guard (skip activation for cron/flush sessions)
- #2645: baseUrl-only flow verified in is_available()
- #1969: aiPeer sync from SOUL.md
- #1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
@erosika

erosika commented Apr 15, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by #9884 — contextTokens budget enforcement is handled by _truncate_to_budget() in the new plugin architecture.

@erosika erosika closed this Apr 15, 2026
angelburgosrosado pushed a commit to angelburgosrosado/hermes-agent that referenced this pull request Apr 27, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
olympus-terminal pushed a commit to olympus-terminal/hermes-agent that referenced this pull request May 16, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
Egavasyug pushed a commit to Egavasyug/hermes-agent that referenced this pull request Jun 10, 2026
Implements all features from the post-merge Honcho plugin spec:

B1: recall_mode support (context/tools/hybrid)
B2: peer_memory_mode gating (stub for ABC suppression mechanism)
B3: resolve_session_name() session key resolution
B4: first-turn context baking in system_prompt_block()
B5: cost-awareness (cadence, injection frequency, reasoning cap)
B6: memory file migration in initialize()
B7: pre-warming context at init

Ports from open PRs:
- NousResearch#3265: token budget enforcement in prefetch()
- NousResearch#4053: cron guard (skip activation for cron/flush sessions)
- NousResearch#2645: baseUrl-only flow verified in is_available()
- NousResearch#1969: aiPeer sync from SOUL.md
- NousResearch#1957: lazy session init in tools mode

Single file change: plugins/memory/honcho/__init__.py
No modifications to client.py, session.py, or any files outside the plugin.
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