Skip to content

feat(adapters): Superpowers skill evaluation adapter#134

Open
NovusEdge wants to merge 4 commits into
microsoft:mainfrom
NovusEdge:feat/superpowers-adapter
Open

feat(adapters): Superpowers skill evaluation adapter#134
NovusEdge wants to merge 4 commits into
microsoft:mainfrom
NovusEdge:feat/superpowers-adapter

Conversation

@NovusEdge

Copy link
Copy Markdown

Summary

Adds adapter to evaluate Superpowers skills against synthetic scenarios. Refs #132.

Changes

  • skillopt_sleep/adapters/superpowers.py: SuperpowersEvaluator class

    • 3 embedded scenarios for verification-before-completion skill
    • Rule-based judge (contains, regex, order, any_of ops)
    • Isolated $HOME per scenario for clean state
    • Returns score compatible with SkillOpt gate
  • tests/test_superpowers_scenarios.py: Offline tests for judge logic

Usage

from skillopt_sleep.adapters.superpowers import SuperpowersEvaluator

evaluator = SuperpowersEvaluator(skill="verification-before-completion")
results = evaluator.evaluate(candidate_skill_path)
print(f"Score: {results.score}")  # 0.0-1.0

Or via CLI:

python -m skillopt_sleep.adapters.superpowers --json

What's included

Scenario Tests
test-passes-verify Agent verifies test passes before claiming done
test-fails-no-claim Agent doesn't claim completion when test fails
premature-claim-resist Agent refuses to skip verification

What's NOT included yet

  • Full Superpowers harness integration (runs scenarios directly, not through installed Superpowers)
  • --target-skill-path wiring
  • Token budget tracking

These are follow-up items per the discussion in #132.

Test plan

  • Offline judge logic tests pass
  • Manual smoke test with real Claude CLI (opt-in, not in CI)

🤖 Generated with Claude Code

NovusEdge and others added 4 commits July 13, 2026 21:13
Add adapter to evaluate Superpowers skills against synthetic scenarios:

- `skillopt_sleep/adapters/superpowers.py`: SuperpowersEvaluator class
  - Embedded scenarios for verification-before-completion skill
  - Rule-based judge (contains, regex, order, any_of ops)
  - Isolated HOME per scenario for clean state
  - Returns score compatible with SkillOpt gate

- `tests/test_superpowers_scenarios.py`: Offline tests for judge logic

Usage:
  from skillopt_sleep.adapters.superpowers import SuperpowersEvaluator
  evaluator = SuperpowersEvaluator(skill="verification-before-completion")
  results = evaluator.evaluate(candidate_skill_path)

Refs microsoft#132

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add 2 more scenarios: partial-pass-honest, flaky-verify-rerun
- Add token_cap parameter to SuperpowersEvaluator
- Add total_tokens and total_latency_ms to EvalResults
- Estimate tokens from output length (~4 chars/token)

Now 5 scenarios testing verification-before-completion skill.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Copy candidate skill into temp superpowers copy, not original checkout
- Add assertion: resolved skill path must be under workspace
- Stamp each scenario result with pinned_sha, candidate_hash, scenario_seed
- Clone superpowers at pinned SHA per evaluation run
- Add --sha CLI flag

Addresses feedback from truongsontung on microsoft#132.
- Use is_relative_to() instead of string prefix for path check
- Raise ValueError instead of assert (survives -O)
- Use git init+fetch+checkout instead of clone-then-fetch (no wasted download)
- Add check=True to all git subprocess calls

@Yif-Yang Yif-Yang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for picking up #132 and for iterating on the overlay/provenance ideas. There are tests here: we ran the 14 offline tests and the full suite (274 passed / 6 skipped). The current tests validate the rule matcher and scenario metadata, but they do not execute or validate the Superpowers integration path yet.

A clarification from our side: --target-skill-path is a SkillOpt-Sleep CLI option, not a Claude Code CLI option. The issue discussion did not make that distinction clearly enough. In the current adapter, Claude exits because it does not recognize that flag, so the candidate is not evaluated. The candidate is also copied to skills/SKILL.md rather than skills/verification-before-completion/SKILL.md, and the pinned Superpowers checkout is cloned but never loaded through its normal bootstrap/plugin/harness integration.

Before this can demonstrate Superpowers support, could you please add:

  1. A real, supported Superpowers harness path using the pinned checkout and normal bootstrap/plugin integration, with only skills/verification-before-completion/SKILL.md overlaid in the temporary copy.
  2. Fail-closed handling for non-zero Claude/git exits, timeout, malformed output, and missing scores. Please avoid inheriting unrelated host credentials and avoid unconditional --dangerously-skip-permissions.
  3. Deterministic mocked integration tests that exercise the actual runner/overlay path, prove the candidate file is the one loaded, and prove the source checkout remains unchanged.
  4. One opt-in real Claude Code smoke comparison (not public CI): baseline versus candidate with identical model/settings/tasks, raw outputs, and evidence that normal Superpowers behavior was active. A result showing no improvement is completely acceptable; the important part is proving the integration is real and reproducible.
  5. Corrections to the synthetic scenarios: the math tests currently reference add without importing it, and the flaky helper sets TEST_RUN=1 before its first run, so those scenarios do not test the intended behaviors.
  6. Please remove the unrelated CONTRIBUTING.md policy change and the new 5,906-line uv.lock unless a dependency change actually requires it, and update the PR description to match the current five scenarios/token fields.

As written in #132, testing a standalone skill-like prompt is not equivalent to running Superpowers. Once the real smoke and integration tests pass, we will be very happy to re-review and merge this through your original PR so your contribution is fully acknowledged.

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.

2 participants