claude-dev-env 1.38.1 → 1.40.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 (282) hide show
  1. package/CLAUDE.md +10 -36
  2. package/_shared/pr-loop/audit-reply-template.md +147 -0
  3. package/_shared/pr-loop/fix-protocol.md +25 -4
  4. package/_shared/pr-loop/gh-payloads.md +37 -50
  5. package/_shared/pr-loop/scripts/code_rules_gate.py +0 -60
  6. package/_shared/pr-loop/scripts/config/post_audit_thread_constants.py +199 -0
  7. package/_shared/pr-loop/scripts/config/reviews_disabled_constants.py +8 -0
  8. package/_shared/pr-loop/scripts/post_audit_thread.py +1242 -0
  9. package/_shared/pr-loop/scripts/preflight.py +129 -2
  10. package/_shared/pr-loop/scripts/reviews_disabled.py +59 -0
  11. package/_shared/pr-loop/scripts/tests/test_code_rules_gate.py +0 -19
  12. package/_shared/pr-loop/scripts/tests/test_post_audit_thread.py +1116 -0
  13. package/_shared/pr-loop/scripts/tests/test_post_audit_thread_constants.py +127 -0
  14. package/_shared/pr-loop/scripts/tests/test_preflight.py +41 -0
  15. package/_shared/pr-loop/scripts/tests/test_reviews_disabled.py +36 -0
  16. package/_shared/pr-loop/state-schema.md +1 -1
  17. package/agents/clean-coder.md +2 -2
  18. package/agents/pr-description-writer.md +150 -52
  19. package/bin/install.mjs +6 -7
  20. package/bin/install.test.mjs +8 -0
  21. package/commands/doc-gist.md +16 -0
  22. package/commands/plan.md +0 -2
  23. package/commands/review-plan.md +1 -1
  24. package/docs/CODE_RULES.md +122 -2
  25. package/docs/PR_DESCRIPTION_GUIDE.md +127 -64
  26. package/hooks/blocking/bot_mention_comment_blocker.py +75 -0
  27. package/hooks/blocking/code_rules_enforcer.py +1143 -129
  28. package/hooks/blocking/convergence_gate_blocker.py +130 -0
  29. package/hooks/blocking/destructive_command_blocker.py +74 -0
  30. package/hooks/blocking/gh_body_arg_blocker.py +30 -0
  31. package/hooks/blocking/md_to_html_blocker.py +119 -0
  32. package/hooks/blocking/pr_description_enforcer.py +57 -22
  33. package/hooks/blocking/test_bot_mention_comment_blocker.py +131 -0
  34. package/hooks/blocking/test_code_rules_enforcer.py +21 -0
  35. package/hooks/blocking/test_code_rules_enforcer_any_exempt_files.py +70 -0
  36. package/hooks/blocking/test_code_rules_enforcer_any_imports_and_cast.py +92 -0
  37. package/hooks/blocking/test_code_rules_enforcer_banned_import_alias.py +143 -0
  38. package/hooks/blocking/test_code_rules_enforcer_banned_prefixes.py +152 -0
  39. package/hooks/blocking/test_code_rules_enforcer_bare_except.py +120 -0
  40. package/hooks/blocking/test_code_rules_enforcer_boundary_types.py +175 -0
  41. package/hooks/blocking/test_code_rules_enforcer_cap_meta.py +0 -1
  42. package/hooks/blocking/test_code_rules_enforcer_collection_prefix.py +50 -0
  43. package/hooks/blocking/test_code_rules_enforcer_docstring_format.py +255 -0
  44. package/hooks/blocking/test_code_rules_enforcer_inline_tuple_string_magic.py +130 -0
  45. package/hooks/blocking/test_code_rules_enforcer_stub_implementations.py +141 -0
  46. package/hooks/blocking/test_code_rules_enforcer_test_branching.py +143 -0
  47. package/hooks/blocking/test_code_rules_enforcer_thin_wrapper_files.py +169 -0
  48. package/hooks/blocking/test_code_rules_enforcer_todo_markers.py +99 -0
  49. package/hooks/blocking/test_code_rules_enforcer_typed_dict_pairs.py +141 -0
  50. package/hooks/blocking/test_convergence_gate_blocker.py +63 -0
  51. package/hooks/blocking/test_destructive_command_blocker.py +146 -0
  52. package/hooks/blocking/test_destructive_command_blocker_no_verify.py +102 -0
  53. package/hooks/blocking/test_gh_body_arg_blocker.py +45 -0
  54. package/hooks/blocking/test_md_to_html_blocker.py +317 -0
  55. package/hooks/blocking/test_pr_description_enforcer.py +69 -8
  56. package/hooks/config/any_type_config.py +7 -0
  57. package/hooks/config/banned_identifiers_constants.py +11 -0
  58. package/hooks/config/blocking_check_limits.py +38 -0
  59. package/hooks/config/bot_mention_comment_blocker_constants.py +20 -0
  60. package/hooks/config/code_rules_enforcer_constants.py +53 -0
  61. package/hooks/config/convergence_branch_constants.py +9 -0
  62. package/hooks/config/doc_gist_auto_publish_constants.py +18 -0
  63. package/hooks/config/html_companion_constants.py +20 -0
  64. package/hooks/config/inline_tuple_string_magic_constants.py +22 -0
  65. package/hooks/config/pr_description_enforcer_constants.py +14 -0
  66. package/hooks/config/test_banned_identifiers_constants.py +17 -0
  67. package/hooks/hooks.json +28 -20
  68. package/hooks/pyproject.toml +69 -0
  69. package/hooks/validators/mypy_integration.py +47 -1
  70. package/hooks/validators/run_all_validators.py +3 -3
  71. package/hooks/validators/test_mypy_integration.py +50 -1
  72. package/hooks/workflow/doc_gist_auto_publish.py +144 -0
  73. package/hooks/workflow/md_to_html_companion.py +365 -0
  74. package/hooks/workflow/test_doc_gist_auto_publish.py +117 -0
  75. package/hooks/workflow/test_md_to_html_companion.py +452 -0
  76. package/package.json +1 -1
  77. package/rules/gh-body-file.md +2 -0
  78. package/scripts/Install-SweepEmptyDirs.ps1 +111 -0
  79. package/scripts/check.ps1 +106 -0
  80. package/scripts/config/timing.py +11 -0
  81. package/scripts/sweep_empty_dirs.py +138 -0
  82. package/scripts/sync_to_cursor/rules.py +1 -1
  83. package/scripts/test_sweep_empty_dirs.py +183 -0
  84. package/skills/_shared/pr-loop/prompts/pr-consistency-audit.xml +323 -0
  85. package/skills/_shared/pr-loop/scripts/_cli_utils.py +22 -0
  86. package/skills/_shared/pr-loop/scripts/_path_resolver.py +165 -0
  87. package/skills/_shared/pr-loop/scripts/_xml_utils.py +20 -0
  88. package/skills/_shared/pr-loop/scripts/build_audit_prompt.py +182 -0
  89. package/skills/_shared/pr-loop/scripts/build_fix_prompt.py +185 -0
  90. package/skills/_shared/pr-loop/scripts/config/__init__.py +0 -0
  91. package/skills/_shared/pr-loop/scripts/config/path_resolver_constants.py +78 -0
  92. package/skills/_shared/pr-loop/scripts/init_loop_state.py +135 -0
  93. package/skills/_shared/pr-loop/scripts/teardown_worktrees.py +175 -0
  94. package/skills/_shared/pr-loop/scripts/write_audit_outcomes.py +182 -0
  95. package/skills/_shared/pr-loop/scripts/write_fix_outcomes.py +206 -0
  96. package/skills/bugteam/CONSTRAINTS.md +21 -22
  97. package/skills/bugteam/EXAMPLES.md +3 -3
  98. package/skills/bugteam/PROMPTS.md +227 -67
  99. package/skills/bugteam/SKILL.md +132 -455
  100. package/skills/bugteam/reference/README.md +1 -1
  101. package/skills/bugteam/reference/audit-and-teammates.md +112 -39
  102. package/skills/bugteam/reference/audit-contract.md +4 -22
  103. package/skills/bugteam/reference/copilot-gap-analysis.md +8 -5
  104. package/skills/bugteam/reference/design-rationale.md +2 -2
  105. package/skills/bugteam/reference/github-pr-reviews.md +50 -57
  106. package/skills/bugteam/reference/obstacles/audit-assign-ids.md +13 -0
  107. package/skills/bugteam/reference/obstacles/audit-capture-excerpts.md +13 -0
  108. package/skills/bugteam/reference/obstacles/audit-walk-categories.md +13 -0
  109. package/skills/bugteam/reference/obstacles/audit-write-xml.md +13 -0
  110. package/skills/bugteam/reference/obstacles/fix-append-summary.md +13 -0
  111. package/skills/bugteam/reference/obstacles/fix-apply-fixes.md +13 -0
  112. package/skills/bugteam/reference/obstacles/fix-git-add-commit.md +13 -0
  113. package/skills/bugteam/reference/obstacles/fix-git-push.md +13 -0
  114. package/skills/bugteam/reference/obstacles/fix-post-reply.md +13 -0
  115. package/skills/bugteam/reference/obstacles/fix-publish-summary.md +13 -0
  116. package/skills/bugteam/reference/obstacles/fix-py-compile.md +13 -0
  117. package/skills/bugteam/reference/obstacles/fix-read-files.md +13 -0
  118. package/skills/bugteam/reference/obstacles/fix-resolve-thread.md +13 -0
  119. package/skills/bugteam/reference/obstacles/fix-test-suite.md +13 -0
  120. package/skills/bugteam/reference/obstacles/fix-violation-count.md +13 -0
  121. package/skills/bugteam/reference/obstacles/fix-write-xml.md +13 -0
  122. package/skills/bugteam/reference/team-setup.md +111 -9
  123. package/skills/bugteam/reference/teardown-publish-permissions.md +39 -8
  124. package/skills/bugteam/scripts/README.md +60 -0
  125. package/skills/bugteam/scripts/_claude_permissions_common.py +358 -0
  126. package/skills/bugteam/scripts/bugteam_code_rules_gate.py +976 -0
  127. package/skills/bugteam/scripts/bugteam_fix_hookspath.py +375 -0
  128. package/skills/bugteam/scripts/bugteam_preflight.py +328 -0
  129. package/skills/bugteam/scripts/config/bugteam_code_rules_gate_constants.py +25 -0
  130. package/skills/bugteam/scripts/config/bugteam_fix_hookspath_constants.py +26 -0
  131. package/skills/bugteam/scripts/config/bugteam_preflight_constants.py +35 -0
  132. package/skills/bugteam/scripts/config/claude_permissions_common_constants.py +20 -0
  133. package/skills/bugteam/scripts/config/probe_code_rules_enforcer_check_constants.py +12 -0
  134. package/skills/bugteam/scripts/config/windows_safe_rmtree_constants.py +7 -0
  135. package/skills/bugteam/scripts/grant_project_claude_permissions.py +175 -0
  136. package/skills/bugteam/scripts/probe_code_rules_enforcer_check.py +107 -0
  137. package/skills/bugteam/scripts/revoke_project_claude_permissions.py +220 -0
  138. package/skills/bugteam/scripts/test__claude_permissions_common.py +112 -0
  139. package/skills/bugteam/scripts/test_bugteam_code_rules_gate.py +400 -0
  140. package/skills/bugteam/scripts/test_bugteam_fix_hookspath.py +384 -0
  141. package/skills/bugteam/scripts/test_bugteam_preflight.py +309 -0
  142. package/skills/bugteam/scripts/test_claude_permissions_common.py +195 -0
  143. package/skills/bugteam/scripts/test_grant_project_claude_permissions.py +55 -0
  144. package/skills/bugteam/scripts/test_probe_code_rules_enforcer_check.py +76 -0
  145. package/skills/bugteam/scripts/test_revoke_project_claude_permissions.py +55 -0
  146. package/skills/bugteam/scripts/test_windows_safe_rmtree.py +108 -0
  147. package/skills/bugteam/scripts/windows_safe_rmtree.py +100 -0
  148. package/skills/bugteam/test_skill_additions.py +1 -11
  149. package/skills/code/SKILL.md +176 -0
  150. package/skills/copilot-review/SKILL.md +16 -0
  151. package/skills/doc-gist/SKILL.md +99 -0
  152. package/skills/doc-gist/references/examples/01-exploration-code-approaches.html +453 -0
  153. package/skills/doc-gist/references/examples/02-exploration-visual-designs.html +515 -0
  154. package/skills/doc-gist/references/examples/03-code-review-pr.html +638 -0
  155. package/skills/doc-gist/references/examples/04-code-understanding.html +491 -0
  156. package/skills/doc-gist/references/examples/05-design-system.html +629 -0
  157. package/skills/doc-gist/references/examples/06-component-variants.html +605 -0
  158. package/skills/doc-gist/references/examples/07-prototype-animation.html +455 -0
  159. package/skills/doc-gist/references/examples/08-prototype-interaction.html +396 -0
  160. package/skills/doc-gist/references/examples/09-slide-deck.html +592 -0
  161. package/skills/doc-gist/references/examples/10-svg-illustrations.html +492 -0
  162. package/skills/doc-gist/references/examples/11-status-report.html +528 -0
  163. package/skills/doc-gist/references/examples/12-incident-report.html +596 -0
  164. package/skills/doc-gist/references/examples/13-flowchart-diagram.html +395 -0
  165. package/skills/doc-gist/references/examples/14-research-feature-explainer.html +381 -0
  166. package/skills/doc-gist/references/examples/15-research-concept-explainer.html +368 -0
  167. package/skills/doc-gist/references/examples/16-implementation-plan.html +702 -0
  168. package/skills/doc-gist/references/examples/17-pr-writeup.html +595 -0
  169. package/skills/doc-gist/references/examples/18-editor-triage-board.html +573 -0
  170. package/skills/doc-gist/references/examples/19-editor-feature-flags.html +663 -0
  171. package/skills/doc-gist/references/examples/20-editor-prompt-tuner.html +722 -0
  172. package/skills/doc-gist/references/examples/README.md +5 -0
  173. package/skills/doc-gist/scripts/config/__init__.py +0 -0
  174. package/skills/doc-gist/scripts/config/gist_upload_constants.py +16 -0
  175. package/skills/doc-gist/scripts/gist_upload.py +177 -0
  176. package/skills/doc-gist/scripts/test_gist_upload.py +51 -0
  177. package/skills/findbugs/SKILL.md +96 -2
  178. package/skills/monitor-open-prs/SKILL.md +14 -32
  179. package/skills/monitor-open-prs/test_skill_contract.py +0 -11
  180. package/skills/pr-consistency-audit/SKILL.md +112 -0
  181. package/skills/pr-consistency-audit/reference/detection-rules.md +96 -0
  182. package/skills/pr-consistency-audit/reference/illustrations.md +78 -0
  183. package/skills/pr-converge/SKILL.md +229 -23
  184. package/skills/pr-converge/config/__init__.py +0 -0
  185. package/skills/pr-converge/config/constants.py +63 -0
  186. package/skills/pr-converge/reference/convergence-gates.md +138 -44
  187. package/skills/pr-converge/reference/examples.md +43 -11
  188. package/skills/pr-converge/reference/fix-protocol.md +6 -5
  189. package/skills/pr-converge/reference/ground-rules.md +5 -3
  190. package/skills/pr-converge/reference/multi-pr-orchestration.md +44 -19
  191. package/skills/pr-converge/reference/obstacles/fix-post-replies.md +13 -0
  192. package/skills/pr-converge/reference/obstacles/fix-publish-summary.md +13 -0
  193. package/skills/pr-converge/reference/obstacles/fix-push.md +13 -0
  194. package/skills/pr-converge/reference/obstacles/fix-read-filelines.md +13 -0
  195. package/skills/pr-converge/reference/obstacles/fix-reset-state.md +13 -0
  196. package/skills/pr-converge/reference/obstacles/fix-resolve-threads.md +13 -0
  197. package/skills/pr-converge/reference/obstacles/fix-spawn-clean-coder.md +13 -0
  198. package/skills/pr-converge/reference/obstacles/fix-stage-commit.md +13 -0
  199. package/skills/pr-converge/reference/obstacles/fix-trigger-bugbot.md +13 -0
  200. package/skills/pr-converge/reference/obstacles/fix-write-test.md +13 -0
  201. package/skills/pr-converge/reference/per-tick.md +107 -31
  202. package/skills/pr-converge/reference/state-schema.md +22 -1
  203. package/skills/pr-converge/reference/stop-conditions.md +9 -7
  204. package/skills/pr-converge/scripts/README.md +34 -46
  205. package/skills/pr-converge/scripts/check_bugbot_ci.py +279 -0
  206. package/skills/pr-converge/scripts/check_convergence.py +497 -0
  207. package/skills/pr-converge/scripts/check_pending_reviews.py +154 -0
  208. package/skills/pr-converge/scripts/config/pr_converge_constants.py +118 -0
  209. package/skills/pr-converge/scripts/fetch_copilot_reviews.py +134 -0
  210. package/skills/pr-converge/scripts/post_fix_reply.py +168 -0
  211. package/skills/pr-converge/scripts/test_check_bugbot_ci.py +312 -0
  212. package/skills/pr-converge/workflows/schedule-wakeup-loop.md +5 -12
  213. package/skills/qbug/SKILL.md +157 -27
  214. package/skills/session-log/SKILL.md +216 -114
  215. package/skills/session-tidy/SKILL.md +1 -1
  216. package/skills/skill-builder/SKILL.md +138 -56
  217. package/skills/skill-builder/references/delegation-map.md +72 -113
  218. package/skills/skill-builder/references/progressive-disclosure.md +122 -0
  219. package/skills/skill-builder/references/self-audit-checklist.md +92 -0
  220. package/skills/skill-builder/references/skill-types.md +228 -0
  221. package/skills/skill-builder/references/thariq-x-post-skills.json +33 -0
  222. package/skills/skill-builder/templates/gap-analysis.md +15 -8
  223. package/skills/skill-builder/workflows/improve-skill.md +86 -57
  224. package/skills/skill-builder/workflows/new-skill.md +80 -168
  225. package/skills/skill-builder/workflows/polish-skill.md +78 -54
  226. package/skills/structure-prompt/SKILL.md +50 -0
  227. package/skills/structure-prompt/reference/adversarial-tuning.md +62 -0
  228. package/skills/structure-prompt/reference/block-classification.md +27 -0
  229. package/skills/structure-prompt/reference/canonical-case.md +48 -0
  230. package/skills/structure-prompt/reference/citation-depth.md +70 -0
  231. package/skills/structure-prompt/reference/cleanup.md +33 -0
  232. package/skills/structure-prompt/reference/constraints.md +33 -0
  233. package/skills/structure-prompt/reference/directives.md +37 -0
  234. package/skills/structure-prompt/reference/examples.md +72 -0
  235. package/skills/structure-prompt/reference/instantiation.md +51 -0
  236. package/skills/structure-prompt/reference/output-contract.md +72 -0
  237. package/skills/structure-prompt/reference/per-category.md +23 -0
  238. package/skills/structure-prompt/reference/persona.md +38 -0
  239. package/skills/structure-prompt/reference/research.md +33 -0
  240. package/skills/structure-prompt/reference/structure.md +28 -0
  241. package/agents/code-standards-agent.md +0 -93
  242. package/agents/groq-coder.md +0 -113
  243. package/agents/plan-executor.md +0 -226
  244. package/agents/project-docs-analyzer.md +0 -53
  245. package/agents/project-structure-organizer-agent.md +0 -72
  246. package/agents/skill-to-agent-converter.md +0 -370
  247. package/agents/skill-writer-agent.md +0 -470
  248. package/agents/user-docs-writer.md +0 -67
  249. package/agents/workflow-visual-documenter.md +0 -82
  250. package/commands/readability-review.md +0 -20
  251. package/hooks/mypy.ini +0 -2
  252. package/hooks/notification/attention_needed_notify.py +0 -71
  253. package/hooks/notification/claude_notification_handler.py +0 -67
  254. package/hooks/notification/notification_utils.py +0 -267
  255. package/hooks/notification/subagent_complete_notify.py +0 -381
  256. package/hooks/notification/test_attention_needed_notify.py +0 -47
  257. package/hooks/notification/test_claude_notification_handler.py +0 -54
  258. package/hooks/notification/test_notification_utils.py +0 -91
  259. package/hooks/notification/test_subagent_complete_notify.py +0 -79
  260. package/scripts/config/groq_bugteam_config.py +0 -230
  261. package/scripts/config/test_groq_bugteam_config.py +0 -83
  262. package/scripts/config/test_spec_implementer_prompt.py +0 -32
  263. package/scripts/groq_bugteam.README.md +0 -131
  264. package/scripts/groq_bugteam.py +0 -647
  265. package/scripts/groq_bugteam_dotenv.py +0 -40
  266. package/scripts/groq_bugteam_spec.py +0 -226
  267. package/scripts/test_groq_bugteam.py +0 -529
  268. package/scripts/test_groq_bugteam_apply_fix_from_spec.py +0 -426
  269. package/scripts/test_groq_bugteam_dotenv.py +0 -66
  270. package/scripts/test_groq_bugteam_spec.py +0 -338
  271. package/skills/bugteam/SKILL_EVALS.md +0 -309
  272. package/skills/dream/SKILL.md +0 -118
  273. package/skills/ingest/SKILL.md +0 -40
  274. package/skills/npm-creator/SKILL.md +0 -187
  275. package/skills/readability-review/SKILL.md +0 -127
  276. package/skills/resume-review/SKILL.md +0 -261
  277. package/skills/rule-audit/SKILL.md +0 -307
  278. package/skills/rule-creator/SKILL.md +0 -150
  279. package/skills/searching-obsidian-vault/SKILL.md +0 -131
  280. package/skills/skill-writer/REFERENCE.md +0 -284
  281. package/skills/skill-writer/SKILL.md +0 -222
  282. package/skills/tdd-team/SKILL.md +0 -128
@@ -0,0 +1,48 @@
1
+ # Mark the canonical sub-bucket with ⭐
2
+
3
+ When a framework has many sub-buckets, one of them usually carries the category's signature failure mode. Marking that sub-bucket with ⭐ helps the auditing agent give it extra attention.
4
+
5
+ ## Detection
6
+
7
+ The marker fires when BOTH hold:
8
+
9
+ - The framework has 5 or more sub-buckets
10
+ - No sub-bucket already carries the ⭐ marker
11
+
12
+ The third condition — whether a canonical signal exists — is determined during selection (below), not detection. When selection finds no clear canonical case, the marker pass does not mark and instead emits a gap note per the [no silent action](output-contract.md#disposition-invariants) invariant.
13
+
14
+ ## How to pick the canonical sub-bucket
15
+
16
+ In order:
17
+
18
+ 1. **Rubric match.** When the calling framework provides a sibling rubric (e.g., at `../category_rubrics/<name>.md` in audit-rubric layouts) and that rubric describes a "Canonical example" or names one axis as the signature pattern, pick that sub-bucket. When no sibling rubric exists, skip this step and fall through to bullet density.
19
+ 2. **Bullet density.** When the rubric stays silent, count the concrete bullets per sub-bucket. The sub-bucket with the most bullets that cite a real identifier or line number wins.
20
+ 3. **Identifier density.** When two sub-buckets tie on bullet count, pick the one whose identifiers appear most often in the data body.
21
+
22
+ ## How to mark it
23
+
24
+ Append `⭐ canonical <category-letter> case` after the sub-bucket title, on the same line.
25
+
26
+ Derive `<category-letter>` from the leading letter of the sub-bucket id (`K3` → `K`, `A2` → `A`, `B1` → `B`). When the framework uses non-lettered sub-bucket ids or no ids at all (e.g., bullets titled `Surface 1`, `Item 1`, `Check 1`), drop the letter and write `⭐ canonical case`.
27
+
28
+ Example before:
29
+ ```
30
+ **K3. Primary path vs fallback path**
31
+ - The file's `if resolved_skill_path is not None:` branch (line 121) is the PRIMARY path…
32
+ ```
33
+
34
+ Example after:
35
+ ```
36
+ **K3. Primary path vs fallback path** ⭐ canonical K case
37
+ - The file's `if resolved_skill_path is not None:` branch (line 121) is the PRIMARY path…
38
+ ```
39
+
40
+ ## What stays put
41
+
42
+ When a ⭐ marker already lives somewhere in the framework, the marker pass leaves it alone — the prompt's author already chose. The skill marks at most one sub-bucket per invocation.
43
+
44
+ When research turns up no clear canonical case (the bullets are evenly weighted, no rubric guidance, no identifier-density signal), the marker pass leaves the framework unmarked AND MUST emit a gap note via the paste-mode or file-path-mode gap-report mechanism that [`output-contract.md`](output-contract.md) defines for the active emission mode. The framework reads fine without an arbitrary pick, but the deferral itself is recorded — see the [no silent action](output-contract.md#disposition-invariants) invariant.
45
+
46
+ ## Disposition reporting
47
+
48
+ Every outcome emits an action note via the mechanism that [`output-contract.md`](output-contract.md) defines. When a sub-bucket was marked: `> Gap: ⭐ canonical <letter> case marker added to sub-bucket "<sub-bucket-id>".` When the framework has fewer than 5 sub-buckets or already carries a ⭐ marker: `> Gap: Canonical-case marker verified — <reason>.` When no clear canonical case exists: `> Gap: Canonical-case marker skipped — framework has 5+ sub-buckets but <rubric match / bullet density / identifier density> found no clear canonical case.` Silent pass is forbidden — see the [no silent action](output-contract.md#disposition-invariants) invariant.
@@ -0,0 +1,70 @@
1
+ # Add file:line citations on identifier mentions
2
+
3
+ When a sub-bucket bullet names an identifier (a function, variable, cmdlet, file path) that also lives in the data body, the bullet earns more value with a `file:line` citation appended.
4
+
5
+ ## Detection
6
+
7
+ Two separate paths, evaluated for every backtick-wrapped identifier in each bullet:
8
+
9
+ **Citation-candidate path.** An identifier is a citation candidate when all three hold:
10
+ - The bullet contains a backtick-wrapped identifier (e.g., `os.walk`, `New-ScheduledTaskTrigger`, `_log_walk_error`)
11
+ - The identifier also appears in the data body
12
+ - No `file:line` citation already follows that identifier within the bullet
13
+
14
+ **Citation-unavailable path.** An identifier triggers the unavailable path when all three hold:
15
+ - The bullet contains a backtick-wrapped identifier
16
+ - The identifier does NOT appear in the data body — its file is not included in the diff or the identifier is external (e.g., a stdlib symbol, a framework API)
17
+ - No `(citation unavailable: <reason>)` marker already follows that identifier within the bullet
18
+
19
+ Both paths fire independently per identifier. A bullet can contain both citable and unciteable identifiers.
20
+
21
+ ## Procedure
22
+
23
+ **For citation candidates:**
24
+ 1. For each citation candidate, search the data body for the identifier.
25
+ 2. Find every occurrence of the identifier in the data body. When the data body uses explicit line numbers (e.g., a code block prefixed with file:line annotations or a diff), use those. When the data body has no line numbers (e.g., a raw pasted dump), use the 1-based line index within the data-body block as `<line>`. Apply the multiple-occurrence policy below to determine which lines to cite.
26
+ 3. Append the citation in this format immediately after the backtick-wrapped identifier: `` `identifier` (`<file>:<line>`)``. When the bullet contains multiple identifiers, cite each one inline after its owning backtick span. The `<file>` value comes from the data-body block's heading or label (e.g., the filename in a `### file.py` heading, the diff header, or the code block's language tag). When the data body has no file identity at all (a raw paste with no heading or label), use `data-body:<line>`. The examples below illustrate both single-identifier and multi-identifier bullets.
27
+
28
+ ## Multiple occurrences
29
+
30
+ When the identifier appears one or more times across the data body:
31
+
32
+ - 1–3 occurrences → cite all of them: `(file_a.py:42, file_a.py:88, file_b.ps1:12)`
33
+ - 4 or more → cite the first and last with `…` between: `(file_a.py:42, …, file_b.ps1:200)`
34
+
35
+ ## Examples
36
+
37
+ Before:
38
+ ```
39
+ - uses `os.walk` with `_log_walk_error` — `_log_walk_error` matches the exact signature stdlib calls.
40
+ ```
41
+
42
+ After (2 occurrences: definition plus one call site):
43
+ ```
44
+ - uses `os.walk` (`sweep_empty_dirs.py:23`) with `_log_walk_error` (`sweep_empty_dirs.py:23, sweep_empty_dirs.py:33`) — `_log_walk_error` matches the exact signature stdlib calls.
45
+ ```
46
+
47
+ Before:
48
+ ```
49
+ - `Get-ScheduledTask`, `New-ScheduledTaskTrigger`, `New-ScheduledTaskAction`, `Register-ScheduledTask`, `Unregister-ScheduledTask` — verify each call's parameter shape.
50
+ ```
51
+
52
+ After (one occurrence per cmdlet):
53
+ ```
54
+ - `Get-ScheduledTask` (`Install-SweepEmptyDirs.ps1:248`), `New-ScheduledTaskTrigger` (`Install-SweepEmptyDirs.ps1:297`), `New-ScheduledTaskAction` (`Install-SweepEmptyDirs.ps1:296`), `Register-ScheduledTask` (`Install-SweepEmptyDirs.ps1:300`), `Unregister-ScheduledTask` (`Install-SweepEmptyDirs.ps1:267`) — verify each call's parameter shape.
55
+ ```
56
+
57
+ ## What stays put
58
+
59
+ When the identifier is a generic concept (e.g., `if version`, `if FLAG`) rather than a real symbol in the data body, the bullet stays as-written. Citations apply to actual identifiers, not category-shaped placeholders.
60
+
61
+ When the identifier sits in a file the data body doesn't include (e.g., the bullet mentions `os.walk` but the diff doesn't define it), the citation skips that identifier. The skipped citation MUST emit BOTH:
62
+
63
+ 1. An inline gap marker adjacent to the identifier: `(citation unavailable: <reason>)` — so the bullet is not visually identical to a successful citation when read in isolation.
64
+ 2. A gap note via the paste-mode or file-path-mode gap-report mechanism that [`output-contract.md`](output-contract.md) defines for the active emission mode.
65
+
66
+ Both records are required by the [no silent action](output-contract.md#disposition-invariants) invariant: the reader of the bullet alone must see the gap, and the reader of the output as a whole must see the gap.
67
+
68
+ ## Disposition reporting
69
+
70
+ Every outcome emits an action note via the mechanism that [`output-contract.md`](output-contract.md) defines. When citations were added: `> Gap: Citations added — <N> identifier(s) cited at file:line.` When no citation candidates exist: `> Gap: Citation-depth verified — no uncited identifiers found.` When a citation was unavailable: `> Gap: Citation unavailable for "<identifier>" — <reason>.` Silent pass is forbidden — see the [no silent action](output-contract.md#disposition-invariants) invariant.
@@ -0,0 +1,33 @@
1
+ # Surface cleanup
2
+
3
+ The optimized prompt has consistent surface formatting.
4
+
5
+ ## Pass list
6
+
7
+ | Surface | State after cleanup |
8
+ |---|---|
9
+ | Typos in mission, metadata, framework, output spec, or questions | Spelled correctly |
10
+ | Bullet style within a single section | Single style throughout (`-`) |
11
+ | Code block language tags | Every fenced block inside the prompt artifact carries a language tag |
12
+ | Trailing whitespace on lines | Removed |
13
+ | Runs of 3+ blank lines | Collapsed to one blank line |
14
+ | Heading levels | Sequential within each block (no jumps from `#` to `###`) |
15
+
16
+ ## Scope
17
+
18
+ This pass changes surface formatting only. Identifiers, content, and ordering pass through unchanged.
19
+
20
+ ## Typo-correction carve-out
21
+
22
+ Typo fixes apply only to plain-language prose — narrative sentences, mission statements, instructions to the agent, and similar running text. The pass leaves these surfaces untouched even when they look like typos:
23
+
24
+ - Text inside backtick code spans (e.g., `` `mispelled_var` `` stays as-is)
25
+ - Text inside fenced code blocks (any language, any content)
26
+ - Identifiers, file paths, URLs, IDs, SHAs, ID prefixes, proper names
27
+ - Any quoted substring the user could be referencing literally (e.g., `"recieve"` in quotes stays as-is)
28
+
29
+ These surfaces are subject to the byte-for-byte preservation invariant in [`output-contract.md`](output-contract.md). When in doubt about whether a token is prose or a literal reference, leave it unchanged.
30
+
31
+ ## Disposition reporting
32
+
33
+ Every surface-formatting change emits an action note via the mechanism that [`output-contract.md`](output-contract.md) defines (e.g., `> Gap: Typo corrected in mission line — "recieve" → "receive".`, `> Gap: Code block language tag added — python.`). When the surface pass makes zero changes, emit a single note: `> Gap: Surface cleanup verified — no formatting issues found.` Silent pass is forbidden — see the [no silent action](output-contract.md#disposition-invariants) invariant.
@@ -0,0 +1,33 @@
1
+ # Narrative directives → measurable criteria
2
+
3
+ Every narrative directive in the optimized prompt names a measurable criterion.
4
+
5
+ ## Detection patterns
6
+
7
+ A narrative directive opens with a soft verb:
8
+ - "Try to `<X>`"
9
+ - "Look at `<X>`"
10
+ - "Make sure to `<X>`"
11
+ - "Consider `<X>`"
12
+ - "Be sure to `<X>`"
13
+ - "Think about `<X>`"
14
+
15
+ ## Transformation
16
+
17
+ Rewrite each narrative directive as a hard constraint with a measurable criterion.
18
+
19
+ | Narrative input | Constraint output |
20
+ |---|---|
21
+ | "Try to be concise" | "Output ≤ 200 words." |
22
+ | "Look at the security aspects" | "Inspect: input validation, auth checks, secret handling." |
23
+ | "Make sure to verify" | "Verify each claim against the source. Cite file:line." |
24
+ | "Consider edge cases" | "Enumerate: empty input, max-size input, concurrent input, malformed input." |
25
+ | "Think about performance" | "Report wall-clock cost and memory cost for each candidate." |
26
+
27
+ ## Omission carve-out
28
+
29
+ When a narrative directive resists rewriting without inventing scope the original prompt did not authorize, omit the directive from the rewritten prompt AND emit a gap note that records both the omitted directive verbatim and the reason it could not be made measurable (e.g., `> Gap: Omitted directive "Consider the edge cases" — no measurable criterion authorized by the source.`). The gap note routes through the paste-mode or file-path-mode gap-report mechanism that [`output-contract.md`](output-contract.md) defines for the active emission mode. Silent omission is forbidden — see the [no silent no-op](output-contract.md#disposition-invariants) invariant.
30
+
31
+ ## Cross-spoke deduplication
32
+
33
+ When the [`directives.md`](directives.md) spoke has already produced identical measurable criteria (e.g., both spokes derive the same surface enumeration from overlapping input), the constraints spoke does not emit a duplicate output line. Instead it reports a merged gap note (e.g., `> Gap: Narrative directive "Try to find" merged with directives output — both derived the same measurable criteria "Inspect: SQL injection, XSS, auth issues."`). The gap note records the deduplication, satisfying the [no silent action](output-contract.md#disposition-invariants) invariant without emitting a duplicate line that the rewritten prompt would carry twice.
@@ -0,0 +1,37 @@
1
+ # Performance directives → measurable constraints
2
+
3
+ Every performance directive in the optimized prompt maps to a measurable constraint or a specific scope.
4
+
5
+ ## Detection patterns
6
+
7
+ Common performance directives:
8
+ - "Take a deep breath"
9
+ - "Think step by step" / "Let's think step by step"
10
+ - "You are an expert"
11
+ - "Be thorough"
12
+ - "Be comprehensive"
13
+ - "Be careful" / "carefully"
14
+ - "Do your best"
15
+ - "Please"
16
+ - "Kindly"
17
+
18
+ ## Transformation
19
+
20
+ Each directive maps to a measurable constraint or to omission:
21
+
22
+ | Directive | Replacement |
23
+ |---|---|
24
+ | "Be thorough" | A surface enumeration. e.g., "Inspect: input validation, auth, secret handling." |
25
+ | "Be comprehensive" | A count target. e.g., "Produce at least 8 findings." |
26
+ | "Be careful" / "carefully" | A locator requirement. e.g., "Cite file:line for every claim." |
27
+ | "Think step by step" / "Let's think step by step" | omitted |
28
+ | "Take a deep breath" | omitted |
29
+ | "Please" / "Kindly" | omitted |
30
+ | "You are an expert" | omitted (covered by the mission line) — unless the persona spoke's creative-writing carve-out preserved the role line intact, in which case leave "You are an expert" in place |
31
+ | "Do your best" | omitted |
32
+
33
+ Every transformation outcome — whether the directive was mapped to a measurable constraint or omitted — MUST emit an action note recording what changed via the mechanism that [`output-contract.md`](output-contract.md) defines (e.g., `> Gap: Directive "Be thorough" replaced with surface enumeration "Inspect: input validation, auth, secret handling."` or `> Gap: Directive "Take a deep breath" omitted — no measurable equivalent.`). See the [no silent action](output-contract.md#disposition-invariants) invariant.
34
+
35
+ ## Show-reasoning carve-out
36
+
37
+ "Think step by step" stays intact when the prompt explicitly requires the agent to show its reasoning chain in the output. The carve-out MUST emit a gap note via the paste-mode or file-path-mode mechanism that [`output-contract.md`](output-contract.md) defines. See the [no silent no-op](output-contract.md#disposition-invariants) invariant.
@@ -0,0 +1,72 @@
1
+ # Worked examples
2
+
3
+ Each example shows an input prompt and the rewritten output, with a note on which spokes fire.
4
+
5
+ ## Example 1: Code-audit prompt with full diff
6
+
7
+ **Input shape**
8
+ - Mission, metadata, large 4-file diff, sub-bucket framework (A1-A7), cross-bucket questions, output spec — in that order.
9
+
10
+ **Spokes that fire**
11
+ - [`structure.md`](structure.md): the diff sits between metadata and framework; relocate to the end.
12
+
13
+ **Rewritten ordering**
14
+ 1. Mission
15
+ 2. Metadata
16
+ 3. Framework (A1-A7)
17
+ 4. Cross-bucket questions
18
+ 5. Output spec
19
+ 6. Diff (all four files contiguous at the end)
20
+
21
+ ## Example 2: Persona-led generic prompt
22
+
23
+ **Input**
24
+ > You are a senior security engineer. Be thorough and review this code carefully. Try to find SQL injection, XSS, and auth issues.
25
+ >
26
+ > ```python
27
+ > # ... code block ...
28
+ > ```
29
+
30
+ **Spokes that fire**
31
+ - [`persona.md`](persona.md): "You are a senior security engineer" → mission line.
32
+ - [`directives.md`](directives.md): "Be thorough" → surface enumeration; "carefully" → locator requirement.
33
+ - [`constraints.md`](constraints.md): "Try to find" → measurable criteria.
34
+ - [`structure.md`](structure.md): code block present → verifies ordering, emits gap note.
35
+
36
+ **Rewritten output**
37
+ > Audit this code for security issues.
38
+ > Inspect: SQL injection, XSS, auth issues.
39
+ > Cite file:line for every finding.
40
+ > ```python
41
+ > # ... code block ...
42
+ > ```
43
+ >
44
+ > The rewritten prompt carries these `> Gap:` lines recording every spoke that fired (per the [no silent action](output-contract.md#disposition-invariants) invariant):
45
+ > `> Gap: Persona transformed — original "You are a senior security engineer" replaced with mission "Audit this code for security issues."`
46
+ > `> Gap: Directive "Be thorough" replaced with surface enumeration "Inspect: SQL injection, XSS, auth issues."`
47
+ > `> Gap: Directive "carefully" replaced with locator requirement "Cite file:line for every finding."`
48
+ > `> Gap: Narrative directive "Try to find" merged with directives output — both derived the same measurable criteria "Inspect: SQL injection, XSS, auth issues."`
49
+ > `> Gap: Structural ordering verified — input already in canonical sequence.`
50
+
51
+ ## Example 3: Multi-category framework without disposition
52
+
53
+ **Input shape**
54
+ - Framework names 5 categories. No per-category requirement on emission.
55
+
56
+ **Spokes that fire**
57
+ - [`per-category.md`](per-category.md): insert canonical disposition line under the category list header.
58
+
59
+ **Inserted line**
60
+ > Each category returns either at least one finding with a locator OR exactly one proof-of-absence with at least 3 adversarial probes specific to that category. A category returning neither is a protocol gap.
61
+
62
+ ## Example 4: Already-optimized prompt
63
+
64
+ **Input**
65
+ - Mission first, framework before data body, persona absent, multi-category disposition present, no soft directives, code block tagged.
66
+
67
+ **Spokes that fire**
68
+ - [`structure.md`](structure.md): code block present → verifies ordering, emits `> Gap:` note recording the check.
69
+ - [`per-category.md`](per-category.md): multi-category framework present → confirms disposition line exists, emits `> Gap:` note.
70
+
71
+ **Rewritten output**
72
+ - Identical to input save for the appended gap notes from structure and per-category.
@@ -0,0 +1,51 @@
1
+ # Fill placeholders with real values
2
+
3
+ Some prompts ship as templates with placeholder tokens. The skill replaces those with concrete values pulled from the rubric, the companion artifact, or the user.
4
+
5
+ ## Detection patterns
6
+
7
+ A placeholder is any bracketed token whose content reads as instructional rather than a literal name. Common shapes:
8
+
9
+ - `[REPO/ARTIFACT]`
10
+ - `[TARGET ID]`
11
+ - `[N]`
12
+ - `[ARTIFACT METADATA]`
13
+ - `[INLINE THE FULL ARTIFACT HERE — do not ask the agent to fetch.]`
14
+ - `[List the supported …]`
15
+ - `[Declared minimum …]`
16
+ - `[file:line / paragraph]`
17
+ - `[A1]–[AN]`, `[B1]–[BN]`, etc.
18
+
19
+ ## Procedure
20
+
21
+ 1. Find every placeholder in the prompt.
22
+ 2. For each placeholder, look up the value via [`research.md`](research.md).
23
+ 3. Replace the placeholder with the real value.
24
+ 4. For placeholders matching `[INLINE THE FULL ARTIFACT HERE …]` (any placeholder that opens with `INLINE THE FULL ARTIFACT`, including the long-form `[INLINE THE FULL ARTIFACT HERE — do not ask the agent to fetch.]`), the artifact's text comes from one of the sources [`research.md`](research.md) enumerates — a local file the user named when invoking in file-path mode, a sibling artifact the rubric points at, content the user pasted alongside the prompt, or a path the user supplied via AskUserQuestion. Inline that text as fenced code blocks, using each file's path as a `###` heading above its fenced block. The skill never reaches outside those sources for retrieval; when none of them yields the artifact, the spoke leaves the placeholder in place and records a gap per [`output-contract.md`](output-contract.md).
25
+
26
+ ## When the rubric points at a sibling prompt
27
+
28
+ Rubric files often say "use category-X.md as the canonical worked example." When that happens:
29
+
30
+ 1. Read the sibling prompt.
31
+ 2. Copy the sibling's data body — the inlined artifact — into this prompt's data body.
32
+ 3. Sharpen this prompt's sub-bucket bullets so they cite the identifiers in the data body that match this category's axes.
33
+ 4. Keep the category-specific phrasing intact. Only the data body and the per-bucket bullets that reference data-body content change.
34
+
35
+ ## Sub-buckets that have nothing to find in the data body
36
+
37
+ When the data body holds nothing that fits a particular sub-bucket (e.g., a SQL sub-bucket and a diff with no SQL), that sub-bucket stays as a proof-of-absence shape. Spell out three adversarial probes the agent runs to confirm zero relevant content. Use the sub-bucket bullets to name the things the agent searches for.
38
+
39
+ ## What stays put
40
+
41
+ These elements pass through untouched:
42
+
43
+ - The mission's category name (e.g., "Category B only") — derived from the file name, not the artifact
44
+ - The per-category disposition statement
45
+ - The cross-bucket question structure (Q1, Q2, Q3 by name)
46
+ - The output spec's lead format (`Total: N (P0=N, P1=N, P2=N)`)
47
+ - The adversarial-pass count and severity tier — handled by [`adversarial-tuning.md`](adversarial-tuning.md) when the noun needs sharpening; the count and tier values come from the original prompt's own adversarial phrase, not a fixed default
48
+
49
+ ## Disposition reporting
50
+
51
+ Every outcome emits an action note via the mechanism that [`output-contract.md`](output-contract.md) defines. When placeholders were filled: `> Gap: Placeholders instantiated — <N> placeholders replaced with real values.` When no placeholders exist: `> Gap: Instantiation verified — no placeholder tokens found.` When a placeholder could not be resolved: `> Gap: Placeholder "<token>" left in place — no real value found in available sources.` Silent pass is forbidden — see the [no silent action](output-contract.md#disposition-invariants) invariant.
@@ -0,0 +1,72 @@
1
+ # Output contract
2
+
3
+ The skill emits exactly one artifact: the rewritten prompt. The emission shape depends on how the input arrived.
4
+
5
+ ## Emission modes
6
+
7
+ **Paste mode** — input arrives as the user's message body or as a fenced block within it. Emit one fenced block containing the rewritten prompt. Choose a fence length that is strictly longer than the longest consecutive backtick run anywhere in the rewritten prompt (i.e., `max_backtick_run + 1`, with a minimum of four backticks). This ensures no inner fence in the rewritten prompt can prematurely close the outer fence — including cases where the input already used a 4+ backtick wrapper:
8
+
9
+ ``````
10
+ `````
11
+ <rewritten prompt, which may itself contain 4-backtick fences>
12
+ `````
13
+ ``````
14
+
15
+ **File-path mode** — input arrives as a file path argument (e.g., `/structure-prompt path/to/file.md`). File-path mode targets Markdown prompt artifacts; rewriting non-Markdown files is not supported. Rewrite the file in place. Emit a confirmation that names the file, gives the line-count delta, and lists the spokes that fired. When gaps exist, the confirmation also lists them — the output may span multiple lines.
16
+
17
+ ## Disposition invariants
18
+
19
+ **No silent action** (also referenced as "no silent no-op"). Every spoke that fires MUST record its action. Two cases use the same `> Gap:` mechanism:
20
+
21
+ - **Deferred.** The spoke elected not to apply its transformation — missing source, ambiguous detection, fallback to user input, carve-out match, or any other reason. The gap note records what was deferred and why.
22
+ - **Applied.** The spoke successfully applied its transformation. The gap note records what changed (e.g., persona transformed, directive replaced, citation added) so the reader can detect the change.
23
+
24
+ Silent omission is never the correct disposition in either case. The reader of the output must always be able to detect which spokes fired, which deferred, and why.
25
+
26
+ ## Preservation invariants
27
+
28
+ Two clauses govern what the rewritten prompt may change.
29
+
30
+ **Existing input content is preserved byte-for-byte.** The rewrite must not alter any of these values when they already appear in the input:
31
+
32
+ - Identifiers (variable names, function names, file paths)
33
+ - IDs and SHAs
34
+ - ID prefixes
35
+ - Proper names (people, products, services)
36
+ - Numeric values (line numbers, thresholds, counts)
37
+ - URLs
38
+ - Code block contents
39
+
40
+ **New numeric criteria are additive content.** When a spoke introduces a new measurable threshold (e.g., the `≥3` adversarial probes from [`per-category.md`](per-category.md), the citation-occurrence cutoffs from [`citation-depth.md`](citation-depth.md), or any new word/probe/count limit), that number is sourced per the authorized-additions list below. New numeric criteria augment the prompt; they never overwrite a numeric value the input already carries.
41
+
42
+ ## Idempotency
43
+
44
+ Output stabilizes by the second invocation: the second and all subsequent invocations produce identical output (i.e., `f(f(x)) == f(f(f(x)))`). On the first invocation, content-mutating spokes (persona, cleanup, directives, constraints, adversarial-tuning, instantiation, citation-depth, canonical-case) apply their transformations and emit "applied" gap notes alongside situation-dependent spokes (structure, per-category) that re-fire because their input conditions still hold. On the second invocation, those mutating spokes no longer match their detection conditions (placeholders substituted, identifiers cited, markers present, noun sharpened, canonical sub-bucket marked), so their gap notes disappear and situation-dependent notes shift to "verified" wording. Combined with the gap-report block's deterministic replacement, the second invocation's output is stable: a third invocation produces identical output.
45
+
46
+ ## Authorized additions
47
+
48
+ The skill adds content only when a spoke explicitly authorizes it. Evidence-required additions (cited values from the rubric, placeholder values from the input or user) must also pass [`research.md`](research.md) confirmation that the new content matches a real source (rubric, sibling artifact, user-pasted context, or AskUserQuestion answer). Skill-defined additions (the per-category disposition line, surface-formatting cleanup, the failure-mode noun from the adversarial-tuning built-in lookup table) are authorized by their spoke firing alone. The authorized additions are:
49
+
50
+ - The mission line, when [`persona.md`](persona.md) replaces a role assignment
51
+ - The per-category disposition line, when [`per-category.md`](per-category.md) detects an unenforced framework
52
+ - Measurable criteria, when [`directives.md`](directives.md) or [`constraints.md`](constraints.md) replaces a soft directive
53
+ - Real values in place of placeholders, when [`instantiation.md`](instantiation.md) fires
54
+ - `file:line` citations on identifier mentions, when [`citation-depth.md`](citation-depth.md) fires
55
+ - The ⭐ canonical-case marker on one sub-bucket, when [`canonical-case.md`](canonical-case.md) fires
56
+ - A category-specific failure-mode noun in the adversarial-pass phrase, when [`adversarial-tuning.md`](adversarial-tuning.md) fires
57
+ - Surface-formatting normalization (typo correction, single bullet style, language tags on fenced blocks, trimmed trailing whitespace, collapsed blank-line runs, sequential heading levels), when [`cleanup.md`](cleanup.md) fires
58
+ - `(citation unavailable: <reason>)` inline markers adjacent to unciteable identifiers, when [`citation-depth.md`](citation-depth.md) fires
59
+
60
+ Skill-defined additions (the per-category disposition line, surface-formatting cleanup, the failure-mode noun from [`adversarial-tuning.md`](adversarial-tuning.md)'s built-in lookup table) are authorized by their spoke firing alone — they do not need an external source. For evidence-required additions (cited values from the rubric, placeholder values from the input or user), [`research.md`](research.md) confirms the new content matches a real source. When evidence is missing for an evidence-required addition, the spoke leaves the prompt as-is and reports the gap. For a skill-defined addition, once the spoke's detection conditions are met the transformation fires and always emits an action note recording what changed — the spoke does not need external evidence beyond its own rubric, unlike evidence-required additions. (Skill-defined additions are still situation-dependent per the routing table; "fires" here means when the spoke is active, not on every invocation.) The "No silent action" invariant applies to both applied and deferred outcomes. The gap-report shape depends on emission mode:
61
+
62
+ - **Paste mode.** The fenced block contains exactly the rewritten prompt — no footer follows it. Record gaps inside the fenced block as a final blockquoted note prefixed `> Gap:` (one line per gap). The note sits below the rewritten prompt's last block and remains inside the fence. On a second invocation, prior-run `> Gap:` lines are deterministically replaced (not accumulated): the current run's gap notes overwrite any prior-run gap notes, ensuring idempotent output across invocations. The passthrough rule in [`block-classification.md`](block-classification.md) step 3 still treats the prior-run gap region as inert during block tagging, but the current run's gap line emission replaces rather than appends.
63
+ - **File-path mode.** The rewritten file on disk MUST be self-describing for gaps. Append a final HTML comment block at the bottom of the file. The block opens with `<!-- gap-report:` on its own line, contains one `> Gap:` line per gap, and closes with `-->` on its own line. The `<!-- gap-report:` block is deterministically replaced (never accumulated) to reflect the current run's gap state. When the current run has gaps, a new `<!-- gap-report:` block containing the gap lines overwrites any prior block. When the current run has no gaps, any prior block is replaced with `<!-- gap-report: none -->` — the file always carries a self-describing gap-report block so a reader can determine the latest run's gap state without external context. Example for a run with two gaps:
64
+
65
+ ```
66
+ <!-- gap-report:
67
+ > Gap: Persona transformed — original "You are an expert code reviewer" replaced with mission "Find bugs in this code."
68
+ > Gap: canonical-case marker skipped — framework has 5+ sub-buckets but rubric match, bullet density, and identifier density found no clear canonical case
69
+ -->
70
+ ```
71
+
72
+ The post-edit confirmation message that names the file and the spokes that fired ALSO lists the same gaps, but the file itself is now self-describing — a reader of the file alone can detect which spokes deferred and why.
@@ -0,0 +1,23 @@
1
+ # Per-category disposition
2
+
3
+ Every multi-category framework requires each category to emit exactly one disposition:
4
+ - At least one positive finding with a locator (file:line, section ID, line number, or equivalent) per category
5
+ - Exactly one explicit proof-of-absence with at least 3 adversarial probes specific to that category
6
+
7
+ ## Detection
8
+
9
+ The framework names 2+ categories, surfaces, sub-buckets, items, checks, or criteria the agent processes.
10
+
11
+ ## Insertion
12
+
13
+ Insert this exact line directly under the category list header, substituting `<category-noun>` with whatever the prompt calls them (sub-bucket, surface, item, category, check, criterion):
14
+
15
+ > Each `<category-noun>` returns either at least one finding with a locator OR exactly one proof-of-absence with at least 3 adversarial probes specific to that `<category-noun>`. A `<category-noun>` returning neither is a protocol gap.
16
+
17
+ ## Idempotency
18
+
19
+ When the framework already states an equivalent requirement (positive finding OR proof-of-absence with ≥3 probes), leave it intact. Insert only when the requirement is absent or weaker than the canonical form.
20
+
21
+ ## Disposition reporting
22
+
23
+ Every outcome emits an action note via the mechanism that [`output-contract.md`](output-contract.md) defines. When the disposition line was inserted: `> Gap: Per-category disposition line inserted under category list header.` When the framework already carries the canonical form: `> Gap: Per-category disposition verified — canonical form already present.` Silent omission is forbidden — see the [no silent action](output-contract.md#disposition-invariants) invariant.
@@ -0,0 +1,38 @@
1
+ # Persona transformation
2
+
3
+ Lead the optimized prompt with what the agent does, not who the agent is.
4
+
5
+ ## Detection patterns
6
+
7
+ The persona block matches any of:
8
+ - "You are a/an `<role>`"
9
+ - "You are an expert in/at `<topic>`"
10
+ - "You are a helpful assistant"
11
+ - "Act as `<role>`"
12
+ - "Pretend to be `<role>`"
13
+ - "Imagine you are `<role>`"
14
+ - "As a/an `<role>`, …"
15
+ - "Role: `<role>`"
16
+
17
+ ## Transformation
18
+
19
+ Replace the persona line with a single mission sentence stating the task in imperative form.
20
+
21
+ | Persona input | Mission output |
22
+ |---|---|
23
+ | "You are a senior security engineer. Review this PR." | "Audit this PR for security issues." |
24
+ | "Act as a code reviewer and find bugs in this code." | "Find bugs in this code." |
25
+ | "You are an expert at SQL. Write a query that…" | "Write a SQL query that…" |
26
+
27
+ ## Creative-writing carve-out
28
+
29
+ The persona line stays intact when the prompt explicitly references one of these output qualities: `style`, `tone`, `voice`, `fiction`, `creative writing`, `narrative`. In that case the persona shapes the output's character and the mission line follows it.
30
+
31
+ ## Disposition reporting
32
+
33
+ The persona pass MUST emit a gap note via the paste-mode or file-path-mode gap-report mechanism that [`output-contract.md`](output-contract.md) defines, recording one of two dispositions:
34
+
35
+ - `> Gap: Persona transformed — original "<persona line>" replaced with mission "<mission line>".`
36
+ - `> Gap: Persona preserved (creative-writing carve-out matched: "<matched keyword>").`
37
+
38
+ When none of the six carve-out keywords appears in the input, the persona line is always transformed. The detection is deterministic: a case-insensitive match against the six listed keywords only. No subjective "near-miss" or "intent" judgment applies. See the [no silent action](output-contract.md#disposition-invariants) invariant.
@@ -0,0 +1,33 @@
1
+ # When the skill needs information that isn't in the input
2
+
3
+ Some spokes need information the input prompt doesn't include — like the line number where an identifier lives, the canonical example for a category, or the real value to put where a placeholder sits. This file describes how to find that information from real sources.
4
+
5
+ ## Where to look, in order
6
+
7
+ 1. **The sibling rubric file.** When the calling framework provides a companion rubric (typically at `../category_rubrics/<same-name>.md` in audit-rubric layouts, but the path is framework-specific), read it first. The rubric often spells out the canonical example, the instantiation recipe, and the category-specific failure-mode noun. When no sibling rubric exists for the input prompt, skip this source and proceed to the companion artifact.
8
+
9
+ 2. **The companion artifact.** When the rubric points at a sibling prompt as a worked example (e.g., "see `category-a-api-contracts.md` for the canonical diff"), read that sibling and use its diff or framework as the reference.
10
+
11
+ 3. **The user-supplied context.** When the user pasted an artifact alongside the prompt — a diff, a PR URL, a file dump — use it directly.
12
+
13
+ 4. **AskUserQuestion.** When the three sources above turn up nothing, ask the user via the AskUserQuestion tool. Phrase the question around the specific blocker (e.g., "Which artifact should I instantiate against?") and offer two to four concrete options.
14
+
15
+ ## What counts as evidence
16
+
17
+ A change earns its place in the rewritten prompt when one of these is true:
18
+ - The rubric file states it
19
+ - The sibling artifact contains it (the line number is real, the identifier sits in the diff)
20
+ - The user-pasted context contains it (the value sits in the prompt body the user supplied, in a fenced block within it, or in an artifact the user pasted alongside the prompt)
21
+ - The user supplied it via an AskUserQuestion answer
22
+
23
+ When none of the four holds, the spoke leaves the prompt as-is and notes the gap in the location [`output-contract.md`](output-contract.md) defines for the active emission mode. The deferral itself is mandatory — see the [no silent no-op](output-contract.md#disposition-invariants) invariant.
24
+
25
+ ## Tone of the AskUserQuestion
26
+
27
+ Use everyday phrasing. Tell the user what's blocked and what answers would unblock it.
28
+
29
+ | What the spoke needs | Question shape |
30
+ |---|---|
31
+ | Which PR or artifact to instantiate against | "I have placeholders in the prompt. Which artifact should I fill them with?" |
32
+ | Which scope of source material to inline | "Should I inline the full diff, the changed files only, or specific paths?" |
33
+ | Which sub-bucket is the canonical case | "The framework has six similarly-weighted sub-buckets. Which one is the canonical case for this category?" |
@@ -0,0 +1,28 @@
1
+ # Structural ordering
2
+
3
+ The optimized prompt presents blocks in this fixed sequence:
4
+
5
+ 1. Mission block
6
+ 2. Metadata block
7
+ 3. Framework block
8
+ 4. Questions block
9
+ 5. Output spec block
10
+ 6. Data body block
11
+
12
+ ## Procedure
13
+
14
+ 1. Extract each tagged block from the input. The gap-report region (prior-run `> Gap:` lines or `<!-- gap-report:` comment blocks) is excluded from block ordering — it is kept at the end during classification and reordering, then deterministically replaced during emission per [`output-contract.md`](output-contract.md).
15
+ 2. Concatenate the blocks in the sequence above.
16
+ 3. Preserve every byte of the inputs that [`output-contract.md`](output-contract.md) lists under "Preservation invariants" exactly as supplied.
17
+
18
+ ## Multiple data bodies
19
+
20
+ When the input contains multiple data body blocks (e.g., several file diffs), group them as a contiguous final section in their original relative order.
21
+
22
+ ## Atomicity
23
+
24
+ The framework block stays whole. The data body section sits as one contiguous region at the end.
25
+
26
+ ## Disposition reporting
27
+
28
+ Every outcome emits an action note via the mechanism that [`output-contract.md`](output-contract.md) defines. When blocks were reordered: `> Gap: Blocks reordered to canonical sequence (mission → metadata → framework → questions → output spec → data body).` When the input already follows canonical ordering and no reorder is needed: `> Gap: Structural ordering verified — input already in canonical sequence.` Silent omission is forbidden — see the [no silent action](output-contract.md#disposition-invariants) invariant.