Skip to content

Add opt-in compact prompts mode to reduce LLM token usage #456

Open

Description

@leogasparini

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:

  1. Line numbers drop zero-padding (L1: instead of L001:)
  2. Meta-analyzer omits redundant finding context from the prompt
  3. Meta-analyzer uses a slimmer structured output schema (no OverallAssessment)
  4. All five LLM analyzer prompts use condensed variants (same semantic content, less formatting overhead)
  5. 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.

Activity

  1. rng1995 commented on Sep 16, 2026

    @rng1995
    Collaborator

    Two compact-prompt implementations are under review: PR #457 proposes the broader opt-in compact mode, while PR #542 implements the first line-number compaction slice. Keeping this feature open until maintainers select and merge the intended scope.

  2. rng1995 commented on Sep 21, 2026

    @rng1995
    Collaborator

    Status correction: the broader compact-prompt implementation, PR #457, is now a draft. The smaller line-number compaction slice, PR #542, remains open and ready for review. Neither has merged; keeping this feature open pending acceptance and merge of the intended scope.

  3. rng1995 commented on Sep 22, 2026

    @rng1995
    Collaborator

    PR #542 has now merged. It implements item 1: SKILLSPECTOR_COMPACT_PROMPTS=true removes zero-padding from prompt line numbers while preserving the default behavior. The relevant default/compact prompt regressions pass on current main at 844ac30.

    This remains a partial implementation of the issue. Items 2-5 (omitting duplicate meta-analyzer context, slimming its output schema, condensed analyzer prompts, and shorter base guidelines) have not landed. The broader PR #457 remains a draft. Keeping the issue open for that remaining scope; the merged line-number slice is not yet in the latest published release, v2.11.2.

  4. rng1995 commented on Sep 23, 2026

    @rng1995
    Collaborator

    Publication update: the line-number compaction from PR #542 is now included in v2.12.0. This supersedes the earlier “not yet released” status. Items 2-5 remain outstanding, with the broader PR #457 still draft, so this issue remains open.

  5. rng1995 commented on Oct 4, 2026

    @rng1995
    Collaborator

    PR-state snapshot checked on 2026-10-04:

    • PR #457 — open, draft; no aggregate review decision reported; merge conflicts reported; latest reported check rollup: success.

    Merged #542 delivered line-number compaction only. The remaining compact-prompt items are still in draft #457.

    Keeping this issue open: the relevant implementation is not merged and the remaining scope still needs verification. Check/review status is a point-in-time snapshot, not a claim of merge readiness.

  6. rng1995 commented on Oct 6, 2026

    @rng1995
    Collaborator

    Merge-state update checked on 2026-10-06: PR #457 is closed without merging, so it is no longer an active implementation.

    Merged PR #542 delivered compact line numbering only. Context deduplication, the slimmer meta-analysis schema, condensed analyzer prompts, and shorter base output guidance remain outside that merged change. Keeping this issue open; no merged PR completes the remaining compact-prompt scope.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions