cc-codeconductor 1.0.0 → 1.2.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 (247) hide show
  1. package/README.md +326 -87
  2. package/dist/core/compilation/compile-checker.d.ts +2 -0
  3. package/dist/core/loop/loop-engine.d.ts +3 -0
  4. package/dist/core/verification/verification-runner.d.ts +7 -0
  5. package/dist/index.d.ts +1 -1
  6. package/dist/index.js +3825 -597
  7. package/dist/library.js +195 -18
  8. package/dist/validation/schemas.d.ts +461 -44
  9. package/package.json +4 -1
  10. package/presets/agy/AGENTS.md +13 -9
  11. package/presets/agy/gates/pre-commit/GATE.md +5 -4
  12. package/presets/agy/hooks.json +2 -2
  13. package/presets/agy/scripts/invoke-hook.cjs +115 -0
  14. package/presets/agy/skills/backlog/SKILL.md +61 -0
  15. package/presets/agy/skills/cc-spec-mutation/SKILL.md +165 -0
  16. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +3 -0
  17. package/presets/agy/skills/evaluation/SKILL.md +61 -2
  18. package/presets/agy/skills/openspec/SKILL.md +50 -16
  19. package/presets/agy/skills/security-ai-llm/SKILL.md +43 -0
  20. package/presets/agy/skills/security-blue-team/SKILL.md +43 -0
  21. package/presets/agy/skills/security-cloud/SKILL.md +43 -0
  22. package/presets/agy/skills/security-crypto/SKILL.md +43 -0
  23. package/presets/agy/skills/security-exploit-dev/SKILL.md +45 -0
  24. package/presets/agy/skills/security-grc/SKILL.md +43 -0
  25. package/presets/agy/skills/security-incident-response/SKILL.md +45 -0
  26. package/presets/agy/skills/security-log-analysis/SKILL.md +43 -0
  27. package/presets/agy/skills/security-malware-analysis/SKILL.md +44 -0
  28. package/presets/agy/skills/security-mobile/SKILL.md +43 -0
  29. package/presets/agy/skills/security-network/SKILL.md +43 -0
  30. package/presets/agy/skills/security-ot-ics/SKILL.md +43 -0
  31. package/presets/agy/skills/security-recon/SKILL.md +45 -0
  32. package/presets/agy/skills/security-red-team/SKILL.md +44 -0
  33. package/presets/agy/skills/security-reverse-engineering/SKILL.md +44 -0
  34. package/presets/agy/skills/security-soc-automation/SKILL.md +43 -0
  35. package/presets/agy/skills/security-threat-hunting/SKILL.md +43 -0
  36. package/presets/agy/skills/security-vuln-assessment/SKILL.md +45 -0
  37. package/presets/agy/skills/security-web/SKILL.md +44 -0
  38. package/presets/agy/skills/testing-tdd/SKILL.md +53 -0
  39. package/presets/agy/skills/using-cc-skills/SKILL.md +48 -0
  40. package/presets/agy/workflows/cc-api-contract.md +14 -0
  41. package/presets/agy/workflows/cc-ask.md +2 -1
  42. package/presets/agy/workflows/cc-backlog.md +69 -0
  43. package/presets/agy/workflows/cc-db-migration.md +14 -0
  44. package/presets/agy/workflows/cc-explore.md +1 -1
  45. package/presets/agy/workflows/cc-feature.md +18 -0
  46. package/presets/agy/workflows/cc-fix.md +14 -0
  47. package/presets/agy/workflows/cc-iterative.md +14 -0
  48. package/presets/agy/workflows/cc-openspec.md +17 -1
  49. package/presets/agy/workflows/cc-scorecard.md +2 -0
  50. package/presets/agy/workflows/cc-security.md +180 -0
  51. package/presets/agy/workflows/cc-spec-mutation.md +191 -0
  52. package/presets/agy/workflows/cc-tdd-cycle.md +14 -0
  53. package/presets/claude/CLAUDE.md +4 -0
  54. package/presets/claude/commands/cc/api-contract.md +14 -0
  55. package/presets/claude/commands/cc/ask.md +2 -1
  56. package/presets/claude/commands/cc/backlog.md +104 -0
  57. package/presets/claude/commands/cc/db-migration.md +14 -0
  58. package/presets/claude/commands/cc/explore.md +1 -1
  59. package/presets/claude/commands/cc/feature.md +18 -0
  60. package/presets/claude/commands/cc/fix.md +17 -0
  61. package/presets/claude/commands/cc/iterative.md +14 -0
  62. package/presets/claude/commands/cc/openspec.md +30 -1
  63. package/presets/claude/commands/cc/review.md +3 -0
  64. package/presets/claude/commands/cc/scorecard.md +2 -0
  65. package/presets/claude/commands/cc/security.md +179 -0
  66. package/presets/claude/commands/cc/spec-mutation.md +190 -0
  67. package/presets/claude/commands/cc/tdd-cycle.md +17 -0
  68. package/presets/claude/gates/pre-commit/GATE.md +5 -4
  69. package/presets/claude/settings.json +13 -11
  70. package/presets/claude/skills/backlog/SKILL.md +61 -0
  71. package/presets/claude/skills/evaluation/SKILL.md +47 -24
  72. package/presets/claude/skills/openspec/SKILL.md +46 -34
  73. package/presets/claude/skills/security/SKILL.md +382 -0
  74. package/presets/claude/skills/security-ai-llm/SKILL.md +43 -0
  75. package/presets/claude/skills/security-blue-team/SKILL.md +43 -0
  76. package/presets/claude/skills/security-cloud/SKILL.md +43 -0
  77. package/presets/claude/skills/security-crypto/SKILL.md +43 -0
  78. package/presets/claude/skills/security-exploit-dev/SKILL.md +45 -0
  79. package/presets/claude/skills/security-grc/SKILL.md +43 -0
  80. package/presets/claude/skills/security-incident-response/SKILL.md +45 -0
  81. package/presets/claude/skills/security-log-analysis/SKILL.md +43 -0
  82. package/presets/claude/skills/security-malware-analysis/SKILL.md +44 -0
  83. package/presets/claude/skills/security-mobile/SKILL.md +43 -0
  84. package/presets/claude/skills/security-network/SKILL.md +43 -0
  85. package/presets/claude/skills/security-ot-ics/SKILL.md +43 -0
  86. package/presets/claude/skills/security-recon/SKILL.md +45 -0
  87. package/presets/claude/skills/security-red-team/SKILL.md +44 -0
  88. package/presets/claude/skills/security-reverse-engineering/SKILL.md +44 -0
  89. package/presets/claude/skills/security-soc-automation/SKILL.md +43 -0
  90. package/presets/claude/skills/security-threat-hunting/SKILL.md +43 -0
  91. package/presets/claude/skills/security-vuln-assessment/SKILL.md +45 -0
  92. package/presets/claude/skills/security-web/SKILL.md +44 -0
  93. package/presets/claude/skills/testing-tdd/SKILL.md +53 -0
  94. package/presets/claude/skills/using-cc-skills/SKILL.md +48 -0
  95. package/presets/codex/AGENTS.md +16 -12
  96. package/presets/codex/commands/cc-ask.md +2 -1
  97. package/presets/codex/gates/pre-commit/GATE.md +5 -4
  98. package/presets/codex/skills/backlog/SKILL.md +61 -0
  99. package/presets/codex/skills/cc-api-contract/SKILL.md +87 -0
  100. package/presets/codex/skills/cc-backlog/SKILL.md +108 -0
  101. package/presets/codex/skills/cc-clarify/SKILL.md +36 -0
  102. package/presets/codex/skills/cc-council/SKILL.md +92 -0
  103. package/presets/codex/skills/cc-db-migration/SKILL.md +88 -0
  104. package/presets/codex/skills/cc-explore/SKILL.md +40 -0
  105. package/presets/codex/skills/cc-feature/SKILL.md +154 -0
  106. package/presets/codex/skills/cc-fix/SKILL.md +165 -0
  107. package/presets/codex/skills/cc-handoff/SKILL.md +45 -0
  108. package/presets/codex/skills/cc-iterative/SKILL.md +150 -0
  109. package/presets/codex/skills/cc-openspec/SKILL.md +191 -0
  110. package/presets/codex/skills/cc-pagespeed/SKILL.md +124 -0
  111. package/presets/codex/skills/cc-prototype/SKILL.md +42 -0
  112. package/presets/codex/skills/cc-refactor/SKILL.md +163 -0
  113. package/presets/codex/skills/cc-review/SKILL.md +152 -0
  114. package/presets/codex/skills/cc-scorecard/SKILL.md +82 -0
  115. package/presets/codex/skills/cc-security/SKILL.md +182 -0
  116. package/presets/codex/skills/cc-spec-mutation/SKILL.md +192 -0
  117. package/presets/codex/skills/cc-tdd-cycle/SKILL.md +266 -0
  118. package/presets/codex/skills/cc-test-plan/SKILL.md +153 -0
  119. package/presets/codex/skills/cc-triage/SKILL.md +38 -0
  120. package/presets/codex/skills/evaluation/SKILL.md +65 -0
  121. package/presets/codex/skills/openspec/SKILL.md +66 -0
  122. package/presets/codex/skills/testing-tdd/SKILL.md +53 -0
  123. package/presets/codex/skills/using-cc-skills/SKILL.md +48 -0
  124. package/presets/cursor/AGENTS.md +2 -2
  125. package/presets/cursor/commands/cc/api-contract.md +14 -0
  126. package/presets/cursor/commands/cc/ask.md +2 -1
  127. package/presets/cursor/commands/cc/backlog.md +105 -0
  128. package/presets/cursor/commands/cc/db-migration.md +14 -0
  129. package/presets/cursor/commands/cc/explore.md +1 -1
  130. package/presets/cursor/commands/cc/feature.md +18 -0
  131. package/presets/cursor/commands/cc/fix.md +17 -0
  132. package/presets/cursor/commands/cc/iterative.md +14 -0
  133. package/presets/cursor/commands/cc/openspec.md +30 -1
  134. package/presets/cursor/commands/cc/scorecard.md +2 -0
  135. package/presets/cursor/commands/cc/security.md +179 -0
  136. package/presets/cursor/commands/cc/spec-mutation.md +190 -0
  137. package/presets/cursor/commands/cc/tdd-cycle.md +14 -0
  138. package/presets/cursor/gates/pre-commit/GATE.md +5 -4
  139. package/presets/cursor/skills/backlog/SKILL.md +61 -0
  140. package/presets/cursor/skills/evaluation/SKILL.md +61 -4
  141. package/presets/cursor/skills/openspec/SKILL.md +47 -33
  142. package/presets/cursor/skills/security-ai-llm/SKILL.md +43 -0
  143. package/presets/cursor/skills/security-blue-team/SKILL.md +43 -0
  144. package/presets/cursor/skills/security-cloud/SKILL.md +43 -0
  145. package/presets/cursor/skills/security-crypto/SKILL.md +43 -0
  146. package/presets/cursor/skills/security-exploit-dev/SKILL.md +45 -0
  147. package/presets/cursor/skills/security-grc/SKILL.md +43 -0
  148. package/presets/cursor/skills/security-incident-response/SKILL.md +45 -0
  149. package/presets/cursor/skills/security-log-analysis/SKILL.md +43 -0
  150. package/presets/cursor/skills/security-malware-analysis/SKILL.md +44 -0
  151. package/presets/cursor/skills/security-mobile/SKILL.md +43 -0
  152. package/presets/cursor/skills/security-network/SKILL.md +43 -0
  153. package/presets/cursor/skills/security-ot-ics/SKILL.md +43 -0
  154. package/presets/cursor/skills/security-recon/SKILL.md +45 -0
  155. package/presets/cursor/skills/security-red-team/SKILL.md +44 -0
  156. package/presets/cursor/skills/security-reverse-engineering/SKILL.md +44 -0
  157. package/presets/cursor/skills/security-soc-automation/SKILL.md +43 -0
  158. package/presets/cursor/skills/security-threat-hunting/SKILL.md +43 -0
  159. package/presets/cursor/skills/security-vuln-assessment/SKILL.md +45 -0
  160. package/presets/cursor/skills/security-web/SKILL.md +44 -0
  161. package/presets/cursor/skills/testing-tdd/SKILL.md +35 -574
  162. package/presets/cursor/skills/using-cc-skills/SKILL.md +48 -0
  163. package/presets/gemini/commands/cc/api-contract.toml +82 -0
  164. package/presets/gemini/commands/cc/ask.toml +54 -0
  165. package/presets/gemini/commands/cc/backlog.toml +103 -0
  166. package/presets/gemini/commands/cc/clarify.toml +31 -0
  167. package/presets/gemini/commands/cc/council.toml +87 -0
  168. package/presets/gemini/commands/cc/db-migration.toml +83 -0
  169. package/presets/gemini/commands/cc/explore.toml +35 -0
  170. package/presets/gemini/commands/cc/feature.toml +153 -0
  171. package/presets/gemini/commands/cc/fix.toml +163 -0
  172. package/presets/gemini/commands/cc/handoff.toml +40 -0
  173. package/presets/gemini/commands/cc/iterative.toml +145 -0
  174. package/presets/gemini/commands/cc/openspec.toml +186 -0
  175. package/presets/gemini/commands/cc/pagespeed.toml +119 -0
  176. package/presets/gemini/commands/cc/prototype.toml +37 -0
  177. package/presets/gemini/commands/cc/refactor.toml +158 -0
  178. package/presets/gemini/commands/cc/review.toml +150 -0
  179. package/presets/gemini/commands/cc/scorecard.toml +77 -0
  180. package/presets/gemini/commands/cc/security.toml +177 -0
  181. package/presets/gemini/commands/cc/spec-mutation.toml +187 -0
  182. package/presets/gemini/commands/cc/tdd-cycle.toml +264 -0
  183. package/presets/gemini/commands/cc/test-plan.toml +148 -0
  184. package/presets/gemini/commands/cc/triage.toml +33 -0
  185. package/presets/opencode/README.md +24 -21
  186. package/presets/opencode/agents/architect.md +6 -0
  187. package/presets/opencode/agents/implementer.md +7 -0
  188. package/presets/opencode/agents/reviewer.md +6 -0
  189. package/presets/opencode/agents/tester.md +6 -0
  190. package/presets/opencode/commands/cc-api-contract.md +14 -0
  191. package/presets/opencode/commands/cc-ask.md +2 -1
  192. package/presets/opencode/commands/cc-backlog.md +68 -0
  193. package/presets/opencode/commands/cc-db-migration.md +14 -0
  194. package/presets/opencode/commands/cc-explore.md +1 -1
  195. package/presets/opencode/commands/cc-feature.md +18 -0
  196. package/presets/opencode/commands/cc-fix.md +17 -0
  197. package/presets/opencode/commands/cc-iterative.md +14 -0
  198. package/presets/opencode/commands/cc-openspec.md +17 -1
  199. package/presets/opencode/commands/cc-scorecard.md +2 -0
  200. package/presets/opencode/commands/cc-security.md +179 -0
  201. package/presets/opencode/commands/cc-spec-mutation.md +190 -0
  202. package/presets/opencode/commands/cc-tdd-cycle.md +14 -0
  203. package/presets/opencode/gates/pre-commit/GATE.md +5 -4
  204. package/presets/opencode/opencode.jsonc +1 -1
  205. package/presets/opencode/prompts/v1.0.0/architect.md +6 -0
  206. package/presets/opencode/prompts/v1.0.0/implementer.md +7 -0
  207. package/presets/opencode/prompts/v1.0.0/reviewer.md +6 -0
  208. package/presets/opencode/prompts/v1.0.0/tester.md +6 -0
  209. package/presets/opencode/skills/backlog/SKILL.md +61 -0
  210. package/presets/opencode/skills/evaluation/SKILL.md +61 -2
  211. package/presets/opencode/skills/openspec/SKILL.md +47 -31
  212. package/presets/opencode/skills/security-ai-llm/SKILL.md +43 -0
  213. package/presets/opencode/skills/security-blue-team/SKILL.md +43 -0
  214. package/presets/opencode/skills/security-cloud/SKILL.md +43 -0
  215. package/presets/opencode/skills/security-crypto/SKILL.md +43 -0
  216. package/presets/opencode/skills/security-exploit-dev/SKILL.md +45 -0
  217. package/presets/opencode/skills/security-grc/SKILL.md +43 -0
  218. package/presets/opencode/skills/security-incident-response/SKILL.md +45 -0
  219. package/presets/opencode/skills/security-log-analysis/SKILL.md +43 -0
  220. package/presets/opencode/skills/security-malware-analysis/SKILL.md +44 -0
  221. package/presets/opencode/skills/security-mobile/SKILL.md +43 -0
  222. package/presets/opencode/skills/security-network/SKILL.md +43 -0
  223. package/presets/opencode/skills/security-ot-ics/SKILL.md +43 -0
  224. package/presets/opencode/skills/security-recon/SKILL.md +45 -0
  225. package/presets/opencode/skills/security-red-team/SKILL.md +44 -0
  226. package/presets/opencode/skills/security-reverse-engineering/SKILL.md +44 -0
  227. package/presets/opencode/skills/security-soc-automation/SKILL.md +43 -0
  228. package/presets/opencode/skills/security-threat-hunting/SKILL.md +43 -0
  229. package/presets/opencode/skills/security-vuln-assessment/SKILL.md +45 -0
  230. package/presets/opencode/skills/security-web/SKILL.md +44 -0
  231. package/presets/opencode/skills/testing-tdd/SKILL.md +35 -574
  232. package/presets/opencode/skills/using-cc-skills/SKILL.md +48 -0
  233. package/presets/shared/__pycache__/mutation_runner.cpython-314.pyc +0 -0
  234. package/presets/shared/invoke-hook.cjs +115 -0
  235. package/presets/shared/mutation_runner.py +273 -0
  236. package/src/presets/council/council.yml +12 -0
  237. package/src/presets/manifests/agy.yml +2 -0
  238. package/src/presets/manifests/claude.yml +3 -0
  239. package/src/presets/manifests/gemini.yml +15 -0
  240. package/src/presets/models/agy.yml +24 -24
  241. package/src/presets/models/claude.yml +10 -10
  242. package/src/presets/models/codex.yml +10 -10
  243. package/src/presets/models/cursor.yml +10 -10
  244. package/src/presets/models/gemini.yml +10 -10
  245. package/src/presets/models/opencode.yml +10 -10
  246. package/presets/agy/scripts/post-tool.sh +0 -25
  247. package/presets/agy/scripts/pre-tool.sh +0 -56
@@ -1,42 +1,65 @@
1
1
  ---
2
2
  name: evaluation
3
3
  description:
4
- Agent scorecard criteria, outcome tracking, model profiles, and evaluation CLI.
5
- Use when running /cc:scorecard or measuring deliverable quality.
4
+ Guides agents through scorecards, outcomes, model profiles, and eval suites.
5
+ Use when running /cc-scorecard or /cc:scorecard, measuring a deliverable, or
6
+ checking workflow gates with suite-run.
6
7
  ---
7
8
 
8
- # Evaluation Skill
9
+ # Evaluation
9
10
 
10
- ## Scorecard criteria (8 weighted)
11
+ ## Overview
11
12
 
12
- See `docs/agent-scorecard.md`. Pass threshold: weighted score >= 2.0, no criterion at 0.
13
+ A scorecard measures the deliverable against eight weighted criteria. Spec
14
+ quality checklists are reviewer-owned. "Seems right" is not a verdict.
13
15
 
14
- ## CLI
16
+ Pass threshold: weighted score >= 2.0 and no criterion at 0.
15
17
 
16
- ```bash
17
- npx cc-codeconductor scorecard create --task BC-001 --from-diff
18
- npx cc-codeconductor scorecard record --task BC-001 --verdict PASS --score 2.5
19
- npx cc-codeconductor scorecard list
20
- npx cc-codeconductor scorecard aggregate
21
- npx cc-codeconductor scorecard models
22
- npx cc-codeconductor scorecard regression
23
- npx cc-codeconductor scorecard matrix
24
- npx cc-codeconductor scorecard compare-models
25
- npx cc-codeconductor scorecard prompt-diff 0.4.0 0.5.0 --agent architect
18
+ ## When to Use
19
+
20
+ - After implement/review, before `openspec archive`
21
+ - Comparing models or prompt versions
22
+ - Proving the workflow tools still work (`suite-run`)
23
+
24
+ **NOT** for rewriting specs (reviewer checklist) or for implementing code.
25
+
26
+ ## Process
27
+
28
+ Local: `bun run dev`. Published: `npx cc-codeconductor`.
29
+
30
+ ```text
31
+ scorecard create --task BC-001 --from-diff
32
+ scorecard record --task BC-001 --verdict PASS --score 2.5
33
+ scorecard list | aggregate | models | regression | matrix | compare-models
34
+ scorecard prompt-diff 0.4.0 0.5.0 --agent architect
35
+ scorecard experiment start --suite harness-v1
36
+ scorecard suite-run --suite workflow-gates
37
+ scorecard suite-run --suite hook-guardrails
38
+ scorecard suite-run --suite scorecard-signals
26
39
  ```
27
40
 
28
- ## Outcome tracking
41
+ `openspec analyze` can auto-suggest `acceptance` / `tests` on `--from-diff`.
42
+ Archive needs PASS when review is required.
29
43
 
30
- Append-only: `.codeconductor/evaluation/outcomes.jsonl`
44
+ Outcomes append to `.codeconductor/evaluation/outcomes.jsonl`.
31
45
 
32
- Record after each phase (openspec) and after review gate with agent, model, verdict, optional cost/tokens.
46
+ ## Common Rationalizations
33
47
 
34
- ## Execution profiles
48
+ | Rationalization | Reality |
49
+ | --- | --- |
50
+ | I'll fill the scorecard by hand without a diff | Use `--from-diff` and runner evidence. |
51
+ | Suites are optional toys | `suite-run` is the workflow tool that proves gates. |
52
+ | Handmade TDD JSON is fine | The runner rejects it. |
35
53
 
36
- `.codeconductor/evaluation/execution-profile.yml` `balanced`, `quality`, `economical`.
54
+ ## Red Flags
37
55
 
38
- Use `scorecard models` before OpenSpec execute loop to show phase → agent → model.
56
+ - PASS with a criterion at 0
57
+ - Archive without a recorded scorecard when review is required
58
+ - Declaring the workflow ready without `suite-run` or `scorecard record`
39
59
 
40
- ## Verdicts
60
+ ## Verification
41
61
 
42
- PASS / REVISE / REJECT see scorecard calculator rules in docs.
62
+ - [ ] Scorecard created from diff (or explicit scores)
63
+ - [ ] Verdict PASS / REVISE / REJECT recorded
64
+ - [ ] For process changes: `scorecard suite-run --suite hook-guardrails` (and
65
+ `workflow-gates` / `scorecard-signals` when those gates changed)
@@ -1,54 +1,66 @@
1
1
  ---
2
2
  name: openspec
3
3
  description:
4
- OpenSpec backlog format, state machine, and delivery workflow for CodeConductor.
5
- Use when running /cc:openspec or editing BACKLOG.md.
4
+ Guides agents through OpenSpec delivery from BACKLOG.md (validate, analyze,
5
+ test-before-implement, scorecard, archive). Use when running /cc-openspec,
6
+ /cc:openspec, or delivering an existing backlog item. Authoring BACKLOG.md
7
+ is skill backlog, not this skill.
6
8
  ---
7
9
 
8
- # OpenSpec / BACKLOG Skill
10
+ # OpenSpec delivery
9
11
 
10
- ## BACKLOG.md contract
12
+ ## Overview
11
13
 
12
- `BACKLOG.md` at repo root is the operational queue. Required sections:
14
+ This skill delivers an existing `BACKLOG.md` item. It is a workflow with CLI
15
+ gates, not a reference doc. Specs describe WHAT; `design.md` describes HOW.
13
16
 
14
- - `## Global` — Product, Strategy, Policy, Review required, TDD required
15
- - `## Items` — active backlog entries
16
- - `## Archive` — completed entries (do not re-execute)
17
+ ## When to Use
17
18
 
18
- Each item: `### BC-001 | Short title` with Priority (P0–P3), Status, Type, Depends on, Description, Scope, Out of scope, Acceptance (measurable checklist).
19
+ - `/cc-openspec` or `openspec next` / `plan` / `done` / `archive`
20
+ - An item is `READY` or later and must move through the state machine
19
21
 
20
- ## Status machine
22
+ **NOT** for creating `BACKLOG.md` (use skill `backlog`) or for stack-specific
23
+ coding rules.
21
24
 
22
- `TODO` → `READY` → `PLANNED` → `IN_PROGRESS` → `REVIEW` → `DONE` → Archive
25
+ ## Process
23
26
 
24
- `BLOCKED` can return to `READY` when resolved. Reviewer rejection: `REVIEW` → `IN_PROGRESS`.
27
+ Local CLI is `bun run dev`. Published package is `npx cc-codeconductor`.
25
28
 
26
- ## CLI commands
29
+ 1. `openspec validate` — must pass before delivery.
30
+ 2. `openspec plan BC-xxx` if the item is not yet `PLANNED`.
31
+ 3. `openspec analyze --output json` — CRITICAL findings exit 1. Do not implement.
32
+ 4. Phases: discover (`repo-explorer`) → design (`architect`) → test (`tester`) →
33
+ implement (`implementer`) → review (`reviewer`). If Global `TDD required: yes`,
34
+ test runs before implement.
35
+ 5. `openspec done` on test/implement requires `captureTddSuiteEvidence`. Handmade
36
+ evidence JSON is rejected.
37
+ 6. `scorecard create --task BC-xxx --from-diff` then record a verdict.
38
+ 7. `openspec archive` only after human review when `Review required: yes` and
39
+ the scorecard is PASS.
27
40
 
28
- ```bash
29
- npx cc-codeconductor openspec validate # gate must pass before delivery
30
- npx cc-codeconductor openspec scan
31
- npx cc-codeconductor openspec plan BC-001
32
- npx cc-codeconductor openspec status
33
- npx cc-codeconductor openspec next
34
- ```
41
+ Status machine: `TODO` → `READY` → `PLANNED` → `IN_PROGRESS` → `REVIEW` → `DONE`
42
+ Archive. `BLOCKED` returns to `READY`. Reviewer rejection: `REVIEW`
43
+ `IN_PROGRESS`.
35
44
 
36
- ## OpenSpec folders
45
+ ## Common Rationalizations
37
46
 
38
- Each item generates `openspec/changes/<slug>/` with `proposal.md`, `design.md`, `tasks.md`, `specs/` — compatible with Fission-AI OpenSpec layout (no external CLI required).
47
+ | Rationalization | Reality |
48
+ | --- | --- |
49
+ | Validate is bureaucracy | `openspec validate` is the gate. Skipping it is a defect. |
50
+ | I'll add tests after green | Global TDD required means tester before implementer. |
51
+ | I'll write the evidence JSON myself | Handmade TDD JSON is rejected. Use the verification runner. |
52
+ | The item is small; skip analyze | `openspec analyze` CRITICAL still stops implement. |
39
53
 
40
- ## Agent phases
54
+ ## Red Flags
41
55
 
42
- | Phase | Agent |
43
- |-------|-------|
44
- | discover | repo-explorer |
45
- | design | architect |
46
- | test | tester |
47
- | implement | implementer |
48
- | review | reviewer |
56
+ - Implementing while analyze reports CRITICAL
57
+ - Archive without a PASS scorecard when review is required
58
+ - Acceptance like "improve UX" with no measurable check
49
59
 
50
- When Global `TDD required: yes`, test runs before implement.
60
+ ## Verification
51
61
 
52
- ## Reject vague backlog
53
-
54
- Do not process items with acceptance like "improve UX" or "fix bugs". Require verifiable criteria.
62
+ - [ ] `openspec validate` exit 0
63
+ - [ ] `openspec analyze --output json` has no CRITICAL
64
+ - [ ] TDD evidence from the runner when TDD is required
65
+ - [ ] `scorecard create --from-diff` recorded
66
+ - [ ] Suite check (optional): `bun run dev scorecard suite-run --suite workflow-gates`
@@ -0,0 +1,382 @@
1
+ ---
2
+ id: security
3
+ version: 1.0.0
4
+ name: Security
5
+ description: >
6
+ Provides expert knowledge for implementing and reviewing application security following OWASP Top 10 (2021), with stack-specific patterns for Spring Boot, Django, Next.js, and Astro.
7
+
8
+ user-invokable: true
9
+ license: MIT
10
+ metadata:
11
+ author: lgzarturo
12
+ category: security
13
+
14
+ compatibility:
15
+ tools: [claude, codex, gemini, agy, opencode]
16
+ stacks:
17
+ languages: []
18
+ frameworks: []
19
+
20
+ risk:
21
+ level: high
22
+ can_execute_shell: false
23
+ can_modify_files: true
24
+ requires_network: false
25
+
26
+ inputs: []
27
+
28
+ outputs: []
29
+
30
+ quality:
31
+ reviewed_by: codeconductor-core
32
+ version: 0.1.0
33
+ ---
34
+
35
+
36
+
37
+ # Security
38
+
39
+ ## OWASP Top 10 (2021) — Quick Reference
40
+
41
+ | # | Category | What to check |
42
+ |---|----------|--------------|
43
+ | A01 | Broken Access Control | Is authorization enforced on every endpoint? |
44
+ | A02 | Cryptographic Failures | Are secrets encrypted at rest and in transit? |
45
+ | A03 | Injection | Is all input sanitized or parameterized? |
46
+ | A04 | Insecure Design | Is the threat model documented? |
47
+ | A05 | Security Misconfiguration | Are defaults changed? Debug off in prod? |
48
+ | A06 | Vulnerable Components | Are dependencies up to date? |
49
+ | A07 | Auth & Session Failures | Are sessions invalidated on logout? Token expiry set? |
50
+ | A08 | Software Integrity Failures | Are supply-chain dependencies verified? |
51
+ | A09 | Logging & Monitoring Failures | Are security events logged without leaking PII? |
52
+ | A10 | SSRF | Are outbound URLs allowlisted? |
53
+
54
+ ## Input Validation
55
+
56
+ Validate all input at system boundaries. Never trust data from: HTTP request
57
+ body, query parameters, headers, cookies, or environment variables passed by
58
+ external systems.
59
+
60
+ **Rules:**
61
+
62
+ - Validate type, format, length, and range
63
+ - Reject unknown fields — do not silently ignore them
64
+ - Use allowlists (accept known-good), not blocklists (reject known-bad)
65
+ - Validate at the API layer before it reaches the service layer
66
+
67
+ ```kotlin
68
+ // Spring Boot — Bean Validation
69
+ data class CreateUserRequest(
70
+ @field:NotBlank @field:Email val email: String,
71
+ @field:Size(min = 8, max = 72) val password: String,
72
+ @field:Size(max = 100) val name: String
73
+ )
74
+
75
+ @PostMapping
76
+ fun createUser(@Valid @RequestBody request: CreateUserRequest): ResponseEntity<UserResponse> {
77
+ // request is guaranteed valid here
78
+ }
79
+ ```
80
+
81
+ ```python
82
+ # Django REST Framework — serializer validation
83
+ class CreateUserSerializer(serializers.Serializer):
84
+ email = serializers.EmailField(max_length=254)
85
+ password = serializers.CharField(min_length=8, max_length=72, write_only=True)
86
+ name = serializers.CharField(max_length=100)
87
+
88
+ def validate_email(self, value):
89
+ if User.objects.filter(email=value).exists():
90
+ raise serializers.ValidationError("Email already registered.")
91
+ return value.lower()
92
+ ```
93
+
94
+ ```typescript
95
+ // Next.js / Astro — Zod
96
+ import { z } from 'zod';
97
+
98
+ const CreateUserSchema = z.object({
99
+ email: z.string().email().max(254),
100
+ password: z.string().min(8).max(72),
101
+ name: z.string().max(100),
102
+ });
103
+
104
+ const result = CreateUserSchema.safeParse(body);
105
+ if (!result.success) {
106
+ return Response.json({ error: result.error.flatten() }, { status: 400 });
107
+ }
108
+ ```
109
+
110
+ ## Authentication
111
+
112
+ ### JWT (Stateless)
113
+
114
+ Use JWTs for stateless API authentication. Keep access tokens short-lived.
115
+
116
+ **Token lifetimes:**
117
+
118
+ | Token | Lifetime | Storage |
119
+ |-------|----------|---------|
120
+ | Access token | 15 minutes | Memory (never localStorage) |
121
+ | Refresh token | 7–30 days | HttpOnly cookie |
122
+
123
+ Never store access tokens in `localStorage` — XSS can read them. Store in
124
+ memory (React state, module variable) and refresh via the HttpOnly cookie.
125
+
126
+ ```kotlin
127
+ // Spring Security 6 + JWT
128
+ @Configuration
129
+ @EnableWebSecurity
130
+ class SecurityConfig(private val jwtFilter: JwtAuthenticationFilter) {
131
+
132
+ @Bean
133
+ fun filterChain(http: HttpSecurity): SecurityFilterChain = http
134
+ .csrf { it.disable() } // stateless API — CSRF not needed
135
+ .sessionManagement { it.sessionCreationPolicy(SessionCreationPolicy.STATELESS) }
136
+ .authorizeHttpRequests { auth ->
137
+ auth
138
+ .requestMatchers("/api/auth/**").permitAll()
139
+ .requestMatchers("/api/admin/**").hasRole("ADMIN")
140
+ .anyRequest().authenticated()
141
+ }
142
+ .addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter::class.java)
143
+ .build()
144
+ }
145
+ ```
146
+
147
+ ```python
148
+ # Django — djangorestframework-simplejwt
149
+ # settings.py
150
+ SIMPLE_JWT = {
151
+ "ACCESS_TOKEN_LIFETIME": timedelta(minutes=15),
152
+ "REFRESH_TOKEN_LIFETIME": timedelta(days=7),
153
+ "ROTATE_REFRESH_TOKENS": True,
154
+ "BLACKLIST_AFTER_ROTATION": True,
155
+ "ALGORITHM": "HS256",
156
+ "AUTH_HEADER_TYPES": ("Bearer",),
157
+ }
158
+ ```
159
+
160
+ ```typescript
161
+ // Next.js — Auth.js (NextAuth v5)
162
+ // auth.ts
163
+ import NextAuth from 'next-auth';
164
+ import Credentials from 'next-auth/providers/credentials';
165
+
166
+ export const { auth, signIn, signOut } = NextAuth({
167
+ providers: [
168
+ Credentials({
169
+ authorize: async (credentials) => {
170
+ // validate and return user or null
171
+ },
172
+ }),
173
+ ],
174
+ session: { strategy: 'jwt', maxAge: 7 * 24 * 60 * 60 },
175
+ });
176
+ ```
177
+
178
+ ### Password Hashing
179
+
180
+ Never store plaintext passwords. Never use MD5 or SHA-1 for password hashing.
181
+
182
+ | Algorithm | Use | Work factor |
183
+ |-----------|-----|-------------|
184
+ | bcrypt | default | cost=12 |
185
+ | Argon2id | preferred when available | m=65536, t=3 |
186
+ | PBKDF2 | FIPS environments | iterations=600000 |
187
+
188
+ ```kotlin
189
+ // Spring Security uses bcrypt by default
190
+ @Bean
191
+ fun passwordEncoder(): PasswordEncoder = BCryptPasswordEncoder(12)
192
+ ```
193
+
194
+ ```python
195
+ # Django uses PBKDF2 by default; switch to Argon2 for stronger hashing
196
+ # pip install django[argon2]
197
+ PASSWORD_HASHERS = [
198
+ "django.contrib.auth.hashers.Argon2PasswordHasher",
199
+ "django.contrib.auth.hashers.PBKDF2PasswordHasher", # fallback for existing hashes
200
+ ]
201
+ ```
202
+
203
+ ## Authorization
204
+
205
+ **Principle of least privilege:** every endpoint must explicitly declare who
206
+ can access it. Deny by default.
207
+
208
+ ```kotlin
209
+ // Spring — method-level security
210
+ @PreAuthorize("hasRole('ADMIN') or #userId == authentication.name")
211
+ fun getUser(userId: String): UserResponse { ... }
212
+ ```
213
+
214
+ ```python
215
+ # Django REST Framework
216
+ class UserDetailView(RetrieveUpdateAPIView):
217
+ permission_classes = [IsAuthenticated, IsOwnerOrAdmin]
218
+ queryset = User.objects.all()
219
+
220
+ class IsOwnerOrAdmin(BasePermission):
221
+ def has_object_permission(self, request, view, obj):
222
+ return request.user.is_staff or obj == request.user
223
+ ```
224
+
225
+ Always check authorization at the **object level**, not just the endpoint
226
+ level. An authenticated user should not be able to access another user's data
227
+ by changing an ID in the URL.
228
+
229
+ ## CORS
230
+
231
+ ```kotlin
232
+ // Spring Boot — explicit allowlist; never use "*" in production
233
+ @Bean
234
+ fun corsConfigurationSource(): CorsConfigurationSource {
235
+ val config = CorsConfiguration().apply {
236
+ allowedOrigins = listOf("https://app.example.com")
237
+ allowedMethods = listOf("GET", "POST", "PUT", "DELETE")
238
+ allowedHeaders = listOf("Authorization", "Content-Type")
239
+ allowCredentials = true
240
+ maxAge = 3600L
241
+ }
242
+ return UrlBasedCorsConfigurationSource().apply {
243
+ registerCorsConfiguration("/api/**", config)
244
+ }
245
+ }
246
+ ```
247
+
248
+ ```python
249
+ # Django — django-cors-headers
250
+ CORS_ALLOWED_ORIGINS = [
251
+ "https://app.example.com",
252
+ ]
253
+ CORS_ALLOW_CREDENTIALS = True
254
+ CORS_ALLOW_ALL_ORIGINS = False # never True in production
255
+ ```
256
+
257
+ ## Security Headers
258
+
259
+ Set these headers on every response. They defend against XSS, clickjacking,
260
+ and MIME sniffing.
261
+
262
+ ```text
263
+ Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
264
+ Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'
265
+ X-Frame-Options: DENY
266
+ X-Content-Type-Options: nosniff
267
+ Referrer-Policy: strict-origin-when-cross-origin
268
+ Permissions-Policy: camera=(), microphone=(), geolocation=()
269
+ ```
270
+
271
+ ```typescript
272
+ // Next.js — next.config.ts
273
+ const securityHeaders = [
274
+ { key: 'X-Frame-Options', value: 'DENY' },
275
+ { key: 'X-Content-Type-Options', value: 'nosniff' },
276
+ { key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
277
+ {
278
+ key: 'Strict-Transport-Security',
279
+ value: 'max-age=63072000; includeSubDomains; preload',
280
+ },
281
+ ];
282
+
283
+ export default {
284
+ headers: async () => [
285
+ { source: '/(.*)', headers: securityHeaders },
286
+ ],
287
+ };
288
+ ```
289
+
290
+ ## Secrets Management
291
+
292
+ **Never commit secrets to source control.** No exceptions.
293
+
294
+ ```text
295
+ ✗ DATABASE_URL = "postgres://user:password@prod.example.com/db" # in source
296
+ ✓ DATABASE_URL = env("DATABASE_URL") # from environment
297
+ ```
298
+
299
+ Rules:
300
+
301
+ - Load secrets from environment variables or a secrets manager (AWS Secrets
302
+ Manager, Vault, GCP Secret Manager)
303
+ - Rotate credentials on any suspected exposure
304
+ - Use separate credentials per environment (dev, staging, prod)
305
+ - Add `.env` to `.gitignore` and never commit it
306
+
307
+ ```python
308
+ # Django — django-environ
309
+ import environ
310
+ env = environ.Env()
311
+ environ.Env.read_env() # reads .env in development only
312
+
313
+ SECRET_KEY = env("SECRET_KEY")
314
+ DATABASE_URL = env.db("DATABASE_URL")
315
+ ```
316
+
317
+ ## Rate Limiting
318
+
319
+ Protect authentication endpoints. Brute-force without rate limiting can
320
+ compromise any account with a weak password.
321
+
322
+ ```kotlin
323
+ // Spring Boot — Bucket4j
324
+ @Component
325
+ class RateLimitFilter(private val rateLimiter: RateLimiter) : OncePerRequestFilter() {
326
+
327
+ override fun doFilterInternal(request: HttpServletRequest, response: HttpServletResponse, chain: FilterChain) {
328
+ if (request.requestURI.startsWith("/api/auth/")) {
329
+ val probe = rateLimiter.tryConsumeAndReturnRemaining(1)
330
+ if (!probe.isConsumed) {
331
+ response.status = HttpStatus.TOO_MANY_REQUESTS.value()
332
+ return
333
+ }
334
+ }
335
+ chain.doFilter(request, response)
336
+ }
337
+ }
338
+ ```
339
+
340
+ Minimum rate limits for auth endpoints: 5 requests per minute per IP. Stricter
341
+ limits (e.g., 3 per 15 minutes) are better for login endpoints.
342
+
343
+ ## SQL Injection Prevention
344
+
345
+ Never concatenate user input into SQL strings. Always use parameterized queries
346
+ or an ORM.
347
+
348
+ ```kotlin
349
+ // bad — SQL injection risk
350
+ val user = jdbcTemplate.queryForObject("SELECT * FROM users WHERE email = '$email'")
351
+
352
+ // good — parameterized
353
+ val user = jdbcTemplate.queryForObject(
354
+ "SELECT * FROM users WHERE email = ?",
355
+ UserRowMapper(),
356
+ email
357
+ )
358
+ ```
359
+
360
+ ```python
361
+ # bad
362
+ User.objects.raw(f"SELECT * FROM users WHERE email = '{email}'")
363
+
364
+ # good — Django ORM handles parameterization automatically
365
+ User.objects.filter(email=email)
366
+ ```
367
+
368
+ ## Logging Security Events
369
+
370
+ Log authentication events without including sensitive data.
371
+
372
+ ```text
373
+ Log: login success/failure, permission denied, password reset, token refresh
374
+ Never: passwords, tokens, PII (full email in prod logs), credit card numbers
375
+ ```
376
+
377
+ ```kotlin
378
+ // Log security events at INFO level; failures at WARN
379
+ log.info("Authentication successful for user={}", userId)
380
+ log.warn("Authentication failed: invalid credentials for user={}", maskedEmail)
381
+ log.warn("Authorization denied: user={} attempted access to resource={}", userId, resourceId)
382
+ ```
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: security-ai-llm
3
+ description: >
4
+ Harden LLM and agent integrations you operate: prompt injection, tool allowlists, secret leakage, and supply-chain of models. Defensive only.
5
+ ---
6
+
7
+ # AI / LLM Security
8
+
9
+ ## Authorization
10
+
11
+ Use this skill only with **explicit written authorization** for a named
12
+ scope (systems, environments, and time window). If authorization is missing,
13
+ expired, or the request is for someone else's systems, **stop**.
14
+
15
+ This skill is **defensive and owner-authorized**. It does not authorize
16
+ offensive cyber operations.
17
+
18
+ ## Do
19
+
20
+ - Treat model output as untrusted; never exec it without a schema
21
+ - Allowlist tools and paths; contain file writes
22
+ - Keep secrets out of prompts and logs
23
+
24
+ ## Do not
25
+
26
+ - Help jailbreak third-party products or steal model weights
27
+ - Log raw user PII to prompt-debug stores
28
+
29
+ - Do not produce exploit payloads, malware, or attack procedures.
30
+
31
+ ## How to Use
32
+
33
+ Load this skill from `/cc-security` when the Task Card domain is `security-ai-llm`.
34
+ Example prompts:
35
+
36
+ - `Review our agent tool runner for path traversal and unbounded shell.`
37
+ - `Add tests that a prompt cannot make the bot dump .env.`
38
+
39
+ ## Integration
40
+
41
+ - Workflow: `/cc-security` (CCEP command `security`)
42
+ - Existing OWASP application-security skill remains `security` (not this id)
43
+ - High-risk changes still require `security-reviewer`
@@ -0,0 +1,43 @@
1
+ ---
2
+ name: security-blue-team
3
+ description: >
4
+ Improve detections, hardening, and response for the estate you defend. Detection-as-code and control design, not offense.
5
+ ---
6
+
7
+ # Blue Team Defense
8
+
9
+ ## Authorization
10
+
11
+ Use this skill only with **explicit written authorization** for a named
12
+ scope (systems, environments, and time window). If authorization is missing,
13
+ expired, or the request is for someone else's systems, **stop**.
14
+
15
+ This skill is **defensive and owner-authorized**. It does not authorize
16
+ offensive cyber operations.
17
+
18
+ ## Do
19
+
20
+ - Tune detections for true positives; document exceptions
21
+ - Pair every new control with a test or canary
22
+ - Share hunt hypotheses with IR, not with the public internet
23
+
24
+ ## Do not
25
+
26
+ - Disable EDR or logging to 'reduce noise' without a ticket
27
+ - Copy attacker malware into production 'for training'
28
+
29
+ - Do not produce exploit payloads, malware, or attack procedures.
30
+
31
+ ## How to Use
32
+
33
+ Load this skill from `/cc-security` when the Task Card domain is `security-blue-team`.
34
+ Example prompts:
35
+
36
+ - `We missed a token-replay. Propose a detection plus a unit test for the API gateway.`
37
+ - `Harden CI: pin actions, require reviews on workflows that deploy.`
38
+
39
+ ## Integration
40
+
41
+ - Workflow: `/cc-security` (CCEP command `security`)
42
+ - Existing OWASP application-security skill remains `security` (not this id)
43
+ - High-risk changes still require `security-reviewer`