cc-codeconductor 1.1.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 (143) hide show
  1. package/README.md +4 -2
  2. package/dist/core/verification/verification-runner.d.ts +7 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.js +1413 -309
  5. package/dist/library.js +29 -1
  6. package/dist/validation/schemas.d.ts +97 -26
  7. package/package.json +1 -1
  8. package/presets/agy/AGENTS.md +10 -9
  9. package/presets/agy/hooks.json +2 -2
  10. package/presets/agy/scripts/invoke-hook.cjs +115 -0
  11. package/presets/agy/skills/backlog/SKILL.md +40 -70
  12. package/presets/agy/skills/cc-spec-mutation/SKILL.md +165 -0
  13. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +3 -0
  14. package/presets/agy/skills/evaluation/SKILL.md +61 -2
  15. package/presets/agy/skills/openspec/SKILL.md +49 -19
  16. package/presets/agy/skills/testing-tdd/SKILL.md +53 -0
  17. package/presets/agy/skills/using-cc-skills/SKILL.md +48 -0
  18. package/presets/agy/workflows/cc-api-contract.md +14 -0
  19. package/presets/agy/workflows/cc-db-migration.md +14 -0
  20. package/presets/agy/workflows/cc-feature.md +18 -0
  21. package/presets/agy/workflows/cc-fix.md +14 -0
  22. package/presets/agy/workflows/cc-iterative.md +14 -0
  23. package/presets/agy/workflows/cc-openspec.md +14 -0
  24. package/presets/agy/workflows/cc-scorecard.md +2 -0
  25. package/presets/agy/workflows/cc-spec-mutation.md +191 -0
  26. package/presets/agy/workflows/cc-tdd-cycle.md +14 -0
  27. package/presets/claude/commands/cc/api-contract.md +14 -0
  28. package/presets/claude/commands/cc/db-migration.md +14 -0
  29. package/presets/claude/commands/cc/feature.md +18 -0
  30. package/presets/claude/commands/cc/fix.md +17 -0
  31. package/presets/claude/commands/cc/iterative.md +14 -0
  32. package/presets/claude/commands/cc/openspec.md +14 -0
  33. package/presets/claude/commands/cc/review.md +3 -0
  34. package/presets/claude/commands/cc/scorecard.md +2 -0
  35. package/presets/claude/commands/cc/spec-mutation.md +190 -0
  36. package/presets/claude/commands/cc/tdd-cycle.md +17 -0
  37. package/presets/claude/settings.json +13 -11
  38. package/presets/claude/skills/backlog/SKILL.md +40 -70
  39. package/presets/claude/skills/evaluation/SKILL.md +47 -24
  40. package/presets/claude/skills/openspec/SKILL.md +46 -38
  41. package/presets/claude/skills/testing-tdd/SKILL.md +53 -0
  42. package/presets/claude/skills/using-cc-skills/SKILL.md +48 -0
  43. package/presets/codex/AGENTS.md +16 -12
  44. package/presets/codex/skills/backlog/SKILL.md +61 -0
  45. package/presets/codex/skills/cc-api-contract/SKILL.md +87 -0
  46. package/presets/codex/skills/cc-backlog/SKILL.md +108 -0
  47. package/presets/codex/skills/cc-clarify/SKILL.md +36 -0
  48. package/presets/codex/skills/cc-council/SKILL.md +92 -0
  49. package/presets/codex/skills/cc-db-migration/SKILL.md +88 -0
  50. package/presets/codex/skills/cc-explore/SKILL.md +40 -0
  51. package/presets/codex/skills/cc-feature/SKILL.md +154 -0
  52. package/presets/codex/skills/cc-fix/SKILL.md +165 -0
  53. package/presets/codex/skills/cc-handoff/SKILL.md +45 -0
  54. package/presets/codex/skills/cc-iterative/SKILL.md +150 -0
  55. package/presets/codex/skills/cc-openspec/SKILL.md +191 -0
  56. package/presets/codex/skills/cc-pagespeed/SKILL.md +124 -0
  57. package/presets/codex/skills/cc-prototype/SKILL.md +42 -0
  58. package/presets/codex/skills/cc-refactor/SKILL.md +163 -0
  59. package/presets/codex/skills/cc-review/SKILL.md +152 -0
  60. package/presets/codex/skills/cc-scorecard/SKILL.md +82 -0
  61. package/presets/codex/skills/cc-security/SKILL.md +182 -0
  62. package/presets/codex/skills/cc-spec-mutation/SKILL.md +192 -0
  63. package/presets/codex/skills/cc-tdd-cycle/SKILL.md +266 -0
  64. package/presets/codex/skills/cc-test-plan/SKILL.md +153 -0
  65. package/presets/codex/skills/cc-triage/SKILL.md +38 -0
  66. package/presets/codex/skills/evaluation/SKILL.md +65 -0
  67. package/presets/codex/skills/openspec/SKILL.md +66 -0
  68. package/presets/codex/skills/testing-tdd/SKILL.md +53 -0
  69. package/presets/codex/skills/using-cc-skills/SKILL.md +48 -0
  70. package/presets/cursor/commands/cc/api-contract.md +14 -0
  71. package/presets/cursor/commands/cc/db-migration.md +14 -0
  72. package/presets/cursor/commands/cc/feature.md +18 -0
  73. package/presets/cursor/commands/cc/fix.md +17 -0
  74. package/presets/cursor/commands/cc/iterative.md +14 -0
  75. package/presets/cursor/commands/cc/openspec.md +14 -0
  76. package/presets/cursor/commands/cc/scorecard.md +2 -0
  77. package/presets/cursor/commands/cc/spec-mutation.md +190 -0
  78. package/presets/cursor/commands/cc/tdd-cycle.md +14 -0
  79. package/presets/cursor/skills/backlog/SKILL.md +40 -70
  80. package/presets/cursor/skills/evaluation/SKILL.md +61 -4
  81. package/presets/cursor/skills/openspec/SKILL.md +46 -36
  82. package/presets/cursor/skills/testing-tdd/SKILL.md +35 -574
  83. package/presets/cursor/skills/using-cc-skills/SKILL.md +48 -0
  84. package/presets/gemini/commands/cc/api-contract.toml +82 -0
  85. package/presets/gemini/commands/cc/ask.toml +54 -0
  86. package/presets/gemini/commands/cc/backlog.toml +103 -0
  87. package/presets/gemini/commands/cc/clarify.toml +31 -0
  88. package/presets/gemini/commands/cc/council.toml +87 -0
  89. package/presets/gemini/commands/cc/db-migration.toml +83 -0
  90. package/presets/gemini/commands/cc/explore.toml +35 -0
  91. package/presets/gemini/commands/cc/feature.toml +153 -0
  92. package/presets/gemini/commands/cc/fix.toml +163 -0
  93. package/presets/gemini/commands/cc/handoff.toml +40 -0
  94. package/presets/gemini/commands/cc/iterative.toml +145 -0
  95. package/presets/gemini/commands/cc/openspec.toml +186 -0
  96. package/presets/gemini/commands/cc/pagespeed.toml +119 -0
  97. package/presets/gemini/commands/cc/prototype.toml +37 -0
  98. package/presets/gemini/commands/cc/refactor.toml +158 -0
  99. package/presets/gemini/commands/cc/review.toml +150 -0
  100. package/presets/gemini/commands/cc/scorecard.toml +77 -0
  101. package/presets/gemini/commands/cc/security.toml +177 -0
  102. package/presets/gemini/commands/cc/spec-mutation.toml +187 -0
  103. package/presets/gemini/commands/cc/tdd-cycle.toml +264 -0
  104. package/presets/gemini/commands/cc/test-plan.toml +148 -0
  105. package/presets/gemini/commands/cc/triage.toml +33 -0
  106. package/presets/opencode/README.md +24 -21
  107. package/presets/opencode/agents/architect.md +6 -0
  108. package/presets/opencode/agents/implementer.md +7 -0
  109. package/presets/opencode/agents/reviewer.md +6 -0
  110. package/presets/opencode/agents/tester.md +6 -0
  111. package/presets/opencode/commands/cc-api-contract.md +14 -0
  112. package/presets/opencode/commands/cc-db-migration.md +14 -0
  113. package/presets/opencode/commands/cc-feature.md +18 -0
  114. package/presets/opencode/commands/cc-fix.md +17 -0
  115. package/presets/opencode/commands/cc-iterative.md +14 -0
  116. package/presets/opencode/commands/cc-openspec.md +14 -0
  117. package/presets/opencode/commands/cc-scorecard.md +2 -0
  118. package/presets/opencode/commands/cc-spec-mutation.md +190 -0
  119. package/presets/opencode/commands/cc-tdd-cycle.md +14 -0
  120. package/presets/opencode/opencode.jsonc +1 -1
  121. package/presets/opencode/prompts/v1.0.0/architect.md +6 -0
  122. package/presets/opencode/prompts/v1.0.0/implementer.md +7 -0
  123. package/presets/opencode/prompts/v1.0.0/reviewer.md +6 -0
  124. package/presets/opencode/prompts/v1.0.0/tester.md +6 -0
  125. package/presets/opencode/skills/backlog/SKILL.md +40 -70
  126. package/presets/opencode/skills/evaluation/SKILL.md +61 -2
  127. package/presets/opencode/skills/openspec/SKILL.md +46 -34
  128. package/presets/opencode/skills/testing-tdd/SKILL.md +35 -574
  129. package/presets/opencode/skills/using-cc-skills/SKILL.md +48 -0
  130. package/presets/shared/__pycache__/mutation_runner.cpython-314.pyc +0 -0
  131. package/presets/shared/invoke-hook.cjs +115 -0
  132. package/presets/shared/mutation_runner.py +273 -0
  133. package/src/presets/manifests/agy.yml +2 -0
  134. package/src/presets/manifests/claude.yml +3 -0
  135. package/src/presets/manifests/gemini.yml +15 -0
  136. package/src/presets/models/agy.yml +24 -24
  137. package/src/presets/models/claude.yml +10 -10
  138. package/src/presets/models/codex.yml +10 -10
  139. package/src/presets/models/cursor.yml +10 -10
  140. package/src/presets/models/gemini.yml +10 -10
  141. package/src/presets/models/opencode.yml +10 -10
  142. package/presets/agy/scripts/post-tool.sh +0 -25
  143. package/presets/agy/scripts/pre-tool.sh +0 -56
@@ -0,0 +1,158 @@
1
+ description = "test verification, risk-based implementation, and scope enforcement."
2
+
3
+ prompt = """
4
+ # Refactor Workflow
5
+
6
+ Refactor description: {{args}}
7
+
8
+ Describe what you want to refactor and why. Include:
9
+
10
+ - The current structure or pattern being changed
11
+ - The target structure or pattern
12
+ - The motivation (performance, readability, architectural alignment, etc.)
13
+ - Known risk areas or dependencies
14
+
15
+ ---
16
+
17
+ ## Prerequisite — Test coverage check
18
+
19
+ Before any role is adopted, verify that the code being refactored has adequate
20
+ test coverage.
21
+
22
+ A refactor without tests is not a refactor — it is a rewrite with unknown
23
+ behavioral consequences.
24
+
25
+ If coverage is insufficient:
26
+
27
+ 1. **STOP**. Report the coverage gap.
28
+ 2. Suggest running `/test-plan` first to establish coverage.
29
+ 3. Do not proceed with the refactor until coverage is confirmed.
30
+
31
+ ---
32
+
33
+ ## Step 0 — CCEP Bootstrap
34
+
35
+ Command: `refactor` (fixed for this workflow — do not infer from user text)
36
+
37
+ 1. Run: `npx cc-codeconductor ccep parse --command refactor "{{args}}" --output json`
38
+ 2. Run: `npx cc-codeconductor ccep resolve --command refactor "{{args}}" --output json`
39
+ 3. Run: `npx cc-codeconductor ccep profile refactor --output json`
40
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command refactor --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
41
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
42
+
43
+ ---
44
+
45
+ ## Step 1 — Architectural justification (Architect role)
46
+
47
+ Invoke the `architect` subagent via the Task tool. Always invoke this step
48
+ first, regardless of risk level. A refactor without a written justification is
49
+ scope creep in disguise.
50
+
51
+ Produce a Refactor Plan that includes:
52
+
53
+ - Statement of the problem with the current structure
54
+ - Proposed target structure and rationale
55
+ - Affected files and module boundaries
56
+ - Risk level: `low`, `medium`, or `high`
57
+ - Behavioral invariants that must not change
58
+ - Open questions requiring human input
59
+
60
+ **Scope creep warning:** If during planning you identify unrelated improvements,
61
+ list them separately as "Out of scope." They are not part of this refactor.
62
+
63
+ **STOP here. Show the Refactor Plan and wait for explicit human approval. Do not
64
+ proceed without written approval of the plan.**
65
+
66
+ ---
67
+
68
+ ## Step 2 — Route by risk
69
+
70
+ Read the risk field from the Refactor Plan and follow the corresponding route.
71
+
72
+ ### Low-risk route
73
+
74
+ Applies when: the refactor is purely internal, no public interfaces change, full
75
+ test coverage exists for the affected code, and behavioral impact is isolated to
76
+ the refactored module.
77
+
78
+ Route: Architect (done) → Implementer
79
+
80
+ Proceed to Step 3a.
81
+
82
+ ### Medium or high-risk route
83
+
84
+ Applies when: module boundaries change, shared interfaces are affected,
85
+ performance characteristics may change, or the refactor touches more than two
86
+ files with behavioral impact.
87
+
88
+ Route: Architect (done) → Implementer → Reviewer
89
+
90
+ Proceed to Step 3b.
91
+
92
+ ---
93
+
94
+ ## Step 3a — Implementation, low-risk (Implementer role)
95
+
96
+ Invoke the `implementer` subagent via the Task tool. Use the approved
97
+ Refactor Plan.
98
+ Implementer creates a Git Worktree before touching any file; all edits happen inside it.
99
+
100
+ 1. Read the Refactor Plan before opening any file.
101
+ 2. Apply only the changes specified in the plan.
102
+ 3. Run the full test suite before and after — both runs must pass.
103
+ 4. Produce an Implementation Summary: what changed, what did not change, test
104
+ results before and after.
105
+
106
+ Any deviation from the plan — including "obvious improvements" encountered
107
+ during implementation — must be flagged and held for a separate task.
108
+
109
+ ---
110
+
111
+ ## Step 3b — Implementation, medium/high-risk (Implementer role)
112
+
113
+ Same rules as Step 3a. Additionally:
114
+
115
+ - Document any unexpected complexity discovered during implementation.
116
+ - Pause and report if complexity changes the risk assessment.
117
+ - If new risks are found, **STOP** and report before continuing.
118
+
119
+ ---
120
+
121
+ ## Step 4 — Test suite verification
122
+
123
+ For all risk levels, confirm:
124
+
125
+ - All tests that existed before the refactor still pass.
126
+ - No test was deleted or commented out to make the suite pass.
127
+ - Behavior documented in the Task Card remains unchanged.
128
+
129
+ If any test fails that was passing before, the refactor has introduced a
130
+ regression. **STOP and report.**
131
+
132
+ ---
133
+
134
+ ## Step 5 — Code review (Reviewer role) — medium/high-risk only
135
+
136
+ Invoke the `reviewer` subagent via the Task tool. Use the diff and Refactor
137
+ Plan.
138
+
139
+ Verify:
140
+
141
+ - The implementation matches the approved plan.
142
+ - No behavior was changed beyond the plan's scope.
143
+ - No unrelated files were modified.
144
+
145
+ Review Report must include CRITICAL / WARNING / SUGGESTION findings. CRITICAL
146
+ findings block completion.
147
+
148
+ ---
149
+
150
+ ## Completion
151
+
152
+ Report: Refactor Plan (approved), Implementation Summary, test results before
153
+ and after, Review Report (if applicable).
154
+
155
+ The refactor is complete only when: all pre-existing tests still pass, the
156
+ implementation matches the approved plan exactly, and no CRITICAL review
157
+ findings remain.
158
+ """
@@ -0,0 +1,150 @@
1
+ description = "CRITICAL, WARNING, and SUGGESTION findings; CRITICAL findings block merge."
2
+
3
+ prompt = """
4
+ # Code Review Workflow
5
+
6
+ Review target: {{args}}
7
+
8
+ Specify what to review. Accepted formats:
9
+
10
+ - A branch name: `feature/my-branch`
11
+ - A file or set of files: `src/api/UserController.kt`
12
+ - A pull request reference: `PR #42`
13
+ - Empty — defaults to the current working diff (`git diff`)
14
+
15
+ ---
16
+
17
+ ## Step 0 — CCEP Bootstrap
18
+
19
+ Command: `review` (fixed for this workflow — do not infer from user text)
20
+
21
+ 1. Run: `npx cc-codeconductor ccep parse --command review "{{args}}" --output json`
22
+ 2. Run: `npx cc-codeconductor ccep resolve --command review "{{args}}" --output json`
23
+ 3. Run: `npx cc-codeconductor ccep profile review --output json`
24
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command review --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
25
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
26
+
27
+ ---
28
+
29
+ ## Step 1 — Diff collection
30
+
31
+ Before adopting the Reviewer role, collect the diff for the specified target.
32
+
33
+ If {{args}} is empty or not provided:
34
+
35
+ - Use `git diff HEAD` as the review target.
36
+
37
+ If {{args}} is a branch name:
38
+
39
+ - Use `git diff main...{{args}}` (or `develop` if main is not the base).
40
+
41
+ If {{args}} is a PR reference:
42
+
43
+ - Retrieve the PR diff and the PR description for context.
44
+
45
+ If {{args}} is a file path:
46
+
47
+ - Use `git diff HEAD -- {{args}}`.
48
+
49
+ Show the diff summary (files changed, lines added/removed) before proceeding.
50
+
51
+ ---
52
+
53
+ ## Step 2 — Code review (Reviewer role)
54
+
55
+ Invoke the `reviewer` subagent via the Task tool.
56
+
57
+ Evaluate the diff against the following checklist:
58
+
59
+ **Correctness**
60
+
61
+ - Does the implementation match the stated intent?
62
+ - Are there logic errors, off-by-one errors, or unhandled edge cases?
63
+
64
+ **Architecture alignment**
65
+
66
+ - Does the change follow existing module boundaries?
67
+ - Does it introduce unplanned coupling or layering violations?
68
+
69
+ **Security**
70
+
71
+ - Are inputs validated before use?
72
+ - Is there any credential, token, or secret in the diff?
73
+ - Are there SQL injection, XSS, or injection risks?
74
+
75
+ **Performance**
76
+
77
+ - Does the change introduce N+1 queries, blocking I/O, or O(n²) loops?
78
+
79
+ **Test coverage**
80
+
81
+ - Do tests exist for the new or changed behavior?
82
+ - Are assertions meaningful (not just checking that no exception is thrown)?
83
+
84
+ **Documentation**
85
+
86
+ - Are public interfaces documented?
87
+ - Is CHANGELOG updated if behavior changed?
88
+
89
+ ---
90
+
91
+ ## Step 3 — Review Report
92
+
93
+ Produce a structured Review Report with findings in three categories:
94
+
95
+ ```markdown
96
+ ## Review Report
97
+
98
+ ### CRITICAL
99
+ [Findings that must be fixed before merge — file:line, description, suggested resolution]
100
+
101
+ ### WARNING
102
+ [Findings that should be resolved before merge — same format as CRITICAL]
103
+
104
+ ### SUGGESTION
105
+ [Optional improvements — style, readability, future-proofing. These do not block merge.]
106
+
107
+ ### Summary
108
+ - Files reviewed: N
109
+ - Total findings: N (X critical, Y warnings, Z suggestions)
110
+ - Merge recommendation: APPROVED | BLOCKED
111
+ ```
112
+
113
+ ---
114
+
115
+ ## Step 4 — Merge decision
116
+
117
+ If any CRITICAL findings exist:
118
+
119
+ - The Review Report status is **BLOCKED**.
120
+ - Report all CRITICAL findings.
121
+ - Do not proceed until each CRITICAL finding is resolved.
122
+ - After resolution, run `/review` again on the same target.
123
+
124
+ If no CRITICAL findings exist:
125
+
126
+ - The Review Report status is **APPROVED**.
127
+ - Report any WARNINGs and SUGGESTIONs for human awareness.
128
+ - The human makes the final merge decision.
129
+
130
+ ---
131
+
132
+ ## Completion
133
+
134
+ Deliver the complete Review Report. Never summarize or omit findings.
135
+
136
+ ---
137
+
138
+ ## Step 5 — Scorecard and outcome
139
+
140
+ ```bash
141
+ npx cc-codeconductor scorecard create --from-diff --agent reviewer
142
+ npx cc-codeconductor scorecard record --verdict PASS|REVISE|REJECT --score <weighted>
143
+ npx cc-codeconductor scorecard regression
144
+ ```
145
+
146
+ Map merge recommendation to scorecard verdict. Record outcome for trend tracking.
147
+
148
+ Skills: `evaluation`. Handmade TDD JSON is rejected. Run `scorecard suite-run`
149
+ or `scorecard record` before declaring the review closed.
150
+ """
@@ -0,0 +1,77 @@
1
+ description = "checklist, and aggregate stats."
2
+
3
+ prompt = """
4
+ # Scorecard Evaluation Workflow
5
+
6
+ Scope: {{args}}
7
+
8
+ ---
9
+
10
+ ## Step 0 — CCEP Bootstrap
11
+
12
+ Command: `scorecard` (fixed for this workflow — do not infer from user text)
13
+
14
+ 1. Run: `npx cc-codeconductor ccep parse --command scorecard "{{args}}" --output json`
15
+ 2. Run: `npx cc-codeconductor ccep resolve --command scorecard "{{args}}" --output json`
16
+ 3. Run: `npx cc-codeconductor ccep profile scorecard --output json`
17
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command scorecard --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
18
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
19
+
20
+ ---
21
+
22
+ ## Step 1 — Identify task
23
+
24
+ Use `{{args}}` as task id (e.g. `BC-001`) or read active item from `npx cc-codeconductor openspec status`.
25
+
26
+ If a change folder exists, run `npx cc-codeconductor openspec analyze --output json` first. `--from-diff` overlays FR/SC coverage onto `acceptance` and TDD evidence onto `tests`.
27
+
28
+ ---
29
+
30
+ ## Step 2 — Create scorecard with auto-signals
31
+
32
+ ```bash
33
+ npx cc-codeconductor scorecard create --task <id> --agent reviewer --from-diff
34
+ ```
35
+
36
+ Review auto-suggested criteria (minimal diff, cc-gain). Complete remaining scores 0–3 per [`docs/agent-scorecard.md`](docs/agent-scorecard.md).
37
+
38
+ ---
39
+
40
+ ## Step 3 — Regression (optional)
41
+
42
+ ```bash
43
+ npx cc-codeconductor scorecard regression
44
+ ```
45
+
46
+ If required checks fail, **STOP** and report failures.
47
+
48
+ ---
49
+
50
+ ## Step 4 — Record outcome
51
+
52
+ ```bash
53
+ npx cc-codeconductor scorecard record --task <id> --agent reviewer --model <model> --verdict PASS --score 2.5
54
+ ```
55
+
56
+ Include `--cost` and `--tokens` when available from session metrics.
57
+
58
+ ---
59
+
60
+ ## Step 5 — Aggregate
61
+
62
+ ```bash
63
+ npx cc-codeconductor scorecard aggregate
64
+ ```
65
+
66
+ Report pass rate and average weighted score.
67
+
68
+ ---
69
+
70
+ ## Routing on verdict
71
+
72
+ - **PASS** — accept deliverable; update backlog if applicable
73
+ - **REVISE** — return to implementer/tester with findings
74
+ - **REJECT** — route to task-coach for re-scoping
75
+
76
+ Apply skill `evaluation`.
77
+ """
@@ -0,0 +1,177 @@
1
+ description = "security-* skills, authorization gate, risk-based routing, hardening, and review."
2
+
3
+ prompt = """
4
+ # Defensive Security Workflow
5
+
6
+ Security objective: {{args}}
7
+
8
+ Provide the following information in {{args}}:
9
+
10
+ - What must be reviewed or hardened, and why
11
+ - Domain: a `security-*` skill id (recon, vuln-assessment, web, cloud, IR,
12
+ hunting, GRC, …) or `web-app` / `api` / `cloud-config` /
13
+ `dependency-supply-chain` / `secrets`
14
+ - Authorization: who authorized this work on this target, and the scope boundary
15
+ - Risk classification (`low`, `medium`, or `high`), if known
16
+ - Scope: which files, modules, repos, or environments are in and out of bounds
17
+
18
+ ---
19
+
20
+ ## Scope and authorization
21
+
22
+ This workflow performs **authorized defensive security work only**: threat
23
+ modeling, hardening, secure configuration, dependency and supply-chain review,
24
+ secret hygiene, and detection coverage.
25
+
26
+ Refuse outright and offer the defensive equivalent instead (threat model,
27
+ hardening, detection coverage, dependency audit):
28
+
29
+ - Exploit or proof-of-concept development
30
+ - Malware authoring, or malware analysis intended for reuse
31
+ - Reverse engineering aimed at bypassing a control
32
+ - Red-team playbooks
33
+ - Any unauthorized-access procedure
34
+
35
+ Scope is limited to the repository under analysis. Do not scan, probe, or
36
+ perform reconnaissance against third-party hosts.
37
+
38
+ Do not proceed without an authorization statement. Do not produce exploit
39
+ payloads, malware, or attack procedures.
40
+
41
+ ---
42
+
43
+ ## Step 0 — CCEP Bootstrap
44
+
45
+ Command: `security` (fixed for this workflow — do not infer from user text)
46
+
47
+ 1. Run: `npx cc-codeconductor ccep parse --command security "{{args}}" --output json`
48
+ 2. Run: `npx cc-codeconductor ccep resolve --command security "{{args}}" --output json`
49
+ 3. Run: `npx cc-codeconductor ccep profile security --output json`
50
+ 4. After planner/intake JSON is available, run: `npx cc-codeconductor ccep evaluate --command security --input <planner.json> --output json`. If `stop` is true, show questions or risks and wait for human input.
51
+ 5. Delegate to subagents using compiled CCEP prompts — never forward raw `{{args}}` to planners.
52
+ Canonical delivery order is test-before-implement whenever both phases apply.
53
+
54
+ ---
55
+
56
+ ## Step 1 — Wayfinding (repo-explorer)
57
+
58
+ If `graphify-out/graph.json` exists, run `graphify query "{{args}}"` (and
59
+ `graphify path` / `graphify explain` when needed). Then invoke `repo-explorer`
60
+ to map modules, conventions, and impact radius. Do not write code in this step.
61
+ Record a Repo Map artifact before intake. Load the matching `security-*` skill
62
+ for the named domain (see `.claude/skills/security-*/SKILL.md`). Keep the OWASP
63
+ `security` skill for application-security reviews.
64
+
65
+ ---
66
+
67
+ ## Step 2 — Task Card validation (task-coach)
68
+
69
+ Invoke `task-coach` with the security objective above.
70
+
71
+ task-coach must produce a Task Card that includes:
72
+
73
+ - Objective: what must be reviewed or hardened, in one sentence
74
+ - Domain: which `security-*` skill applies, or `web-app` / `api` /
75
+ `cloud-config` / `dependency-supply-chain` / `secrets`
76
+ - Authorization: who authorized this work on this target, and the scope boundary
77
+ - Risk classification: `low`, `medium`, or `high`
78
+ - Scope: which files or modules are likely affected
79
+
80
+ If authorization is absent, unclear, or names a system the requester does not
81
+ own or operate, **STOP and refuse. Do not route the task.**
82
+
83
+ Redact secrets, tokens, and credentials from any evidence before it enters the
84
+ Task Card. Summarize logs; do not paste env files.
85
+
86
+ **STOP here. Show the Task Card and wait for human confirmation.**
87
+
88
+ ---
89
+
90
+ ## Step 3 — Route by risk
91
+
92
+ Read the risk field from the Task Card and follow the corresponding route.
93
+
94
+ ### Low-risk route
95
+
96
+ Applies when: the weakness is isolated, not exploitable in the current
97
+ configuration, and no authentication, secret, or dependency boundary is
98
+ involved.
99
+
100
+ Route: `task-coach` → `tester` → `implementer`
101
+
102
+ Proceed directly to Step 4 (tests), then Step 5a.
103
+
104
+ ### Medium or high-risk route
105
+
106
+ Applies when: the work touches authentication, authorization, secrets,
107
+ cryptography, trust-boundary input validation, or a dependency upgrade.
108
+
109
+ Route: `task-coach` → `architect` → `tester` → `implementer` → `reviewer`
110
+
111
+ Invoke `architect` before implementation. architect must:
112
+
113
+ - Identify the weakness and the affected trust boundary
114
+ - Define the hardening approach and affected files
115
+ - Flag any regression risk to adjacent components
116
+ - Produce a Technical Plan
117
+
118
+ On **high** risk, also invoke `security-reviewer` before Reviewer.
119
+
120
+ **STOP here if high-risk. Show the Technical Plan and wait for human approval
121
+ before continuing.**
122
+
123
+ ---
124
+
125
+ ## Step 4 — Tests (tester)
126
+
127
+ Invoke `tester` for all risk levels.
128
+
129
+ tester must:
130
+
131
+ 1. Write a regression test that proves the weakness exists and confirm it fails
132
+ before any change (RED)
133
+ 2. Verify that existing tests still pass
134
+ 3. Produce a Coverage Summary: test added, case covered
135
+
136
+ ---
137
+
138
+ ## Step 5a — Implementation, low-risk (implementer)
139
+
140
+ Invoke `implementer` with the Task Card.
141
+ Implementer creates a Git Worktree before touching any file; all edits happen inside it.
142
+
143
+ implementer must:
144
+
145
+ 1. Apply the minimal hardening change — no unrelated changes
146
+ 2. Run the suite and make the RED regression test pass
147
+ 3. Produce an Implementation Summary: weakness, change applied, files changed
148
+
149
+ ---
150
+
151
+ ## Step 5b — Implementation, medium/high-risk (implementer)
152
+
153
+ Invoke `implementer` with the approved Technical Plan and the Task Card.
154
+ Implementer creates a Git Worktree before touching any file; all edits happen inside it.
155
+
156
+ implementer must follow the plan exactly. Any deviation requires a new Technical
157
+ Plan approval. After implementation, run the full test suite. No exploit code.
158
+
159
+ ---
160
+
161
+ ## Step 6 — Review (Reviewer role) — medium/high-risk only
162
+
163
+ Invoke `reviewer` with the diff and Task Card. The Reviewer must apply the OWASP
164
+ rules in the `security` skill.
165
+
166
+ reviewer produces a Review Report with CRITICAL / WARNING / SUGGESTION findings.
167
+ If any CRITICAL findings exist, **STOP**. Do not close the task until they are
168
+ resolved.
169
+
170
+ ---
171
+
172
+ ## Completion
173
+
174
+ Report: Task Card, Implementation Summary, regression test added, Review Report
175
+ (if applicable). The task is complete only when: the regression test passes, the
176
+ full suite passes, and no CRITICAL review findings remain.
177
+ """