Skip to content

perf(prompt): compact the skills guidance preamble, -218 always-on tokens (salvage #72813) [needs wording sign-off] - #77698

Closed
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage/72813-compact-skills-guidance
Closed

perf(prompt): compact the skills guidance preamble, -218 always-on tokens (salvage #72813) [needs wording sign-off]#77698
kshitijk4poor wants to merge 1 commit into
NousResearch:mainfrom
kshitijk4poor:salvage/72813-compact-skills-guidance

Conversation

@kshitijk4poor

Copy link
Copy Markdown
Collaborator

Context

The skills-guidance preamble (the prose block above <available_skills> instructing the model when/how to load skills) is paid on EVERY session's system prompt, for every user with skills installed — and it had grown to 1,550 chars of overlapping instructions. This compacts it to 678 chars while preserving every behavioral contract the long form carried.

Measured impact

387 → 169 tokens (−218 tokens, −56%) of always-on system-prompt weight for any session with skills, measured on a live build_skills_system_prompt render.

The wording gate (flagging for maintainer sign-off)

This is a REWORDING of tuned behavioral prompt copy, so it can shift model behavior — that's a taste/behavior call, not a mechanical merge. Mitigation shipped with the PR: a disclosure-contract test asserts the compacted string still carries each key behavioral phrase (MUST-load on match, partial-relevance loading, hermes-agent-skill-first rule, patch-when-stale, offer-to-save-after-hard-tasks). If maintainers want the long form back for any single behavior, the test names exactly which phrase anchors it. Requesting explicit sign-off on the wording rather than silent auto-merge — NOT arming auto-merge on this one.

Provenance

Salvage of #72813 by @JeremyDev87 (authorship preserved; attribution mapping merged as #77685). The PR's delegate_tool.py hunks were dropped as superseded — main already rewrote _build_top_level_description to the static duplication-free design this PR was reaching for; what survives is the prompt_builder compaction.

Verification

  • tests/agent/test_prompt_builder.py 56 passed / 1 skipped.
  • Mutation check: reverting prompt_builder.py fails the new disclosure-contract test; restore green.
  • Zero skills hidden: the <available_skills> entries are byte-identical before/after (only the preamble prose changed).

Closes #72813.

- Compact the Skill preamble and delegate_task narrative.
- Preserve dynamic delegation limits and safety, lifecycle, and inheritance contracts.
- Add semantic regression coverage for the retained behavior.

Refs NousResearch#72737
@alt-glitch alt-glitch added type/perf Performance improvement or optimization P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint tool/skills Skills system (list, view, manage) needs-decision Awaiting maintainer decision before any implementation labels Aug 3, 2026
@Ruanjq98

Ruanjq98 commented Aug 3, 2026

Copy link
Copy Markdown

Code Review: #77698

Verdict: Approve

Test: additional coverage.

LGTM - Reviewed diff. Changes are sound.

@GottZ

GottZ commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

This was generated by AI during triage.

Summary

Two PRs address Issue #72737. #72813 compacted both the skills preamble and delegation guidance, while #77698 preserves only the skills-preamble compaction because the delegation portion was superseded by #77372.

Related pull requests

Duplicates

#72813 and #77698 contain essentially the same skills-preamble compaction and test; #77698 is the focused salvage, while #72813's additional delegation work is not duplicated there and was superseded by #77372.

Suggested consolidation

Keep #77698 open with a salvage path: obtain the requested maintainer wording sign-off on its focused skills-preamble compaction and contract test. #72813 is already closed in favor of #77698 for that portion, with its delegation portion superseded by #77372, so no reopen or additional duplicate closure is needed.

Cross-PR triage: Reviewed 2 pull requests and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 21 kB of PR diffs, 8 kB of issue/PR text, 1 kB of discussion (3 comments), 3 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch.

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 needs-decision Awaiting maintainer decision before any implementation P3 Low — cosmetic, nice to have 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.

5 participants