Add opt-in compact prompts mode to reduce LLM token usage
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.9k
- Forks
- 1.5k
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 66
Description
LLM analyzer prompts carry redundant content that inflates token consumption without improving detection quality:
- Line numbers are zero-padded (L001: instead of L1:), adding ~3 wasted characters per line across every file sent to the LLM.
- The meta-analyzer embeds each finding's context snippet in the prompt alongside the full line-numbered file content, duplicating the same code.
- The OverallAssessment field in MetaAnalyzerResult is generated by the LLM but never consumed downstream (the report node computes its own risk score).
- Several analyzer prompts (SSD, SDI, SQP, meta-analyzer, TP4) contain repeated phrasing, verbose formatting (horizontal rules, per-section rule-ID reminders already present in the
summary table), and filler sentences.
Proposal: Introduce a SKILLSPECTOR_COMPACT_PROMPTS=true environment variable that activates condensed prompt variants. Default behavior stays identical for backward compatibility.
When enabled:
- Line numbers drop zero-padding (L1: instead of L001:)
- Meta-analyzer omits redundant finding context from the prompt
- Meta-analyzer uses a slimmer structured output schema (no OverallAssessment)
- All five LLM analyzer prompts use condensed variants (same semantic content, less formatting overhead)
- BASE_ANALYSIS_PROMPT output guidelines shortened from 5 lines to 2
Estimated savings per scan: 400-800 input tokens from prompt condensation, ~375 input tokens per call from line numbering (on a 500-line file), 30-50 output tokens per meta-analyzer call from schema reduction, plus variable savings from context omission.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Locate the analyzer prompt definitions, BASE_ANALYSIS_PROMPT, MetaAnalyzerResult, and the line-number formatting described in the issue. Trace how prompt configuration is selected, then verify that the opt-in mode condenses all listed prompts and removes redundant meta-analyzer data while default behavior remains unchanged and the stated token savings are achieved.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- ai, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 64/100