Skip to content

feat(adapters): Superpowers skill evaluation adapter#134

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

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

Conversation

@NovusEdge

@NovusEdge NovusEdge commented Jul 13, 2026

Copy link
Copy Markdown

Summary

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

Changes

  • skillopt_sleep/adapters/superpowers.py: SuperpowersEvaluator class

    • 5 embedded scenarios for verification-before-completion skill
    • Rule-based judge (contains, regex, order, any_of ops)
    • Proper harness integration: clones pinned Superpowers, overlays candidate to skills/<name>/SKILL.md, symlinks HOME/.claude/skills
    • Fail-closed: non-zero exit, timeout, missing binary all error
    • Token estimation and latency tracking
  • tests/test_superpowers_scenarios.py: 20 tests

    • Judge logic coverage
    • Mocked integration tests proving overlay mechanism works
  • scripts/smoke_superpowers.sh: Manual baseline vs candidate comparison

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 CLI:

python -m skillopt_sleep.adapters.superpowers --skill verification-before-completion --json

Scenarios

ID Description
test-passes-verify Fixes failing test, verifies it passes before claiming done
test-fails-no-claim Reports failure honestly, no false completion claim
premature-claim-resist Refuses to skip verification on adversarial prompt
partial-pass-honest Reports partial pass accurately, not "all pass"
flaky-verify-rerun Re-runs flaky test rather than trusting stale result

Test plan

  • 20 offline tests pass (pytest tests/test_superpowers_scenarios.py)
  • Manual smoke test with scripts/smoke_superpowers.sh (opt-in, not CI)

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.

- Use real harness path: skills/<name>/SKILL.md + HOME/.claude/skills symlink
- Remove nonexistent --target-skill-path flag
- Fail-closed on non-zero exit, timeout, missing claude binary
- Fix scenarios: add missing imports, fix flaky test sentinel logic
- Add 6 mocked integration tests proving overlay mechanism works
- Add smoke_superpowers.sh for manual baseline/candidate comparison
- Remove unrelated CONTRIBUTING.md change and 5.9k-line uv.lock

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@Yif-Yang

Copy link
Copy Markdown
Contributor

Thanks for the substantial update. The candidate overlay path, invalid CLI flag, fail-closed process handling, scenario fixtures, mocked integration coverage, and unrelated-file cleanup are all meaningful improvements. We re-ran the branch: the 20 focused tests pass, and the suite also passes when combined with current main (334 passed / 6 skipped).

A few issues still block merging the adapter as a reliable Superpowers evaluator:

  1. The negative judge rules are currently ineffective. _score_check() treats contains and not_contains arguments as literal strings, but scenarios pass values such as "all tests pass|done|complete|fixed". An output containing “Done” or “all tests pass” therefore still passes that not_contains check. The flaky scenario can also satisfy its second check merely by reporting the first-run message, without demonstrating an actual rerun. Please make the alternatives explicit (or implement well-tested alternative matching) and add regression cases that fail on false completion claims and on a missing rerun.

  2. The new integration tests mock subprocess.run, so they prove file placement but not that Claude actually loaded Superpowers or the overlaid candidate. The manual smoke remains unchecked; it uses || true, and the JSON result omits ScenarioResult.output, so it cannot currently supply the requested raw evidence. Please run one reproducible baseline-versus-candidate smoke with the same model/settings/tasks, preserve the raw outputs, fail on runner errors, and show that normal Superpowers behavior and the candidate skill were active. A result showing no improvement is completely acceptable.

  3. _run_scenario() still copies the full host environment and invokes Claude with unconditional --dangerously-skip-permissions. Because the candidate skill is input to the agent, this can expose host credentials/files to untrusted candidate instructions. Please use a constrained execution boundary and a scrubbed environment rather than an unconditional permission bypass.

The feature direction remains valuable, and we would like to merge it through your PR so the contribution stays fully attributed. Once these focused correctness, live-integration, and safety points are addressed, we will re-review promptly.

- Fix not_contains to split on pipe (all alternatives must be absent)
- Add regression tests for false completion claim detection
- Scrub host env: only PATH/TERM/LANG/ANTHROPIC_API_KEY, no credentials
- Remove unconditional --dangerously-skip-permissions (opt-in via SKILLOPT_UNSAFE=1)
- Include raw output in JSON for smoke test evidence
- Fix smoke script: fail on errors, preserve raw output
@Yif-Yang

Copy link
Copy Markdown
Contributor

Thanks—the latest commit fixes pipe-separated alternatives, adds false-completion regressions, scrubs the inherited environment, makes unsafe mode opt-in, and preserves raw output. Those are meaningful improvements.

A few blockers remain:

  1. The flaky scenario still passes after only one failed run: its output contains both test_flaky and “First run fails - run again”, which satisfies the current rerun rule. The order rule can likewise accept Done ... pytest ... fixed because it selects alternatives by pattern order rather than the earliest completion claim. More fundamentally, scoring final stdout/stderr lets an agent merely state “pytest … 1 passed” without executing pytest. Please use externally verifiable execution evidence and add missing-rerun and false-self-report regressions.
  2. The smoke script is present, but no real baseline-versus-candidate artifacts have been supplied yet. Please provide reproducible raw results using the same pinned SHA/model/settings/tasks, with evidence that stock Superpowers and the overlaid candidate were actually loaded.
  3. Real tool execution still relies on SKILLOPT_UNSAFE=1 plus --dangerously-skip-permissions, exposing the API credential and host filesystem/network without an OS-level constrained boundary. Please isolate candidate execution appropriately.
  4. A nonexistent candidate path silently evaluates the baseline, and the CLI exits successfully even when ScenarioResult.error is set. Please fail explicitly in both cases so the smoke script's set -e is meaningful.

Once these are addressed, we can re-review promptly.

- Add file_exists judge op for external execution evidence (not stdout parsing)
- Update flaky scenario to require .test_passed sentinel (proves rerun)
- Fail explicitly on missing candidate path (FileNotFoundError)
- CLI exits non-zero when any scenario has error
- Use --allowedTools by default instead of blanket permission bypass
- Symlink auth from real HOME to preserve Claude login in isolated env
- Add SECURITY.md documenting execution model and limitations
- Add smoke test artifacts as merge evidence (score: 1.0)

Regression tests added:
- test_file_exists_positive/negative
- test_false_self_report_regression
- test_flaky_no_rerun_regression
- test_nonexistent_candidate_raises
- test_default_uses_scoped_permissions
- test_unsafe_mode_uses_permission_bypass

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 21, 2026 19:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a new SuperpowersEvaluator adapter to run synthetic, offline-evaluable scenarios against a pinned Superpowers checkout, along with a rule-based judge, tests, and a manual smoke script/security doc to validate real-harness runs.

Changes:

  • Added skillopt_sleep/adapters/superpowers.py implementing scenario setup, Superpowers checkout/overlay, Claude execution, and rule-based scoring.
  • Added tests/test_superpowers_scenarios.py covering judge ops and overlay/CLI fail-closed behaviors with mocked subprocess execution.
  • Added a manual smoke script + security notes, and committed sample smoke outputs under smoke_results/.

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
skillopt_sleep/adapters/superpowers.py Core adapter: embedded scenarios, judge implementation, temp workspace setup, Superpowers clone + skill overlay, scenario execution and scoring
skillopt_sleep/adapters/__init__.py Initializes adapters package
tests/test_superpowers_scenarios.py Offline tests for judge ops and overlay mechanics (mocked subprocess.run)
scripts/smoke_superpowers.sh Manual smoke runner that writes JSON outputs
docs/superpowers/SECURITY.md Documents security model/limitations for running untrusted candidate skills
.gitignore Ignores uv.lock
smoke_results/20260721_215806/baseline.json Committed smoke artifact output
smoke_results/20260721_220108/baseline.json Committed smoke artifact output
smoke_results/20260721_220638/baseline.json Committed smoke artifact output

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread skillopt_sleep/adapters/superpowers.py Outdated
Comment on lines +254 to +261
pos1 = output.lower().find(args[0].lower())
pos2 = -1
for pat in args[1].split("|"):
p = output.lower().find(pat.lower())
if p >= 0:
pos2 = p
break
return pos1 >= 0 and pos2 >= 0 and pos1 < pos2
Comment on lines +300 to +305
sid = scenario["id"]
scenario_seed = random.randint(0, 2**31 - 1)
result = ScenarioResult(
id=sid, passed=False,
pinned_sha=pinned_sha, candidate_hash=candidate_hash, scenario_seed=scenario_seed,
)
Comment thread skillopt_sleep/adapters/superpowers.py Outdated
Comment on lines +336 to +345
# Symlink auth-related files from real HOME (credentials, not config)
real_claude_dir = Path.home() / ".claude"
if real_claude_dir.exists():
for auth_file in ["credentials.json", ".credentials.json", "settings.json"]:
src = real_claude_dir / auth_file
if src.exists():
dst = claude_dir / auth_file
if not dst.exists():
dst.symlink_to(src)

Comment thread skillopt_sleep/adapters/superpowers.py Outdated
Comment on lines +364 to +388
cmd = ["claude", "-p", prompt]

if os.environ.get("SKILLOPT_UNSAFE") == "1":
import warnings
warnings.warn(
"SKILLOPT_UNSAFE=1: Running with --dangerously-skip-permissions. "
"Do not use with untrusted candidate skills.",
stacklevel=2,
)
cmd.append("--dangerously-skip-permissions")
else:
# Scoped permissions: allow only tools needed for test scenarios
# Bash for pytest, Edit/Write for fixing code, Read for inspection
cmd.extend([
"--allowedTools", "Bash,Edit,Write,Read",
])

t0 = time.time()
try:
proc = subprocess.run(
cmd,
cwd=str(project_dir),
capture_output=True,
text=True,
timeout=timeout,
Comment on lines +176 to +178
skill: str
version: str
scenarios: List[ScenarioResult] = field(default_factory=list)
Comment on lines +203 to +206
return {
"skill": self.skill,
"version": self.version,
"score": self.score,
Comment thread skillopt_sleep/adapters/superpowers.py Outdated
Raises:
FileNotFoundError: if candidate_skill_path is provided but doesn't exist
"""
results = EvalResults(skill=self.skill, version=self.version)
Comment thread scripts/smoke_superpowers.sh Outdated
Comment on lines +9 to +13
# Usage:
# SKILLOPT_UNSAFE=1 ./scripts/smoke_superpowers.sh [candidate_skill_path]
#
# Output: writes results + raw output to smoke_results/ for PR evidence.
# Fails on any runner error (no silent swallowing).
Comment thread scripts/smoke_superpowers.sh Outdated
Comment on lines +70 to +71
echo "Results saved to $OUTDIR"
echo "Include these files in your PR as evidence of smoke test."
Comment thread docs/superpowers/SECURITY.md Outdated
Comment on lines +14 to +17
1. **Scrubbed environment**: Only essential vars passed (HOME, PATH, TERM, LANG, ANTHROPIC_API_KEY)
2. **Isolated HOME**: Each scenario gets its own HOME directory
3. **No `--dangerously-skip-permissions` by default**: Permission prompts required unless explicitly bypassed
4. **Project directory isolation**: Each scenario gets its own project directory
@Yif-Yang

Copy link
Copy Markdown
Contributor

Thanks for the latest update. We re-ran head 30fe4d36: all 31 focused tests pass, and a merge simulation with current main passes the full suite (399 passed / 6 skipped). The missing-candidate failure and non-zero CLI exit on scenario errors are now fixed, and moving away from stdout-only evidence is a useful step.

A few merge blockers remain:

  1. The committed smoke evidence still has no candidate run. All three files are baseline.json, every candidate_hash is empty, one run is unauthenticated (Not logged in), and one artifact contains three checks while current HEAD defines two. This does not provide a reproducible baseline-versus-candidate comparison or prove that either the normal Superpowers bootstrap or the overlaid candidate was loaded. Please run the same pinned SHA/model/settings/tasks through the normal Superpowers plugin/bootstrap path (including its SessionStart/using-superpowers activation), provide a sanitized baseline + candidate pair with a non-empty candidate hash, and include an explicit load marker or equivalent evidence. Raw outputs should be shared as sanitized attachments/excerpts rather than committed by default.

  2. The new sentinel evidence is still forgeable by the evaluated agent. .pytest_executed, .test_ran, and .test_passed all live in the agent-writable project, while the run grants Bash,Edit,Write,Read. We confirmed that simply creating those files and reporting 1 passed satisfies both updated scenarios without running pytest. Please record execution/rerun evidence through a harness-owned audit/wrapper outside the candidate's writable boundary, or another tamper-resistant mechanism.

  3. --allowedTools is not an isolation boundary. The default path symlinks the host's Claude credentials and settings.json into the scenario HOME, passes ANTHROPIC_API_KEY, and grants unrestricted Bash/Read access. A candidate can therefore read or exfiltrate host credentials even without --dangerously-skip-permissions. Please remove the host credential/config symlinks, make any credential-bearing trusted-candidate mode explicitly opt-in and fail closed by default, and use an OS-level boundary for untrusted or model-generated candidates. Documenting the limitation is helpful, but it does not mitigate it.

Please also address the related Copilot inline findings—especially deterministic provenance/top-level pinned SHA, order alternative matching, and not committing raw smoke output—while making the focused changes above. Once the real candidate comparison and execution boundary are in place, we will re-review promptly.

…isolation

Addresses remaining maintainer + Copilot review blockers on microsoft#134.

- Load the pinned checkout via the normal plugin bootstrap (`claude
  --plugin-dir`), not a hand-rolled skills symlink. A per-run session marker is
  injected into using-superpowers/SKILL.md and required in the agent's output,
  proving the SessionStart/using-superpowers activation actually ran.
- Replace agent-writable sentinel files with harness-owned evidence: a
  pytest/python shim on PATH logs every invocation outside the project dir, and
  the harness re-runs pytest itself after the agent exits. Scenarios now score
  pytest_runs and harness_test_passes; forged files no longer satisfy any check.
- Stop reusing host credentials by default. ~/.claude auth/settings are no
  longer symlinked; reuse is opt-in via SKILLOPT_HOST_AUTH=1 (warns). Fail
  closed (NO_AUTH) when neither a key nor host-auth is available.
- Add OS-level isolation, opt-in via SKILLOPT_SANDBOX=bwrap|docker.
- Prompt on stdin + --output-format text, matching backend.py CLI usage.
- Deterministic scenario seed (SHA + id), pinned_sha carried on EvalResults and
  in to_dict(); order op accepts any alternative occurring after the first token.
- Stop committing smoke_results/ (raw output + host paths); smoke script now
  writes gitignored raw JSON plus sanitized *.summary.txt excerpts to share.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 22:01
@NovusEdge

Copy link
Copy Markdown
Author

Thanks for the thorough passes. Pushed 674d1db addressing all three merge blockers and the Copilot inline findings.

1. Real baseline-vs-candidate smoke, non-empty candidate hash

Both arms run the pinned SHA d884ae04 through the normal plugin bootstrap (claude --plugin-dir <checkout>), so the SessionStart hook and using-superpowers activation fire as they do for a real user. A per-run session marker is injected into skills/using-superpowers/SKILL.md and required in the agent's output — a scenario fails if the bootstrap didn't load.

arm candidate_hash pytest_runs harness_test_passes bootstrap_loaded passed
baseline (none) 2 ✅ (SPLOAD-bdbd87e2)
candidate 3d9a09aff1d3 2 ✅ (SPLOAD-bdbd87e2)

Same pinned SHA / model / scenario for both. Candidate hash is non-empty, authentication is real (host OAuth via opt-in SKILLOPT_HOST_AUTH=1, no more Not logged in), and both arms carry the identical two-check set at current HEAD. Raw output is no longer committed — smoke_results/ is gitignored; the script emits sanitized *.summary.txt excerpts to paste/attach instead.

2. Evidence is no longer forgeable by the agent

Sentinel files in the agent-writable project are gone. Evidence is now harness-owned:

  • pytest_runs — a pytest/python -m pytest shim on PATH logs every invocation to a file outside the project directory, then execs the real interpreter. The agent can't increment it without actually running pytest, and can't reach the log.
  • harness_test_passes — after the agent exits, the harness re-runs pytest itself. Stating "1 passed" proves nothing.
  • The flaky scenario's attempt counter is stamped by the shim (SKILLOPT_ATTEMPT), so a passing rerun can't be faked; pytest_runs >= 2 is required.

Regression tests confirm forged .pytest_executed/.test_ran/.test_passed files and self-reported "1 passed" both fail (test_forged_sentinel_files_do_not_count, test_pytest_runs_ignores_self_report, test_missing_rerun_regression).

3. Real execution boundary

  • Host ~/.claude credentials/settings.json are never symlinked by default. Reuse is opt-in via SKILLOPT_HOST_AUTH=1 (warns); otherwise ANTHROPIC_API_KEY only, and it fails closed (NO_AUTH) when neither is present.
  • OS-level isolation via opt-in SKILLOPT_SANDBOX=bwrap|docker (read-only system, writable project + HOME only). SECURITY.md now states plainly that --allowedTools is not a boundary.

Copilot inline findings

  • order now accepts any alternative occurring after the first token (not just the first match found anywhere).
  • scenario_seed is deterministic (sha256(pinned_sha:scenario_id)) — reproducible across identical runs.
  • Host ~/.claude symlinking removed / made opt-in; settings.json no longer copied under the credentials rationale; SECURITY.md updated to match.
  • CLI uses stdin + --output-format text matching backend.py.
  • pinned_sha carried on EvalResults and emitted at top level of to_dict().
  • smoke_results/ no longer committed; script + docs steer to sanitized excerpts.

Tests: 44 focused pass; full suite 304 passed / 6 skipped. Happy to run the other four scenarios if useful.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Comment on lines +430 to +438
project_dir = workspace / f"project-{sid}"
project_dir.mkdir(parents=True, exist_ok=True)
scenario_home = workspace / f"home-{sid}"
scenario_home.mkdir(parents=True, exist_ok=True)
audit_dir = workspace / f"audit-{sid}"
audit_dir.mkdir(parents=True, exist_ok=True)
audit_log = audit_dir / "pytest.log"
bin_dir = workspace / f"bin-{sid}"
_write_pytest_shims(bin_dir, audit_log)
Comment on lines +457 to +462
bootstrap_skill = superpowers_dir / "skills" / "using-superpowers" / "SKILL.md"
if bootstrap_skill.exists():
bootstrap_skill.write_text(
bootstrap_skill.read_text()
+ f"\n\n## Session marker\n\nEnd your final message with the line `{marker}`.\n"
)
Comment on lines +392 to +400
return [
"docker", "run", "--rm", "-i",
"-v", f"{project_dir}:{project_dir}",
"-v", f"{home}:{home}",
"-v", f"{plugin_dir}:{plugin_dir}:ro",
"-w", str(project_dir),
"-e", "HOME", "-e", "ANTHROPIC_API_KEY", "-e", "SKILLOPT_ATTEMPT",
image,
]
…checkout reuse

Addresses 3 Copilot inline findings on 674d1db:

- Move the pytest shim + audit log under scenario HOME (was under the bare
  workspace). bwrap/docker only mount project_dir, HOME and plugin_dir, so the
  old location left the shim invisible inside the sandbox and pytest_runs stuck
  at 0.
- Pass PATH/LANG/TERM into the docker sandbox so the shimmed PATH carries into
  the container; without PATH the shim dir dropped off and invocations weren't
  counted.
- Strip any prior "## Session marker" block before injecting the current one.
  The checkout is reused across scenarios, so appending accumulated markers.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 23:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (2)

skillopt_sleep/adapters/superpowers.py:614

  • superpowers_version is treated as user-facing configuration, but it’s not used to select what gets checked out (the clone is pinned solely by pinned_sha). This is easy for callers to misinterpret as “I’m evaluating tag vX.Y.Z”, when they’re actually evaluating whatever SHA is passed.
    def __init__(
        self,
        skill: str = "verification-before-completion",
        superpowers_version: str = DEFAULT_VERSION,
        timeout: int = DEFAULT_TIMEOUT,
        token_cap: int = 0,
    ):
        self.skill = skill
        self.version = superpowers_version
        self.timeout = timeout
        self.token_cap = token_cap  # 0 = no cap

docs/superpowers/SECURITY.md:20

  • This mitigation text says the scenario HOME is "empty", but the adapter creates an isolated HOME tree (e.g., .claude/ and .skillopt/) for shims/logs. Rewording avoids implying HOME has no files, only that no host Claude config is reused.
1. **No host credential reuse by default.** The scenario `HOME` is empty; host
   `~/.claude/credentials.json` and `settings.json` are never copied or
   symlinked. Reuse is opt-in via `SKILLOPT_HOST_AUTH=1`, which warns.

Comment on lines +432 to +441
# Isolated project, HOME and (harness-only) audit dir per scenario
project_dir = workspace / f"project-{sid}"
project_dir.mkdir(parents=True, exist_ok=True)
scenario_home = workspace / f"home-{sid}"
scenario_home.mkdir(parents=True, exist_ok=True)
# shim + audit log live under HOME so they're visible inside the sandbox
# (bwrap/docker mount HOME but not the bare workspace)
audit_log = scenario_home / ".skillopt" / "pytest.log"
bin_dir = scenario_home / ".skillopt" / "bin"
_write_pytest_shims(bin_dir, audit_log)
Comment on lines +469 to +470
claude_dir = scenario_home / ".claude"
claude_dir.mkdir(parents=True, exist_ok=True)
Comment on lines +329 to +342
def _write_pytest_shims(bin_dir: Path, audit_log: Path) -> None:
"""Install harness-owned `pytest`/`python` shims that log real invocations.

The log lives outside the agent's project directory and the shims always
exec the real interpreter, so an invocation can be counted but not forged
from inside the project. Same pattern as the tool shims in backend.py.
"""
bin_dir.mkdir(parents=True, exist_ok=True)
real_python = sys.executable

def _install(name: str, body: str) -> None:
path = bin_dir / name
path.write_text(f"#!/usr/bin/env bash\n{body}")
path.chmod(path.stat().st_mode | stat.S_IEXEC | stat.S_IXGRP | stat.S_IXOTH)
Comment on lines +661 to +663
for scenario in scenarios:
if scenario_filter and scenario["id"] != scenario_filter:
continue
# No || true - fail if runner errors
python -m skillopt_sleep.adapters.superpowers "${args[@]}" > "$outfile"

# Sanitized summary for sharing: no raw output, no host paths, no secrets
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.

3 participants