feat: principle-driven compression — minimal intervention, block sizes, file decompress#47
Open
ranxianglei wants to merge 1 commit into
Open
Conversation
2287df2 to
77098fe
Compare
ddad4e8 to
41c37b0
Compare
…ery 10% tips - system.ts: 72 lines → 15 lines (principles only, no thresholds/levels/lists) - utils.ts: buildContextUsageGuidance returns just context number (no guidance text) - inject.ts: gating uses 10pp intervals from 15%, Tips show tools not commands - nudge.ts: removed consolidation suggestion - config.ts: added minNudgeContextPercent (default 15) - tests: updated assertions for simplified output
41c37b0 to
0f41b88
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Complete redesign of ACP compression prompts from rule-driven (72 lines of rules) to principle-driven (~20 lines of principles). Plus new features for better context awareness.
Prompt Redesign
buildContextUsageGuidancereturns just context number — no guidance text.Context: X%. Every 10 percentage points (from 15%): Tips show tool names. Below 15%: no compression prompts. At 65%: stronger overflow warning.b50 (76t), b51 (88t), ...Tool Improvements
summaryMaxCharsoptional parameter for override.toFileoptional parameter — writes content to file without inflating context. Block stays compressed.<dcp-message-id>and<dcp-system-reminder>).(bN)placeholders needed).Config
minNudgeContextPercent: 15 (don't nudge below 15%)perMessageNudgeGrowthPercent: 10 (percentage points, not relative %)nudgeFrequency: 6Files Changed (11 files, +158/-118)
lib/prompts/system.ts— principle-driven rewrite + BE FRUGAL + tag fixlib/messages/inject/utils.ts— simplified to context number onlylib/messages/inject/inject.ts— 10pp interval gating + min thresholdlib/prompts/extensions/nudge.ts— removed consolidation, added block token countslib/compress/range.ts— summaryMaxChars parameterlib/compress/message.ts— summaryMaxChars parameterlib/compress/decompress.ts— toFile parameterlib/compress/search.ts— (already good description)lib/config.ts— minNudgeContextPercenttests/nudge-text.test.ts— updated assertionsdevlog/2026-07-01_principle-driven-prompts/— REQ.md + WORKLOG.md