Skip to content

fix: reduce gateway context burn from skills catalog injection - #12015

Closed
RustColdCalls wants to merge 1 commit into
NousResearch:mainfrom
RustColdCalls:fix/skills-prompt-mode-gateway
Closed

fix: reduce gateway context burn from skills catalog injection#12015
RustColdCalls wants to merge 1 commit into
NousResearch:mainfrom
RustColdCalls:fix/skills-prompt-mode-gateway

Conversation

@RustColdCalls

@RustColdCalls RustColdCalls commented Apr 18, 2026

Copy link
Copy Markdown

Summary

  • add skills.system_prompt_mode config (auto|full|minimal|off)
  • default auto: full skills catalog on CLI, minimal skills guidance on gateway platforms
  • add compact build_minimal_skills_system_prompt() to avoid shipping full <available_skills> every turn on gateways
  • keep full catalog available via explicit full override
  • bump config schema 17 -> 18
  • update/add tests for new prompt-mode behavior and schema-version assertions

Why

Slack/gateway sessions were burning context budget faster because the full skills catalog was injected each turn. This change cuts baseline prompt overhead on gateways while preserving full behavior on CLI.

Validation

  • python -m pytest tests/agent/test_prompt_builder.py tests/run_agent/test_run_agent.py tests/hermes_cli/test_config.py tests/tools/test_browser_camofox_state.py -q
    • 413 passed, 1 skipped
  • Full-suite run in this workspace currently has pre-existing unrelated failures (not introduced by this branch).

- add skills.system_prompt_mode config (auto/full/minimal/off)
- default auto to minimal on gateway platforms, full on CLI
- add compact minimal skills prompt builder
- add regression tests for gateway auto/minimal + full override
- bump config schema to 18 and update version-pinned tests
@alt-glitch alt-glitch added type/perf Performance improvement or optimization P2 Medium — degraded but workaround exists comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/gateway Gateway runner, session dispatch, delivery tool/skills Skills system (list, view, manage) labels Apr 24, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for targeting a real prompt-cost issue. Current main still unconditionally builds the full skills index whenever skills tooling is available (agent/system_prompt.py:292-318), so the performance premise remains valid.

Problems

  • The proposed auto branch classifies every non-CLI platform as minimal. That would include TUI (tui_gateway/server.py:4613) and API-server sessions (gateway/platforms/api_server.py:1354), not only messaging gateways.
  • The config version bump is not needed for an additive default: AGENTS.md:584-590 and hermes_cli/config.py:6180-6184 specify that deep-merge makes new keys effective without migration. The exact-version test updates are also change-detector coverage (AGENTS.md:1309-1355).
  • The target code moved: current skills config setup is agent/agent_init.py:1422-1428, and prompt selection is agent/system_prompt.py:292-318; GitHub currently reports this branch as conflicting.

Suggested changes

  • Port the change to those extracted modules, use an explicit messaging-platform predicate, and cover CLI/TUI/API-server plus all supported modes.
  • Remove the schema bump and version snapshots; document the supported config option if retained.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit labels Jul 12, 2026
@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Closing as superseded. This targeted a real problem — the full skills catalog burning gateway context every turn — and the premise was confirmed valid by review. But the branch is now ~17k commits behind: the code it patches moved to agent/system_prompt.py / agent/agent_init.py, the auto heuristic misclassifies TUI and API-server sessions as messaging gateways, and the config-version bump is unnecessary for an additive key.

The same capability has since been implemented on a current base in #72200 (agent.skills_catalog_mode, cache-safe names-only demotion that never hides skills, sweeper feedback addressed, CI green), so we're consolidating on that PR rather than asking for a rebase here.

Thanks for surfacing this early — you had the right idea well before the ecosystem caught up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:blast-broad Sweeper blast radius: broad — a core path most sessions hit sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/skills Skills system (list, view, manage) type/perf Performance improvement or optimization

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants