Skip to content

feat: system prompt overspec audit and mitigation#16343

Open
micuintus wants to merge 8 commits intoanomalyco:devfrom
micuintus:feature/issues/16339_Overspec_Audit_and_Mitgation
Open

feat: system prompt overspec audit and mitigation#16343
micuintus wants to merge 8 commits intoanomalyco:devfrom
micuintus:feature/issues/16339_Overspec_Audit_and_Mitgation

Conversation

@micuintus
Copy link

@micuintus micuintus commented Mar 6, 2026

Issue for this PR

Closes #16339

Type of change

  • Bug fix
  • Refactor / code improvement

What does this PR do?

  • Add a system prompt audit to CI (warning, not blocking)
  • Audited the current system prompts and remove redundancies in current system prompts

How did you verify your code works?

Manual testing

Screenshots / recordings

No UI change

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Michael Voigt added 8 commits March 6, 2026 11:21
Create script/audit-overspecification.ts that:
- Audits all session and agent prompt files
- Measures tokens (chars/4), directives (MUST/NEVER/ALWAYS/IMPORTANT/CRITICAL),
  and examples (XML and markdown patterns)
- Compares against thresholds by prompt type:
  - Provider: ≤1500 tokens, ≤12 directives, ≤5 examples
  - Utility: ≤200 tokens, ≤4 directives, ≤0 examples
  - Agent: ≤400 tokens, ≤6 directives, ≤3 examples
  - Meta: ≤800 tokens, ≤0 directives, ≤0 examples
- Outputs structured report to stdout, violations to stderr
- Runs in warning mode (exit 0) for CI integration

Issue: anomalyco#16339
Reduce token count from 3843 to ~2400 by:

- Remove New Applications section (~500 tokens)

- Remove 3 verbose examples (Delete temp, Write tests, Find config)

- Keep 5 most illustrative examples

- Remove redundant tool usage instructions

Issue: anomalyco#16339
Reduce token count from 2770 to ~1200 by:

- Consolide repetitive 'keep going' directives

- Simplify 10-step workflow to 9 concise steps

- Remove Reading Files section (redundant)

- Remove Writing Prompts section (not relevant)

- Compress Communication Guidelines

- Keep Memory section as flagged for review

Issue: anomalyco#16339
Reduce token count from 2425 to ~1700 by:

- Remove duplicate IMPORTANT statements about conciseness

- Reduce examples from 18 to 7

- Remove redundant tool usage instructions

- Consolidate security warnings

Issue: anomalyco#16339
Reduce token count from 1937 to ~1400 by:

- Reduce examples from 18 to 7

- Remove duplicate IMPORTANT statements

- Consolidate verbosity guidelines

Issue: anomalyco#16339
Remove verbose task management examples and explanations

Streamline tool usage policy section

Keep core functionality intact

Issue: anomalyco#16339
Reduce examples from 10 to 5

Bring token count under 400 threshold

Issue: anomalyco#16339
Add npm script to run prompt overspecification audit

Usage: bun run audit:prompts

Issue: anomalyco#16339
@github-actions github-actions bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels Mar 6, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 6, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Science based system prompt over specification audit and mitigation

1 participant