Skip to content

feat: add prompt rewriter skill and optimization category#26

Merged
rosspeili merged 3 commits intoARPAHLS:mainfrom
rosspeili:feat/prompt-rewriter
Mar 21, 2026
Merged

feat: add prompt rewriter skill and optimization category#26
rosspeili merged 3 commits intoARPAHLS:mainfrom
rosspeili:feat/prompt-rewriter

Conversation

@rosspeili
Copy link
Copy Markdown
Contributor

Purpose

This PR implements the Prompt Token Rewriter skill, introducing the new optimization category to the Skillware registry. This skill serves as a deterministic middleware to help agents compress bloated prompts and context histories, significantly reducing token costs while maintaining 100% semantic integrity.

Changes

  • New Skill: skills/optimization/prompt_rewriter/
    • skill.py: Heuristic Regex-based compression logic with three aggression levels (low, medium, high).
    • manifest.yaml: Standardized metadata aligned with Skillware parameters and constitution guidelines.
    • instructions.md: Detailed cognitive map instructing the agent on how and when to use the tool.
    • card.json: UI presentation schema for agent dashboards.
  • Documentation Updates:
    • Created docs/skills/prompt_rewriter.md (Reference Card).
    • Updated docs/skills/README.md to include the new Optimization category.
    • Added a "Skill Chaining" middleware example to docs/usage/gemini.md.
  • Quality Assurance:
    • Added a robust pytest suite in tests/skills/optimization/test_prompt_rewriter.py.
    • Provided an interactive test script in examples/prompt_compression_demo.py.

Verification Results

  • pytest suite: 4/4 Passing (Schema, Low-Aggression, High-Aggression, Error-Handling).
  • Manual verification via demo: Successfully reduced a sample conversational prompt from 39 tokens to 15 tokens (~61% saving) while retaining all core instructions.

Fixes #21

@rosspeili rosspeili merged commit d83dc2e into ARPAHLS:main Mar 21, 2026
5 checks passed
@rosspeili rosspeili deleted the feat/prompt-rewriter branch March 21, 2026 15:07
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.

[New Skill]: Prompt Token Rewriter

1 participant