@mrciphersmith/keryx 0.2.72 → 0.2.73

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 (126) hide show
  1. package/dist/cli.js +352 -22
  2. package/package.json +2 -2
  3. package/src/gdskills/bundled/rules/core/gproject-contracts.mdc +1 -1
  4. package/src/gdskills/bundled/rules/core/jobs-documentation.mdc +1 -1
  5. package/src/gdskills/bundled/rules/core/subagent-context-construction.md +1 -1
  6. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.codex.md +326 -20
  7. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.cursor.md +320 -22
  8. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.opencode.md +326 -12
  9. package/src/gdskills/bundled/skills/orchestration/code-verifier/SKILL.zed.md +333 -9
  10. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.codex.md +92 -4
  11. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.cursor.md +92 -4
  12. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.opencode.md +92 -4
  13. package/src/gdskills/bundled/skills/orchestration/context-collector/SKILL.zed.md +92 -4
  14. package/src/gdskills/bundled/skills/orchestration/context-collector/orchestrator-prompt.md +1 -1
  15. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.codex.md +154 -1098
  16. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.cursor.md +154 -1098
  17. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.opencode.md +154 -1098
  18. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/SKILL.zed.md +154 -1098
  19. package/src/gdskills/bundled/skills/orchestration/feature-analyzer/orchestrator-prompt.md +1 -1
  20. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.codex.md +101 -41
  21. package/src/gdskills/bundled/skills/orchestration/feature-dev/SKILL.cursor.md +101 -41
  22. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.codex.md +115 -49
  23. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.cursor.md +115 -49
  24. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.opencode.md +115 -49
  25. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/SKILL.zed.md +115 -49
  26. package/src/gdskills/bundled/skills/orchestration/issue-analyzer/orchestrator-prompt.md +1 -1
  27. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.codex.md +15 -6
  28. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.cursor.md +15 -6
  29. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.opencode.md +15 -6
  30. package/src/gdskills/bundled/skills/orchestration/job-documenter/SKILL.zed.md +15 -6
  31. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.codex.md +1 -1
  32. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.cursor.md +1 -1
  33. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.md +1 -1
  34. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.opencode.md +1 -1
  35. package/src/gdskills/bundled/skills/orchestration/job-orchestrator/SKILL.zed.md +1 -1
  36. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.codex.md +300 -55
  37. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.cursor.md +300 -55
  38. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.md +120 -37
  39. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.opencode.md +300 -55
  40. package/src/gdskills/bundled/skills/orchestration/task-implementer/SKILL.zed.md +300 -55
  41. package/src/gdskills/bundled/skills/orchestration/task-implementer/input-contract.schema.json +56 -14
  42. package/src/gdskills/bundled/skills/orchestration/task-implementer/orchestrator-prompt.md +50 -23
  43. package/src/gdskills/bundled/skills/orchestration/task-implementer/output-contract.schema.json +6 -2
  44. package/src/gdskills/bundled/skills/orchestration/task-implementer/task-request.template.md +18 -12
  45. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.codex.md +1 -1
  46. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.cursor.md +1 -1
  47. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.codex.md +168 -9
  48. package/src/gdskills/bundled/skills/planning/consistency-checker/SKILL.cursor.md +168 -9
  49. package/src/gdskills/bundled/skills/planning/interview/SKILL.codex.md +7 -1
  50. package/src/gdskills/bundled/skills/planning/interview/SKILL.cursor.md +7 -1
  51. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.codex.md +7 -1
  52. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.cursor.md +7 -1
  53. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.codex.md +215 -9
  54. package/src/gdskills/bundled/skills/planning/patterns-researcher/SKILL.cursor.md +215 -9
  55. package/src/gdskills/bundled/skills/planning/planner/SKILL.codex.md +168 -9
  56. package/src/gdskills/bundled/skills/planning/planner/SKILL.cursor.md +168 -9
  57. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.codex.md +2 -2
  58. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.cursor.md +2 -2
  59. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.opencode.md +2 -2
  60. package/src/gdskills/bundled/skills/planning/prd-creator/SKILL.zed.md +2 -2
  61. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.codex.md +133 -9
  62. package/src/gdskills/bundled/skills/planning/problem-definer/SKILL.cursor.md +133 -9
  63. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.codex.md +145 -9
  64. package/src/gdskills/bundled/skills/planning/project-discovery/SKILL.cursor.md +145 -9
  65. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.codex.md +210 -9
  66. package/src/gdskills/bundled/skills/planning/spec-writer/SKILL.cursor.md +210 -9
  67. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.codex.md +161 -9
  68. package/src/gdskills/bundled/skills/planning/stack-advisor/SKILL.cursor.md +161 -9
  69. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.codex.md +1 -1
  70. package/src/gdskills/bundled/skills/platform/claude-md-management/SKILL.cursor.md +1 -1
  71. package/src/gdskills/bundled/skills/platform/hookify/SKILL.codex.md +1 -1
  72. package/src/gdskills/bundled/skills/platform/hookify/SKILL.cursor.md +1 -1
  73. package/src/gdskills/bundled/skills/quality/changelog/SKILL.codex.md +1 -1
  74. package/src/gdskills/bundled/skills/quality/changelog/SKILL.cursor.md +1 -1
  75. package/src/gdskills/bundled/skills/quality/commit/SKILL.codex.md +1 -1
  76. package/src/gdskills/bundled/skills/quality/commit/SKILL.cursor.md +1 -1
  77. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.codex.md +1 -1
  78. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.cursor.md +1 -1
  79. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.codex.md +1 -1
  80. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.cursor.md +1 -1
  81. package/src/gdskills/bundled/skills/quality/deploy/SKILL.codex.md +1 -1
  82. package/src/gdskills/bundled/skills/quality/deploy/SKILL.cursor.md +1 -1
  83. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.codex.md +1 -1
  84. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.cursor.md +1 -1
  85. package/src/gdskills/bundled/skills/quality/pr/SKILL.codex.md +1 -1
  86. package/src/gdskills/bundled/skills/quality/pr/SKILL.cursor.md +1 -1
  87. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.codex.md +15 -1
  88. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.cursor.md +248 -165
  89. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.opencode.md +15 -1
  90. package/src/gdskills/bundled/skills/quality/pr-issue-documenter/SKILL.zed.md +359 -19
  91. package/src/gdskills/bundled/skills/quality/push/SKILL.codex.md +1 -1
  92. package/src/gdskills/bundled/skills/quality/push/SKILL.cursor.md +1 -1
  93. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.codex.md +1 -1
  94. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.cursor.md +1 -1
  95. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.codex.md +1 -1
  96. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.cursor.md +1 -1
  97. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.codex.md +299 -24
  98. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.cursor.md +296 -31
  99. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.opencode.md +309 -18
  100. package/src/gdskills/bundled/skills/quality/tests-creator/SKILL.zed.md +312 -17
  101. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.codex.md +29 -30
  102. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.cursor.md +29 -30
  103. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.opencode.md +29 -30
  104. package/src/gdskills/bundled/skills/review/code-ai-review/SKILL.zed.md +29 -30
  105. package/src/gdskills/bundled/skills/review/code-learned-review/SKILL.codex.md +21 -30
  106. package/src/gdskills/bundled/skills/review/code-learned-review/SKILL.cursor.md +21 -30
  107. package/src/gdskills/bundled/skills/review/code-learned-review/SKILL.opencode.md +21 -30
  108. package/src/gdskills/bundled/skills/review/code-learned-review/SKILL.zed.md +21 -30
  109. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.codex.md +19 -23
  110. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.cursor.md +19 -23
  111. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.opencode.md +19 -23
  112. package/src/gdskills/bundled/skills/review/code-mobx-store-review/SKILL.zed.md +19 -23
  113. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.codex.md +17 -24
  114. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.cursor.md +17 -24
  115. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.opencode.md +17 -24
  116. package/src/gdskills/bundled/skills/review/code-style-review/SKILL.zed.md +17 -24
  117. package/src/gdskills/bundled/skills/review/review-orchestrator/SKILL.md +16 -3
  118. package/src/gdskills/bundled/skills/planning/brainstorm/SKILL.claude.md +0 -46
  119. package/src/gdskills/bundled/skills/planning/interviewer/SKILL.claude.md +0 -94
  120. package/src/gdskills/bundled/skills/quality/changelog/SKILL.claude.md +0 -45
  121. package/src/gdskills/bundled/skills/quality/db-migrate/SKILL.claude.md +0 -40
  122. package/src/gdskills/bundled/skills/quality/dependency-update/SKILL.claude.md +0 -45
  123. package/src/gdskills/bundled/skills/quality/deploy/SKILL.claude.md +0 -42
  124. package/src/gdskills/bundled/skills/quality/perf-check/SKILL.claude.md +0 -48
  125. package/src/gdskills/bundled/skills/quality/security-audit/SKILL.claude.md +0 -40
  126. package/src/gdskills/bundled/skills/quality/test-gen/SKILL.claude.md +0 -30
@@ -1,6 +1,7 @@
1
1
  ---
2
2
  name: task-implementer
3
- description: "Autonomous implementation agent that receives a single atomic task (JSON task object from issue-analyzer) and implements it end-to-end: researches codebase, plans changes, writes code, creates tests/stories as needed, verifies via lint/type-check/test, and reports results. Use when: implementing a single decomposed task from issue-analyzer, executing code changes autonomously."
3
+ model_tier: standard
4
+ description: "Use when implementing a single decomposed task from issue-analyzer end-to-end, or executing autonomous code changes from a JSON task object."
4
5
  triggers:
5
6
  - "Implement task"
6
7
  - "Execute task scenario"
@@ -9,9 +10,10 @@ triggers:
9
10
  - "Implement issue task"
10
11
  metadata:
11
12
  author: "MrCipherSmith"
12
- version: "1.0.0"
13
+ version: "1.3.0"
13
14
  category: "implementation"
14
- compatible_harnesses: "cursor,codex,zed,opencode"
15
+ agent_worthy: true
16
+ compatible_harnesses: "claude,cursor,codex,zed,opencode"
15
17
  license: "MIT"
16
18
  ---
17
19
 
@@ -38,7 +40,7 @@ Phase 2: RESEARCH → Deep-read target files, understand module patterns
38
40
  Phase 3: PLAN → Decide implementation approach, list file changes
39
41
  Phase 4: IMPLEMENT → Write code, tests, stories
40
42
  Phase 5: VERIFY → Run lint, type-check, tests
41
- Phase 6: REPORT → Emit JSON result object
43
+ Phase 6: REPORT → Write result file + emit compact STATUS response
42
44
  ```
43
45
 
44
46
  ---
@@ -67,7 +69,7 @@ TASK: (from JSON object passed by orchestrator)
67
69
  task_name: string, e.g. "Add validation to form"
68
70
  task_type: string: ui_component|store_logic|service_api|refactoring|fix|mixed
69
71
  complexity: string: low|medium|high
70
- dependencies: array of task_id strings (already satisfied — orchestrator ensures order)
72
+ dependencies: array of task_id strings this task reads from
71
73
  description: string: what to implement
72
74
  target_files: array of file path strings
73
75
  acceptance_criteria: array of criterion strings
@@ -75,6 +77,7 @@ TASK: (from JSON object passed by orchestrator)
75
77
  existing_tests: array of file path strings (may be empty)
76
78
  existing_stories: array of file path strings (may be empty)
77
79
  module_patterns: string: how similar code is written in this module
80
+ test_case_specs: optional — provided by tests-creator (RED-phase test stubs already committed)
78
81
  ```
79
82
 
80
83
  **1.2 Extract from workspace context:**
@@ -92,19 +95,60 @@ WORKSPACE:
92
95
  ```
93
96
  FIX_CONTEXT:
94
97
  review_feedback: structured findings from reviewer (file, line, severity, message)
95
- original_task_id: the task that introduced the issue
96
- iteration: fix iteration number (1 or 2)
98
+ original_task_ids: the tasks that introduced the findings (array)
99
+ iteration: fix iteration number, 1..3 — the same repair bound as 5.4
97
100
  ```
98
101
 
99
- **1.4 Validate:**
102
+ **1.4 Validate the request against the contract:**
103
+
104
+ Write the request you were handed to a file and run:
105
+
106
+ ```bash
107
+ keryx skills contracts validate <request.json> --schema task-implementer-input
100
108
  ```
101
- ASSERT task_id IS NOT EMPTY → otherwise ABORT("Missing task_id")
102
- ASSERT task_type IN valid_types → otherwise ABORT("Invalid task_type")
103
- ASSERT target_files IS NOT EMPTY → otherwise ABORT("No target files")
104
- ASSERT codebase_path EXISTS → otherwise ABORT("Codebase path not found")
105
- ASSERT branch IS NOT EMPTY → otherwise ABORT("Wrong branch checked out")
109
+
110
+ Non-zero exit means the dispatch is malformed — ABORT and report `NEEDS_CONTEXT`
111
+ with the validator's own message. Do not repair the request yourself; the
112
+ orchestrator owns it.
113
+
114
+ The refusals are the contract's, not a checklist you run by eye
115
+ (`input-contract.schema.json`, registered in `src/gdskills/contracts.ts`):
116
+
117
+ | What is refused | Where the schema says so |
118
+ |---|---|
119
+ | Missing `task_id` / `task_name` / `task_type` / `description` / `target_files` / `acceptance_criteria` | `task.required` |
120
+ | `task_type` outside `ui_component\|store_logic\|service_api\|refactoring\|fix\|mixed` | `task.task_type.enum` |
121
+ | A `task_id` that is not `task-<n>` | `task.task_id.pattern` |
122
+ | Empty `target_files` or empty `acceptance_criteria` | `minItems: 1` on both |
123
+ | Missing `codebase_path` / `branch` / `issue_number` | `workspace.required` |
124
+ | `skip_confirmation` anything but `true` | `automation.skip_confirmation.const` |
125
+ | `max_self_fix_attempts` above 3 | `automation.max_self_fix_attempts.maximum` |
126
+ | Any field the contract does not declare | `additionalProperties: false` |
127
+
128
+ The list above is a reading aid. The schema is the authority, and if the two
129
+ disagree the schema wins.
130
+
131
+ Two things a schema cannot check, because they are facts about the machine
132
+ rather than about the payload. Check them yourself and ABORT with
133
+ `STATUS: NEEDS_CONTEXT` on either:
134
+
135
+ ```bash
136
+ test -d "<codebase_path>" # otherwise: codebase path not found
137
+ git -C "<codebase_path>" rev-parse --abbrev-ref HEAD # must equal <branch>
106
138
  ```
107
139
 
140
+ **1.5 TDD Check (if `test_case_specs` is present):**
141
+
142
+ If the task object contains `test_case_specs` (provided by `tests-creator`):
143
+ 1. Read each test file listed in `test_case_specs.test_files`
144
+ 2. Run the tests using `test_case_specs.run_command` — confirm they FAIL
145
+ 3. If tests pass already → report `DONE_WITH_CONCERNS` (tests may not be testing the right thing)
146
+ 4. Note: **implementation goal is to make these tests GREEN** — do not rewrite or delete them
147
+
148
+ If `test_case_specs` is absent:
149
+ - The task was not pre-processed by `tests-creator`
150
+ - Write tests as part of Phase 4 (standard mode) following `tdd-workflow.mdc`
151
+
108
152
  ### Phase 2: RESEARCH
109
153
 
110
154
  Deep-read the target files and surrounding module to understand patterns.
@@ -112,19 +156,31 @@ Deep-read the target files and surrounding module to understand patterns.
112
156
  **2.0 Read job context (if available):**
113
157
 
114
158
  If the orchestrator provided `JOB_NAME` and `CONTEXT_PATH`:
115
- - Read `CONTEXT_PATH` (e.g., `.metaproject/jobs/<job-name>/ai/context.md`)
159
+ - Read `CONTEXT_PATH` (e.g., `<JOBS_ROOT>/<job-name>/ai/context.md`)
116
160
  - Extract relevant sections: library docs, codebase patterns, conventions, best practices
117
161
  - Use this context throughout Phase 2-4 to guide implementation decisions
118
162
  - If the file does not exist, proceed without it — context is optional
119
163
 
164
+ **2.0b Verify the project-skill covering the target (see `rules/core/skill-lifecycle.mdc`):**
165
+
166
+ Before you rely on a project-skill's guidance, confirm it still matches the code:
167
+ - `keryx skills route <target_file>` — find the project-skill for this module/entity (if any).
168
+ - If one exists: `keryx skills verify <module>/<skill>` — classifies it `fresh | stale | needs-review | blocked`.
169
+ - If it is **not `fresh`**: do not follow it blindly. Verify each claim against the code you read in Phase 2, and note the drift in `notes` (Phase 6.1) so the orchestrator can trigger `skills learn`.
170
+ - If no skill exists for a non-trivial module you had to reverse-engineer, note that too — it's a candidate for `skills create`.
171
+
172
+ This step is read-only and inline; do not spawn a subagent for it.
173
+
120
174
  **2.1 Read all target files:**
121
175
  - Read each file from `target_files` in full
122
176
  - If a file does not exist yet, note it as "new file to create"
123
177
  - Read the `context` field for additional type/signature info
124
178
 
125
179
  **2.2 Read existing tests and stories:**
126
- - If `existing_tests` is not "none" — read each test file
127
- - If `existing_stories` is not "none" — read each story file
180
+ - `existing_tests` and `existing_stories` are arrays and default to `[]`
181
+ (`input-contract.schema.json`). Empty means none; the string `"none"` is not a
182
+ legal value and a request carrying it is refused by 1.4
183
+ - Read each file listed in either array
128
184
  - Understand existing test patterns (describe/it structure, mocks, fixtures)
129
185
 
130
186
  **2.3 Read module neighbors:**
@@ -139,20 +195,33 @@ If the orchestrator provided `JOB_NAME` and `CONTEXT_PATH`:
139
195
 
140
196
  **2.4 Load relevant rules (from `module_patterns` or by detection):**
141
197
 
142
- Based on what you're implementing, load and follow the relevant project rules:
198
+ Based on what you're implementing, load and follow the relevant project rules.
199
+
200
+ **Always load (all task types):**
201
+ - `tdd-workflow.mdc` — red-green-refactor, STATUS: DONE requires passing tests
202
+ - `error-handling.mdc` — Result pattern, no silent failures
203
+ - `solid-principles.mdc` — SRP, OCP, DIP (load for any task that creates new classes/services)
143
204
 
144
- | Task Type | Relevant Rules |
205
+ **Load by task type:**
206
+
207
+ | Task Type | Additional Rules |
145
208
  |-----------|---------------|
146
209
  | `ui_component` | `code-style-patterns.mdc`, `frontend-assistant.mdc`, `storybook-guidelines.mdc` |
147
210
  | `store_logic` | `code-style-patterns.mdc`, `mobx-store-template.mdc` |
148
- | `service_api` | `code-style-patterns.mdc`, `nestjs-dto.mdc` |
149
- | `fix` | Load rules based on the files being fixed |
150
- | `mixed` | Load all applicable rules |
211
+ | `service_api` | `code-style-patterns.mdc`, `nestjs-dto.mdc`, `api-contracts.mdc` |
212
+ | `fix` | Rules based on the files being fixed; always `error-handling.mdc` |
213
+ | `mixed` | All applicable rules above |
214
+
215
+ **Load when detected:**
216
+ - Database/ORM files touched → `database-patterns.mdc`
217
+ - Auth, API keys, user input → `security-baseline.mdc`
218
+ - `async`/`await` or queue code → `async-patterns.mdc`
219
+ - New architectural layers or modules → `clean-architecture.mdc`
151
220
 
152
- Rules are located at:
153
- - OpenCode: `.metaproject/rules/core/<rule>.mdc`
154
- - Cursor: `.cursor/rules/core/<rule>.mdc`
155
- - Codex: `.metaproject/rules/core/<rule>.mdc`
221
+ Rules live at `.metaproject/rules/core/<rule>.mdc` on every harness — that is the
222
+ one tree `keryx init` installs and the one every build of this skill reads.
223
+ Cursor additionally mirrors them under `.cursor/rules/core/<rule>.mdc`; when both
224
+ are present they are copies of the same file, so read either.
156
225
 
157
226
  **Output of Phase 2:** Mental model of the implementation:
158
227
  ```
@@ -204,14 +273,26 @@ CHANGE_PLAN:
204
273
 
205
274
  Execute the change plan. Write production-quality code.
206
275
 
207
- **4.1 Implementation order:**
276
+ **4.0 TDD Mode Selection:**
277
+
278
+ - **TDD Mode** (when `test_case_specs` is present): tests already exist and are RED. Skip to writing implementation code that makes them GREEN. Do NOT write new tests — only write code that satisfies the existing stubs.
279
+ - **Standard Mode** (no `test_case_specs`): write tests first (per `tdd-workflow.mdc`), then implementation.
280
+
281
+ **4.1 Implementation order (Standard Mode):**
208
282
  1. Types and interfaces first (shared types, DTOs)
209
- 2. Service/API layer changes
210
- 3. Store/logic layer changes
211
- 4. Component/UI layer changes
212
- 5. Tests
283
+ 2. Write failing tests for each acceptance criterion (RED)
284
+ 3. Service/API layer implementation (make service tests GREEN)
285
+ 4. Store/logic layer implementation (make store tests GREEN)
286
+ 5. Component/UI layer implementation (make component tests GREEN)
213
287
  6. Stories (if needed)
214
288
 
289
+ **4.1 Implementation order (TDD Mode — test_case_specs provided):**
290
+ 1. Read all test stubs from `test_case_specs.test_files`
291
+ 2. Understand the expected API shape from test assertions
292
+ 3. Implement types/interfaces to satisfy test imports
293
+ 4. Implement code layer by layer until all tests are GREEN
294
+ 5. Stories (if needed)
295
+
215
296
  **4.2 Code standards (always follow):**
216
297
  - TypeScript strict mode — no `any`, no `as` casts unless justified
217
298
  - Use project path aliases for imports (`@components/...`, `@utils/...`)
@@ -258,28 +339,38 @@ Commit type mapping:
258
339
  Run verification checks appropriate to the task type.
259
340
 
260
341
  **5.1 Always run:**
342
+
261
343
  ```bash
262
- npm run lint # ESLint (errors only)
263
- npm run type-check # tsc --noEmit
344
+ keryx health run --changed --source eslint,typescript
264
345
  ```
265
346
 
347
+ Lint and type-check in one call, over the changed files only. Do NOT hard-code a
348
+ package manager and a script name: the project may not be an npm project, and
349
+ `src/health/sources/eslint.ts` and `src/health/sources/typescript.ts` resolve the
350
+ real invocation. The run writes a normalized report; `keryx health status` prints
351
+ it.
352
+
266
353
  **5.2 Run if tests exist:**
354
+
267
355
  ```bash
268
- npm test # Vitest run
356
+ keryx test run --changed --strict
269
357
  ```
270
358
 
271
- If tests were created or modified, ensure they pass.
359
+ `src/testing/service.ts:780` detects `bun` / `pnpm` / `yarn` / `npm` from the
360
+ lockfile and builds the argv from the project's own test script — the
361
+ if-chain you would otherwise write in shell, already written. `--strict` makes a
362
+ non-zero exit the signal; if tests were created or modified they must pass.
272
363
 
273
- **5.3 Run if stories were created (optional, only if build is available):**
364
+ **5.3 Run if stories were created (optional, only if the script exists):**
274
365
  ```bash
275
- npm run build-storybook # Verify stories compile
366
+ <pm> run build-storybook # <pm> is the package manager keryx test run detected
276
367
  ```
277
368
 
278
369
  **5.4 Handle failures:**
279
370
 
280
371
  | Failure | Action |
281
372
  |---------|--------|
282
- | Lint errors | Fix automatically using `npm run lint:fix:changed`, re-run lint |
373
+ | Lint errors | Fix them in code, re-run `keryx health run --changed` |
283
374
  | Type errors | Fix the type errors in code, re-commit |
284
375
  | Test failures | Fix failing tests, re-commit |
285
376
  | Story build failure | Fix story code, re-commit |
@@ -303,7 +394,9 @@ identical outputs cost the whole budget to learn what the second one already
303
394
  said. Report the block instead, naming what repeated.
304
395
 
305
396
 
306
- **ROLLBACK POLICY**: If implementation fatally fails (e.g. tests still failing after 3 attempts or unresolvable compilation errors), you MUST run `git reset --hard` to clean the worktree before reporting the failure in Phase 6, unless explicitly instructed to leave it dirty.
397
+ **ROLLBACK POLICY**: If implementation fatally fails (tests still failing after 3 attempts, or unresolvable compilation errors), restore ONLY the files this task changed — `git checkout -- <your files>` for tracked ones, delete the untracked ones you created — then report the failure in Phase 6.
398
+
399
+ **Never run `git reset --hard`, `git clean`, or any unscoped revert.** You do not own the worktree. `job-orchestrator` dispatches implementers in PARALLEL WAVES sharing a single worktree, so an unscoped reset destroys a wave-mate's uncommitted work — work that is not yours, cannot be recovered, and whose loss is invisible to you because the other agent's failure surfaces somewhere else entirely. If you cannot identify which files are yours, leave the tree exactly as it is and say so in the report: a dirty tree is recoverable, a destroyed one is not.
307
400
 
308
401
  **5.5 Re-commit fixes if any:**
309
402
  ```bash
@@ -316,10 +409,15 @@ task: <task_id>"
316
409
 
317
410
  ### Phase 6: REPORT
318
411
 
319
- Emit a JSON result object as the final message to the orchestrator.
412
+ Write the full result to a file, then emit a compact STATUS response to the orchestrator.
320
413
 
321
- **Output structure:**
414
+ **6.1 Write result file (when `JOB_NAME` is provided):**
322
415
 
416
+ If the orchestrator provided `JOB_NAME` in the workspace context:
417
+ ```bash
418
+ mkdir -p <JOBS_ROOT>/<JOB_NAME>/results
419
+ ```
420
+ Write full JSON to `<JOBS_ROOT>/<JOB_NAME>/results/<task_id>.json`:
323
421
  ```json
324
422
  {
325
423
  "task_id": "<task_id>",
@@ -336,30 +434,76 @@ Emit a JSON result object as the final message to the orchestrator.
336
434
  "test_result": "<pass|N passed, M failed: details|skipped>",
337
435
  "story_result": "<pass|build error: details|not applicable>",
338
436
  "acceptance_criteria_met": "<all|partial: list of unmet criteria|none>",
437
+ "skill_drift": "<none | stale: <module>/<skill> — <what diverged> | missing: <module> should have a project-skill>",
339
438
  "notes": "<any warnings, blockers, or additional context>"
340
439
  }
341
440
  ```
342
441
 
442
+ Set `skill_drift` from Phase 2.0b: if the project-skill you used was not `fresh`, or the code you wrote diverged from what a skill documents, name the skill and the divergence. The orchestrator uses this to decide whether to trigger `skills learn` (do NOT run `learn` yourself — it is a mutating step the orchestrator dispatches; see `rules/core/skill-lifecycle.mdc`).
443
+
444
+ Then check the shape and record the file — two commands, both of which refuse
445
+ rather than warn:
446
+
447
+ ```bash
448
+ keryx skills contracts validate <JOBS_ROOT>/<JOB_NAME>/results/<task_id>.json \
449
+ --schema task-implementer-output
450
+ keryx job document <JOB_NAME> --type implementation-report \
451
+ --file <JOBS_ROOT>/<JOB_NAME>/results/<task_id>.json
452
+ ```
453
+
454
+ - `contracts validate` exits non-zero on a missing required field, a `status`
455
+ outside `success|partial|failed`, a `task_id` that is not `task-<n>`, or any
456
+ key the contract does not declare (`additionalProperties: false`). Fix the
457
+ result and re-run; do not report a result the contract rejects.
458
+ - `job document` **refuses when the file does not exist** — "`--file` not found:
459
+ … Write the document first, then record it" (`src/job/service.ts`) — and
460
+ refuses a `--type` outside `analysis|implementation-report|review|verification-report`
461
+ and a job name no package matches. On success it copies the result into the
462
+ job package and appends it to `documentation.documents_created` in
463
+ `state.json`, which is what makes "the result was recorded" a fact
464
+ `keryx job status <JOB_NAME> --json` can be asked about instead of a sentence
465
+ in this file.
466
+
467
+ One caveat, stated because it is real: the package holds ONE
468
+ `implementation-report.json` per job, so a later task in the same wave replaces
469
+ it. The per-task files under `results/` are the complete set; the recorded
470
+ document is the most recent.
471
+
472
+ If `JOB_NAME` is not provided, skip the file write and both commands — there is
473
+ no job package to record against.
474
+
475
+ The step's own status is the orchestrator's to write (`keryx job step <JOB_NAME>
476
+ <step-id> --status …`). Do not write it yourself: `src/job/plans.ts` makes
477
+ `implement` ONE step for a whole wave, so a single task cannot close it, and
478
+ `keryx job complete` refuses while any step is still open.
479
+
480
+ **6.2 Emit compact STATUS response:**
481
+
482
+ Return a compact STATUS response following `rules/core/subagent-status-protocol.md`.
483
+ **Do NOT include the full JSON block inline** — the orchestrator reads the result file when it needs details.
484
+ The inline response must contain only: STATUS line + Completed bullets + Files changed + Verification summary.
485
+
343
486
  **Status classification:**
344
- - `success`: All acceptance criteria met, all verifications pass
345
- - `partial`: Some criteria met or some verification failures after self-fix attempts
346
- - `failed`: Critical blockers prevented implementation. Worktree must be reverted via `git reset --hard`.
487
+ - `success` → `STATUS: DONE`
488
+ - `partial` → `STATUS: DONE_WITH_CONCERNS`
489
+ - `failed` → `STATUS: BLOCKED`
347
490
 
348
491
  ---
349
492
 
350
493
  ## Automation Settings
351
494
 
352
- This skill is designed to run fully autonomously. The following settings control behavior:
495
+ This skill is designed to run fully autonomously. The settings, their types,
496
+ their defaults and their bounds are declared in one place —
497
+ `input-contract.schema.json`, the `automation` object — and are checked by the
498
+ validation in Phase 1.4. To see them:
353
499
 
354
- | Setting | Default | Options | Description |
355
- |---------|---------|---------|-------------|
356
- | `auto_commit` | `true` | true/false | Automatically commit changes |
357
- | `verify_lint` | `true` | true/false | Run ESLint after implementation |
358
- | `verify_types` | `true` | true/false | Run type-check after implementation |
359
- | `verify_tests` | `true` | true/false | Run tests after implementation |
360
- | `verify_stories` | `false` | true/false | Build storybook to verify stories |
361
- | `max_self_fix_attempts` | `3` | 1-5 | Max attempts to fix verification failures |
362
- | `commit_message_style` | `conventional` | `conventional` | Commit format |
500
+ ```bash
501
+ keryx skills contracts list # names task-implementer-input and its file
502
+ ```
503
+
504
+ They are deliberately not restated here. The table that used to sit in this spot
505
+ said `max_self_fix_attempts: 1-5` while Phase 5.4 says the maximum is 3, and a
506
+ second copy of a schema is how that happens.
363
507
 
364
508
  ---
365
509
 
@@ -388,7 +532,108 @@ This skill is designed to run fully autonomously. The following settings control
388
532
  7. **DO** use `runInAction()` after every `await` in MobX actions.
389
533
  8. **DO** commit with conventional commit format referencing the issue number.
390
534
  9. **DO** verify your work before reporting.
391
- 10. Return the JSON result object as your **final message** to the orchestrator.
535
+ 10. **DO** make `STATUS: <TOKEN>` the first line of your final message, and put no
536
+ JSON in the response body. The full JSON result is the file Phase 6.1 writes
537
+ and records. (This rule used to say the opposite — "return the JSON result
538
+ object as your final message" — which contradicted 6.2, `## Reporting
539
+ Results`, and `parseChildResult`, the production function that throws on any
540
+ first line that is not a canonical STATUS token.)
541
+
542
+ ---
543
+
544
+ ## Red Flags — Stop and re-read this skill if you are thinking:
545
+
546
+ | Rationalization | Why it's wrong |
547
+ |---|---|
548
+ | "I'll implement first and verify acceptance criteria later" | Implementing without criteria means you might build the wrong thing correctly |
549
+ | "This is a small change, I don't need to read the context document" | Context documents exist because the task description alone is incomplete by design |
550
+ | "The task description is clear, I don't need to read related files first" | Module patterns and conventions only emerge from reading the actual files, not the description |
551
+ | "I'll report DONE and note the skipped tests as a concern" | Skipped verification is a failed verification — partial is not done |
552
+ | "I understand how this module works from previous tasks" | Each task targets a specific slice; read the files fresh to catch state that has changed |
553
+
554
+ **IRON LAW: READ ALL SPECIFIED FILES AND THE CONTEXT DOCUMENT BEFORE WRITING A SINGLE LINE OF CODE.**
555
+
556
+ ---
557
+
558
+ ## Reporting Results
559
+
560
+ **Rule:** `rules/core/subagent-status-protocol.md`
561
+
562
+ Every final response to the orchestrator MUST begin with `STATUS: <STATUS>`. The full JSON result object is written to a file in Phase 6.1 — the inline response contains only the compact STATUS format. No JSON in the response body.
563
+
564
+ ### Iron Law
565
+
566
+ **STATUS LINE IS MANDATORY — ORCHESTRATOR CANNOT INTERPRET FREE TEXT**
567
+
568
+ ### When to use each status
569
+
570
+ | Status | Use when |
571
+ |--------|----------|
572
+ | `DONE` | All acceptance criteria met, all verifications pass (or pass after self-fix) |
573
+ | `DONE_WITH_CONCERNS` | Task complete but: criteria required interpretation, workaround was used, unexpected discovery, verification passed with warnings |
574
+ | `BLOCKED` | Unresolvable blocker: required file missing after checking, unresolvable type errors after 3 attempts, branch conflict needing orchestrator action |
575
+ | `NEEDS_CONTEXT` | Task input is incomplete: `target_files` empty, `acceptance_criteria` uses undefined terms, `context` field missing required types |
576
+
577
+ ### Correct final response format
578
+
579
+ ```
580
+ STATUS: DONE
581
+
582
+ ## Completed
583
+ - Added validation logic to PipelineStep component
584
+ - Created unit tests covering all 4 acceptance criteria
585
+ - Committed 2 conventional commits
586
+
587
+ ## Files changed
588
+ - src/components/PipelineStep.tsx — added validateStep() method
589
+ - src/components/PipelineStep.test.tsx — new test file, 14 tests
590
+
591
+ ## Verification
592
+ - lint: pass
593
+ - type-check: pass
594
+ - tests: 14 passed, 0 failed
595
+
596
+ Result file: <JOBS_ROOT>/<job-name>/results/task-1.json
597
+ ```
598
+
599
+ For `DONE_WITH_CONCERNS`:
600
+
601
+ ```
602
+ STATUS: DONE_WITH_CONCERNS
603
+
604
+ ## Completed
605
+ - Implemented feature as described
606
+
607
+ ## Files changed
608
+ - src/services/auth.ts — updated token refresh logic
609
+
610
+ ## Verification
611
+ - lint: pass
612
+ - type-check: pass
613
+ - tests: 8 passed, 0 failed
614
+
615
+ ## Concerns for orchestrator
616
+ - The acceptance criterion "support legacy tokens" was ambiguous — implemented support for both v1 and v2 token formats. If only v2 is needed, the v1 branch can be removed.
617
+
618
+ Result file: <JOBS_ROOT>/<job-name>/results/task-2.json
619
+ ```
620
+
621
+ For `BLOCKED`:
622
+
623
+ ```
624
+ STATUS: BLOCKED
625
+
626
+ ## Reason
627
+ src/types/pipeline.ts does not exist and is listed as a dependency. Cannot implement the store layer without the type definitions.
628
+
629
+ ## What I need from orchestrator
630
+ Run task-1 (which creates pipeline.ts) before re-dispatching this task, or provide the type definitions directly.
631
+
632
+ ## Work completed so far
633
+ - (nothing — blocked before implementation could start)
634
+ ```
635
+
636
+ See `rules/core/subagent-status-protocol.md` for the full format specification. Four statuses are yours as a skill worker; the fifth, `FAILED`, belongs to harness child workers and you must never emit it — report `BLOCKED` instead.
392
637
 
393
638
  ---
394
639
 
@@ -398,7 +643,7 @@ When dispatched by `job-orchestrator`, the prompt MAY include:
398
643
 
399
644
  ```
400
645
  JOB_NAME: <job-name>
401
- CONTEXT_PATH: .metaproject/jobs/<job-name>/ai/context.md
646
+ CONTEXT_PATH: <JOBS_ROOT>/<job-name>/ai/context.md
402
647
  ```
403
648
 
404
649
  If provided, read the context document at the start of Phase 2 (RESEARCH) before reading target files. The context document contains:
@@ -2,20 +2,22 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "task-implementer-input-contract",
4
4
  "title": "Task Implementer Input Contract",
5
- "description": "Defines all input parameters required to run task-implementer skill autonomously. Receives a single Gherkin Scenario from issue-analyzer plus workspace context.",
5
+ "description": "Defines all input parameters required to run task-implementer skill autonomously. Receives one atomic task object from issue-analyzer plus workspace context. Registered as contract `task-implementer-input`: validate a request with `keryx skills contracts validate <request.json> --schema task-implementer-input`.",
6
6
  "type": "object",
7
+ "additionalProperties": false,
7
8
  "required": ["task", "workspace", "automation"],
8
9
  "properties": {
9
10
  "task": {
10
11
  "type": "object",
11
- "description": "The atomic task to implement, extracted from issue-analyzer Gherkin Scenario.",
12
+ "description": "The atomic task to implement, as issue-analyzer decomposed it.",
13
+ "additionalProperties": false,
12
14
  "required": ["task_id", "task_name", "task_type", "description", "target_files", "acceptance_criteria"],
13
15
  "properties": {
14
16
  "task_id": {
15
17
  "type": "string",
16
- "pattern": "^task-\\d+$",
17
- "description": "Unique task identifier from issue-analyzer",
18
- "examples": ["task-1", "task-3"]
18
+ "pattern": "^(?:task|fix)-\\d+$",
19
+ "description": "Unique task identifier. `fix-<n>` is legal because orchestrator-prompt.md Step 4 builds exactly that for a fix round; the pattern was `^task-\\d+$`, so every fix dispatch this skill documents was one the contract would have refused.",
20
+ "examples": ["task-1", "task-3", "fix-1"]
19
21
  },
20
22
  "task_name": {
21
23
  "type": "string",
@@ -78,12 +80,31 @@
78
80
  "module_patterns": {
79
81
  "type": "string",
80
82
  "description": "Notes on how similar code is written in the module"
83
+ },
84
+ "test_case_specs": {
85
+ "type": "object",
86
+ "description": "RED-phase test stubs already written and committed by tests-creator. Present => TDD Mode (SKILL.md Phase 4.0): the implementer makes these GREEN and writes no new tests.",
87
+ "additionalProperties": false,
88
+ "required": ["test_files", "run_command"],
89
+ "properties": {
90
+ "test_files": {
91
+ "type": "array",
92
+ "items": { "type": "string" },
93
+ "minItems": 1,
94
+ "description": "Test files that must be failing when the task starts"
95
+ },
96
+ "run_command": {
97
+ "type": "string",
98
+ "description": "Command that runs exactly those test files"
99
+ }
100
+ }
81
101
  }
82
102
  }
83
103
  },
84
104
  "workspace": {
85
105
  "type": "object",
86
106
  "description": "Workspace context managed by the orchestrator.",
107
+ "additionalProperties": false,
87
108
  "required": ["codebase_path", "branch", "issue_number"],
88
109
  "properties": {
89
110
  "codebase_path": {
@@ -104,17 +125,28 @@
104
125
  "issue_title": {
105
126
  "type": "string",
106
127
  "description": "GitHub issue title for context"
128
+ },
129
+ "job_name": {
130
+ "type": "string",
131
+ "description": "Job package slug, when the dispatch came from job-orchestrator. Phase 6.1 records its result against this name with `keryx job document <job_name> --type implementation-report --file <path>`; absent, Phase 6.1 skips the file write.",
132
+ "examples": ["issue-4141--pipeline-validation"]
133
+ },
134
+ "context_path": {
135
+ "type": "string",
136
+ "description": "Job context document read at the start of Phase 2, e.g. .metaproject/jobs/<job_name>/ai/context.md"
107
137
  }
108
138
  }
109
139
  },
110
140
  "fix_context": {
111
141
  "type": "object",
112
142
  "description": "Present only for fix tasks dispatched from review loop.",
143
+ "additionalProperties": false,
113
144
  "properties": {
114
145
  "review_feedback": {
115
146
  "type": "array",
116
147
  "items": {
117
148
  "type": "object",
149
+ "additionalProperties": false,
118
150
  "required": ["file", "severity", "message"],
119
151
  "properties": {
120
152
  "file": {
@@ -143,22 +175,27 @@
143
175
  },
144
176
  "description": "Structured findings from review skills"
145
177
  },
146
- "original_task_id": {
147
- "type": "string",
148
- "pattern": "^task-\\d+$",
149
- "description": "The task that introduced the issues"
178
+ "original_task_ids": {
179
+ "type": "array",
180
+ "items": {
181
+ "type": "string",
182
+ "pattern": "^task-\\d+$"
183
+ },
184
+ "minItems": 1,
185
+ "description": "The tasks that introduced the findings. Plural because a fix round collects findings across a whole wave — orchestrator-prompt.md Step 4 has always sent an array, while this field was named `original_task_id` and typed as one string, so the two could never agree."
150
186
  },
151
187
  "iteration": {
152
188
  "type": "integer",
153
189
  "minimum": 1,
154
- "maximum": 2,
155
- "description": "Fix iteration number (max 2)"
190
+ "maximum": 3,
191
+ "description": "Fix iteration number. Three, the same bound `flow-orchestrator`, `job-orchestrator` and SKILL.md Phase 5.4 carry and `src/gdskills/round-bound.test.ts` pins; it was 2 here, a fourth disagreeing repair bound."
156
192
  }
157
193
  }
158
194
  },
159
195
  "automation": {
160
196
  "type": "object",
161
- "description": "Controls for autonomous execution.",
197
+ "description": "Controls for autonomous execution. This object is the ONLY definition of the automation settings — SKILL.md points here rather than restating the defaults.",
198
+ "additionalProperties": false,
162
199
  "required": ["skip_confirmation"],
163
200
  "properties": {
164
201
  "skip_confirmation": {
@@ -194,9 +231,14 @@
194
231
  "max_self_fix_attempts": {
195
232
  "type": "integer",
196
233
  "minimum": 1,
197
- "maximum": 5,
234
+ "maximum": 3,
198
235
  "default": 3,
199
- "description": "Max attempts to fix verification failures"
236
+ "description": "Max attempts to fix verification failures. Bounded at 3, not 5: SKILL.md Phase 5.4 states an absolute \"Maximum 3 self-fix attempts per verification step\" and cites the evidence for it, so a request asking for 4 was asking for something the skill refuses to do."
237
+ },
238
+ "commit_message_style": {
239
+ "type": "string",
240
+ "const": "conventional",
241
+ "description": "Commit format. One value: SKILL.md Phase 4.5 documents the conventional form and no other."
200
242
  }
201
243
  }
202
244
  }