Skip to content

fix(honcho): lazy session init in tools mode#1957

Closed
erosika wants to merge 3 commits into
NousResearch:mainfrom
erosika:eri/honcho-fixes
Closed

fix(honcho): lazy session init in tools mode#1957
erosika wants to merge 3 commits into
NousResearch:mainfrom
erosika:eri/honcho-fixes

Conversation

@erosika

@erosika erosika commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Lazy session init in tools mode: recallMode: "tools" no longer eagerly calls get_or_create() -> session.context(summary=True) on startup. Session creation is deferred until the first Honcho tool is actually invoked, eliminating a blocking HTTP round-trip after /new.
  • Default session strategy: Changed from per-session to per-directory so cross-session context (peer card, conclusions, dialectic) persists across runs in the same working directory.

Test plan

  • All 104 honcho unit tests pass
  • Live test: /new + recallMode: "tools" + writeFrequency: async + later honcho tool invocation
  • Zero get_or_create calls at init, ensure_session fires lazily on first tool call

Related meta issue: #2210

@erosika erosika force-pushed the eri/honcho-fixes branch 4 times, most recently from fcf7523 to 2bc0594 Compare March 19, 2026 20:05
@erosika erosika changed the title fix(honcho): lazy session init, banner gating, per-directory default fix(honcho): lazy session init in tools mode, default session strategy to per-directory Mar 20, 2026
@erosika erosika force-pushed the eri/honcho-fixes branch 3 times, most recently from e7f40ff to f3cf933 Compare March 26, 2026 18:09
@erosika erosika force-pushed the eri/honcho-fixes branch 2 times, most recently from 8ab8d08 to b640e7a Compare March 30, 2026 01:13
@erosika erosika changed the title fix(honcho): lazy session init in tools mode, default session strategy to per-directory fix(honcho): lazy session init in tools mode Mar 30, 2026
erosika added 3 commits March 30, 2026 13:44
recallMode=tools still eagerly called get_or_create() ->
session.context(summary=True) on startup, adding a blocking HTTP
round-trip even when no Honcho tool was invoked. Defer session
creation until the first tool call via ensure_session().

- Extract _ensure_honcho_session_initialized helper on AIAgent
- Add ensure_session() to HonchoSessionManager for lazy init
- Tool handlers lazily init via _resolve_session_context()
- Add integration test verifying deferred init flow
- Update test assertions for per-directory default
When recall_mode=tools, _activate_honcho skips eager session init,
so the lazy path through _resolve_session_context -> ensure_session
never ran migrate_memory_files. Add migration logic to ensure_session
with a _migrated set to guarantee it runs exactly once per session key.
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 — lazy session init / initOnSessionStart is implemented 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.

1 participant