Skip to content

feat(skillopt-sleep): sync vendored engine to upstream v0.2.0#247

Merged
amondnet merged 4 commits into
mainfrom
amondnet/skillopt-update
Jul 5, 2026
Merged

feat(skillopt-sleep): sync vendored engine to upstream v0.2.0#247
amondnet merged 4 commits into
mainfrom
amondnet/skillopt-update

Conversation

@amondnet

@amondnet amondnet commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Syncs the vendored plugins/skillopt-sleep engine and Claude Code plugin assets with upstream microsoft/SkillOpt v0.2.0 (commit e4ea6a6):

  • New engine modules: dream, scheduler, harvest_codex, harvest_sources, tasks_file
  • New CLI actions: schedule / unschedule, plus a --preferences flag
  • Upstream renamed the slash command /sleep/skillopt-sleep (commands/sleep.mdcommands/skillopt-sleep.md)
  • sync-upstream.sh and README.md updated to match the renamed command and new modules

Related issue

N/A

Checklist

  • PR title follows Conventional Commits
  • Tests added or updated, and the suite passes (bun run test)
  • Lint/format pass (bun run lint)
  • Documentation updated (plugins/skillopt-sleep/README.md, skill doc)
  • No breaking change, or a BREAKING CHANGE: note is included
    (upstream command rename /sleep/skillopt-sleep is a user-facing rename; existing users of /sleep will need to use the new command name)

Note

bun.lock shows unrelated pre-existing drift (gatekeeper 1.4.0 → 1.6.0) in the working tree — intentionally left uncommitted as it is unrelated to this change.


Summary by cubic

Syncs the vendored skillopt_sleep engine and plugin assets to SkillOpt v0.2.0, adding scheduling, Codex transcript harvesting, and renaming the slash command to /skillopt-sleep. CI now excludes the vendored engine from Codacy and SonarCloud; docs remove the unimplemented --preferences flag.

  • New Features

    • New modules: dream, scheduler, harvest_codex, harvest_sources, tasks_file.
    • CLI: schedule / unschedule; flags --max-sessions, --max-tasks, --tasks-file, --target-skill-path, --backend, --source.
    • Transcript sources: harvest from Claude or Codex; auto source selection; filters engine headless replays.
    • Dream: multi-rollout + associative recall; concurrent rollouts; safer caching via sample_id.
    • Backends: claude, codex, copilot. Version 0.2.0.
    • Staging: secret redaction for all persisted diagnostics.
    • CI: exclude vendored engine from Codacy and SonarCloud analysis.
  • Migration

    • Slash command renamed /sleep/skillopt-sleep. Update any docs, aliases, and cron instructions.

Written for commit 6273f05. Summary will update on new commits.

Sync the vendored skillopt_sleep engine and Claude Code plugin assets
with microsoft/SkillOpt v0.2.0 (e4ea6a6):

- new engine modules: dream, scheduler, harvest_codex, harvest_sources,
  tasks_file; new schedule/unschedule CLI actions and --preferences flag
- upstream renamed the slash command /sleep -> /skillopt-sleep
  (commands/sleep.md -> commands/skillopt-sleep.md); sync-upstream.sh
  and README updated to match
@vercel

vercel Bot commented Jul 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
claude-code-plugins Ready Ready Preview, Comment Jul 4, 2026 2:52am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 4, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@amondnet, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 713752c8-87e4-44ed-bcce-f6dd0bbe647b

📥 Commits

Reviewing files that changed from the base of the PR and between d6603b6 and 6273f05.

📒 Files selected for processing (27)
  • .codacy.yml
  • .sonarcloud.properties
  • plugins/skillopt-sleep/.agents/skills/skillopt-sleep/SKILL.md
  • plugins/skillopt-sleep/README.md
  • plugins/skillopt-sleep/commands/skillopt-sleep.md
  • plugins/skillopt-sleep/scripts/install-cron.sh
  • plugins/skillopt-sleep/scripts/sync-upstream.sh
  • plugins/skillopt-sleep/skillopt_sleep/__init__.py
  • plugins/skillopt-sleep/skillopt_sleep/__main__.py
  • plugins/skillopt-sleep/skillopt_sleep/backend.py
  • plugins/skillopt-sleep/skillopt_sleep/config.py
  • plugins/skillopt-sleep/skillopt_sleep/consolidate.py
  • plugins/skillopt-sleep/skillopt_sleep/cycle.py
  • plugins/skillopt-sleep/skillopt_sleep/dream.py
  • plugins/skillopt-sleep/skillopt_sleep/experiments/run_experiment.py
  • plugins/skillopt-sleep/skillopt_sleep/harvest.py
  • plugins/skillopt-sleep/skillopt_sleep/harvest_codex.py
  • plugins/skillopt-sleep/skillopt_sleep/harvest_sources.py
  • plugins/skillopt-sleep/skillopt_sleep/memory.py
  • plugins/skillopt-sleep/skillopt_sleep/mine.py
  • plugins/skillopt-sleep/skillopt_sleep/replay.py
  • plugins/skillopt-sleep/skillopt_sleep/rollout.py
  • plugins/skillopt-sleep/skillopt_sleep/scheduler.py
  • plugins/skillopt-sleep/skillopt_sleep/staging.py
  • plugins/skillopt-sleep/skillopt_sleep/state.py
  • plugins/skillopt-sleep/skillopt_sleep/tasks_file.py
  • plugins/skillopt-sleep/skillopt_sleep/types.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch amondnet/skillopt-update

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown

🔍 Tessl Skill Review

plugins/skillopt-sleep/.agents/skills/skillopt-sleep/SKILL.md

score

Review Details

Review Details

Dimension Score Detail
conciseness ██░ 2/3 The opening paragraphs contain significant conceptual explanation ('deployment-time analogue of training', 'synthesizes three ideas') that Claude doesn't need. The CLI flags table and config keys are efficient, but the introductory framing and 'When to use this skill' section with trigger phrases add bulk without adding actionable value.
actionability ███ 3/3 Provides fully executable bash commands for every operation (run, dry-run, adopt, schedule, unschedule), a complete CLI flags table with defaults, config keys with descriptions, and concrete validation/demo commands. The guidance is copy-paste ready throughout.
workflow clarity ███ 3/3 The six-stage cycle is clearly sequenced with explicit validation (stage 4 gates on held-out slice, stage 5 stages without changing live files, stage 6 requires explicit adoption with backup). The hard rules section reinforces safety constraints and the feedback loop (gate blocks regressions) is explicit.
progressive disclosure ██░ 2/3 References to external docs exist (design spec, guide section) but are vaguely signaled ('See the SkillOpt-Sleep guide section'). No bundle files are provided to validate references. The config keys and CLI flags could potentially be split into a reference file, and the inline content is somewhat long for a SKILL.md overview.

Overall: This is a well-structured skill with strong actionability and workflow clarity — the six-stage cycle is clearly defined with explicit validation gates and safety constraints, and all CLI commands are executable. The main weaknesses are verbosity in the introductory sections (conceptual framing, trigger phrases) and somewhat weak progressive disclosure with vague external references and no bundle files to support them.

Suggestions:

  • Trim the introductory paragraphs: remove the 'synthesizes three ideas' section and the conceptual framing ('deployment-time analogue of training') — Claude doesn't need this context to execute the skill.
  • Move the CLI flags table and config keys into a separate REFERENCE.md and link to it, keeping SKILL.md as a concise overview with the most common commands.

To improve your score, point your agent at the Tessl optimization guide. Need help? Jump on our Discord.

Feedback

Report issues with this review at tesslio/skill-review, or send private feedback from your terminal with tessl feedback.

@codacy-production

codacy-production Bot commented Jul 4, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

본 풀 리퀘스트는 skillopt-sleep 플러그인에 새로운 백엔드(Copilot, Azure OpenAI, Azure Responses) 지원, 야간 크론 스케줄링 기능, "dream" 및 "associative recall"을 통한 야간 통합 메커니즘, 그리고 진단 로깅을 통한 관찰 가능성(Observability) 개선 등 다양한 기능 향상을 도입합니다. 코드 리뷰 결과, 멀티스레드 환경에서 self._tokensself._cache 업데이트 시 발생할 수 있는 동시성 레이스 컨디션 이슈와 scheduler.py 내 쉘 메타문자 이스케이프 누락으로 인한 커맨드 인젝션 취약점 등 고위험군 결함이 발견되었습니다. 또한, Azure API 호출 실패 시 에러 기록 누락, Codex 세션 파싱 중 예외 처리 미흡, 리스트 형태의 tasks 파일 사용 시 실행 차단 문제 등 시스템 안정성과 관찰 가능성을 높이기 위한 개선 사항들이 제안되었습니다.

Comment thread plugins/skillopt-sleep/skillopt_sleep/backend.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/backend.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/backend.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/backend.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/scheduler.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/backend.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/backend.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/harvest_codex.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/tasks_file.py
The skillopt_sleep package is vendored read-only from microsoft/SkillOpt;
static-analysis findings there must be fixed upstream, not patched locally.
Same rationale as the Codacy exclusion: the skillopt_sleep package is
vendored read-only from microsoft/SkillOpt; findings there are tracked
for upstream reporting (#248), not patched locally.

@cubic-dev-ai cubic-dev-ai Bot 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.

3 issues found and verified against the latest diff

Confidence score: 3/5

  • In plugins/skillopt-sleep/skillopt_sleep/harvest_codex.py, _strip_codex_meta can drop valid session content when prompts are wrapped in <environment_context>, which risks losing training/replay inputs silently if merged as-is — parse and retain text after the closing marker before merging.
  • In plugins/skillopt-sleep/skillopt_sleep/replay.py, replay_batch now does a direct int(...) on SKILLOPT_SLEEP_WORKERS, so a malformed env var can crash replay before any work starts — add the same fallback-to-1 parsing used by multi_rollout to keep batch runs resilient.
  • In plugins/skillopt-sleep/skillopt_sleep/replay.py, the sample_id fix appears incomplete for tool-required flows using attempt_with_tools, so cached rollouts may still collapse to a single response and reduce contrast/diversity — extend the cache-key/ID handling to the tool path and validate with a tool-task replay check.

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread plugins/skillopt-sleep/skillopt_sleep/harvest_codex.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/replay.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/replay.py
@greptile-apps

greptile-apps Bot commented Jul 4, 2026

Copy link
Copy Markdown

Greptile Summary

This PR syncs the vendored skillopt_sleep Python engine to upstream SkillOpt v0.2.0, adding five new modules (dream, scheduler, harvest_codex, harvest_sources, tasks_file) and renaming the user-facing slash command from /sleep to /skillopt-sleep. CI exclusions (Codacy + SonarCloud) are also added to prevent vendored code from appearing in static analysis results.

  • New capabilities: nightly scheduling via crontab (schedule/unschedule commands), Codex Desktop transcript harvesting (harvest_codex.py, harvest_sources.py), multi-rollout contrastive dream learning (dream.py), and a --tasks-file replay path for reviewed task payloads.
  • Breaking rename: /sleep/skillopt-sleep is user-facing; existing aliases and cron instructions must be updated (noted in checklist).
  • Backend additions: copilot backend and two Azure OpenAI backends (azure, azure-responses) are introduced alongside improved retry/error-surface logic for the existing claude and codex backends.

Confidence Score: 4/5

Safe to merge for users who have read the command rename notice; the core consolidation and staging logic is correct, but the generated report footer and the Codex harvest path still carry known defects from prior review rounds.

The new dream, scheduler, staging redaction, and consolidate observability code is well-written and isolated. Two defects from earlier rounds remain open — the stale /sleep adopt string in every generated report.md footer, and the missing _is_headless_replay guard in harvest_codex.py — that will produce misleading user output and silent training-data pollution respectively until addressed. The new issues found in this round (no cron bounds validation, missing error surfacing in CopilotCliBackend) are non-blocking but reduce operational reliability.

cycle.py (stale command reference in generated reports), harvest_codex.py (missing headless-replay filter), scheduler.py (no hour/minute bounds check), backend.py (CopilotCliBackend silent auth errors).

Important Files Changed

Filename Overview
plugins/skillopt-sleep/skillopt_sleep/scheduler.py New file — implements crontab-based nightly scheduling. _runner_cmd and _split_managed logic is solid; idempotent block management is well-designed. Missing: no validation of hour/minute bounds before writing the cron expression, so out-of-range values produce a silently-broken schedule.
plugins/skillopt-sleep/skillopt_sleep/backend.py Large additions: CopilotCliBackend, AzureOpenAIBackend, AzureResponsesBackend, and substantial improvements to CodexCliBackend (retry loop, auth-marker detection). Claude and Codex backends gain proper error surfacing via last_call_error. CopilotCliBackend is missing equivalent error detection, leaving Copilot auth failures silent in diagnostics.
plugins/skillopt-sleep/skillopt_sleep/harvest_codex.py New file — Codex Desktop session harvesting. _sanitize_text, _strip_codex_meta, and _is_meta_prompt filtering are careful. harvest_codex() is missing the _is_headless_replay() guard that harvest.py applies (issue #62), so engine-generated single-turn sessions can leak into the training pool when --source codex or --source auto is used.
plugins/skillopt-sleep/skillopt_sleep/dream.py New file — dream augmentation and associative recall. recall_similar uses Jaccard similarity for lexical matching; dream_augment creates labelled synthetic variants. Both mechanisms are opt-in (default off) and only enlarge the train split. Clean, stdlib-only implementation.
plugins/skillopt-sleep/skillopt_sleep/harvest_sources.py New file — clean source-selection router. auto mode correctly falls back from Codex to Claude when no Codex sessions are found; limit is respected per source.
plugins/skillopt-sleep/skillopt_sleep/cycle.py Significant refactor: switched from harvest+consolidate to harvest_for_config+dream_consolidate, added _progress logging, task archiving, and diagnostics.json output. Stale /sleep adopt reference at line 87 in the generated report.md footer was flagged in a prior review round and remains unaddressed.
plugins/skillopt-sleep/skillopt_sleep/main.py Major CLI expansion: new flags (--source, --max-sessions, --max-tasks, --tasks-file, --progress, --target-skill-path), new subcommands (schedule, unschedule), and copilot backend choice. Double load_tasks_file call and missing --preferences flag were flagged in prior rounds; --hour/--minute bounds go unvalidated before being written to crontab.
plugins/skillopt-sleep/skillopt_sleep/consolidate.py Adds holdout_detail, reflect_raw, and call_error fields for diagnostics observability; skips val scoring when gate_off to avoid wasted cost. _holdout_detail correctly surfaces per-task evidence. Parallel multi-rollout via ThreadPoolExecutor is properly bounded.
plugins/skillopt-sleep/skillopt_sleep/staging.py Adds redact_secrets() with a comprehensive set of secret patterns and recursive dict/list handling. Patterns are specific enough to avoid false positives on normal diagnostic prose. JWT and private-key patterns use appropriate anchors.
plugins/skillopt-sleep/skillopt_sleep/replay.py Adds sample_id to replay_one to prevent attempt-cache collapse on dream multi-rollouts. New parallel replay_batch using ThreadPoolExecutor is sound; dict-key iteration order for futures is deterministic in Python 3.7+.
plugins/skillopt-sleep/commands/skillopt-sleep.md Command file renamed from sleep.md to skillopt-sleep.md; updated command references and added schedule/unschedule to the action table. Previously flagged --preferences flag in the example invocation still appears documented but unimplemented in _add_common().

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant User
    participant CLI as __main__.py
    participant HS as harvest_sources.py
    participant HC as harvest_codex.py
    participant H as harvest.py
    participant Cycle as cycle.py
    participant Dream as dream.py
    participant Consolidate as consolidate.py
    participant Staging as staging.py

    User->>CLI: "skillopt_sleep run [--source claude|codex|auto]"
    CLI->>Cycle: "run_sleep_cycle(cfg, seed_tasks=None)"

    alt seed_tasks provided via --tasks-file
        Cycle-->>Cycle: use seed_tasks directly
    else normal harvest
        Cycle->>HS: harvest_for_config(cfg, since_iso, limit)
        alt "source == codex"
            HS->>HC: harvest_codex(archived_sessions_dir)
        else "source == auto"
            HS->>HC: harvest_codex(archived_sessions_dir)
            alt codex_digests empty
                HS->>H: harvest(transcripts_dir)
            end
        else "source == claude (default)"
            HS->>H: harvest(transcripts_dir)
        end
        HS-->>Cycle: List[SessionDigest]
        Cycle->>Cycle: mine(digests)
    end

    Cycle->>Dream: dream_consolidate(backend, tasks, skill, memory)
    Note over Dream: recall similar past tasks (recall_k>0), dream augment variants (dream_factor>0)
    Dream->>Consolidate: consolidate(backend, enlarged_tasks)
    Consolidate-->>Dream: ConsolidationResult
    Dream-->>Cycle: ConsolidationResult

    Cycle->>Staging: write_staging(report, diagnostics)
    Staging-->>User: staging_dir + diagnostics.json
    opt auto_adopt or user runs /skillopt-sleep adopt
        User->>CLI: skillopt_sleep adopt
        CLI->>Staging: adopt_staging(cfg)
        Staging-->>User: live CLAUDE.md / SKILL.md updated
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant User
    participant CLI as __main__.py
    participant HS as harvest_sources.py
    participant HC as harvest_codex.py
    participant H as harvest.py
    participant Cycle as cycle.py
    participant Dream as dream.py
    participant Consolidate as consolidate.py
    participant Staging as staging.py

    User->>CLI: "skillopt_sleep run [--source claude|codex|auto]"
    CLI->>Cycle: "run_sleep_cycle(cfg, seed_tasks=None)"

    alt seed_tasks provided via --tasks-file
        Cycle-->>Cycle: use seed_tasks directly
    else normal harvest
        Cycle->>HS: harvest_for_config(cfg, since_iso, limit)
        alt "source == codex"
            HS->>HC: harvest_codex(archived_sessions_dir)
        else "source == auto"
            HS->>HC: harvest_codex(archived_sessions_dir)
            alt codex_digests empty
                HS->>H: harvest(transcripts_dir)
            end
        else "source == claude (default)"
            HS->>H: harvest(transcripts_dir)
        end
        HS-->>Cycle: List[SessionDigest]
        Cycle->>Cycle: mine(digests)
    end

    Cycle->>Dream: dream_consolidate(backend, tasks, skill, memory)
    Note over Dream: recall similar past tasks (recall_k>0), dream augment variants (dream_factor>0)
    Dream->>Consolidate: consolidate(backend, enlarged_tasks)
    Consolidate-->>Dream: ConsolidationResult
    Dream-->>Cycle: ConsolidationResult

    Cycle->>Staging: write_staging(report, diagnostics)
    Staging-->>User: staging_dir + diagnostics.json
    opt auto_adopt or user runs /skillopt-sleep adopt
        User->>CLI: skillopt_sleep adopt
        CLI->>Staging: adopt_staging(cfg)
        Staging-->>User: live CLAUDE.md / SKILL.md updated
    end
Loading

Reviews (2): Last reviewed commit: "docs(skillopt-sleep): remove unimplement..." | Re-trigger Greptile

Comment thread plugins/skillopt-sleep/commands/skillopt-sleep.md Outdated
Comment thread plugins/skillopt-sleep/skillopt_sleep/harvest_codex.py
Comment thread plugins/skillopt-sleep/skillopt_sleep/__main__.py
The engine's production CLI path has no --preferences argument and the
config-file 'preferences' key is never forwarded to the backend (only the
experiments harness wires it via build_backend). Documenting it caused an
argparse error for users. Tracked upstream in #248.
@sonarqubecloud

sonarqubecloud Bot commented Jul 4, 2026

Copy link
Copy Markdown

@amondnet amondnet merged commit 54cf109 into main Jul 5, 2026
15 checks passed
@amondnet amondnet deleted the amondnet/skillopt-update branch July 5, 2026 05:55
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.

1 participant