perf(bedrock): add SKILLSPECTOR_COMPACT_PROMPTS option to reduce LLM token usage - #457
Open
leogasparini wants to merge 1 commit into
Open
perf(bedrock): add SKILLSPECTOR_COMPACT_PROMPTS option to reduce LLM token usage#457leogasparini wants to merge 1 commit into
leogasparini wants to merge 1 commit into
Conversation
Introduce an opt-in env var (SKILLSPECTOR_COMPACT_PROMPTS=true) that reduces token consumption across all LLM analyzer prompts while preserving the default behavior for backward compatibility. When enabled, compact mode applies five optimizations: 1. Line numbers drop zero-padding (L001 -> L1), saving ~3 chars per line 2. Meta-analyzer finding context omitted from prompt (already in file content) 3. Meta-analyzer response schema drops unused OverallAssessment field 4. All analyzer prompts condensed (redundant phrasing, verbose formatting) 5. BASE_ANALYSIS_PROMPT output guidelines shortened from 5 lines to 2 Estimated per-scan savings with compact mode on: - ~100 input tokens/call from prompt condensation (x4-8 calls) - ~3 chars/line from line numbering (500-line file = ~375 tokens/call) - ~30-50 output tokens/call from OverallAssessment removal - Variable savings from context field omission Default behavior is fully preserved: all original prompts, schemas, and formatting remain active unless the env var is explicitly set. All 2955 tests pass in both default and compact modes. Lint clean. Signed-off-by: leonardogasparini <leonardo.gasparini@tui.com>
leogasparini
force-pushed
the
optimize-llm-token-usage
branch
from
August 28, 2026 11:45
274189b to
f575edb
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.
Introduce an opt-in env var (SKILLSPECTOR_COMPACT_PROMPTS=true) that reduces token consumption across all LLM analyzer prompts while preserving the default behavior for backward compatibility.
When enabled, compact mode applies five optimizations:
Estimated per-scan savings with compact mode on:
Default behavior is fully preserved: all original prompts, schemas, and formatting remain active unless the env var is explicitly set.
All 2955 tests pass in both default and compact modes. Lint clean.
Contributes to #456.