easy-coding-harness 1.0.1 → 1.1.0-beta.1

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 (28) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +17 -15
  3. package/dist/cli.js +209 -195
  4. package/dist/cli.js.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/claude/agents/ec-implementer.md +4 -0
  7. package/templates/claude/agents/ec-reviewer.md +6 -0
  8. package/templates/codex/agents/ec-implementer.toml +4 -0
  9. package/templates/codex/agents/ec-reviewer.toml +6 -0
  10. package/templates/common/bundled-skills/ec-init/SKILL.md +2 -2
  11. package/templates/common/bundled-skills/ec-meta/references/local-architecture/README.md +6 -6
  12. package/templates/common/skills/ec-analysis/SKILL.md +56 -104
  13. package/templates/common/skills/ec-config/SKILL.md +37 -47
  14. package/templates/common/skills/ec-implementing/SKILL.md +26 -10
  15. package/templates/common/skills/ec-lite/SKILL.md +1 -1
  16. package/templates/common/skills/ec-memory/SKILL.md +3 -4
  17. package/templates/common/skills/ec-quality/SKILL.md +46 -25
  18. package/templates/common/skills/ec-task-management/SKILL.md +2 -2
  19. package/templates/common/skills/ec-tdd-init/SKILL.md +7 -7
  20. package/templates/common/skills/ec-workflow/SKILL.md +24 -22
  21. package/templates/main-constraint/AGENTS.md.tpl +23 -16
  22. package/templates/main-constraint/CLAUDE.md.tpl +23 -16
  23. package/templates/qoder/agents/ec-implementer.md +4 -0
  24. package/templates/qoder/agents/ec-reviewer.md +6 -0
  25. package/templates/runtime/tools/easy_coding_java_coverage.py +5 -5
  26. package/templates/shared-hooks/easy_coding_inputs.py +305 -0
  27. package/templates/shared-hooks/easy_coding_state.py +495 -461
  28. package/templates/shared-hooks/inject-subagent-context.py +3 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-coding-harness",
3
- "version": "1.0.1",
3
+ "version": "1.1.0-beta.1",
4
4
  "description": "CLI scaffold for installing Easy Coding harness files into agent-native directories.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -48,3 +48,7 @@ complete exactly that unit. Your reply IS the return value, not a message to a h
48
48
  - `checks`: TDD lifecycle commands actually run, otherwise an empty array
49
49
 
50
50
  Do not claim a file is verified unless the card asked you to run a check and you ran it.
51
+
52
+ - Use only the current correction/diff and direct dependencies. Preserve unrelated progress.
53
+ - Do not add repeated validation, fallback, retries, compatibility branches, idempotency
54
+ changes or defensive copies without an explicit requirement or demonstrated defect.
@@ -53,3 +53,9 @@ dimension named in your task card. Your reply IS the return value.
53
53
  - `repo_id` and `source_task_id`: copy unchanged when present in the task card
54
54
  - `findings`: array of `{file, line, issue, severity}` (`severity`: info | warning | error)
55
55
  - `suggestion`: optional fix direction per finding
56
+
57
+ - Use only the current correction/diff and direct dependencies. Preserve unrelated progress.
58
+ - Do not add repeated validation, fallback, retries, compatibility branches, idempotency
59
+ changes or defensive copies without an explicit requirement or demonstrated defect.
60
+ - Review code and test behavior only. Do not reconstruct fingerprints or inspect workflow
61
+ history. Passed work stays passed until relevant inputs change; suggestions do not block.
@@ -45,4 +45,8 @@ Output (return exactly this):
45
45
  - checks: TDD lifecycle commands actually run, otherwise an empty array
46
46
 
47
47
  Do not claim a file is verified unless the card asked you to run a check and you ran it.
48
+
49
+ - Use only the current correction/diff and direct dependencies. Preserve unrelated progress.
50
+ - Do not add repeated validation, fallback, retries, compatibility branches, idempotency
51
+ changes or defensive copies without an explicit requirement or demonstrated defect.
48
52
  """
@@ -50,4 +50,10 @@ Output (return exactly this):
50
50
  - repo_id and source_task_id: copy unchanged when present in the task card
51
51
  - findings: array of {file, line, issue, severity} (severity: info | warning | error)
52
52
  - suggestion: optional fix direction per finding
53
+
54
+ - Use only the current correction/diff and direct dependencies. Preserve unrelated progress.
55
+ - Do not add repeated validation, fallback, retries, compatibility branches, idempotency
56
+ changes or defensive copies without an explicit requirement or demonstrated defect.
57
+ - Review code and test behavior only. Do not reconstruct fingerprints or inspect workflow
58
+ history. Passed work stays passed until relevant inputs change; suggestions do not block.
53
59
  """
@@ -85,7 +85,7 @@ initialization standard. Check each item:
85
85
  and non-empty?
86
86
  - **Project profile**: `project.yaml` exists with `mode` and `test` fields (ec-init owns it;
87
87
  `config.yaml` is CLI-owned — not ec-init's concern)?
88
- - **TDD runtime contract**: CLI-owned `config.yaml` has schema 5 TDD defaults and both
88
+ - **TDD runtime contract**: CLI-owned `config.yaml` has schema 6 unit test defaults and both
89
89
  `.easy-coding/tools/easy_coding_java_coverage.py` and
90
90
  `.easy-coding/tools/easy_coding_tdd_readiness.py` exist? Missing fields or tools mean
91
91
  `easy-coding upgrade` is required; ec-init must not repair them directly. Project-specific
@@ -169,7 +169,7 @@ agent must be able to see what was generated and on what evidence.
169
169
  tests live, naming conventions, coverage expectations, which classes of code this project
170
170
  tests vs skips. Also fill `project.yaml` `test.framework` and `test.command` with commands
171
171
  you verified exist (read package.json scripts or equivalent — do not guess).
172
- If effective TDD is disabled, do not inspect JaCoCo or GitLab and do not add TDD-specific
172
+ If effective unit test strategy is `none`, do not inspect JaCoCo or GitLab and do not add TDD-specific
173
173
  requirements. If it is enabled for Java, additionally document JUnit/JaCoCo commands,
174
174
  production/test source roots, XML report paths, the local acceptance gate, and the generated
175
175
  GitLab TEST-stage job as non-blocking automation infrastructure.
@@ -63,12 +63,12 @@ confirmation before a minimal mutation, creates no task/QUALITY/MEMORY artifacts
63
63
  until the user invokes it again. If a task is active, the user chooses whether to cancel startup,
64
64
  close the task, or clear only the session task pointer before Lite starts.
65
65
 
66
- Java TDD is a third independent, default-off control managed by `ec-config`. Session overrides
67
- project configuration; ANALYSIS freezes enabled state and the 1..100 changed-line threshold
68
- (default 90) on entry to IMPLEMENT. Disabled TDD changes no ordinary workflow test depth. Enabled
69
- TDD adds lifecycle evidence, a TDD review dimension, passed local unit-test evidence, and a local
70
- JaCoCo diff gate. `ec-tdd-init` still generates the equivalent GitLab TEST-stage job, but remote
71
- pipeline execution and status are not Harness acceptance dependencies.
66
+ Java unit tests use an independent `unit_test_mode: none|ut|tdd` managed by `ec-config`.
67
+ Session values override project defaults. Both UT and TDD freeze the shared `ut_coverage_threshold`
68
+ (default 90) and repository baseline on entry to IMPLEMENT, and require passed local unit tests
69
+ plus JaCoCo changed-line coverage. UT has no test-first or separate TDD-review requirement; TDD
70
+ adds lifecycle evidence and its review dimension. Both reuse `ec-tdd-init` infrastructure.
71
+ Remote GitLab execution is not a task acceptance gate.
72
72
 
73
73
  The active task pointer lives in `sessions/{agent}-{session-id}.json` (with an agent-prefixed PPID fallback only
74
74
  when a hook payload has no logical session ID);
@@ -21,12 +21,8 @@ Communicate with the user in the user's language.
21
21
  4. Inspect concrete code paths and tests. Expand context only when evidence reveals another
22
22
  dependency or risk.
23
23
 
24
- Apply a progressive cost budget while doing this work. A likely Fast task reads only the nearest
25
- comparable implementation, its direct contracts, and targeted tests. Standard reads the affected
26
- module closure. Expand into cross-module or repository-wide context only after concrete evidence
27
- shows the compound high-risk and complexity signals required for Strict. Do not scan unrelated
28
- repositories, the full Spec, broad Git history, or every architecture section merely to prove
29
- that a bounded task might be complicated.
24
+ Load context only for the current change and its direct dependencies. Reuse existing findings;
25
+ without new evidence, do not repeat discovery or expand into unrelated modules.
30
26
 
31
27
  For a task with `task.json.spec_source`, use `resume-spec-context` against the stored source, exact
32
28
  `selected_spec_tasks`, and only their stored `task.repo_paths` bindings. Schema, Spec ID, design
@@ -73,7 +69,8 @@ when local evidence conflicts or a deviation can change the contract, risk, or a
73
69
 
74
70
  ## Analysis artifacts
75
71
 
76
- Copy `.easy-coding/templates/dev-spec-skeleton.md` first, then replace every `[[EC_TODO:...]]`.
72
+ For a non-TDD Fast task use the compact form below. Otherwise copy
73
+ `.easy-coding/templates/dev-spec-skeleton.md` first, then replace every `[[EC_TODO:...]]`.
77
74
  Keep every mandatory section. The `### 决策闭环` (Decision Closure) and `### Workflow Mode`
78
75
  sections are required. The decision section must contain exactly one standalone
79
76
  `decision_status: closed` marker, and no other `decision_status` marker may appear elsewhere in
@@ -153,108 +150,63 @@ line count, or create many one-use helpers, merely to make the plan look modular
153
150
  clear semantic boundary, reuse point, or independently testable responsibility. Use parallel only
154
151
  for truly independent write scopes. Better unit contracts reduce later QUALITY rework.
155
152
 
156
- Every Harness task is a repository-mutation task and requires `test-strategy.md`. Pure read-only
153
+ Standard/Strict tasks require `test-strategy.md`; compact Fast tasks keep checks in the plan. Pure read-only
157
154
  conversation never enters ANALYSIS and creates no task.
158
155
 
159
- ## Optional Java TDD analysis
160
-
161
- Read `effective_tdd_enabled` and `effective_tdd_coverage_threshold` from the state snapshot.
162
- For a `type=tdd-init` task, treat frozen TDD as off even if the project/session requests it. That
163
- task is the sole exception allowed to inspect and plan build/CI coverage infrastructure while TDD
164
- is off. Its scope is infrastructure only: never plan historical business-test backfill or a
165
- repository-wide coverage target, and explicitly record `coverage scope: changed production lines`.
166
-
167
- When TDD is disabled, stop here: do not inspect GitLab CI or JaCoCo, do not add TDD fields or
168
- extra tests, and do not strengthen the selected Workflow Mode's ordinary acceptance depth. This
169
- zero-cost rule applies to ordinary tasks, not the explicit `tdd-init` infrastructure task above.
170
-
171
- When TDD is enabled for a Java code task, make `test-strategy.md` record:
172
-
173
- - detected Java/JUnit build system, exact unit-test command, production/test source roots, and
174
- JaCoCo XML paths;
175
- - immutable Git baseline SHA and the configured changed-production-line threshold; design tests
176
- toward 100% while treating the threshold as the mechanical minimum;
177
- - feature/bug RED -> GREEN -> REFACTOR evidence, or for pure refactors a pre-change
178
- characterization GREEN -> post-change GREEN sequence without inventing a RED failure;
179
- - the local unit-test command and local changed-line acceptance command. Record that
180
- `ec-tdd-init` generated the GitLab TEST-stage job, but remote execution, pipeline identity, and
181
- status are non-blocking and never require an intermediate commit or push. Include these exact,
182
- language-independent contract markers: `local_test_gate: required` and
183
- `remote_ci_acceptance: non-blocking`.
184
- - current `tdd_readiness_status=ready`; a missing receipt requires `ec-tdd-init`, while
185
- `needs_repair` requires fixing the reported entry without resetting TDD configuration.
186
- Build-file content changes use current task tests and coverage; they do not require reinit.
187
-
188
- The state API mechanically freezes current Git `HEAD` per repository into `task.tdd_baselines`
189
- when ANALYSIS advances to IMPLEMENT. Plan the local command with that exact SHA and the frozen
190
- threshold. The generated GitLab job remains parameterized for infrastructure parity, but the
191
- Harness acceptance plan never waits for remote CI. Never use a mutable `HEAD` fallback at
192
- verification time. Non-Canonical TDD is limited to one Git repository; multi-repository TDD must
193
- use Canonical repository bindings.
194
-
195
- Also append a `### TDD Mode` section to `dev-spec.md` with enabled state, frozen threshold,
196
- baseline, local unit-test gate, local coverage gate, generated GitLab job as non-blocking
197
- infrastructure, and lifecycle evidence. Do not add this section when TDD is disabled.
198
-
199
- If the task is not a Java project, explain that Java-only TDD cannot be activated and obtain a
200
- mode decision before advancing. The CLI never installs JaCoCo or edits CI automatically.
156
+ ## Optional Java unit test strategies
157
+
158
+ Read `effective_unit_test_mode` and `effective_ut_coverage_threshold` from the snapshot. The
159
+ strategy is independent of workflow depth. For `type=tdd-init`, freeze strategy `none` and only
160
+ initialize the existing changed-line infrastructure; do not backfill historical business tests.
161
+
162
+ With `none`, retain ordinary task-required verification and add no coverage scan, command, or
163
+ artifact. With `ut` or `tdd`, reuse the existing Java/JUnit/JaCoCo readiness. Missing infrastructure
164
+ uses `ec-tdd-init`; damaged local entries need only the reported repair. Build-file changes alone
165
+ do not require reinitialization. GitLab execution is not an acceptance dependency.
166
+
167
+ For UT, keep the normal compact Fast analysis when applicable. Record the related unit-test
168
+ command with coverage collection and the changed-line gate command in the plan for compact Fast,
169
+ or in the existing `test-strategy.md` for other tasks, using the
170
+ confirmed `ut_coverage_threshold`. The state API freezes each repository's current Git HEAD in
171
+ `task.tdd_baselines`; use that exact baseline at verification time. Do not duplicate these values
172
+ across extra documents or add a UT Mode section. No RED/GREEN/REFACTOR evidence or TDD review is
173
+ required. Existing tests may already satisfy the threshold; add tests only for relevant gaps.
174
+
175
+ For TDD, also record the existing test-first contract in `test-strategy.md` and a `### TDD Mode`
176
+ section in `dev-spec.md`: frozen threshold, immutable baseline per repository, local unit-test
177
+ command, JaCoCo XML paths, and lifecycle evidence. Use RED -> GREEN -> REFACTOR for feature/bug
178
+ units, or characterization GREEN -> post-change GREEN for pure refactors. Refactor only for a
179
+ concrete improvement. Include `TDD`, `JaCoCo`, `baseline`, `local_test_gate: required`, and
180
+ `remote_ci_acceptance: non-blocking` in the test strategy.
181
+
182
+ Both strategies accept changed production lines at the configured threshold, without chasing
183
+ 100% or expanding to historical coverage. One grouped test execution supplies both test and
184
+ coverage evidence. Non-Canonical coverage uses one Git repository; multi-repository coverage uses
185
+ Canonical repository bindings. Preserve failed tests as failures even when coverage reaches target.
201
186
 
202
187
  ## Workflow mode calculation
203
188
 
204
- Resolve configured mode from the state snapshot:
189
+ Execution mode equals the mechanical minimum for the actual current scope. Do not propose a
190
+ higher mode or ask the user to select one. Old configured/frozen modes do not raise the minimum.
191
+ Use `propose-workflow-mode --agent <agent-id> --session-file <P>` once after the plan exists;
192
+ it returns the calculated mode and reasons, so a separate floor/proposal round is unnecessary.
205
193
 
206
- `session.workflow_mode > project behavior.workflow_mode > adaptive`
194
+ For a non-TDD Fast task, dev-spec.md may use the compact form:
207
195
 
208
- After writing the execution plan, ask the state API to calculate the mechanical minimum:
209
-
210
- ```bash
211
- {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py workflow-floor \
212
- --agent <agent-id> --session-file <P>
213
- ```
214
-
215
- Use its `minimum_mode` and `reasons` as the proposal floor. You may raise this result when
216
- uncertainty or user preference requires more rigor, but never lower or replace it with a
217
- self-reported floor. The state API rechecks the floor when the proposal is saved and frozen.
218
-
219
- The calculation is intentionally Standard-centered:
220
-
221
- - `fast`: up to three coherent low-risk units in one actually modified repository, at most eight
222
- changed files, no explicit high-risk signal, and no public or cross-repository contract impact.
223
- Small parameter changes, bounded field/mapping edits, and a few ordinary model files should
224
- normally remain Fast.
225
- - `standard`: the default for ordinary business work. Four or more units, more than eight files,
226
- bounded compatibility work, actual but contained multi-repository changes, broad low-risk work,
227
- and bounded high-risk work remain Standard.
228
- - `strict`: requires both an explicit high-risk signal and concrete complexity/blast-radius
229
- evidence. Complexity means actual multi-repository edits, at least five units, at least fifteen
230
- changed files, or a public/cross-repository contract. Parallel execution is a Standard signal
231
- by itself. Generic domain words in a risk description, title, file path, Spec repository
232
- catalog, or unselected task are never sufficient evidence of high risk.
233
-
234
- Repository count comes only from repositories that own files in current plan units. Canonical
235
- Spec metadata, unselected tasks, dependency summaries, unused `repo_paths`, and supermodule child
236
- registrations do not raise the mode. A real multi-repository change is a Standard signal by
237
- itself and reaches Strict only when an explicit high-risk signal is also present.
238
-
239
- If configuration is concrete, it is also a floor. The selected mode may be raised by the user
240
- but never placed below either floor. The Agent must not raise an adaptive proposal to Strict from
241
- vague uncertainty or a domain keyword; cite both the explicit risk and the concrete complexity
242
- signal. Explain the decision and state-specific effects in the dev-spec.
243
-
244
- Persist the proposal before requesting ANALYSIS -> IMPLEMENT:
245
-
246
- ```bash
247
- {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py propose-workflow-mode \
248
- --configured <adaptive|fast|standard|strict> \
249
- --selected <fast|standard|strict> \
250
- --minimum <fast|standard|strict> \
251
- --source <project|session|adaptive|user> \
252
- --reason "<reason>" \
253
- --agent <agent-id> --session-file <P>
196
+ ```markdown
197
+ <!-- easy-coding:compact -->
198
+ decision_status: closed
199
+ Goal: <confirmed behavior>
200
+ Scope: <exact files and preservation boundary>
201
+ Acceptance: <observable outcome and minimum check>
254
202
  ```
255
203
 
256
- Repeat `--reason` for distinct material risks. Re-running the command replaces the proposal
257
- while still in ANALYSIS.
204
+ Record Unit `input_files` for the known additional direct inputs (an empty list means the
205
+ Unit files are self-contained). Include shared helpers, fixtures, schemas and configuration
206
+ actually consumed by its checks. Without a declared closure, checks cover the owning module.
207
+ Build commands still include their module compilation inputs. Do not infer a whole-program call graph. Keep Unit contracts and test points in the existing execution plan. Do not duplicate them across
208
+ full template chapters or create a separate test strategy for this compact form. Canonical work
209
+ consumes the selected source closure; it does not redesign unrelated selected tasks.
258
210
 
259
211
  ## User presentation and transition
260
212
 
@@ -263,9 +215,9 @@ pasting the full `dev-spec.md`. The receipt must contain:
263
215
 
264
216
  - the core solution and affected scope/units;
265
217
  - acceptance and test-strategy highlights;
266
- - configured, minimum, and selected workflow modes with reasons;
218
+ - the computed minimum workflow mode and its concrete reasons;
267
219
  - the material risks and explicit acceptance boundaries;
268
- - explicit user ability to request a higher mode or a permitted lower mode.
220
+ - the computed minimum mode as an execution fact, without offering mode choices.
269
221
 
270
222
  End the summary with the absolute path to
271
223
  `.easy-coding/tasks/<task-id>/dev-spec.md`. When the current client supports local-file Markdown
@@ -305,6 +257,6 @@ If evidence requires changing Canonical task boundaries, contracts, files, symbo
305
257
  or dependencies, obtain confirmation and run `begin-spec-change --affected-task <id> --summary
306
258
  <confirmed-change> --agent <agent-id> --session-file <P>` before editing. This persists the
307
259
  intent across handoffs and blocks implementation/acceptance until synchronization. Update the original static design with revision +1,
308
- restore READY, and call `sync-spec-design --affected-task ...`. This invalidates the old local
309
- plan. Run `resume-spec-context` after synchronization, then refresh derived artifacts. Never
260
+ restore READY, and call `sync-spec-design --affected-task ...`. For bounded corrections this refreshes only affected Unit mappings; other design changes
261
+ invalidate the old local plan. Run `resume-spec-context` after synchronization, then refresh derived artifacts. Never
310
262
  substitute edits to the derived `dev-spec.md`, and never edit `EDS:EXECUTION` by hand.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ec-config
3
- description: Inspect and configure Easy Coding project/session Approval, Workflow, and Java TDD modes.
3
+ description: Inspect and configure Easy Coding project/session Approval, Workflow, and Java unit test strategies.
4
4
  ---
5
5
 
6
6
  # ec-config — mode configuration
@@ -10,69 +10,59 @@ and available actions. Never mutate project or session settings without an expli
10
10
 
11
11
  ## Configuration panel
12
12
 
13
- Call `snapshot` and show project, session, effective, and frozen task values for:
13
+ Call `snapshot` and show project, session, effective, and frozen task values for `approval_mode`,
14
+ the mechanically calculated workflow mode (read-only), `unit_test_mode`, and `ut_coverage_threshold`.
15
+ Use `project_unit_test_mode`, `session_unit_test_mode`, `effective_unit_test_mode`, their threshold
16
+ counterparts, `task_unit_test_mode`, `task_tdd_baselines`, and `unit_test_readiness_status` directly.
17
+ When readiness is `not_checked`, report it as not checked; do not scan infrastructure merely to
18
+ populate the panel. Inspect readiness when the user requests it or selects UT/TDD.
14
19
 
15
- - `approval_mode`;
16
- - `workflow_mode`;
17
- - `tdd_enabled` and `tdd_coverage_threshold`.
20
+ Precedence is `session override > project config > defaults`. Defaults are Approval `guard`,
21
+ Workflow `adaptive`, unit test strategy `none`, and shared changed-line coverage threshold 90%.
22
+ The strategies are:
18
23
 
19
- Use the returned fields directly, including `project_tdd_enabled`, `session_tdd_enabled`,
20
- `effective_tdd_enabled`, their threshold counterparts, `task_tdd_enabled`, and the task's
21
- per-repository `task_tdd_baselines` frozen state. When `tdd_readiness_status=not_checked` because
22
- TDD is off, explicitly run the read-only readiness command below before showing readiness:
24
+ - `none`: ordinary task-required verification, with no additional coverage gate.
25
+ - `ut`: passed local unit tests and changed-production-line JaCoCo coverage at the threshold.
26
+ No test-first order, RED/GREEN history, refactor cycle, or separate TDD review is required.
27
+ - `tdd`: test-first development plus the same local test and coverage gates; retain TDD lifecycle
28
+ evidence and the TDD review dimension.
23
29
 
24
- ```bash
25
- python3 .easy-coding/tools/easy_coding_tdd_readiness.py --cwd . check
26
- ```
27
-
28
- This explicit configuration-panel check is the only disabled-mode readiness scan; ordinary hooks
29
- must not inspect build or CI files while TDD is off.
30
-
31
- Explain precedence as `session override > project config > defaults`. Defaults are Approval
32
- `guard`, Workflow `adaptive`, TDD disabled, and TDD changed-line coverage threshold 90%. An active
33
- task freezes its effective TDD values when ANALYSIS advances to IMPLEMENT; later project/session
34
- changes affect future tasks and ANALYSIS only.
30
+ UT/TDD currently apply to Java code tasks. Neither strategy raises the mechanical workflow depth.
31
+ ANALYSIS -> IMPLEMENT freezes strategy, threshold, and repository baselines; later project/session
32
+ changes affect future tasks and ANALYSIS only. `none` preserves the threshold for later use.
35
33
 
36
34
  Approval semantics stay independent from verification depth: `approve` waits at each
37
35
  non-mechanical edge, `guard` waits at ANALYSIS -> IMPLEMENT and QUALITY -> MEMORY, `confirm`
38
- waits only for the plan, and `auto` advances legal green edges immediately. Every mode temporarily
39
- pauses only when code changes after the frozen QUALITY checkpoint, because the user must see
40
- and accept that exact new diff; this exception does not convert `auto` into `guard`.
36
+ waits only for the plan, and `auto` advances legal green edges immediately. A new code diff after
37
+ the QUALITY checkpoint requires acceptance of that exact diff without changing the approval mode.
41
38
 
42
39
  ## Project configuration
43
40
 
44
- Use `easy-coding config` for project settings. The CLI confirms one atomic update of Approval,
45
- Workflow, TDD, and (when enabled) the threshold. The threshold must be an integer from 1 to 100.
46
- Enabling TDD is rejected atomically unless `ec-tdd-init` readiness is currently `ready`.
41
+ Use `easy-coding config`. The CLI confirms an atomic update of Approval, unit test strategy, and
42
+ its shared threshold (integer 1..100). Execution depth remains calculated automatically.
47
43
 
48
44
  ## Session configuration
49
45
 
50
46
  After explicit user selection, use the current logical session file:
51
47
 
52
48
  ```bash
53
- # approval
54
49
  {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py set-approval-mode --mode approve|guard|confirm|auto --agent <agent-id> --session-file <P>
55
50
  {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py clear-approval-mode --agent <agent-id> --session-file <P>
56
51
 
57
- # workflow
58
- {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py set-workflow-mode --mode adaptive|fast|standard|strict --agent <agent-id> --session-file <P>
59
- {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py clear-workflow-mode --agent <agent-id> --session-file <P>
60
-
61
- # TDD; omitting threshold preserves an existing session threshold, otherwise project/default 90 applies
62
- {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py set-tdd --enabled true|false [--threshold 1..100] --agent <agent-id> --session-file <P>
63
- {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py clear-tdd --agent <agent-id> --session-file <P>
52
+ # Omitting threshold preserves the session threshold or inherits project/default 90.
53
+ {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py set-unit-test-mode --mode none|ut|tdd [--threshold 1..100] --agent <agent-id> --session-file <P>
54
+ {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py clear-unit-test-mode --agent <agent-id> --session-file <P>
64
55
  ```
65
56
 
66
- Turning TDD off must preserve the existing Fast/Standard/Strict test depth exactly: do not inspect
67
- CI, request JaCoCo, add TDD artifacts, run coverage commands, or strengthen acceptance criteria.
68
- When TDD is on, explain that it applies only to Java code tasks and activates RED/GREEN/REFACTOR,
69
- TDD review, a passed local unit-test gate, and local changed-line JaCoCo coverage. `ec-tdd-init`
70
- still generates the GitLab TEST-stage job, but Harness does not wait for or record remote pipeline
71
- results as acceptance evidence.
72
-
73
- Before any project/session enable action, require `tdd_readiness_status=ready`. If it is not ready,
74
- route `needs_init` to `ec-tdd-init` and `needs_repair` to the reported repair. Preserve existing
75
- settings on failure; never offer or persist "enable now, initialize later". Normal build-file
76
- changes do not require initialization, and a CLI upgrade must preserve project/session TDD values.
77
- Readiness means infrastructure can measure future changed production lines. It does not certify
78
- repository-wide coverage and does not require tests for unchanged historical code.
57
+ Selecting UT/TDD requires ready infrastructure. Reuse `ec-tdd-init` and its existing readiness
58
+ receipt for both strategies. Route `needs_init` to initialization and `needs_repair` to the reported
59
+ repair, preserving existing settings. Normal build-file changes do not require reinitialization.
60
+ The shared gate measures changed production lines, not historical repository-wide coverage.
61
+ GitLab automation may reuse it, but remote pipelines are not Harness acceptance dependencies.
62
+
63
+ Run related unit tests once with coverage collection, and reuse that execution for both test and
64
+ coverage evidence. Inputs unchanged means reuse; only rerun affected checks after relevant changes.
65
+ Test assertions stay in ordinary review for UT. Do not add a separate UT review or workflow stage.
66
+
67
+ Execution depth always equals the current mechanical minimum. Legacy workflow settings do not
68
+ raise it. Do not offer execution-depth choices or recommend changing to Lite.
@@ -15,23 +15,33 @@ or claim. On session resume or after design sync, call `resume-spec-context --ag
15
15
  handoff summaries and derived plans cannot substitute for this context. A blocked context or
16
16
  pending `spec_change` stops implementation until the original source is repaired/synchronized.
17
17
 
18
- If frozen `task.tdd_enabled` is not `true`, IMPLEMENT writes production and planned test code but
18
+ If frozen `task.unit_test_mode` is `none` or `ut`, IMPLEMENT writes production and planned test code but
19
19
  does not run lint, typecheck, test, build, or coverage commands. Deterministic execution belongs
20
20
  to QUALITY's Verification Gate. TDD is the only exception because RED/GREEN/REFACTOR commands are
21
21
  part of the implementation method; current-fingerprint green evidence may be reused by QUALITY.
22
+ UT writes the necessary tests here and runs them once with coverage in QUALITY, with no TDD lifecycle.
22
23
 
23
- When frozen TDD is enabled, every feature/bug unit must capture a meaningful failing unit test
24
- before production code (RED), the smallest passing implementation (GREEN), and a green refactor.
24
+ When frozen `task.unit_test_mode` is `tdd`, every feature/bug unit must capture a meaningful failing unit test
25
+ before production code (RED) and the smallest passing implementation (GREEN). Refactor only
26
+ when a concrete improvement is needed; unchanged GREEN inputs do not require another run.
25
27
  Pure refactors instead capture a passing characterization test before the change and rerun it
26
28
  afterward. Never fake RED evidence. Keep tests deterministic, boundary-focused, and minimally
27
- mocked, and design changed production code toward 100% unit coverage.
29
+ mocked, and meet the confirmed changed-line threshold without expanding scope for extra coverage.
28
30
 
29
31
  Communicate with the user in the user's language.
30
32
 
33
+ For a bounded correction already routed by `begin-correction`, use the existing plan and the
34
+ returned file scope. Restoring known behavior needs the affected regression checks, not an
35
+ artificial RED/REFACTOR cycle. Preserve all unrelated Unit progress. A correction of generated
36
+ tracking metadata is handled once; do not reopen design or rewrite the complete plan for it.
37
+
38
+ When a lifecycle check is necessary, call `prepare-check` before running it and `record-check`
39
+ afterward as documented in ec-quality. QUALITY reuses these input-bound results.
40
+
31
41
  ## Non-negotiable gates
32
42
 
33
- 1. Modify only files in the confirmed change-scope table. A new file requirement returns the
34
- task to ANALYSIS.
43
+ 1. Modify only confirmed files. Return to ANALYSIS only for a substantive scope/contract
44
+ expansion; restoring a previously mapped file uses the correction scope.
35
45
  2. Preserve existing encoding and project comment conventions.
36
46
  3. Each unit must carry `acceptance_criteria`, `test_points`, `contracts`, and `risks`.
37
47
  Missing unit context is an analysis defect; do not make the implementer rediscover it.
@@ -88,6 +98,11 @@ Communicate with the user in the user's language.
88
98
  14. Use one blank line between coherent logic sections. Do not create noisy blank-line gaps or
89
99
  compress unrelated steps into an unreadable block.
90
100
 
101
+ Keep validation at its responsible boundary. Do not repeat internal null/state checks already
102
+ covered by the contract. Without an explicit requirement or demonstrated defect, add no fallback,
103
+ retry, compatibility branch, idempotency change, defensive copy, or speculative error handling.
104
+ An added validation needs a concrete triggering input and the failure it prevents.
105
+
91
106
  ## Choose the execution owner
92
107
 
93
108
  `strategy` defines dependency shape; `workflow_mode` defines assurance depth.
@@ -120,7 +135,7 @@ Sub-agents never dispatch other sub-agents or read `.easy-coding` workflow asset
120
135
  # Task Card
121
136
  ## Identity Easy Coding implementation unit
122
137
  ## Workflow Mode {fast|standard|strict}
123
- ## TDD {off | on, frozen changed-line threshold N%}
138
+ ## Unit Tests {none | ut | tdd; shared changed-line threshold N%}
124
139
  ## Task {unit description}
125
140
  ## Source Spec {spec_id@revision + sha256 | NONE}
126
141
  ## Source Task {source_task_id | NONE}
@@ -176,7 +191,8 @@ checks:[], issues:[], needs_attention:[]
176
191
  8. If a static Canonical change is confirmed, first persist it with `begin-spec-change
177
192
  --affected-task <id> --summary <confirmed-change> --agent <agent-id> --session-file <P>`.
178
193
  Revise the original design by exactly one revision, validate READY and use `sync-spec-design`;
179
- then `resume-spec-context` and rebuild the local plan in ANALYSIS. Never edit the
194
+ then `resume-spec-context`. A bounded correction preserves the plan and continues IMPLEMENT;
195
+ substantive expansion returns to ANALYSIS. Never edit the
180
196
  machine-owned execution block. If a writeback was
181
197
  interrupted, run `reconcile-spec-execution` with the stored idempotent pending action.
182
198
  Reconciliation only consumes dispatch/result evidence created after the current `in_progress`
@@ -188,8 +204,8 @@ conversation overhead while keeping work observable.
188
204
  ## End state
189
205
 
190
206
  - After all units are implemented, hand control to ec-workflow for IMPLEMENT -> QUALITY.
191
- - New risk above the frozen mode: call `raise-workflow-mode`; modes may rise but never silently
192
- fall after ANALYSIS.
207
+ - A concrete new risk changes the calculated minimum: update its Unit risk and call
208
+ `raise-workflow-mode` to recalculate. The argument cannot inflate the mechanical result.
193
209
 
194
210
  ## Self-check
195
211
 
@@ -77,5 +77,5 @@ For an explicit repository mutation:
77
77
  another file changed after confirmation, or Git HEAD moved. Re-present the proposal rather
78
78
  than bypassing that result. Lite remains enabled for the next request.
79
79
 
80
- Lite intentionally omits TDD, QUALITY, MEMORY, task history, and completion transitions. Use a
80
+ Lite intentionally omits UT/TDD coverage gates, QUALITY, MEMORY, task history, and completion transitions. Use a
81
81
  normal Fast task instead when the user wants those guarantees.
@@ -42,10 +42,9 @@ policy, changed files, and any Canonical source tasks that required targeted ver
42
42
  the user's accepted exception without re-reviewing or re-analyzing the code. Canonical writeback
43
43
  already carries the same digest and authorization as shared `acceptance` evidence.
44
44
 
45
- When frozen TDD is enabled, add its threshold, lifecycle evidence, passed local unit-test result,
46
- and local changed-line result to the short memory's execution evidence. Remote CI status is not
47
- part of Harness acceptance or task memory. When TDD is off, omit TDD fields entirely so ordinary
48
- tasks incur no additional memory work.
45
+ For frozen UT/TDD, record the strategy, shared threshold, passed local unit-test result, and
46
+ changed-line coverage result with its frozen baseline. Only TDD includes lifecycle evidence.
47
+ Remote CI is not acceptance evidence. With `none`, omit coverage-specific fields.
49
48
 
50
49
  Ask the state API for `memory-instruction`. Distill only when it returns `action:distill`;
51
50
  otherwise record `no-op`. Long memory receives reusable facts only, not file dumps, transient