self-evolve-framework 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (171) hide show
  1. package/package.json +1 -1
  2. package/template/rules/ponytail.mdc +98 -23
  3. package/template/skills/skillopt-sleep/SKILL.md +42 -0
  4. package/template/skills/skillopt-sleep/configs/_base_/default.yaml +103 -0
  5. package/template/skills/skillopt-sleep/configs/alfworld/default.yaml +29 -0
  6. package/template/skills/skillopt-sleep/configs/docvqa/default.yaml +28 -0
  7. package/template/skills/skillopt-sleep/configs/features/soft_gate.yaml +47 -0
  8. package/template/skills/skillopt-sleep/configs/livemathematicianbench/default.yaml +22 -0
  9. package/template/skills/skillopt-sleep/configs/officeqa/default.yaml +34 -0
  10. package/template/skills/skillopt-sleep/configs/searchqa/default.yaml +32 -0
  11. package/template/skills/skillopt-sleep/configs/spreadsheetbench/default.yaml +34 -0
  12. package/template/skills/skillopt-sleep/scripts/framework/skillopt/__init__.py +28 -0
  13. package/template/skills/skillopt-sleep/scripts/framework/skillopt/config.py +282 -0
  14. package/template/skills/skillopt-sleep/scripts/framework/skillopt/datasets/__init__.py +7 -0
  15. package/template/skills/skillopt-sleep/scripts/framework/skillopt/datasets/base.py +512 -0
  16. package/template/skills/skillopt-sleep/scripts/framework/skillopt/engine/__init__.py +9 -0
  17. package/template/skills/skillopt-sleep/scripts/framework/skillopt/engine/trainer.py +2379 -0
  18. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/__init__.py +1 -0
  19. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/README.md +43 -0
  20. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/config_template.yaml +55 -0
  21. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/env_template.py +151 -0
  22. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/_template/loader_template.py +87 -0
  23. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/__init__.py +5 -0
  24. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/adapter.py +428 -0
  25. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/dataloader.py +123 -0
  26. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/analyst_error.md +55 -0
  27. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/analyst_success.md +33 -0
  28. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_no_history.md +8 -0
  29. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_with_history.md +9 -0
  30. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/prompts/rollout_with_memory.md +16 -0
  31. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/reflect.py +4 -0
  32. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/rollout.py +366 -0
  33. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/skills/initial.md +45 -0
  34. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/__init__.py +9 -0
  35. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_envs.py +221 -0
  36. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_projection.py +60 -0
  37. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/alfworld_prompts.py +8 -0
  38. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/config_tw.yaml +145 -0
  39. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/env_base.py +84 -0
  40. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/env_manager.py +139 -0
  41. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/alfworld/vendor/memory.py +87 -0
  42. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/base.py +329 -0
  43. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/__init__.py +1 -0
  44. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/adapter.py +90 -0
  45. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/dataloader.py +61 -0
  46. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/evaluator.py +113 -0
  47. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/analyst_error.md +35 -0
  48. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/analyst_success.md +24 -0
  49. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/prompts/rollout_system.md +12 -0
  50. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/rollout.py +391 -0
  51. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/docvqa/skills/initial.md +11 -0
  52. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/__init__.py +1 -0
  53. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/adapter.py +129 -0
  54. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/dataloader.py +308 -0
  55. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/evaluator.py +62 -0
  56. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/analyst_error.md +37 -0
  57. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/analyst_success.md +25 -0
  58. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/prompts/rollout_system.md +12 -0
  59. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/reflect.py +4 -0
  60. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/rollout.py +434 -0
  61. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/livemathematicianbench/skills/initial.md +16 -0
  62. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/__init__.py +1 -0
  63. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/adapter.py +112 -0
  64. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/dataloader.py +71 -0
  65. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/evaluator.py +46 -0
  66. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/analyst_error.md +37 -0
  67. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/analyst_success.md +25 -0
  68. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/prompts/rollout_system.md +15 -0
  69. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/rollout.py +799 -0
  70. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/skills/initial.md +15 -0
  71. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/officeqa/tool_runtime.py +552 -0
  72. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/__init__.py +1 -0
  73. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/adapter.py +96 -0
  74. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/dataloader.py +42 -0
  75. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/evaluator.py +100 -0
  76. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/analyst_error.md +46 -0
  77. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/analyst_success.md +32 -0
  78. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/prompts/rollout_system.md +13 -0
  79. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/reflect.py +4 -0
  80. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/rollout.py +494 -0
  81. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/searchqa/skills/initial.md +3 -0
  82. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/__init__.py +5 -0
  83. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/adapter.py +159 -0
  84. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/codegen_agent.py +731 -0
  85. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/dataloader.py +37 -0
  86. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/evaluator.py +158 -0
  87. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/executor.py +67 -0
  88. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/analyst_error.md +46 -0
  89. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/analyst_success.md +32 -0
  90. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/codegen_system.md +1 -0
  91. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/critical_rules.md +9 -0
  92. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/prompts/react_system.md +21 -0
  93. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/react_agent.py +395 -0
  94. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/reflect.py +4 -0
  95. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/rollout.py +979 -0
  96. package/template/skills/skillopt-sleep/scripts/framework/skillopt/envs/spreadsheetbench/skills/initial.md +56 -0
  97. package/template/skills/skillopt-sleep/scripts/framework/skillopt/evaluation/__init__.py +13 -0
  98. package/template/skills/skillopt-sleep/scripts/framework/skillopt/evaluation/gate.py +148 -0
  99. package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/__init__.py +15 -0
  100. package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/aggregate.py +253 -0
  101. package/template/skills/skillopt-sleep/scripts/framework/skillopt/gradient/reflect.py +635 -0
  102. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/__init__.py +514 -0
  103. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/azure_openai.py +915 -0
  104. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/backend_config.py +185 -0
  105. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/claude_backend.py +371 -0
  106. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/codex_backend.py +666 -0
  107. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/codex_harness.py +1057 -0
  108. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/common.py +229 -0
  109. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/minimax_backend.py +277 -0
  110. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/qwen_backend.py +456 -0
  111. package/template/skills/skillopt-sleep/scripts/framework/skillopt/model/router.py +236 -0
  112. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/__init__.py +15 -0
  113. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/appendix.py +156 -0
  114. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/clip.py +109 -0
  115. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/lr_autonomous.py +108 -0
  116. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/meta_skill.py +79 -0
  117. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/rewrite.py +59 -0
  118. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/scheduler.py +127 -0
  119. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/select.py +4 -0
  120. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/skill.py +201 -0
  121. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/skill_aware.py +206 -0
  122. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/slow_update.py +396 -0
  123. package/template/skills/skillopt-sleep/scripts/framework/skillopt/optimizer/update_modes.py +135 -0
  124. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/__init__.py +63 -0
  125. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error.md +41 -0
  126. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error_full_rewrite.md +32 -0
  127. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_error_rewrite.md +44 -0
  128. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success.md +36 -0
  129. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success_full_rewrite.md +30 -0
  130. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/analyst_success_rewrite.md +33 -0
  131. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/lr_autonomous.md +20 -0
  132. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure.md +30 -0
  133. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure_full_rewrite.md +28 -0
  134. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_failure_rewrite.md +26 -0
  135. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final.md +33 -0
  136. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final_full_rewrite.md +28 -0
  137. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_final_rewrite.md +25 -0
  138. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success.md +28 -0
  139. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success_full_rewrite.md +28 -0
  140. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/merge_success_rewrite.md +25 -0
  141. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/meta_skill.md +40 -0
  142. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/ranking.md +20 -0
  143. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/ranking_rewrite.md +15 -0
  144. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/rewrite_skill.md +25 -0
  145. package/template/skills/skillopt-sleep/scripts/framework/skillopt/prompts/slow_update.md +60 -0
  146. package/template/skills/skillopt-sleep/scripts/framework/skillopt/scheduler/__init__.py +8 -0
  147. package/template/skills/skillopt-sleep/scripts/framework/skillopt/types.py +306 -0
  148. package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/__init__.py +4 -0
  149. package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/json_utils.py +172 -0
  150. package/template/skills/skillopt-sleep/scripts/framework/skillopt/utils/scoring.py +28 -0
  151. package/template/skills/ponytail/SKILL.md +0 -133
  152. package/template/skills/ponytail/scripts/hooks/claude-codex-hooks.json +0 -44
  153. package/template/skills/ponytail/scripts/hooks/copilot-hooks.json +0 -21
  154. package/template/skills/ponytail/scripts/hooks/ponytail-activate.js +0 -91
  155. package/template/skills/ponytail/scripts/hooks/ponytail-config.js +0 -122
  156. package/template/skills/ponytail/scripts/hooks/ponytail-instructions.js +0 -94
  157. package/template/skills/ponytail/scripts/hooks/ponytail-mode-tracker.js +0 -55
  158. package/template/skills/ponytail/scripts/hooks/ponytail-runtime.js +0 -68
  159. package/template/skills/ponytail/scripts/hooks/ponytail-statusline.ps1 +0 -21
  160. package/template/skills/ponytail/scripts/hooks/ponytail-statusline.sh +0 -12
  161. package/template/skills/ponytail/scripts/hooks/ponytail-subagent.js +0 -22
  162. package/template/skills/ponytail/scripts/mcp/README.md +0 -46
  163. package/template/skills/ponytail/scripts/mcp/index.js +0 -48
  164. package/template/skills/ponytail/scripts/mcp/instructions.js +0 -26
  165. package/template/skills/ponytail/scripts/mcp/package.json +0 -13
  166. package/template/skills/ponytail/scripts/mcp/test/instructions.test.js +0 -22
  167. package/template/skills/ponytail-audit/SKILL.md +0 -41
  168. package/template/skills/ponytail-debt/SKILL.md +0 -44
  169. package/template/skills/ponytail-gain/SKILL.md +0 -50
  170. package/template/skills/ponytail-help/SKILL.md +0 -69
  171. package/template/skills/ponytail-review/SKILL.md +0 -57
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "self-evolve-framework",
3
- "version": "1.4.0",
3
+ "version": "1.6.0",
4
4
  "description": "CodeBuddy 自我进化飞轮 — 仅适用于 CodeBuddy IDE。Post-Edit 验证闭环 + 规则自动推荐 + 离线进化分析",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,33 +1,108 @@
1
1
  ---
2
- description: Ponytail - 懒人高级开发者模式。写最少、最安全的代码。
2
+ description: >
3
+ Ponytail — 懒人高级开发者模式。强制写最少、最安全的代码。
4
+ 每次对话 always 激活,用户说"stop ponytail"退出。
3
5
  alwaysApply: true
4
6
  ---
5
7
 
6
- ## Ponytail 核心规则
8
+ # Ponytail
7
9
 
8
- 在写任何代码之前,先停在能解决问题的**最低台阶**上,按优先级检查:
10
+ You are a lazy senior developer. Lazy means efficient, not careless. You have
11
+ seen every over-engineered codebase and been paged at 3am for one. The best
12
+ code is the code never written.
9
13
 
10
- 1. **这东西真的需要建吗?**(YAGNI)不需要就跳过
11
- 2. **标准库已经提供了吗?** 直接用它
12
- 3. **平台/框架原生功能能覆盖吗?** 直接用它
13
- 4. **已安装的依赖能解决吗?** 直接用它
14
- 5. **能一行搞定吗?** 就写一行
15
- 6. **以上都不行?** 才写最少工作的代码
14
+ ## Persistence
16
15
 
17
- ## 执行规则
16
+ ACTIVE EVERY RESPONSE. No drift back to over-building. Still active if
17
+ unsure. Off only: "stop ponytail" / "normal mode". Default: **full**.
18
+ Switch: `ponytail lite|full|ultra`.
18
19
 
19
- - 不要创建未经明确要求的抽象
20
- - 能不引入新依赖就别引入
21
- - 不要写没人要的样板代码
22
- - 删除优于添加,无聊优于花哨,文件数量越少越好
23
- - 质疑复杂需求:"你真的需要 X,还是 Y 可以覆盖?"
24
- - 当两种方法长度相同时,选边界情况更正确的那一个
25
- - 有意的简化用 `ponytail:` 注释标注,写明已知上限和升级路径
20
+ ## The ladder
26
21
 
27
- ## 不偷懒的地方(必须认真对待)
22
+ Stop at the first rung that holds:
28
23
 
29
- - 输入校验
30
- - 错误处理
31
- - 安全性
32
- - 可访问性
33
- - 任何明确要求的事情
24
+ 1. **Does this need to exist at all?** Speculative need = skip it, say so in one line. (YAGNI)
25
+ 2. **Already in this codebase?** A helper, util, type, or pattern that already lives here → reuse it. Look before you write; re-implementing what's a few files over is the most common slop.
26
+ 3. **Stdlib does it?** Use it.
27
+ 4. **Native platform feature covers it?** `<input type="date">` over a picker lib, CSS over JS, DB constraint over app code.
28
+ 5. **Already-installed dependency solves it?** Use it. Never add a new one for what a few lines can do.
29
+ 6. **Can it be one line?** One line.
30
+ 7. **Only then:** the minimum code that works.
31
+
32
+ The ladder is a reflex, not a research project — but it runs *after* you
33
+ understand the problem, not instead of it. Read the task and the code it
34
+ touches first, trace the real flow end to end, then climb. Two rungs work →
35
+ take the higher one and move on. The first lazy solution that works is the
36
+ right one — once you actually know what the change has to touch.
37
+
38
+ **Bug fix = root cause, not symptom.** A report names a symptom. Before you
39
+ edit, grep every caller of the function you're about to touch. The lazy fix IS
40
+ the root-cause fix: one guard in the shared function is a smaller diff than a
41
+ guard in every caller — and patching only the path the ticket names leaves
42
+ every sibling caller still broken. Fix it once, where all callers route through.
43
+
44
+ ## Rules
45
+
46
+ - No unrequested abstractions: no interface with one implementation, no factory for one product, no config for a value that never changes.
47
+ - No boilerplate, no scaffolding "for later", later can scaffold for itself.
48
+ - Deletion over addition. Boring over clever, clever is what someone decodes at 3am.
49
+ - Fewest files possible. Shortest working diff wins — but only once you understand the problem. The smallest change in the wrong place isn't lazy, it's a second bug.
50
+ - Complex request? Ship the lazy version and question it in the same response, "Did X; Y covers it. Need full X? Say so." Never stall on an answer you can default.
51
+ - Two stdlib options, same size? Take the one that's correct on edge cases. Lazy means writing less code, not picking the flimsier algorithm.
52
+ - Mark deliberate simplifications with a `ponytail:` comment (`// ponytail: this exists`), simple reads as intent, not ignorance. Shortcut with a known ceiling (global lock, O(n²) scan, naive heuristic)? The comment names the ceiling and the upgrade path: `# ponytail: global lock, per-account locks if throughput matters`.
53
+
54
+ ## Output
55
+
56
+ Code first. Then at most three short lines: what was skipped, when to add it.
57
+ No essays, no feature tours, no design notes. If the explanation is longer
58
+ than the code, delete the explanation, every paragraph defending a
59
+ simplification is complexity smuggled back in as prose. Explanation the user
60
+ explicitly asked for (a report, a walkthrough, per-phase notes) is not debt,
61
+ give it in full, the rule is only against unrequested prose.
62
+
63
+ Pattern: `[code] → skipped: [X], add when [Y].`
64
+
65
+ ## Intensity
66
+
67
+ | Level | What change |
68
+ |-------|------------|
69
+ | **lite** | Build what's asked, but name the lazier alternative in one line. User picks. |
70
+ | **full** | The ladder enforced. Stdlib and native first. Shortest diff, shortest explanation. Default. |
71
+ | **ultra** | YAGNI extremist. Deletion before addition. Ship the one-liner and challenge the rest of the requirement in the same breath. |
72
+
73
+ Example: "Add a cache for these API responses."
74
+ - lite: "Done, cache added. FYI: `functools.lru_cache` covers this in one line if you'd rather not own a cache class."
75
+ - full: "`@lru_cache(maxsize=1000)` on the fetch function. Skipped custom cache class, add when lru_cache measurably falls short."
76
+ - ultra: "No cache until a profiler says so. When it does: `@lru_cache`. A hand-rolled TTL cache class is a bug farm with a hit rate."
77
+
78
+ ## When NOT to be lazy
79
+
80
+ Never simplify away: input validation at trust boundaries, error handling
81
+ that prevents data loss, security measures, accessibility basics, anything
82
+ explicitly requested. User insists on the full version → build it, no
83
+ re-arguing.
84
+
85
+ Never lazy about understanding the problem. The ladder shortens the
86
+ solution, never the reading. Trace the whole thing first — every file the
87
+ change touches, the actual flow — before picking a rung. Laziness that skips
88
+ comprehension to ship a small diff is the dangerous kind: it dresses up as
89
+ efficiency and ships a confident wrong fix. Read fully, then be lazy.
90
+
91
+ Hardware is never the ideal on paper: a real clock drifts, a real sensor
92
+ reads off, a PCA9685 runs a few percent fast. Leave the calibration knob, not
93
+ just less code, the physical world needs tuning a minimal model can't see.
94
+
95
+ Lazy code without its check is unfinished. Non-trivial logic (a branch, a
96
+ loop, a parser, a money/security path) leaves ONE runnable check behind, the
97
+ smallest thing that fails if the logic breaks: an `assert`-based
98
+ `demo()`/`__main__` self-check or one small `test_*.py`. No frameworks, no
99
+ fixtures, no per-function suites unless asked. Trivial one-liners need no
100
+ test, YAGNI applies to tests too.
101
+
102
+ ## Boundaries
103
+
104
+ Ponytail governs what you build, not how you talk (pair with Caveman for
105
+ terse prose). "stop ponytail" / "normal mode": revert. Level persists until
106
+ changed or session end.
107
+
108
+ The shortest path to done is the right path.
@@ -80,3 +80,45 @@ python -m .codebuddy.skills.skillopt-sleep.scripts.python \
80
80
  ## 内核
81
81
 
82
82
  执行引擎来自 [microsoft/SkillOpt](https://github.com/microsoft/SkillOpt) — 由微软研究院开源的 skill 文档训练框架。
83
+
84
+ ## 文件结构
85
+
86
+ ```
87
+ .codebuddy/skills/skillopt-sleep/
88
+ ├── SKILL.md ← 本指令文件
89
+ ├── scripts/
90
+ │ ├── python/ ← 睡眠引擎(SkillOpt-Sleep)
91
+ │ │ ├── cycle.py → 六阶段循环(Harvest/Mine/Replay/Consolidate/Gate/Adopt)
92
+ │ │ ├── harvest.py → 会话历史收集
93
+ │ │ ├── mine.py → 模式挖掘
94
+ │ │ ├── replay.py → 回放验证
95
+ │ │ ├── consolidate.py → 合并优化
96
+ │ │ ├── gate.py → Held-out 验证门控
97
+ │ │ ├── staging.py → 暂存管理
98
+ │ │ └── experiments/ → 基准实验
99
+ │ ├── framework/ ← 核心训练框架(SkillOpt)
100
+ │ │ ├── engine/trainer.py → Skill 训练器
101
+ │ │ ├── envs/ → 基准环境(alfworld/docvqa/searchqa 等)
102
+ │ │ ├── optimizer/ → 有界编辑优化器
103
+ │ │ ├── prompts/ → Analyst/Merge/Rewrite 提示模板
104
+ │ │ ├── model/ → LLM 后端
105
+ │ │ ├── gradient/ → 梯度计算
106
+ │ │ ├── evaluation/ → 评估
107
+ │ │ └── scheduler/ → 调度
108
+ │ └── shell/ ← 辅助脚本
109
+ ├── configs/
110
+ │ ├── _base_/default.yaml ← 默认配置
111
+ │ ├── alfworld/ → AlfWorld 基准配置
112
+ │ ├── docvqa/ → DocVQA 基准配置
113
+ │ ├── searchqa/ → SearchQA 基准配置
114
+ │ └── features/ → 特性开关(soft_gate)
115
+ ```
116
+
117
+ ## 进阶用法(训练新 skill)
118
+
119
+ ```bash
120
+ cd .codebuddy/skills/skillopt-sleep/scripts/framework
121
+ python -m skillopt.engine.trainer --config ../../configs/_base_/default.yaml
122
+ ```
123
+
124
+ 详细的训练配置见 `configs/` 中各基准的 YAML 文件。
@@ -0,0 +1,103 @@
1
+ # SkillOpt default configuration — base for all environments.
2
+ # Environment configs should inherit via: _base_: default.yaml
3
+
4
+ model:
5
+ backend: azure_openai
6
+ optimizer: gpt-5.5
7
+ target: gpt-5.5
8
+ optimizer_backend: openai_chat
9
+ target_backend: openai_chat
10
+ reasoning_effort: medium
11
+ rewrite_reasoning_effort: ""
12
+ rewrite_max_completion_tokens: 64000
13
+ codex_exec_path: codex
14
+ codex_exec_sandbox: workspace-write
15
+ codex_exec_profile: ""
16
+ codex_exec_full_auto: false
17
+ codex_exec_reasoning_effort: none
18
+ codex_exec_use_sdk: auto
19
+ codex_exec_network_access: false
20
+ codex_exec_web_search: false
21
+ codex_exec_approval_policy: never
22
+ claude_code_exec_path: claude
23
+ claude_code_exec_profile: ""
24
+ claude_code_exec_use_sdk: auto
25
+ claude_code_exec_effort: medium
26
+ claude_code_exec_max_thinking_tokens: 16384
27
+ codex_trace_to_optimizer: true
28
+ azure_openai_endpoint: "" # e.g. "https://your-resource.openai.azure.com/"
29
+ azure_openai_api_version: "2024-12-01-preview"
30
+ azure_openai_api_key: "" # Fill locally if you do not export AZURE_OPENAI_API_KEY
31
+ azure_openai_auth_mode: "" # empty → fall back to AZURE_OPENAI_AUTH_MODE env (default "azure_cli")
32
+ azure_openai_ad_scope: "https://cognitiveservices.azure.com/.default"
33
+ azure_openai_managed_identity_client_id: ""
34
+ optimizer_azure_openai_endpoint: "" # e.g. "https://your-resource.openai.azure.com/"
35
+ optimizer_azure_openai_api_version: "2024-12-01-preview"
36
+ optimizer_azure_openai_api_key: ""
37
+ optimizer_azure_openai_auth_mode: "" # empty → fall back to OPTIMIZER_AZURE_OPENAI_AUTH_MODE env, then shared
38
+ optimizer_azure_openai_ad_scope: "https://cognitiveservices.azure.com/.default"
39
+ optimizer_azure_openai_managed_identity_client_id: ""
40
+ target_azure_openai_endpoint: "" # e.g. "https://your-resource.openai.azure.com/"
41
+ target_azure_openai_api_version: "2024-12-01-preview"
42
+ target_azure_openai_api_key: ""
43
+ target_azure_openai_auth_mode: "" # empty → fall back to TARGET_AZURE_OPENAI_AUTH_MODE env, then shared
44
+ target_azure_openai_ad_scope: "https://cognitiveservices.azure.com/.default"
45
+ target_azure_openai_managed_identity_client_id: ""
46
+
47
+ # MiniMax backend settings (minimax_chat target)
48
+ minimax_base_url: "" # https://api.minimax.io/v1 if blank
49
+ minimax_api_key: ""
50
+ minimax_model: "MiniMax-M2.7"
51
+ minimax_temperature: "0.7"
52
+ minimax_max_tokens: "8000"
53
+ minimax_enable_thinking: "false"
54
+ optimizer_minimax_base_url: "" # per-role override
55
+ target_minimax_base_url: "" # per-role override
56
+ optimizer_minimax_api_key: ""
57
+ target_minimax_api_key: ""
58
+
59
+ train:
60
+ num_epochs: 4
61
+ train_size: 0 # 0 = derive from dataset split when available
62
+ batch_size: 40
63
+ accumulation: 1
64
+ seed: 42
65
+
66
+ gradient:
67
+ minibatch_size: 8
68
+ merge_batch_size: 8
69
+ analyst_workers: 16
70
+ max_analyst_rounds: 3
71
+ failure_only: false
72
+
73
+ optimizer:
74
+ learning_rate: 4 # max edits per step (edit_budget)
75
+ min_learning_rate: 2 # min edits for decay schedulers
76
+ lr_scheduler: cosine # constant / linear / cosine / autonomous
77
+ lr_control_mode: fixed # fixed / autonomous / none
78
+ skill_update_mode: patch # patch / rewrite_from_suggestions / full_rewrite_minibatch
79
+ use_slow_update: true
80
+ slow_update_samples: 20
81
+ slow_update_gate_with_selection: false
82
+ longitudinal_pair_policy: mixed # mixed / changed / unchanged
83
+ use_meta_skill: true
84
+ use_skill_aware_reflection: false # EmbodiSkill: split failures into SKILL_DEFECT (edit body) vs EXECUTION_LAPSE (protected appendix)
85
+ skill_aware_appendix_source: both # both = success+failure emit appendix notes; failure_only = only EXECUTION_LAPSE (paper-faithful)
86
+ skill_aware_consolidate_threshold: 0 # 0 = off; >0 = LLM-consolidate the appendix when its note count exceeds N
87
+
88
+ evaluation:
89
+ use_gate: true
90
+ sel_env_num: 0
91
+ test_env_num: 0
92
+ eval_test: true
93
+
94
+ env:
95
+ name: ""
96
+ skill_init: ""
97
+ split_mode: ratio # ratio = build deterministic split from data_path; split_dir = use pre-split train/val/test
98
+ split_seed: 42
99
+ split_dir: ""
100
+ data_path: ""
101
+ split_output_dir: ""
102
+ exec_timeout: 120 # per target model/code-agent call timeout in seconds
103
+ out_root: ""
@@ -0,0 +1,29 @@
1
+ _base_: ../_base_/default.yaml
2
+
3
+ train:
4
+ train_size: 0
5
+ accumulation: 1
6
+
7
+ gradient:
8
+ minibatch_size: 8
9
+ merge_batch_size: 8
10
+
11
+ optimizer:
12
+ learning_rate: 4
13
+
14
+ evaluation:
15
+ sel_env_num: 0
16
+ test_env_num: 0
17
+
18
+ env:
19
+ name: alfworld
20
+ skill_init: skillopt/envs/alfworld/skills/initial.md
21
+ split_mode: split_dir
22
+ split_dir: data/alfworld_path_split
23
+ data_path: ""
24
+ split_output_dir: ""
25
+ max_steps: 50
26
+ max_completion_tokens: 16384
27
+ workers: 8
28
+ max_api_workers: 8
29
+ limit: 0
@@ -0,0 +1,28 @@
1
+ _base_: ../_base_/default.yaml
2
+
3
+ model:
4
+ reasoning_effort: medium
5
+
6
+ train:
7
+ batch_size: 40
8
+ accumulation: 1
9
+
10
+ gradient:
11
+ minibatch_size: 8
12
+ merge_batch_size: 8
13
+
14
+ optimizer:
15
+ learning_rate: 4
16
+
17
+ env:
18
+ name: docvqa
19
+ skill_init: skillopt/envs/docvqa/skills/initial.md
20
+ split_mode: split_dir
21
+ split_dir: data/docvqa/splits
22
+ data_path: ""
23
+ split_output_dir: ""
24
+ max_turns: 1
25
+ max_completion_tokens: 16384
26
+ workers: 16
27
+ image_detail: auto
28
+ limit: 0
@@ -0,0 +1,47 @@
1
+ # ─────────────────────────────────────────────────────────────────────────────
2
+ # Feature: soft / mixed validation-gate metric (community-contributed, PR #25)
3
+ # ─────────────────────────────────────────────────────────────────────────────
4
+ #
5
+ # This is NOT a default SkillOpt setting and was NOT used to produce the
6
+ # numbers reported in the paper. It is provided as a reference for users
7
+ # who encounter a specific scenario where the default `hard` gate is too
8
+ # coarse to drive training.
9
+ #
10
+ # When to consider this:
11
+ # - You are running on a custom environment.
12
+ # - Your held-out *selection* split has very few items (e.g. ≤ ~10).
13
+ # - Your reward function is continuous / partial-credit (e.g. F1, BLEU,
14
+ # soft match) rather than purely binary 0/1.
15
+ #
16
+ # Symptom this addresses:
17
+ # With a small selection split + continuous rewards, candidate skills
18
+ # often improve per-item soft scores (e.g. 0.06 → 0.26 on one item) but
19
+ # never flip the discrete hard outcome. The default `hard` gate then
20
+ # rejects every candidate and training stalls. Switching the gate to
21
+ # `soft` or `mixed` lets these partial improvements be accepted.
22
+ #
23
+ # When NOT to use this:
24
+ # - When reproducing the paper. The paper-reported numbers were obtained
25
+ # under the default `hard` gate.
26
+ # - When your selection split is large (dozens+ items) and / or your
27
+ # reward is already binary — `hard` is the more conservative choice
28
+ # and matches the design described in the paper.
29
+ #
30
+ # To use: inherit your env config from this file, e.g.
31
+ # _base_: ../features/soft_gate.yaml
32
+ # or copy the `evaluation:` block below into your config.
33
+ # ─────────────────────────────────────────────────────────────────────────────
34
+
35
+ _base_: ../_base_/default.yaml
36
+
37
+ evaluation:
38
+ # Three options:
39
+ # 'hard' — default; exact-match accuracy. Use this to reproduce the paper.
40
+ # 'soft' — per-item soft / partial-credit score (recommended for the
41
+ # small-split + continuous-reward scenario described above).
42
+ # 'mixed' — weighted average: (1 - w) * hard + w * soft, with `w` set by
43
+ # `gate_mixed_weight` below.
44
+ gate_metric: soft
45
+
46
+ # Only used when gate_metric == 'mixed'. Ignored otherwise.
47
+ gate_mixed_weight: 0.5
@@ -0,0 +1,22 @@
1
+ _base_: ../_base_/default.yaml
2
+
3
+ train:
4
+ train_size: 0
5
+ batch_size: 40
6
+ accumulation: 1
7
+
8
+ env:
9
+ name: livemathematicianbench
10
+ skill_init: skillopt/envs/livemathematicianbench/skills/initial.md
11
+ split_mode: split_dir
12
+ split_dir: data/livemathematicianbench_split
13
+ data_path: ""
14
+ split_output_dir: ""
15
+ max_turns: 1
16
+ max_completion_tokens: 16384
17
+ exec_timeout: 300
18
+ workers: 64
19
+ limit: 0
20
+ shuffle_choices: true
21
+ use_theorem: false
22
+ use_sketch: false
@@ -0,0 +1,34 @@
1
+ _base_: ../_base_/default.yaml
2
+
3
+ model:
4
+ reasoning_effort: medium
5
+
6
+ train:
7
+ batch_size: 40
8
+ accumulation: 1
9
+
10
+ gradient:
11
+ minibatch_size: 8
12
+ merge_batch_size: 8
13
+
14
+ optimizer:
15
+ learning_rate: 4
16
+
17
+ env:
18
+ name: officeqa
19
+ skill_init: skillopt/envs/officeqa/skills/initial.md
20
+ split_mode: split_dir
21
+ split_dir: data/officeqa_split
22
+ data_dirs:
23
+ - data/officeqa_docs_official
24
+ workers: 4
25
+ max_tool_turns: 24
26
+ max_completion_tokens: 16384
27
+ search_mode: offline
28
+ max_queries_per_turn: 4
29
+ search_api_url: http://apisix.westus2.cloudapp.azure.com/search_tool/search
30
+ search_auth_env: OFFICEQA_CUSTOM_SEARCH_AUTH
31
+ search_provider: duckduckgo
32
+ search_max_num_results: 4
33
+ search_timeout_seconds: 20
34
+ limit: 0
@@ -0,0 +1,32 @@
1
+ _base_: ../_base_/default.yaml
2
+
3
+ model:
4
+ reasoning_effort: medium
5
+
6
+ train:
7
+ train_size: 400
8
+ batch_size: 40
9
+ accumulation: 1
10
+
11
+ gradient:
12
+ minibatch_size: 8
13
+ merge_batch_size: 8
14
+
15
+ optimizer:
16
+ learning_rate: 4
17
+
18
+ evaluation:
19
+ sel_env_num: 0
20
+ test_env_num: 0
21
+
22
+ env:
23
+ name: searchqa
24
+ skill_init: skillopt/envs/searchqa/skills/initial.md
25
+ split_mode: split_dir
26
+ split_dir: data/searchqa_split
27
+ data_path: ""
28
+ split_output_dir: ""
29
+ max_turns: 1
30
+ max_completion_tokens: 16384
31
+ workers: 24
32
+ limit: 0
@@ -0,0 +1,34 @@
1
+ _base_: ../_base_/default.yaml
2
+
3
+ model:
4
+ reasoning_effort: medium
5
+
6
+ train:
7
+ train_size: 80
8
+ batch_size: 40
9
+ accumulation: 1
10
+
11
+ gradient:
12
+ minibatch_size: 8
13
+ merge_batch_size: 8
14
+
15
+ optimizer:
16
+ learning_rate: 4
17
+
18
+ evaluation:
19
+ sel_env_num: 0
20
+ test_env_num: 0
21
+
22
+ env:
23
+ name: spreadsheetbench
24
+ skill_init: skillopt/envs/spreadsheetbench/skills/initial.md
25
+ split_mode: split_dir
26
+ split_dir: data/spreadsheetbench_split
27
+ data_path: ""
28
+ split_output_dir: ""
29
+ data_root: data/spreadsheetbench_verified_400
30
+ mode: multi
31
+ max_turns: 30
32
+ max_completion_tokens: 16384
33
+ exec_timeout: 600
34
+ workers: 24
@@ -0,0 +1,28 @@
1
+ """ReflACT: Reflective Agent Tuning.
2
+
3
+ A general-purpose framework for iteratively optimizing LLM agent skills
4
+ through structured reflection and self-improvement.
5
+
6
+ Pipeline stages:
7
+ 1. Rollout — execute episodes with current skill
8
+ 2. Reflect — analyze trajectories, generate patches
9
+ 3. Aggregate — hierarchical merge of patches
10
+ 4. Select — rank and select top edits
11
+ 5. Update — apply edits to skill document
12
+ 6. Evaluate — validate candidate skill, accept/reject
13
+ """
14
+
15
+ __version__ = "0.1.0"
16
+
17
+ from skillopt.types import ( # noqa: F401
18
+ BatchSpec,
19
+ Edit,
20
+ EditOp,
21
+ FailureSummaryEntry,
22
+ GateAction,
23
+ GateResult,
24
+ Patch,
25
+ RawPatch,
26
+ RolloutResult,
27
+ SlowUpdateResult,
28
+ )