@event4u/agent-config 8.12.0 → 9.0.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 (284) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +164 -0
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/agent-handoff.md +35 -0
  5. package/dist/agent-src/commands/agents/init.md +1 -0
  6. package/dist/agent-src/commands/agents/optimize.md +1 -0
  7. package/dist/agent-src/commands/agents/user/accept.md +3 -2
  8. package/dist/agent-src/commands/agents/user/init.md +5 -4
  9. package/dist/agent-src/commands/agents/user/update.md +3 -2
  10. package/dist/agent-src/commands/agents/user.md +1 -0
  11. package/dist/agent-src/commands/agents.md +1 -0
  12. package/dist/agent-src/commands/analytics/show.md +1 -0
  13. package/dist/agent-src/commands/analytics.md +1 -0
  14. package/dist/agent-src/commands/analyze/decision.md +1 -0
  15. package/dist/agent-src/commands/analyze/incident.md +1 -0
  16. package/dist/agent-src/commands/analyze/near-miss.md +1 -0
  17. package/dist/agent-src/commands/analyze/postmortem.md +1 -0
  18. package/dist/agent-src/commands/analyze/premortem.md +1 -0
  19. package/dist/agent-src/commands/analyze/reference-repo.md +1 -0
  20. package/dist/agent-src/commands/analyze.md +3 -2
  21. package/dist/agent-src/commands/brand/identity.md +6 -5
  22. package/dist/agent-src/commands/brand/review.md +6 -5
  23. package/dist/agent-src/commands/brand/strategy.md +6 -4
  24. package/dist/agent-src/commands/brand/tokens.md +7 -6
  25. package/dist/agent-src/commands/brand/voice.md +5 -4
  26. package/dist/agent-src/commands/brand.md +9 -7
  27. package/dist/agent-src/commands/bug/fix.md +1 -0
  28. package/dist/agent-src/commands/bug/investigate.md +1 -0
  29. package/dist/agent-src/commands/bug.md +2 -1
  30. package/dist/agent-src/commands/challenge-me/vision.md +1 -0
  31. package/dist/agent-src/commands/challenge-me/with-docs.md +1 -0
  32. package/dist/agent-src/commands/challenge-me.md +28 -6
  33. package/dist/agent-src/commands/chat-history.md +1 -0
  34. package/dist/agent-src/commands/check-current-md.md +1 -0
  35. package/dist/agent-src/commands/commit.md +1 -0
  36. package/dist/agent-src/commands/context/create.md +3 -2
  37. package/dist/agent-src/commands/context.md +1 -0
  38. package/dist/agent-src/commands/cost/profile.md +1 -0
  39. package/dist/agent-src/commands/cost.md +2 -1
  40. package/dist/agent-src/commands/council/analysis.md +1 -0
  41. package/dist/agent-src/commands/council/debate.md +1 -0
  42. package/dist/agent-src/commands/council/default.md +21 -20
  43. package/dist/agent-src/commands/council/design.md +1 -0
  44. package/dist/agent-src/commands/council/optimize.md +1 -0
  45. package/dist/agent-src/commands/council/pr.md +1 -0
  46. package/dist/agent-src/commands/council.md +1 -0
  47. package/dist/agent-src/commands/estimate-ticket.md +1 -0
  48. package/dist/agent-src/commands/feature/dev.md +1 -0
  49. package/dist/agent-src/commands/feature/explore.md +1 -0
  50. package/dist/agent-src/commands/feature/plan.md +1 -0
  51. package/dist/agent-src/commands/feature/refactor.md +1 -0
  52. package/dist/agent-src/commands/feature/roadmap.md +1 -0
  53. package/dist/agent-src/commands/feature.md +2 -1
  54. package/dist/agent-src/commands/fix/pr-comments.md +19 -0
  55. package/dist/agent-src/commands/fix.md +2 -1
  56. package/dist/agent-src/commands/ghostwriter/delete.md +1 -0
  57. package/dist/agent-src/commands/ghostwriter/fetch.md +1 -0
  58. package/dist/agent-src/commands/ghostwriter/show.md +1 -0
  59. package/dist/agent-src/commands/ghostwriter/write.md +1 -0
  60. package/dist/agent-src/commands/ghostwriter.md +1 -0
  61. package/dist/agent-src/commands/grill-me.md +17 -12
  62. package/dist/agent-src/commands/humanize.md +1 -0
  63. package/dist/agent-src/commands/image/analyse.md +2 -1
  64. package/dist/agent-src/commands/image/create.md +1 -0
  65. package/dist/agent-src/commands/image/verify.md +1 -0
  66. package/dist/agent-src/commands/image.md +16 -12
  67. package/dist/agent-src/commands/implement-ticket.md +1 -0
  68. package/dist/agent-src/commands/judge/on-diff.md +1 -0
  69. package/dist/agent-src/commands/judge/solo.md +1 -0
  70. package/dist/agent-src/commands/judge/steps.md +1 -0
  71. package/dist/agent-src/commands/judge.md +1 -0
  72. package/dist/agent-src/commands/knowledge/cross-repo.md +1 -0
  73. package/dist/agent-src/commands/knowledge/forget.md +1 -0
  74. package/dist/agent-src/commands/knowledge/ingest.md +1 -0
  75. package/dist/agent-src/commands/knowledge/list.md +10 -0
  76. package/dist/agent-src/commands/knowledge.md +1 -0
  77. package/dist/agent-src/commands/memory/learn-low-impact.md +1 -0
  78. package/dist/agent-src/commands/memory/mine-session.md +1 -0
  79. package/dist/agent-src/commands/memory/promote.md +3 -2
  80. package/dist/agent-src/commands/memory.md +1 -0
  81. package/dist/agent-src/commands/mission/upgrade.md +45 -24
  82. package/dist/agent-src/commands/mode.md +1 -0
  83. package/dist/agent-src/commands/module/create.md +1 -0
  84. package/dist/agent-src/commands/module/explore.md +1 -0
  85. package/dist/agent-src/commands/module.md +1 -0
  86. package/dist/agent-src/commands/optimize/agents-dir.md +1 -0
  87. package/dist/agent-src/commands/optimize/project.md +1 -0
  88. package/dist/agent-src/commands/optimize/prompt.md +1 -0
  89. package/dist/agent-src/commands/optimize.md +2 -1
  90. package/dist/agent-src/commands/orchestrate.md +1 -0
  91. package/dist/agent-src/commands/override.md +1 -0
  92. package/dist/agent-src/commands/package.md +2 -1
  93. package/dist/agent-src/commands/post-as/ghostwriter.md +1 -0
  94. package/dist/agent-src/commands/post-as/me.md +1 -0
  95. package/dist/agent-src/commands/post-as.md +1 -0
  96. package/dist/agent-src/commands/pr/create/description-only.md +1 -0
  97. package/dist/agent-src/commands/pr/create.md +28 -0
  98. package/dist/agent-src/commands/prediction-pool.md +7 -6
  99. package/dist/agent-src/commands/prepare-for-review.md +1 -0
  100. package/dist/agent-src/commands/profile/activate.md +1 -0
  101. package/dist/agent-src/commands/profile/deactivate.md +1 -0
  102. package/dist/agent-src/commands/profile.md +1 -0
  103. package/dist/agent-src/commands/project.md +2 -1
  104. package/dist/agent-src/commands/refine-ticket.md +7 -0
  105. package/dist/agent-src/commands/research/deep.md +1 -0
  106. package/dist/agent-src/commands/research.md +1 -0
  107. package/dist/agent-src/commands/review/routing.md +1 -0
  108. package/dist/agent-src/commands/review.md +2 -1
  109. package/dist/agent-src/commands/roadmap/ai-council.md +1 -0
  110. package/dist/agent-src/commands/roadmap/materialize.md +1 -0
  111. package/dist/agent-src/commands/roadmap/process-full.md +1 -0
  112. package/dist/agent-src/commands/roadmap/process-phase.md +1 -0
  113. package/dist/agent-src/commands/roadmap/process-step.md +1 -0
  114. package/dist/agent-src/commands/roadmap.md +1 -0
  115. package/dist/agent-src/commands/security-audit-config.md +2 -1
  116. package/dist/agent-src/commands/skill/preview.md +1 -0
  117. package/dist/agent-src/commands/skill.md +1 -0
  118. package/dist/agent-src/commands/skills/discover.md +1 -0
  119. package/dist/agent-src/commands/skills.md +1 -0
  120. package/dist/agent-src/commands/sync/agent-settings.md +1 -0
  121. package/dist/agent-src/commands/sync.md +2 -1
  122. package/dist/agent-src/commands/team/adversarial.md +97 -0
  123. package/dist/agent-src/commands/team/delegate.md +110 -0
  124. package/dist/agent-src/commands/team/review.md +85 -0
  125. package/dist/agent-src/commands/team/status.md +123 -0
  126. package/dist/agent-src/commands/team-knowledge.md +8 -6
  127. package/dist/agent-src/commands/team.md +152 -0
  128. package/dist/agent-src/commands/tests/e2e-heal.md +1 -0
  129. package/dist/agent-src/commands/tests/e2e-plan.md +1 -0
  130. package/dist/agent-src/commands/tests/execute.md +1 -0
  131. package/dist/agent-src/commands/tests.md +2 -1
  132. package/dist/agent-src/commands/update-form-request-messages.md +1 -0
  133. package/dist/agent-src/commands/upstream-contribute.md +1 -0
  134. package/dist/agent-src/commands/video/from-script.md +3 -2
  135. package/dist/agent-src/commands/video/from-song.md +22 -21
  136. package/dist/agent-src/commands/video/scene.md +1 -0
  137. package/dist/agent-src/commands/video/stitch.md +2 -1
  138. package/dist/agent-src/commands/video/storyboard.md +1 -0
  139. package/dist/agent-src/commands/video.md +1 -0
  140. package/dist/agent-src/commands/work.md +1 -0
  141. package/dist/agent-src/commands/worktree/cleanup.md +8 -7
  142. package/dist/agent-src/commands/worktree/create.md +1 -0
  143. package/dist/agent-src/commands/worktree/verify.md +1 -0
  144. package/dist/agent-src/commands/worktree.md +1 -0
  145. package/dist/agent-src/rules/active-remediation.md +12 -36
  146. package/dist/agent-src/rules/artifact-drafting-protocol.md +7 -64
  147. package/dist/agent-src/rules/context-hygiene.md +19 -113
  148. package/dist/agent-src/rules/design-fidelity.md +4 -60
  149. package/dist/agent-src/rules/domain-adoption-policy.md +10 -106
  150. package/dist/agent-src/rules/framework-neutrality-in-generic-skills.md +12 -60
  151. package/dist/agent-src/rules/improve-before-implement.md +6 -0
  152. package/dist/agent-src/rules/minimal-safe-diff.md +6 -86
  153. package/dist/agent-src/rules/size-enforcement.md +10 -0
  154. package/dist/agent-src/rules/tool-safety.md +17 -3
  155. package/dist/agent-src/skills/agent-security-review/SKILL.md +12 -1
  156. package/dist/agent-src/skills/ai-council/SKILL.md +11 -0
  157. package/dist/agent-src/skills/bug-analyzer/SKILL.md +24 -2
  158. package/dist/agent-src/skills/code-review/SKILL.md +105 -93
  159. package/dist/agent-src/skills/code-review/checklists/backend.md +50 -0
  160. package/dist/agent-src/skills/code-review/checklists/database.md +19 -0
  161. package/dist/agent-src/skills/code-review/checklists/dependency.md +18 -0
  162. package/dist/agent-src/skills/code-review/checklists/docs.md +14 -0
  163. package/dist/agent-src/skills/code-review/checklists/frontend.md +19 -0
  164. package/dist/agent-src/skills/code-review/checklists/infra.md +17 -0
  165. package/dist/agent-src/skills/code-review/checklists/producing-the-review.md +62 -0
  166. package/dist/agent-src/skills/code-review/checklists/test-only.md +13 -0
  167. package/dist/agent-src/skills/code-review/evals/evals.json +53 -15
  168. package/dist/agent-src/skills/condense-memory/SKILL.md +3 -2
  169. package/dist/agent-src/skills/conventional-commits-writing/evals/evals.json +15 -0
  170. package/dist/agent-src/skills/docker/SKILL.md +10 -0
  171. package/dist/agent-src/skills/docx-authoring/SKILL.md +102 -0
  172. package/dist/agent-src/skills/github-ci/evals/evals.json +25 -0
  173. package/dist/agent-src/skills/humanizer/SKILL.md +79 -3
  174. package/dist/agent-src/skills/humanizer/references/anti-aiisms.md +112 -0
  175. package/dist/agent-src/skills/humanizer/references/fixtures.md +70 -0
  176. package/dist/agent-src/skills/judge-bug-hunter/SKILL.md +7 -1
  177. package/dist/agent-src/skills/laravel/SKILL.md +10 -0
  178. package/dist/agent-src/skills/launch-readiness/SKILL.md +35 -0
  179. package/dist/agent-src/skills/merge-conflicts/SKILL.md +30 -0
  180. package/dist/agent-src/skills/pdf-tools/SKILL.md +101 -0
  181. package/dist/agent-src/skills/quality-tools/evals/evals.json +15 -0
  182. package/dist/agent-src/skills/security-audit/SKILL.md +29 -0
  183. package/dist/agent-src/skills/security-maturity-assessment/SKILL.md +90 -0
  184. package/dist/agent-src/skills/security-maturity-assessment/evals/triggers.json +52 -0
  185. package/dist/agent-src/skills/skill-writing/SKILL.md +79 -0
  186. package/dist/agent-src/skills/spreadsheet-authoring/SKILL.md +11 -3
  187. package/dist/agent-src/skills/subagent-orchestration/schemas/team-review-status.json +103 -0
  188. package/dist/agent-src/skills/terraform/SKILL.md +10 -0
  189. package/dist/agent-src/skills/test-driven-development/SKILL.md +31 -0
  190. package/dist/agent-src/skills/threat-modeling/SKILL.md +15 -0
  191. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  192. package/dist/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
  193. package/dist/agent-src/templates/scripts/telemetry/engagement.ts +30 -0
  194. package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +22 -9
  195. package/dist/agent-src/templates/scripts/telemetry_record.ts +5 -0
  196. package/dist/discovery/deprecation-report.md +1 -1
  197. package/dist/discovery/discovery-manifest.json +378 -174
  198. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  199. package/dist/discovery/discovery-manifest.summary.md +4 -4
  200. package/dist/discovery/orphan-report.md +1 -1
  201. package/dist/discovery/packs.json +16 -8
  202. package/dist/discovery/trust-report.md +3 -3
  203. package/dist/discovery/workspaces.json +14 -6
  204. package/dist/install/install.mjs +46 -0
  205. package/dist/mcp/registry-manifest.json +3 -3
  206. package/dist/router.json +1 -1
  207. package/dist/scripts/condense.js +5 -0
  208. package/dist/scripts/condense.js.map +1 -1
  209. package/dist/server/schemas/settings.js +11 -0
  210. package/dist/server/schemas/settings.js.map +1 -1
  211. package/docs/CLAIMS.md +9 -2
  212. package/docs/SKILL_CENSUS.md +8 -0
  213. package/docs/architecture.md +3 -3
  214. package/docs/benchmark.md +67 -2
  215. package/docs/catalog.md +10 -4
  216. package/docs/command-flows.md +6 -1
  217. package/docs/contracts/ai-council-config.md +9 -2
  218. package/docs/contracts/ai-team-config.md +224 -0
  219. package/docs/contracts/command-clusters.md +1 -0
  220. package/docs/contracts/prelaunch-diagnostics.md +151 -0
  221. package/docs/contracts/release-pr-gating.md +1 -0
  222. package/docs/decisions/ADR-049-configuration-trust-boundary.md +9 -1
  223. package/docs/featured-skills.md +2 -2
  224. package/docs/getting-started-by-role.md +3 -1
  225. package/docs/getting-started.md +42 -1
  226. package/docs/governance-advantage.md +1 -1
  227. package/docs/guidelines/agent-infra/active-remediation-mechanics.md +45 -0
  228. package/docs/guidelines/agent-infra/agent-interaction-and-decision-quality.md +28 -0
  229. package/docs/guidelines/agent-infra/artifact-drafting-protocol-mechanics.md +76 -0
  230. package/docs/guidelines/agent-infra/context-hygiene-mechanics.md +90 -0
  231. package/docs/guidelines/agent-infra/domain-adoption-gates.md +112 -0
  232. package/docs/guidelines/agent-infra/framework-neutrality-patterns.md +66 -0
  233. package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +99 -0
  234. package/docs/guidelines/agent-infra/skill-quality-checklist.md +13 -0
  235. package/docs/guidelines/design-fidelity-mechanics.md +76 -0
  236. package/docs/maintainers/branch-protection.md +18 -0
  237. package/docs/parity/command-frontmatter.md +60 -0
  238. package/docs/proof.md +7 -6
  239. package/package.json +1 -1
  240. package/src/agent-src/templates/scripts/telemetry/aggregator.ts +0 -0
  241. package/src/agent-src/templates/scripts/telemetry/engagement.ts +30 -0
  242. package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +22 -9
  243. package/src/agent-src/templates/scripts/telemetry_record.ts +5 -0
  244. package/src/config/agent-settings.template.yml +71 -7
  245. package/src/config/prelaunch-areas.yml +36 -0
  246. package/src/scripts/_cli/cmd_doctor.ts +288 -1
  247. package/src/scripts/_lib/claude_plugin.ts +114 -4
  248. package/src/scripts/_lib/orchestration_record.ts +5 -0
  249. package/src/scripts/_lib/tool_adapter_registry.ts +120 -0
  250. package/src/scripts/ai_team/config.ts +234 -0
  251. package/src/scripts/ai_team/review_gate.ts +636 -0
  252. package/src/scripts/ai_team/team_dispatch.ts +612 -0
  253. package/src/scripts/bench_ab_task_runner.ts +11 -1
  254. package/src/scripts/bench_parity_count.ts +279 -0
  255. package/src/scripts/build_linear_digest.ts +3 -1
  256. package/src/scripts/check_bridge_derivation.ts +172 -0
  257. package/src/scripts/check_consumer_scope_flip.ts +179 -0
  258. package/src/scripts/check_council_config_location.ts +115 -15
  259. package/src/scripts/check_host_loadability.ts +81 -0
  260. package/src/scripts/condense.ts +5 -0
  261. package/src/scripts/hook_manifest.yaml +12 -1
  262. package/src/scripts/install.ts +39 -0
  263. package/src/scripts/lint_handoffs.ts +42 -0
  264. package/src/scripts/lint_skill_descriptions.ts +228 -0
  265. package/src/scripts/lint_skill_descriptions_allowlist.json +1 -0
  266. package/src/scripts/lint_skill_scripts_readonly.ts +145 -0
  267. package/src/scripts/lint_skill_scripts_readonly_allowlist.json +8 -0
  268. package/src/scripts/lint_supported_tools_matrix.ts +35 -0
  269. package/src/scripts/optimize_skill_description.ts +144 -0
  270. package/src/scripts/orchestration_record.ts +2 -1
  271. package/src/scripts/prelaunch_diagnostics.ts +248 -0
  272. package/src/scripts/rule_backlinks.ts +0 -0
  273. package/src/scripts/run_skill_evals.ts +70 -4
  274. package/src/scripts/schemas/command.schema.json +7 -0
  275. package/src/scripts/schemas/evals.schema.json +105 -14
  276. package/src/scripts/schemas/prelaunch-report.schema.json +107 -0
  277. package/src/scripts/schemas/skill.schema.json +18 -1
  278. package/src/scripts/schemas/subagent.schema.json +6 -0
  279. package/src/scripts/skill_linter.ts +43 -3
  280. package/src/scripts/smoke_host_loadability.sh +73 -0
  281. package/src/scripts/team_review_gate_hook.ts +115 -0
  282. package/src/scripts/trigger_eval_grandfather.json +1 -2
  283. package/src/scripts/utilization_report.ts +225 -0
  284. package/src/server/schemas/settings.ts +25 -0
@@ -43,6 +43,27 @@ For each conflicted file:
43
43
  3. **Understand "theirs"** — what does the incoming branch intend?
44
44
  4. **Check if both changes are needed** — often both sides added different things.
45
45
 
46
+ ### 2b. Merge Resolution Plan — mandatory before touching a conflict
47
+
48
+ After reading both sides, write the plan; under `autonomous-execution` the
49
+ approval gate applies (a standing mandate states the plan and proceeds; an
50
+ interactive session surfaces it and waits):
51
+
52
+ ```
53
+ ## Merge Resolution Plan
54
+ - Conflicts: {N files / M hunks}
55
+ - Execution order: {dependency leaves first — a file nothing else imports
56
+ resolves before the files that import it}
57
+ | file | strategy | rationale |
58
+ |---|---|---|
59
+ - Decisions needed from the user: {semantic/deleted-modified items, or none}
60
+ - Validation: {targeted checks to run after resolution}
61
+ ```
62
+
63
+ **Backup before resolution:** every deleted-modified file is copied to a
64
+ temp path (`$TMPDIR/merge-backup-<ts>/<file>`) and the path noted in the
65
+ plan BEFORE any resolution touches it.
66
+
46
67
  ### 3. Resolution strategies
47
68
 
48
69
  | Situation | Strategy |
@@ -54,6 +75,8 @@ For each conflicted file:
54
75
  | Migration conflicts (same timestamp) | **Rename** — adjust timestamp to avoid collision |
55
76
  | Auto-generated files (OpenAPI spec, baselines) | **Regenerate** — resolve source, then regenerate the output |
56
77
  | Formatting-only conflicts | **Accept either** — then run quality tools to normalize |
78
+ | Import-block conflicts (both sides added imports) | **Keep both** — union the imports, drop duplicates, let the linter order them |
79
+ | Binary files (images, archives, compiled assets) | **Pick one side whole** — never splice; regenerate from source if generated, else ask which side wins |
57
80
 
58
81
  ### 4. File-type specific rules (stack-aware)
59
82
 
@@ -104,6 +127,13 @@ For each conflicted file:
104
127
  - Import statement ordering
105
128
  - Formatting-only differences
106
129
 
130
+ ### 5b. Resolution log — one line per conflict
131
+
132
+ Every resolved conflict gets a one-line explanation ("kept both — additive
133
+ imports"; "took theirs — lockfile regenerated") collected into the final
134
+ summary: the auditable log the reviewer reads instead of re-deriving each
135
+ hunk decision.
136
+
107
137
  ### 6. Verify after resolution
108
138
 
109
139
  After resolving ALL conflicts:
@@ -0,0 +1,101 @@
1
+ ---
2
+ model_tier: medium
3
+ name: pdf-tools
4
+ description: "Use when creating, merging, splitting, filling, or extracting from a PDF — library-per-task, output validated. Triggers on 'merge these PDFs', 'fill this PDF form', 'split the PDF', 'create a PDF'."
5
+ status: active
6
+ tier: senior
7
+ domain: process
8
+ compatibility: "Requires consumer-installed PDF libraries: pypdf (merge/split/rotate/encrypt/extract), reportlab (create), a form library for AcroForm fill; an OCR engine (e.g. tesseract) only for the OCR task. No LibreOffice dependency. Ships zero runtime in this package."
9
+ workspaces:
10
+ - agent-config-maintainer
11
+ packs:
12
+ - meta
13
+ ---
14
+
15
+ # pdf-tools
16
+
17
+ Wing-1 engineering skill for **PDF write/transform** — `markitdown` reads a PDF
18
+ to Markdown; this creates, merges, fills, and extracts. Ships zero runtime: the
19
+ agent drives libraries the consumer has. Pattern re-implementation only.
20
+
21
+ ## When to use
22
+
23
+ - "Merge / split / rotate / encrypt these PDFs."
24
+ - "Fill this PDF form (AcroForm) with these values."
25
+ - "Create a PDF from this content."
26
+ - "Extract the text / tables from this PDF" (structured extraction beyond `markitdown`'s Markdown).
27
+ - "OCR this scanned PDF."
28
+
29
+ Do NOT use for: PDF → Markdown ingestion (`markitdown`); Word (`docx-authoring`).
30
+
31
+ ## Procedure
32
+
33
+ ### 1. Library per task — do not force one tool
34
+
35
+ | Task | Library path |
36
+ |---|---|
37
+ | merge / split / rotate / encrypt | pypdf — page-level operations, no rendering |
38
+ | create from content | reportlab (canvas / platypus) |
39
+ | form-fill (AcroForm) | a form-aware library; map field name → value, then flatten if the form must not be re-editable |
40
+ | text / table extraction | a text-layer extractor; tables need a layout-aware pass, not naive text |
41
+ | OCR (scanned/image PDF) | an OCR engine over rasterized pages — ONLY when there is no text layer |
42
+
43
+ ### 2. Decide flatten-or-keep on form fills
44
+
45
+ A filled AcroForm stays editable unless flattened. Flatten when the PDF is a
46
+ final artifact (an invoice, a signed form); keep fields when the recipient must
47
+ edit further. State which you chose — a silently-editable "final" form is a
48
+ correctness bug.
49
+
50
+ ### 3. Validate — assert output validity, do not trust the write
51
+
52
+ 1. Re-open the output with pypdf; assert `len(reader.pages)` matches the expected count (merge = sum; split = 1 per part).
53
+ 2. For a form-fill: read back one field value (pre-flatten) or extract the rendered text (post-flatten) and assert the value is present.
54
+ 3. For create: assert the file opens and page 1 carries expected text.
55
+
56
+ ## Output format
57
+
58
+ 1. The output PDF path(s).
59
+ 2. Validation: page count matches expected ✅, read-back value/text present ✅.
60
+ 3. For fills: flatten decision stated (flattened / kept-editable + why).
61
+
62
+ ## Gotcha
63
+
64
+ **OCR is a last resort, not the default extraction path.** Running OCR over a
65
+ PDF that already has a text layer produces worse output (OCR errors) than the
66
+ existing text and burns time. Check for a text layer first; OCR only when it is
67
+ genuinely absent.
68
+
69
+ - **Editable "final" form:** a filled AcroForm left un-flattened ships as a "signed invoice" the recipient can silently alter → flatten when the artifact is final.
70
+
71
+ ## Do NOT
72
+
73
+ - Do NOT bundle a Python toolkit in this package — drive the consumer's libraries (zero-runtime posture).
74
+ - Do NOT OCR a PDF that has a text layer.
75
+ - Do NOT leave a "final" filled form editable without saying so.
76
+ - Do NOT claim success on "file written"; claim it only after the re-open + page-count assertion.
77
+
78
+ ## Related Skills
79
+
80
+ **WHEN to use this**
81
+
82
+ - The task creates, merges, splits, rotates, encrypts, or form-fills a PDF.
83
+ - Structured text/table extraction beyond `markitdown`'s Markdown, or OCR of a scanned PDF.
84
+
85
+ **WHEN NOT to use this**
86
+
87
+ - PDF → Markdown ingestion → [`markitdown`](../markitdown/SKILL.md).
88
+ - Word documents → [`docx-authoring`](../docx-authoring/SKILL.md); spreadsheets → [`spreadsheet-authoring`](../spreadsheet-authoring/SKILL.md).
89
+
90
+ ## When the agent should load this
91
+
92
+ - "Merge / split / rotate these PDFs."
93
+ - "Fill this PDF form."
94
+ - "Create a PDF from this content."
95
+ - "Extract the tables from this PDF / OCR this scan."
96
+
97
+ ## Output
98
+
99
+ 1. **Output PDF(s)** — the path(s). Cite as `pdf-output`.
100
+ 2. **Validation receipt** — page count matches expected ✅, read-back value/text present ✅. Cite as `pdf-validation`.
101
+ 3. **Fill decision** — present on form-fills: flattened / kept-editable + why. Cite as `pdf-fill-decision`.
@@ -0,0 +1,15 @@
1
+ {
2
+ "skill": "quality-tools",
3
+ "_calibration": "Seed for eval-schema v2 (ecosystem-harvest skill-quality-gates Phase 2). tool-choice + trajectory assertions are trace-gated: pass:null (manual-pending) in CI until a recorded tool-trace.json exists.",
4
+ "scenarios": [
5
+ {
6
+ "id": "runs-project-pinned-tools",
7
+ "prompt": "Fix the failing lint on the changed files.",
8
+ "environment": "a project whose pinned quality CLI is defined in its task runner",
9
+ "assertions": [
10
+ { "kind": "tool-choice", "must_use": ["bash"], "must_not_use": [] },
11
+ { "kind": "trajectory_budget", "n": 8 }
12
+ ]
13
+ }
14
+ ]
15
+ }
@@ -40,6 +40,30 @@ Do NOT use when:
40
40
 
41
41
  ## Procedure: Security audit
42
42
 
43
+ ### 0. False-positive gate — restate the claim before reporting
44
+
45
+ Before any finding enters report, restate as one falsifiable sentence naming all three:
46
+
47
+ 1. **Privilege level** — access attacker already has (anonymous, authenticated user, tenant admin, CI runner).
48
+ 2. **Execution context** — where vulnerable code runs (request handler, queue worker, sandboxed template, build step).
49
+ 3. **Attacker precondition** — concrete state or input attacker must control to trigger it.
50
+
51
+ Any of the three not concretely nameable → **not a finding yet** — trace further or drop with one-line reason.
52
+
53
+ **Rationalizations to Reject:**
54
+
55
+ | Rationalization | Reality |
56
+ |---|---|
57
+ | "It looks dangerous" | Pattern-recognition is not analysis — trace the full data flow from entry to sink first |
58
+ | "This is clearly critical" | Complete a devil's-advocate pass — models systematically overrate severity |
59
+ | "Report it just in case" | Over-reporting erodes trust; an unverifiable finding is noise, not diligence |
60
+ | "Same pattern as a known CVE" | Same pattern ≠ same preconditions — verify the preconditions hold in THIS codebase |
61
+
62
+ **Standard vs. Deep verification routing:**
63
+
64
+ - **Standard** — traced data flow + all three claim elements named → report with normal field list.
65
+ - **Deep** — severity High/Critical, OR precondition chain crosses trust boundary you did not trace → devil's-advocate pass first: actively try to refute finding (existing middleware? framework default? type system? config?). Report only what survives; killed findings listed one-line under *Rejected candidates* so triage is auditable.
66
+
43
67
  ### 1. Map attack surface
44
68
 
45
69
  Identify all entry points where untrusted data enters:
@@ -78,6 +102,9 @@ User Input → Controller → Validation → Service → DB/File/External
78
102
  | **Secret exposure** | Hardcoded credentials, secrets in logs, `.env` in public dir |
79
103
  | **Rate limiting** | Missing throttle on auth endpoints, password reset, API |
80
104
  | **Header injection** | User input in response headers, email headers |
105
+ | **Insecure defaults / fail-open** | Guards that allow on error (`catch { return true }` in an authz check), default-allow matchers, debug mode defaulting on, permissive CORS/`verify=false` fallbacks, feature flags whose missing value grants access |
106
+
107
+ Worked example (fail-open): `if (!$gate->check($user)) { … }` wrapped in `try/catch` that logs and **continues** fails open — exception in gate grants access. Finding shape: Category *Insecure defaults*, Evidence the catch block `file:line`, Fix *fail closed — rethrow or deny on gate error*.
81
108
 
82
109
  ### 4. Framework-specific checks
83
110
 
@@ -108,6 +135,8 @@ For each vulnerability:
108
135
  - **Fix:** concrete mitigation
109
136
  - **Confidence:** Low / Medium / High
110
137
 
138
+ After findings, add **Rejected candidates** section: one line per look-dangerous-but-benign pattern the Step-0 gate killed, with traced reason ("raw SQL string is a static migration constant — no user input reaches it"). Audit that rejects nothing has usually skipped the gate.
139
+
111
140
  ## Integration with other skills
112
141
 
113
142
  - **analysis-autonomous-mode** — routes here when security concerns are detected
@@ -0,0 +1,90 @@
1
+ ---
2
+ model_tier: high
3
+ name: security-maturity-assessment
4
+ description: "Use when the user wants a security-maturity scorecard / posture assessment of a module — category ratings with evidence, not a vulnerability hunt. Also on 'wie sicher ist dieses Modul aufgestellt?'"
5
+ domain: quality
6
+ workspaces:
7
+ - engineering
8
+ packs:
9
+ - engineering-base
10
+ ---
11
+
12
+ # security-maturity-assessment
13
+
14
+ Rate how mature a module's security **posture** is — category by category, every rating backed by `file:line` evidence — instead of hunting individual vulnerabilities. Output is a scorecard a maintainer can re-run and diff, not a finding list.
15
+
16
+ ## When to use
17
+
18
+ - "How mature / well-set-up is this module's security?" — posture, not holes
19
+ - Baseline before a hardening effort, or re-assessment after one
20
+ - A stakeholder needs a defensible rating per category with cited evidence
21
+
22
+ Do NOT use when:
23
+
24
+ - Hunting concrete vulnerabilities — route to [`security-audit`](../security-audit/SKILL.md)
25
+ - One route/action's authorization chain — route to [`authz-review`](../authz-review/SKILL.md)
26
+ - Pre-implementation threat model for a new feature — route to [`threat-modeling`](../threat-modeling/SKILL.md)
27
+ - Writing new secure code — route to [`security`](../security/SKILL.md)
28
+ - AI-agent config/behaviour review — route to [`agent-security-review`](../agent-security-review/SKILL.md)
29
+
30
+ ## The nine categories
31
+
32
+ | # | Category | Critical? | What to inspect |
33
+ |---|---|---|---|
34
+ | 1 | Input validation | **Yes** | Request-boundary validation primitives on every entry point; no inline ad-hoc checks |
35
+ | 2 | Authorization | **Yes** | Per-object ownership/tenant checks, policy coverage, field-level access |
36
+ | 3 | Secrets handling | **Yes** | No hardcoded creds; env/vault usage; secrets absent from logs and VCS |
37
+ | 4 | Error handling | No | No swallowed exceptions; no stack traces / internals leaked to clients |
38
+ | 5 | Logging & audit | No | Security events (auth, permission denials, admin actions) logged; no PII in logs |
39
+ | 6 | Dependency hygiene | No | Lockfiles present; known-CVE scan wired; update cadence visible |
40
+ | 7 | Data boundaries | No | Serializers/resources whitelist fields; exports/queues don't leak internals |
41
+ | 8 | Tenant isolation | **Yes** (multi-tenant only; else N/A) | Tenant scoping on queries, jobs, caches; cross-tenant negative tests |
42
+ | 9 | Security test coverage | No | Negative tests exist (401/403/404 paths, abuse cases), not only happy-path |
43
+
44
+ ## Rating rubric
45
+
46
+ | Rating | Meaning |
47
+ |---|---|
48
+ | **Missing** | No control exists for the category |
49
+ | **Weak** | Ad-hoc, inconsistent — some paths covered, most not |
50
+ | **Moderate** | Control present and usual, with named gaps |
51
+ | **Satisfactory** | Consistent across the surface; minor gaps only |
52
+ | **Strong** | Consistent AND enforced (CI gate, test, linter) or negatively tested |
53
+
54
+ ## Procedure
55
+
56
+ 1. **Scope** — name the module/paths under assessment; list entry points (routes, jobs, commands, webhooks). Scorecard without stated scope is not reproducible.
57
+ 2. **Assess each category** — inspect the code the category names. Every rating cites evidence:
58
+ - Positive evidence: `file:line` of the control (`app/Http/Requests/…:12`).
59
+ - Absence evidence: the searches run that came back empty (name the grep patterns) — "not found" beats "probably missing".
60
+ - Multi-tenant N/A: single-tenant systems rate category 8 `N/A`; drops out of the roll-up.
61
+ 3. **Roll up deterministically** — overall rating is computed, not vibed:
62
+ - `overall = min( median(all rated categories), one step above the lowest critical-category rating )`
63
+ - Consequences: any critical category **Missing** caps overall at **Weak**; any critical **Weak** caps overall at **Moderate**. Non-critical categories move the median but never lift the cap.
64
+ 4. **Recommend** — max 3 next steps, ordered by which would raise the overall rating (fix the lowest critical category first).
65
+
66
+ ## Output format
67
+
68
+ 1. **Scope block** — module/paths + entry-point list, so the scorecard is re-runnable.
69
+ 2. **Scorecard table** — one row per category: `Category | Rating | Evidence (file:line or named empty searches) | Gap`. Every row MUST carry evidence; a rating without a citation is invalid.
70
+ 3. **Overall rating** — with the roll-up shown (`median=…, lowest critical=…, cap=… → overall=…`), never a bare verdict.
71
+ 4. **Top-3 next steps** — ordered by roll-up impact.
72
+
73
+ ## Gotcha
74
+
75
+ - The model tends to rate from vibes ("looks well-structured") — a rating row without `file:line` or named empty searches is invalid; redo it.
76
+ - Don't let a Strong non-critical category mask a Weak critical one — the cap rule exists precisely because a polished logging setup does not offset missing authorization.
77
+ - A vulnerability found mid-assessment is **out of scope** for the scorecard — note it and route to [`security-audit`](../security-audit/SKILL.md) (with its false-positive gate) instead of inlining findings here.
78
+
79
+ ## Do NOT
80
+
81
+ - Do NOT emit a rating without evidence — every row cites `file:line` or the empty searches that prove absence.
82
+ - Do NOT average away critical categories — the deterministic cap always wins.
83
+ - Do NOT turn the scorecard into a finding list — posture assessment and vulnerability hunting are different deliverables.
84
+ - Do NOT assess unscoped ("the whole app") when the user named a module.
85
+
86
+ ## See also
87
+
88
+ - [`security-audit`](../security-audit/SKILL.md) — vulnerability hunting with the false-positive gate.
89
+ - [`defense-in-depth`](../defense-in-depth/SKILL.md) — layering controls the scorecard checks for.
90
+ - [`ai-code-blindspots`](../ai-code-blindspots/SKILL.md) — the per-surface invisible-controls checklist.
@@ -0,0 +1,52 @@
1
+ {
2
+ "skill": "security-maturity-assessment",
3
+ "last_eval": "2026-07-12",
4
+ "description": "5 should-trigger + 5 should-not-trigger queries. Should-trigger covers DE + EN posture/scorecard/baseline phrasings. Should-not-trigger covers the neighbouring security skills (vuln hunt, authz chain, threat model, secure coding, agent config) whose vocabulary overlaps.",
5
+ "queries": [
6
+ {
7
+ "q": "how mature is the security posture of our billing module?",
8
+ "trigger": true
9
+ },
10
+ {
11
+ "q": "give me a security scorecard for this codebase with evidence per category",
12
+ "trigger": true
13
+ },
14
+ {
15
+ "q": "wie sicher ist dieses Modul aufgestellt? Bitte pro Kategorie bewerten",
16
+ "trigger": true
17
+ },
18
+ {
19
+ "q": "baseline our security maturity before the hardening sprint",
20
+ "trigger": true
21
+ },
22
+ {
23
+ "q": "rate input validation, secrets and tenant isolation for the API package",
24
+ "trigger": true
25
+ },
26
+ {
27
+ "q": "audit this module for SQL injection and XSS vulnerabilities",
28
+ "trigger": false,
29
+ "note": "vulnerability hunt → security-audit"
30
+ },
31
+ {
32
+ "q": "review the authorization chain for the invoice download route",
33
+ "trigger": false,
34
+ "note": "single-route authz → authz-review"
35
+ },
36
+ {
37
+ "q": "threat-model the new file-upload feature before we build it",
38
+ "trigger": false,
39
+ "note": "pre-implementation → threat-modeling"
40
+ },
41
+ {
42
+ "q": "write a policy and gate for this new admin action",
43
+ "trigger": false,
44
+ "note": "writing secure code → security"
45
+ },
46
+ {
47
+ "q": "red-team my Claude agent's MCP and hook config",
48
+ "trigger": false,
49
+ "note": "agent config/behaviour → agent-security-review"
50
+ }
51
+ ]
52
+ }
@@ -451,12 +451,91 @@ to every skill you author.
451
451
  4. Does the description carry filler ("comprehensive", "advanced",
452
452
  "powerful")?
453
453
 
454
+ ## Read-only-by-default scripts
455
+
456
+ A script shipped inside a skill (`scripts/**`) is **side-effect-free by
457
+ default** — inspects, computes, prints; does not mutate. Mutation (write /
458
+ delete / rename / copy) gates behind an explicit flag named in this SKILL.md —
459
+ `--writable` / `--apply` / `--write` / `--output` / `--fix` — so the default
460
+ invocation is safe. A generator whose *declared purpose* is to write (emits an
461
+ artifact to a caller-supplied path) is allowlisted with a rationale in
462
+ `src/scripts/lint_skill_scripts_readonly_allowlist.json` instead of a redundant
463
+ flag. `lint_skill_scripts_readonly` enforces this: an ungated, non-allowlisted
464
+ write fails the build.
465
+
466
+ ## Description-optimizer loop (U1 — held-out, not vibes)
467
+
468
+ Descriptions are the trigger surface; tune them like a model, not like prose:
469
+
470
+ 1. Draft 2-3 candidate descriptions for the skill.
471
+ 2. Ensure `evals/triggers.json` has should- AND should-not-trigger queries
472
+ (grow beyond the 5+5 stub when optimizing — more queries = a real test split).
473
+ 3. Run the helper: `npx tsx src/scripts/optimize_skill_description.ts
474
+ --skill <id> --candidate "…" [--candidate "…"] [--live]` — it splits the
475
+ queries deterministically into train/held-out, scores every candidate
476
+ (deterministic token-overlap proxy by default; `--live` = haiku judge,
477
+ ~$0.001 per query·candidate), and picks the best **held-out** accuracy.
478
+ 4. Adopt the pick ONLY if it beats the current description on the held-out
479
+ split — a train-only win is overfitting to the queries you wrote.
480
+
481
+ ## Self-QA loop for output-producing skills (optional pattern)
482
+
483
+ For skills whose product is a rendered/structural artifact (decks, docs,
484
+ diagrams, dashboards, generated UI): **assume there are problems** and have a
485
+ fresh-eyes pass find them before handing back. The author-context is blind to
486
+ its own omissions; a context-free verifier is not.
487
+
488
+ 1. Produce the artifact.
489
+ 2. Dispatch a fresh subagent (no authoring context) with ONLY the artifact +
490
+ the acceptance criteria: "list every visual/structural defect; assume at
491
+ least one exists."
492
+ 3. Fix what it finds; re-run once. Two clean passes → done.
493
+
494
+ Worked example (deck skill): the author renders 12 slides; the fresh-eyes
495
+ pass gets the PDF + "check overflow, contrast, orphaned bullets, broken
496
+ images" — it flags a clipped title on slide 7 the author never re-read.
497
+ One fix, one re-check, done.
498
+
499
+ Scope: complements `verify-before-complete` (which gates the completion
500
+ claim); this pattern is HOW to get the fresh evidence for artifacts where no
501
+ deterministic checker exists. Skip it when a real validator covers the
502
+ surface (linter, schema, test) — deterministic checks beat judge passes.
503
+
504
+ ## Known-pitfalls section (optional pattern, tool skills)
505
+
506
+ Tool/integration skills teach the happy path; the recurring support burden is
507
+ the *silent* failures — the ones that cost money, corrupt state, or fail with no
508
+ error. For a high-support-burden tool skill, add a `## Known pitfalls` section
509
+ in this micro-format:
510
+
511
+ 1. **A Symptom → Root cause → Fix table.** Each row starts from the *observable
512
+ symptom* (what the user sees), not the internal cause — the user greps for
513
+ the symptom, not the fix.
514
+
515
+ | Symptom | Root cause | Fix |
516
+ |---|---|---|
517
+ | `<what the user observes>` | `<why it happens>` | `<the concrete action>` |
518
+
519
+ 2. **Optionally, a quick-reference anti-pattern checklist** (Anti-pattern ·
520
+ cost/impact · fix difficulty) for traps worth scanning before shipping — add
521
+ it only when it does not restate the skill's existing `## Gotcha` / `## Do
522
+ NOT`; the table is the load-bearing part.
523
+
524
+ Sourcing floor — **real, not invented**: every entry names a genuinely common
525
+ failure (a high-vote community question, a documented incident class), never a
526
+ hypothetical. **≤ 5 entries per skill.** The value is a short, sourced,
527
+ high-signal list; a long one is noise. A pitfall is a *section on the existing
528
+ tool skill*, **never** a new skill per pitfall and never a generated grid (see
529
+ [`size-enforcement`](../../rules/size-enforcement.md) § Per-tool pitfall
530
+ content).
531
+
454
532
  ## Do NOT
455
533
 
456
534
  * Write documentation-style, pointer-only, or too-broad skills ("Laravel skill")
457
535
  * Skip Procedure or use vague validation
458
536
  * Exceed size limits (see `docs/guidelines/agent-infra/size-and-scope.md`)
459
537
  * Duplicate rules
538
+ * Ship a skill script that mutates the filesystem on its default invocation — gate it behind a flag or allowlist it with a rationale
460
539
 
461
540
  ## Encode usage policy in the description
462
541
 
@@ -41,9 +41,17 @@ prose document/table (that is the document surface, `doc-coauthoring`).
41
41
  2. **Formulas over hardcoded values.** Any computed cell holds a **formula**
42
42
  (`=SUM(...)`, `=B2*C2`), never the typed-in result. Hardcoding a computed
43
43
  value is the cardinal spreadsheet defect — it does not recalculate.
44
- 3. **Read back after every write.** After writing a formula, read the cell back
45
- and confirm no formula error (`#REF!`, `#DIV/0!`, `#VALUE!`). The read-back is
46
- the spreadsheet's verification truth source.
44
+ 3. **Read back after every write, and RECALCULATE first.** After writing a
45
+ formula, force a recalculation, then read the cell back — a library that
46
+ writes formulas without recalculating leaves the cached value stale, so a
47
+ read-back before recalc proves nothing. The **zero-formula-error contract**:
48
+ any of `#REF!` / `#DIV/0!` / `#VALUE!` / `#N/A` / `#NAME?` in a written cell
49
+ is a **failure**, not a warning — reject the output and fix the formula. The
50
+ recalc'd read-back is the spreadsheet's verification truth source.
51
+ **Formulas, never hardcoded computed values** — a library that writes the
52
+ Python-computed number into the cell instead of the `=` formula has produced
53
+ a dead spreadsheet that will not update when inputs change; write the formula
54
+ string and let the recalc compute it.
47
55
  4. **Source-comment web-sourced cells.** Any figure taken from the web carries a
48
56
  cell comment with its source. Financial figures follow the
49
57
  [`spreadsheet-source-quality`](../../rules/spreadsheet-source-quality.md) rule
@@ -0,0 +1,103 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft-07/schema#",
3
+ "$id": "https://event4u.dev/agent-config/schemas/team-review-status.json",
4
+ "title": "Team Review Status Envelope",
5
+ "description": "Wire format for every /team:review return — plugin path and multi-host fallback alike. Extends the subagent-status.json frame (same status enum, same NEEDS_CONTEXT/BLOCKED semantics) with review findings, the reviewed ref, and quota visibility. Emitted by src/scripts/ai_team/team_dispatch.ts; contract prose in docs/contracts/ai-team-config.md.",
6
+ "type": "object",
7
+ "required": ["status", "findings", "reviewed_ref", "model", "quota"],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "status": {
11
+ "type": "string",
12
+ "enum": ["DONE", "DONE_WITH_CONCERNS", "NEEDS_CONTEXT", "BLOCKED"],
13
+ "description": "DONE = review ran, no findings above info. DONE_WITH_CONCERNS = review ran and findings[] needs the caller's attention, OR the model output was unparseable (raw carries the verbatim text — never silently dropped). NEEDS_CONTEXT = reviewer lacks context beyond the bundle; blocking_question must be answered. BLOCKED = no review was produced (auth, quota, transport); blocking_reason describes why."
14
+ },
15
+ "summary": {
16
+ "type": "string",
17
+ "minLength": 1,
18
+ "description": "One- or two-sentence review outcome."
19
+ },
20
+ "findings": {
21
+ "type": "array",
22
+ "description": "Review findings. Empty for a clean DONE and for BLOCKED (no review happened).",
23
+ "items": {
24
+ "type": "object",
25
+ "required": ["severity", "evidence", "suggested_fix"],
26
+ "additionalProperties": false,
27
+ "properties": {
28
+ "severity": {
29
+ "type": "string",
30
+ "enum": ["critical", "major", "minor", "info"],
31
+ "description": "critical = data loss / security / correctness on the main path. major = real defect, wrong under realistic input. minor = defect on an edge path or maintainability trap. info = observation, no action required."
32
+ },
33
+ "evidence": {
34
+ "type": "string",
35
+ "minLength": 1,
36
+ "description": "What is wrong, citing the exact hunk/line from the reviewed diff — never invented code."
37
+ },
38
+ "suggested_fix": {
39
+ "type": "string",
40
+ "minLength": 1,
41
+ "description": "Concrete, minimal fix proposal."
42
+ },
43
+ "location": {
44
+ "type": "string",
45
+ "description": "file[:line] when known."
46
+ }
47
+ }
48
+ }
49
+ },
50
+ "reviewed_ref": {
51
+ "type": "string",
52
+ "minLength": 1,
53
+ "description": "HEAD sha the repo-context bundle was built from — pins what was actually reviewed."
54
+ },
55
+ "model": {
56
+ "type": "string",
57
+ "minLength": 1,
58
+ "description": "Reviewer model id, or the literal 'auto' when the codex CLI default was used (no --model flag passed)."
59
+ },
60
+ "quota": {
61
+ "type": "object",
62
+ "required": ["used", "ceiling"],
63
+ "additionalProperties": false,
64
+ "description": "Shared cli_call_budget openai-bucket visibility after this run.",
65
+ "properties": {
66
+ "used": {
67
+ "type": "integer",
68
+ "minimum": 0,
69
+ "description": "Today's openai-bucket call count (UTC-day, shared with the council)."
70
+ },
71
+ "ceiling": {
72
+ "type": "integer",
73
+ "minimum": 0,
74
+ "description": "ai_team.max_calls_per_day — the team-side ceiling on the shared bucket."
75
+ }
76
+ }
77
+ },
78
+ "raw": {
79
+ "type": "string",
80
+ "description": "Verbatim model output, present ONLY when the findings contract could not be parsed (status is then DONE_WITH_CONCERNS). Preserved so a malformed review is loud, never dropped."
81
+ },
82
+ "blocking_question": {
83
+ "type": "string",
84
+ "minLength": 1,
85
+ "description": "Single specific question whose answer would unblock. Required when status = NEEDS_CONTEXT."
86
+ },
87
+ "blocking_reason": {
88
+ "type": "string",
89
+ "minLength": 1,
90
+ "description": "Why no review was produced (auth_expired → codex login, cli_quota_exhausted, transport error). Required when status = BLOCKED."
91
+ }
92
+ },
93
+ "allOf": [
94
+ {
95
+ "if": {"properties": {"status": {"const": "NEEDS_CONTEXT"}}, "required": ["status"]},
96
+ "then": {"required": ["blocking_question"]}
97
+ },
98
+ {
99
+ "if": {"properties": {"status": {"const": "BLOCKED"}}, "required": ["status"]},
100
+ "then": {"required": ["blocking_reason"]}
101
+ }
102
+ ]
103
+ }
@@ -128,6 +128,16 @@ Each env has a GitHub IAM role with:
128
128
  - resources
129
129
  - state management
130
130
 
131
+ ## Known pitfalls
132
+
133
+ | Symptom | Root cause | Fix |
134
+ |---|---|---|
135
+ | `Error acquiring the state lock` blocks every command | A prior `apply` crashed / was killed and left the lock held (DynamoDB / backend lock) | Confirm no apply is actually running, then `terraform force-unlock <lock-id>` — never delete the lock table |
136
+ | `plan` wants to destroy+recreate a resource after a rename | Renaming a resource block changes its address; Terraform sees the old address gone and a new one added | `terraform state mv <old.addr> <new.addr>` (or a `moved {}` block) so it tracks the same object |
137
+ | `count`/`for_each` errors with "value depends on resource attributes that cannot be determined until apply" | The count/for_each expression reads an unknown (not-yet-created) value | Key `for_each` off a static/known map, or split into a two-stage apply with `-target` |
138
+ | A change applies but the next `plan` shows the same diff again (perpetual diff) | The provider normalizes/computes the attribute differently than written (ordering, defaults, case) | Match the provider's canonical form, or `ignore_changes` on that attribute in `lifecycle` |
139
+ | `plan` shows a resource as tainted/replaced after a manual console change | Out-of-band drift — someone edited the resource outside Terraform | `terraform apply -refresh-only` to reconcile state, then decide code-vs-cloud; stop the manual edits |
140
+
131
141
  ## Gotcha
132
142
 
133
143
  - `terraform apply` without `-auto-approve` requires interactive confirmation — don't use in CI without the flag.
@@ -83,6 +83,37 @@ talked-around. Externalized to
83
83
  [`testing-anti-patterns/process-anti-patterns.md`](../testing-anti-patterns/process-anti-patterns.md)
84
84
  to keep this skill under the 400-line sunset trigger.
85
85
 
86
+ ## Mode contracts — Goal / Activities / Forbidden / Output
87
+
88
+ The flow runs as four modes. Each Forbidden item names **how a reviewer
89
+ checks it from the diff** — an unverifiable prohibition does not ship.
90
+
91
+ | Mode | Goal | Activities | Forbidden (diff check) | Output contract |
92
+ |---|---|---|---|---|
93
+ | **Design** | One-sentence behavior + enumerated cases | Steps 1–2 | **No production code** (diff touches no `src/**` production path) · no test bodies yet | Case list (happy/boundary/error) |
94
+ | **Test-Red** | A failing test that fails RIGHT | Steps 3–4 | **No production edits** (diff = `tests/**` only) · test must fail at an **assertion, not an import/setup error** (failure output cites the assertion line) | Failing test + its observed failure reason |
95
+ | **Implement** | Minimum code to green | Steps 5–6 | **No test edits** (no `tests/**` paths in Implement-phase diffs — changing the assertion to fit the code is the canonical violation; genuinely-wrong test → STOP and ask, never silently edit) · no scope beyond the one case | Green run output |
96
+ | **Debug** | Fix a defect found later | (re-enter at 3) | **No bugfix before a reproducing regression test exists** (the fix commit contains a `tests/**` addition that fails without the fix) | Regression test + fix, verified red→green |
97
+
98
+ ### Mode inference on resume
99
+
100
+ Step 0 of any resume: if `agents/runtime/state/HANDOFF.md` exists, resume
101
+ from its Mode + Contract-owed fields (see `/agent-handoff` file mode) instead
102
+ of re-deriving. Otherwise infer the mode from observable state — never
103
+ assume Design:
104
+
105
+ | Observed state | Resume in |
106
+ |---|---|
107
+ | No test for the target behavior | Design |
108
+ | Test exists, currently failing at an assertion | Implement |
109
+ | Test exists + passing, defect reported | Debug |
110
+ | Test failing at import/collection error | Test-Red (fix the test, not the code) |
111
+
112
+ At every mode transition, one consent-checkpoint sentence (per
113
+ `ask-when-uncertain` / `autonomous-execution` — no new mechanism): name the
114
+ mode you are leaving, the output contract you hand over, and the mode you
115
+ enter; under an autonomous mandate the sentence is stated, not asked.
116
+
86
117
  ## Procedure
87
118
 
88
119
  ### 1. Identify the behavior to test