github severity1/claude-code-prompt-improver v0.6.0
v0.6.0: Declarative hook engine with JSON nudge registry

latest release: v0.6.1
one month ago

Changes

This release replaces the three standalone hook scripts with one declarative engine driven by a JSON nudge registry. Each prompt-improvement capability is now a data row in nudges/<EventName>/*.json, dispatched by a single engine.py <EventName> entry point. Adding an inject-context nudge is one JSON file with zero Python changes.

Added

  • Declarative engine (scripts/engine.py): sole entry point, invoked as engine.py <EventName>. Reads stdin once, runs the event's rules (each in a try/except so one bad rule cannot suppress others), merges inject_context fragments by priority with a blank-line join, emits one hookSpecificOutput, and exits 0 on every path
  • Rule layer (scripts/rules.py): JSON loader, validate_rule, the event->capability matrix, and rules_for(event). Each rule's event must match its parent directory; invalid rows are skipped with a stderr note (loading never raises)
  • Escape-hatch builtins (scripts/nudge_builtins.py): two allowlist dicts (HANDLERS, MATCHERS) referenced by string name only - no eval/importlib/getattr-on-path
  • JSON nudge registry (nudges/<EventName>/*.json): per-event subdirectories, recursively globbed and validated
  • approach-assessment nudge (UserPromptSubmit): on a non-trivial request, raises which approach fits - plan, subagent, heavier orchestration, or just do it - and reminds that a spawned subagent needs its context passed explicitly
  • output-readability nudge (UserPromptSubmit): self-cancelling reminder to make substantial deliverables (report, review, summary, comparison, analysis) human-parsable
  • subagent-routing nudge (SubagentStart): breadth-over-depth, conclusion-first guidance when an Explore or Plan agent spawns - a capability the old script layer could not express
  • New test suites: tests/test_engine.py (end-to-end subprocess per event), tests/test_rules.py, tests/test_nudge_builtins.py

Changed

  • improve and workflow became named handlers in nudge_builtins.py; plan became a pure-data nudge row
  • background-exec moved from UserPromptSubmit to PreToolUse/Bash so it fires only when a Bash command is actually about to run; the PreToolUse matcher now covers EnterPlanMode|Bash
  • approach-assessment (priority 10) now merges before workflow (priority 20) on UserPromptSubmit
  • Bumped plugin version to 0.6.0

Removed

  • Standalone hook scripts scripts/improve-prompt.py, scripts/plan-guidance.py, and scripts/workflow-guidance.py (collapsed into the engine)
  • Their test files tests/test_hook.py and tests/test_workflow_guidance.py

Note for manual installs: the three scripts above are gone. Copy scripts/engine.py, scripts/rules.py, scripts/nudge_builtins.py, and the whole nudges/ tree (keep scripts/ and nudges/ siblings), then add per-event engine.py <EventName> dispatch entries to settings.json.

Installation

claude plugin marketplace add severity1/severity1-marketplace
claude plugin install prompt-improver@severity1-marketplace

Don't miss a new claude-code-prompt-improver release

NewReleases is sending notifications on new releases.