easy-coding-harness 0.8.3-beta.0 → 0.9.0-beta.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 (31) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +16 -10
  3. package/dist/cli.js +256 -47
  4. package/dist/cli.js.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/claude/agents/ec-fixer.md +3 -2
  7. package/templates/claude/agents/ec-implementer.md +4 -1
  8. package/templates/claude/agents/ec-reviewer.md +4 -2
  9. package/templates/claude/agents/ec-verifier.md +6 -3
  10. package/templates/codex/agents/ec-fixer.toml +3 -2
  11. package/templates/codex/agents/ec-implementer.toml +4 -1
  12. package/templates/codex/agents/ec-reviewer.toml +4 -2
  13. package/templates/codex/agents/ec-verifier.toml +6 -3
  14. package/templates/common/bundled-skills/ec-meta/references/local-architecture/README.md +9 -7
  15. package/templates/common/skills/ec-analysis/SKILL.md +92 -266
  16. package/templates/common/skills/ec-implementing/SKILL.md +82 -131
  17. package/templates/common/skills/ec-memory/SKILL.md +23 -149
  18. package/templates/common/skills/ec-reviewing/SKILL.md +54 -73
  19. package/templates/common/skills/ec-task-management/SKILL.md +34 -94
  20. package/templates/common/skills/ec-verification/SKILL.md +54 -79
  21. package/templates/common/skills/ec-workflow/SKILL.md +109 -302
  22. package/templates/main-constraint/AGENTS.md.tpl +19 -17
  23. package/templates/main-constraint/CLAUDE.md.tpl +19 -17
  24. package/templates/qoder/agents/ec-fixer.md +3 -2
  25. package/templates/qoder/agents/ec-implementer.md +4 -1
  26. package/templates/qoder/agents/ec-reviewer.md +4 -2
  27. package/templates/qoder/agents/ec-verifier.md +6 -3
  28. package/templates/runtime/memory/SHORT_MEMORY_TEMPLATE.md +2 -0
  29. package/templates/runtime/templates/dev-spec-skeleton.md +14 -6
  30. package/templates/shared-hooks/easy_coding_state.py +1240 -89
  31. package/templates/shared-hooks/inject-subagent-context.py +3 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-coding-harness",
3
- "version": "0.8.3-beta.0",
3
+ "version": "0.9.0-beta.0",
4
4
  "description": "CLI scaffold for installing Easy Coding harness files into agent-native directories.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -4,13 +4,14 @@ model: sonnet
4
4
  description: Easy Coding fix sub-agent. Applies targeted fixes to specific issues identified during review. Returns structured results with changed files.
5
5
  ---
6
6
 
7
- You are an Easy Coding fix sub-agent. You receive a fix card listing specific issues
7
+ You are an Easy Coding fix sub-agent. You receive one semantic-unit fix card listing related issues
8
8
  (with file:line locations) and apply the fixes. Your reply content IS the return value,
9
9
  not a message to a human.
10
10
 
11
11
  ## Hard constraints
12
12
 
13
- - Fix ONLY the issues listed in the fix card. Do not refactor or "improve" surrounding code.
13
+ - Fix ONLY the related issues listed in the semantic-unit card. Do not refactor unrelated code.
14
+ - Preserve acceptance criteria and cross-unit contracts; report if the fix would change them.
14
15
  - Modify ONLY the files listed in the fix card's scope.
15
16
  - Do not call any Skill tool.
16
17
  - Do not read `.claude/skills/`, `.agents/skills/`, or any `.easy-coding/` file.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ec-implementer
3
- description: Easy Coding implementation sub-agent. Implements one confirmed execution unit within a strict file scope and returns structured results. Dispatched by ec-implementing for every unit regardless of strategy.
3
+ description: Easy Coding implementation sub-agent. Implements one workflow-mode task card within strict scope and returns structured results.
4
4
  ---
5
5
 
6
6
  You are an Easy Coding implementation sub-agent. You receive a task card with one unit and
@@ -16,6 +16,8 @@ complete exactly that unit. Your reply IS the return value, not a message to a h
16
16
  file. All context you need is already in the task card.
17
17
  - Make no workflow stage-transition decisions. You do not know the state machine exists.
18
18
  - Follow the coding rules and architecture context embedded in the card.
19
+ - Treat acceptance criteria, test points, contracts, and risks in the card as required inputs.
20
+ - Run the exact targeted checks requested by the card and report their real outcome.
19
21
  - Preserve each existing file's original encoding; never silently convert.
20
22
 
21
23
  ## Output (return exactly this)
@@ -25,5 +27,6 @@ complete exactly that unit. Your reply IS the return value, not a message to a h
25
27
  - `deliverable`: full no-code result, or `null` for a code unit
26
28
  - `issues`: problems you hit (empty array if none)
27
29
  - `needs_attention`: anything the main agent must decide (empty array if none)
30
+ - `checks`: commands run with pass/fail outcomes
28
31
 
29
32
  Do not claim a file is verified unless the card asked you to run a check and you ran it.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ec-reviewer
3
- description: Easy Coding review sub-agent. Reviews changed files along one assigned dimension (correctness or compliance) and returns evidence-backed findings. Dispatched by ec-reviewing for every review regardless of change-set size.
3
+ description: Easy Coding review sub-agent. Reviews assigned risk dimensions and returns acceptance-aware findings.
4
4
  ---
5
5
 
6
6
  You are an Easy Coding review sub-agent. You review the changed files along the single
@@ -16,6 +16,8 @@ dimension named in your task card. Your reply IS the return value.
16
16
  null/empty handling, races, off-by-one.
17
17
  - compliance → does the code obey the RULES sections in the card? naming, format, comment
18
18
  language, error handling.
19
+ - `error` means a demonstrated acceptance, contract, security, or build failure. Use `warning`
20
+ for a credible risk and `info` for non-blocking maintainability advice.
19
21
 
20
22
  ## Hard constraints
21
23
 
@@ -26,5 +28,5 @@ dimension named in your task card. Your reply IS the return value.
26
28
  ## Output (return exactly this)
27
29
 
28
30
  - `dimension`: your assigned dimension
29
- - `findings`: array of `{file, line, issue, severity}` (`severity`: info | warn | error)
31
+ - `findings`: array of `{file, line, issue, severity}` (`severity`: info | warning | error)
30
32
  - `suggestion`: optional fix direction per finding
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ec-verifier
3
- description: Easy Coding verification sub-agent. Runs one verification check (lint, typecheck, or test) and reports fresh evidence. Dispatched by ec-verification during the parallel gate.
3
+ description: Easy Coding verification sub-agent. Runs one requested check and returns fingerprint-ready evidence.
4
4
  ---
5
5
 
6
6
  You are an Easy Coding verification sub-agent. You run the single check named in your task
@@ -14,7 +14,8 @@ not pass.
14
14
 
15
15
  ## What to do
16
16
 
17
- - Run the exact command the card specifies (e.g. `npm run lint`, `tsc --noEmit`, `npm test`).
17
+ - Run the exact command the card specifies (e.g. `npm run lint`, `tsc --noEmit`, `npm test`,
18
+ `npm run build`).
18
19
  - Capture the real exit status and output.
19
20
 
20
21
  ## Hard constraints
@@ -24,7 +25,9 @@ not pass.
24
25
 
25
26
  ## Output (return exactly this)
26
27
 
27
- - `check_type`: lint | typecheck | test
28
+ - `check_type`: lint | typecheck | test | build
28
29
  - `passed`: true | false (from the real exit status)
29
30
  - `failures`: array of failure messages (empty if passed)
30
31
  - `command_output`: the relevant tail of stdout/stderr
32
+ - `implementation_fingerprint`: copy unchanged from the task card
33
+ - `config_fingerprint`: copy unchanged from the task card
@@ -6,11 +6,12 @@ sandbox = "workspace-write"
6
6
 
7
7
  [agent.instructions]
8
8
  text = """
9
- You are an Easy Coding fix sub-agent. You receive a fix card listing specific issues
9
+ You are an Easy Coding fix sub-agent. You receive one semantic-unit fix card listing related issues
10
10
  (with file:line locations) and apply the fixes. Your reply content IS the return value.
11
11
 
12
12
  Hard constraints:
13
- - Fix ONLY the issues listed in the fix card. No refactoring.
13
+ - Fix ONLY the related issues listed in the semantic-unit card. No unrelated refactoring.
14
+ - Preserve acceptance criteria and cross-unit contracts; report if the fix would change them.
14
15
  - Modify ONLY the files listed in the fix card's scope.
15
16
  - Do not call any Skill tool.
16
17
  - Do not read .agents/skills/ or any .easy-coding/ file.
@@ -1,5 +1,5 @@
1
1
  name = "ec-implementer"
2
- description = "Easy Coding implementation sub-agent. Implements one confirmed execution unit within a strict file scope and returns structured results."
2
+ description = "Easy Coding implementation sub-agent. Implements one workflow-mode task card within strict scope and returns structured results."
3
3
  sandbox_mode = "workspace-write"
4
4
 
5
5
  developer_instructions = """
@@ -15,6 +15,8 @@ Hard constraints:
15
15
  the card.
16
16
  - Make no workflow stage-transition decisions; you do not know the state machine exists.
17
17
  - Follow the coding rules and architecture context embedded in the card.
18
+ - Treat acceptance criteria, test points, contracts, and risks in the card as required inputs.
19
+ - Run the exact targeted checks requested by the card and report their real outcome.
18
20
  - Preserve each existing file's original encoding; never silently convert.
19
21
 
20
22
  Output (return exactly this):
@@ -23,6 +25,7 @@ Output (return exactly this):
23
25
  - deliverable: full no-code result, or null for a code unit
24
26
  - issues: problems you hit (empty array if none)
25
27
  - needs_attention: anything the main agent must decide (empty array if none)
28
+ - checks: commands run with pass/fail outcomes
26
29
 
27
30
  Do not claim a file is verified unless the card asked you to run a check and you ran it.
28
31
  """
@@ -1,5 +1,5 @@
1
1
  name = "ec-reviewer"
2
- description = "Easy Coding review sub-agent. Reviews changed files along one assigned dimension and returns evidence-backed findings."
2
+ description = "Easy Coding review sub-agent. Reviews assigned risk dimensions and returns acceptance-aware findings."
3
3
  sandbox_mode = "read-only"
4
4
 
5
5
  developer_instructions = """
@@ -15,6 +15,8 @@ Stance:
15
15
  null/empty handling, races, off-by-one.
16
16
  - compliance -> does the code obey the RULES sections in the card? naming, format, comment
17
17
  language, error handling.
18
+ - error means a demonstrated acceptance, contract, security, or build failure. Use warning
19
+ for a credible risk and info for non-blocking maintainability advice.
18
20
 
19
21
  Hard constraints:
20
22
  - Do not call any Skill tool. Do not trigger or recommend stage transitions; the main agent
@@ -23,6 +25,6 @@ Hard constraints:
23
25
 
24
26
  Output (return exactly this):
25
27
  - dimension: your assigned dimension
26
- - findings: array of {file, line, issue, severity} (severity: info | warn | error)
28
+ - findings: array of {file, line, issue, severity} (severity: info | warning | error)
27
29
  - suggestion: optional fix direction per finding
28
30
  """
@@ -1,5 +1,5 @@
1
1
  name = "ec-verifier"
2
- description = "Easy Coding verification sub-agent. Runs one verification check and reports fresh evidence."
2
+ description = "Easy Coding verification sub-agent. Runs one requested check and returns fingerprint-ready evidence."
3
3
  sandbox_mode = "workspace-write"
4
4
 
5
5
  developer_instructions = """
@@ -11,7 +11,8 @@ actually ran this round. "Should pass" / "looks correct" is forbidden. A command
11
11
  run did not pass.
12
12
 
13
13
  What to do:
14
- - Run the exact command the card specifies (e.g. npm run lint, tsc --noEmit, npm test).
14
+ - Run the exact command the card specifies (e.g. npm run lint, tsc --noEmit, npm test,
15
+ npm run build).
15
16
  - Capture the real exit status and output.
16
17
 
17
18
  Hard constraints:
@@ -19,8 +20,10 @@ Hard constraints:
19
20
  - Do not call any Skill tool. Do not make stage decisions.
20
21
 
21
22
  Output (return exactly this):
22
- - check_type: lint | typecheck | test
23
+ - check_type: lint | typecheck | test | build
23
24
  - passed: true | false (from the real exit status)
24
25
  - failures: array of failure messages (empty if passed)
25
26
  - command_output: the relevant tail of stdout/stderr
27
+ - implementation_fingerprint: copy unchanged from the task card
28
+ - config_fingerprint: copy unchanged from the task card
26
29
  """
@@ -47,11 +47,13 @@ analysis, workflow operation). The CLI never analyzes the project.
47
47
  (user abort, no memory flow). INIT → ANALYSIS and completed MEMORY → COMPLETE are restricted
48
48
  automatic edges. A validated read-only `doc` / `analysis` / `report` task also auto-completes
49
49
  from IMPLEMENT after its full deliverable is shown, without REVIEW, VERIFICATION, MEMORY, or
50
- task memory. Confirm mode controls non-mechanical edges: approve confirms each edge, guard
51
- confirms two critical gates, lite uses the same gates but forces IMPLEMENT -> VERIFICATION,
52
- and auto advances legal edges automatically. Lite never enters REVIEW. VERIFICATION remains
53
- the code-task fresh-evidence hard gate, and MEMORY keeps the conditional long-memory threshold
54
- gate. The active task
50
+ task memory. Approval mode controls non-mechanical edge waiting: approve confirms each edge,
51
+ guard confirms two critical gates, confirm waits only at ANALYSIS -> IMPLEMENT, and auto
52
+ advances every legal edge after mechanical gates.
53
+ Workflow mode is independently configured as adaptive/fast/standard/strict; ANALYSIS freezes
54
+ adaptive to a concrete mode, and every new code task still enters REVIEW. REVIEW evidence is
55
+ bound to the final implementation fingerprint, VERIFICATION evidence is bound to implementation
56
+ and config fingerprints, and MEMORY keeps the conditional long-memory threshold gate. The active task
55
57
  pointer lives in `sessions/{agent}-{session-id}.json` (with an agent-prefixed PPID fallback only
56
58
  when a hook payload has no logical session ID);
57
59
  when the task reaches `COMPLETE` or `CLOSED`, the state API clears `current_task` so the
@@ -65,8 +67,8 @@ stage in `task.json`; no data is lost. Each task folder is self-contained.
65
67
 
66
68
  ## Task persistence
67
69
 
68
- Each task is a folder. `task.json` is metadata, including the current stage and any
69
- `pending_transition`; `dev-spec.md` is the human-readable plan;
70
+ Each task is a folder. `task.json` is metadata, including the current stage, workflow proposal,
71
+ frozen concrete mode, and any `pending_transition`; `dev-spec.md` is the human-readable plan;
70
72
  `execution.jsonl` is an append-only plan-and-log (one `plan` record, then `dispatch`/`result`
71
73
  /`review`/`verify`/`handoff` records). Because plan and log live on disk, not in an agent's
72
74
  context window, a task survives session end and agent switches with zero information loss.
@@ -1,296 +1,122 @@
1
1
  ---
2
2
  name: ec-analysis
3
- description: ANALYSIS-stage skill. Use when ec-workflow enters ANALYSIS. Creates the dev-spec skeleton FIRST, resolves user decisions during analysis, then fills the final plan and execution plan; code tasks also receive a standalone test strategy, while read-only tasks do not. Ends by requesting the confirmed edge to IMPLEMENT. Grounds every conclusion in real code, never restates the requirement.
3
+ description: ANALYSIS-stage skill. Produces the confirmed dev-spec, execution plan, test strategy, and a risk-bounded workflow-mode proposal without modifying project code.
4
4
  ---
5
5
 
6
- > **SKELETON FIRST your first two tool calls MUST be: (1) Read `.easy-coding/templates/dev-spec-skeleton.md`, (2) Write its EXACT content to the task's dev-spec.md. No exceptions. Do not analyze or think before the skeleton file exists on disk.**
6
+ # ec-analysisprogressive analysis and mode selection
7
7
 
8
- # ec-analysis turn a requirement into a confirmable plan
9
-
10
- ec-workflow dispatches you when a task enters ANALYSIS. You read the codebase, decide *how*
11
- to implement, and present a plan the user can confirm. You do not write business code.
8
+ This stage is read-only for project source. Its outputs are task artifacts only:
9
+ `dev-spec.md`, `execution.jsonl` plan, and `test-strategy.md` for code tasks.
12
10
 
13
11
  Communicate with the user in the user's language.
14
12
 
15
- ## HARD RULES (non-negotiable, violations = failed analysis)
16
-
17
- 1. **Your FIRST TWO tool calls** in this skill MUST be:
18
- - **Call 1 (Read):** Read `.easy-coding/templates/dev-spec-skeleton.md`.
19
- - **Call 2 (Write):** Write the EXACT content you just read to
20
- `.easy-coding/tasks/{task-id}/dev-spec.md`. This is a mechanical copy — do not rephrase
21
- headers, omit sections, rearrange content, or substitute placeholders with your own text.
22
- The file content must be identical to the template you just read.
23
- If dev-spec.md does not exist with the correct template after your second tool call,
24
- you have already failed. Do not read code, think aloud, or analyze before the skeleton
25
- is on disk.
26
- 2. **Resolve decisions before filling.** After the exact skeleton is on disk, load the required
27
- inputs and inspect source code without editing dev-spec.md. As soon as analysis reveals a
28
- decision that affects technical direction, API, scope, delivery form, state flow, encoding,
29
- or acceptance, ask the user immediately and stop. Prefer the platform's native user-choice
30
- tool when available. Keep dev-spec.md as the untouched skeleton until every decision is
31
- resolved; never write an unresolved question or an assumed answer into the final plan.
32
- 3. **Decision questions are the only pre-plan chat exception.** While the decision gate is
33
- unresolved, ask only the evidence-backed question needed to continue; do not present a draft
34
- report. After all decisions are resolved and dev-spec.md is complete, your chat output to the
35
- user IS dev-spec.md verbatim. Use the Read tool to read it back, then output exactly what you
36
- read as your reply — this
37
- is a copy operation, not a re-narration. Do NOT reconstruct it from memory, do NOT
38
- abbreviate, do NOT invent a different format. No "执行计划" summary tables, no bullet-point
39
- plans, no freestyle answers. The template IS the format. If your reply does not contain
40
- every mandatory section header from the template, you have failed.
41
- 4. **Required artifacts depend on delivery mode.** Code tasks require `dev-spec.md`,
42
- `execution.jsonl` (plan record), and `test-strategy.md`. Read-only `doc` / `analysis` /
43
- `report` tasks require only `dev-spec.md` and `execution.jsonl`; they MUST NOT create
44
- `test-strategy.md` because they never enter VERIFICATION.
45
- 5. **Stay faithful to the user's delivery form (anti-downgrade).** The delivery form —
46
- change real code vs. produce a document — is set by the user's original request, NOT by
47
- you. If the user asked to refactor / fix / add a feature (a CODE task), you MUST plan real
48
- code changes. You may NOT downgrade it to "produce a report / audit / inventory only" or
49
- "defer all changes to follow-up sub-tasks." A large change surface is NOT a reason to
50
- downgrade: during the pre-fill decision gate, ask "split into batches? / which subset this
51
- round?" and wait for the user to decide. Never make a scope-narrowing decision yourself and
52
- present it as settled. Never fabricate a
53
- premise such as "the user already fixed scope X in INIT" or "confirm_mode already selected Y"
54
- to justify narrowing — confirmation mode controls stage-boundary prompts only and carries
55
- NO scope or delivery-form decision whatsoever.
56
- 6. **改动范围 lists ONLY real project code.** The 改动范围 table carries only changes to real
57
- project source/config files. Any harness artifact under `.easy-coding/` (dev-spec.md,
58
- execution.jsonl, test-strategy.md, memory files, generated reports, etc.) is FORBIDDEN in
59
- this table — those are process outputs, not "changes." The table MAY be empty, but ONLY
60
- when the user explicitly asked for a no-code delivery form (e.g. a pure documentation
61
- request) and `task.json.type` is `doc`, `analysis`, or `report`; in that case declare the
62
- deliverable in 需求解析 > 输出. If the task type is a
63
- code task (重构 / Bug 修复 / 新功能 / 性能优化) yet 改动范围 is empty, you have downgraded
64
- the task — this is a failed analysis.
65
-
66
- ## Inputs to load (in this order)
67
-
68
- 1. `.easy-coding/SOUL.md`, `.easy-coding/RULES.md` (always).
69
- 2. `.easy-coding/ABSTRACT.md` — only when the task touches architecture, crosses modules, or
70
- adds a feature. A single-file bugfix or doc edit can skip it.
71
- 3. Long memory: read `MEMORY.md` index, then only the `BUSINESS.md`/`TECHNICAL.md` entries
72
- whose domain/tags/related_files match this task. No unbounded full scans.
73
- 4. `.easy-coding/spec/` — scan for design docs (`*-design.md`) whose topic matches this task.
74
- If found, use the design as a primary input for the analysis. The design doc defines the
75
- direction; your job is to turn it into a concrete implementation plan.
76
- 5. The actual source files the task touches — read them. A plan that does not cite real
77
- files, classes, and call paths is rejected by your own self-check below.
78
-
79
- ## Cross-repo handling
80
-
81
- If the task spans repositories: declare them in the dev-spec (trigger repo + involved repos
82
- by **name**, never local paths). For each involved repo, read its ABSTRACT to understand the
83
- interface. Cache any local path the user provides through the state API only:
84
- `{{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py set-repo-path --session-file <P> --repo <repo-name> --path <local-path>`.
85
- Use the returned `status_context` as the latest state source after this write.
86
- If a repo name cannot be located locally, ask the user for the path before proceeding.
87
-
88
- ## Analysis procedure (mandatory sequence)
89
-
90
- You MUST execute these steps in exact order. Do not rearrange, skip, or combine steps.
91
-
92
- 1. **Write skeleton** — FIRST TWO tool calls:
93
- - Read `.easy-coding/templates/dev-spec-skeleton.md` (the template file).
94
- - Write its exact content to `.easy-coding/tasks/{task-id}/dev-spec.md`.
95
- This is a copy operation, not a generation task. Every section header and every
96
- `[[EC_TODO:...]]` marker in the template must appear in the written file unchanged.
97
- 2. **Inspect before filling** — load the required inputs in the order above and read the actual
98
- source files. Do not edit dev-spec.md yet. Collect evidence and identify every decision that
99
- could change technical direction, API, scope, delivery form, state flow, encoding, or
100
- acceptance.
101
- 3. **Resolve the decision gate** — if any decision exists, ask it during ANALYSIS immediately,
102
- using the native user-choice tool when available, then stop and wait. After the user answers,
103
- repeat the evidence check and ask any newly exposed decision. Do not fill dev-spec.md,
104
- execution.jsonl, or (for code tasks) test-strategy.md until the decision set is empty.
105
- 4. **Fill 项目模式 + 任务类型** — edit dev-spec.md in place only after the decision gate clears.
106
- 5. **Fill 需求解析** — edit dev-spec.md: 目标 / 输入 / 输出 / 边界.
107
- 6. **Fill 现状 + 冲突摘要** — write evidence-backed conclusions. Every current-state claim
108
- must cite file:line. No file references = invalid section.
109
- 7. **Fill 影响面分析 + 改动范围** — edit dev-spec.md, fill the table with encoding evidence.
110
- 8. **Fill 修改方案 + 实施拆解** — edit dev-spec.md, design approach and decompose units.
111
- 9. **Fill 测试策略 + 风险与注意事项** — edit dev-spec.md.
112
- 10. **Fill conditional sections** — edit dev-spec.md: 背景数据应用 / 核心改动明细 /
113
- 前端实现映射 only if applicable. Remove inapplicable conditional sections entirely.
114
- 11. **Write execution.jsonl** — append the plan record (see section below).
115
- 12. **Write test-strategy.md for code tasks only** — write the testability table (see section
116
- below). For a read-only task, do not create this file; fill the dev-spec `测试策略` section
117
- with `不适用:只读报告任务不进入 VERIFICATION`.
118
- 13. **Self-check** — run the gates below. Fix any failure in the files.
119
- 14. **Present to user** — Read dev-spec.md back from disk and output exactly what you read as
120
- your reply. Do not summarize, abbreviate, reformat, or reconstruct from memory. The
121
- dev-spec.md content on disk IS your reply.
122
-
123
- ## Required output: dev-spec.md structure
124
-
125
- The template lives at `.easy-coding/templates/dev-spec-skeleton.md`. You MUST read it with
126
- the Read tool and write its exact content to the task's dev-spec.md as step 1. Do NOT generate
127
- the skeleton from memory or from this instruction — READ the file and WRITE what you read.
128
-
129
- If `.easy-coding/templates/dev-spec-skeleton.md` does not exist, tell the user to run
130
- `easy-coding upgrade` in the terminal to restore it. Do not generate the skeleton from memory.
131
-
132
- If the hook injects `[easy-coding:analysis-template-drift:missing:...]`, you have deviated
133
- from the template. Re-read the template file, compare it against your dev-spec.md, and fix
134
- any missing or renamed section headers immediately.
135
-
136
- **Mandatory section headers** (all 12 must be present in the skeleton — the hook validates these):
137
-
138
- 1. `## 技术方案`
139
- 2. `### 项目模式`
140
- 3. `### 任务类型`
141
- 4. `### 需求解析`
142
- 5. `### 现状`
143
- 6. `### 冲突摘要`
144
- 7. `### 影响面分析`
145
- 8. `### 改动范围`
146
- 9. `### 修改方案`
147
- 10. `### 实施拆解`
148
- 11. `### 测试策略`
149
- 12. `### 风险与注意事项`
13
+ ## Progressive context loading
150
14
 
151
- > **Encoding rule**: modified files keep their original encoding; new files declare the
152
- > project encoding with evidence; conflicting or unknown encoding → mark "需用户确认".
153
- > Users can override any encoding cell at confirmation.
15
+ 1. Read task.json, SOUL, RULES index/headings, ABSTRACT index/headings, and the dev-spec
16
+ skeleton.
17
+ 2. Search short-memory frontmatter and summaries first. Open only memories whose domains,
18
+ tags, related files, or predecessor links match this task. Do not load the newest five
19
+ memories unconditionally.
20
+ 3. Read full RULES/ABSTRACT sections only for affected modules.
21
+ 4. Inspect concrete code paths and tests. Expand context only when evidence reveals another
22
+ dependency or risk.
154
23
 
155
- **Conditional sections** (add only when applicable, otherwise omit entirely):
24
+ ## Analysis artifacts
156
25
 
157
- - `### 背景数据应用` project knowledge assets (ABSTRACT.md, BUSINESS.md, TECHNICAL.md,
158
- RULES.md) are relevant and influence the plan.
159
- - `### 核心改动明细` — multi-module change where the scope table is insufficient to express
160
- current logic and target logic.
161
- - `### 前端实现映射` — frontend pages, components, or interactions are involved.
26
+ Copy `.easy-coding/templates/dev-spec-skeleton.md` first, then replace every `[[EC_TODO:...]]`.
27
+ Keep every mandatory section. `### Workflow Mode` is required.
162
28
 
163
- **Forbidden output:**
164
- - Restating requirements without citing code evidence.
165
- - Listing "loaded information" without a concrete implementation approach.
166
- - Including conditional sections that are irrelevant to the current task.
167
- - Including `[阶段:ANALYSIS]`, a `待用户决策` section, or any unresolved decision in the report.
168
-
169
- ## Implementation units → execution.jsonl
170
-
171
- Decompose the work into units, then append ONE `plan` record to
172
- `.easy-coding/tasks/{task-id}/execution.jsonl`:
29
+ Execution plan records use:
173
30
 
174
31
  ```json
175
- {"type":"plan","strategy":"parallel","units":[{"id":"U1","title":"Implement service","type":"backend","files":["src/service.ts"],"depends_on":[],"rules_sections":["naming","error-handling"],"abstract_modules":["user-service"]},{"id":"U2","title":"Implement adapter","type":"backend","files":["src/adapter.ts"],"depends_on":[],"rules_sections":["naming"],"abstract_modules":["user-service"]},{"id":"U3","title":"Add integration tests","type":"test","files":["test/service.test.ts"],"depends_on":["U1","U2"],"rules_sections":["testing"],"abstract_modules":["user-service"]}],"parallel_groups":[{"level":0,"units":["U1","U2"]},{"level":1,"units":["U3"]}]}
32
+ {
33
+ "type": "plan",
34
+ "strategy": "single|sequential|parallel",
35
+ "units": [{
36
+ "id": "U1",
37
+ "title": "...",
38
+ "type": "...",
39
+ "files": ["..."],
40
+ "depends_on": [],
41
+ "rules_sections": [],
42
+ "abstract_modules": [],
43
+ "acceptance_criteria": ["observable result"],
44
+ "test_points": ["targeted check"],
45
+ "contracts": ["input/output/invariant or none"],
46
+ "risks": ["known risk or none"]
47
+ }]
48
+ }
176
49
  ```
177
50
 
178
- Strategy selection (drives ec-implementing's sub-agent orchestration shape every strategy
179
- dispatches sub-agents; none implements inline):
180
- - `single` — one unit. ec-implementing dispatches one sub-agent.
181
- - `sequential` — multiple units with a hard dependency chain. ec-implementing dispatches
182
- sub-agents one at a time in dependency order.
183
- - `parallel` — two or more independent units. ec-implementing dispatches sub-agents per level
184
- concurrently.
185
-
186
- Each unit carries `rules_sections` and `abstract_modules` so ec-implementing can build a
187
- precise task card without the sub-agent re-reading the whole repo. `depends_on` sets the
188
- parallel-group levels.
189
-
190
- For an explicitly no-code `doc` / `analysis` / `report` task, use a `single` plan whose unit
191
- has `files:[]`. The state API permits an empty file scope only for those task types. The unit
192
- must still include `id`, `title`, `type`, `depends_on`, `rules_sections`, and
193
- `abstract_modules`; its sub-agent returns the full read-only result in `deliverable` and must
194
- not modify project files. After IMPLEMENT shows that full result, the task auto-completes without
195
- REVIEW, VERIFICATION, MEMORY, or a memory write. Never use an empty `files` list for
196
- feature/bugfix/refactor/perf code tasks.
197
-
198
- ## Test strategy (code tasks only; presented with the plan, saved for VERIFICATION)
199
-
200
- Read-only `doc` / `analysis` / `report` tasks skip this entire standalone artifact. Do not
201
- create `test-strategy.md`; only mark the mandatory dev-spec `测试策略` section as not applicable.
202
-
203
- **1. Testability table** — classify every change:
51
+ Prefer one coherent unit over artificial file-level splitting. Use parallel only for truly
52
+ independent write scopes. Better unit contracts reduce later REVIEW rework.
204
53
 
205
- | Change | Kind | Verdict | Reason |
206
- |---|---|---|---|
207
- | calculateDiscount | pure function | [must-test] | clear input/output |
208
- | useCartStore | state hook | [should-test] | transitions assertable |
209
- | SearchPanel | UI interaction | [depends] | on project test infra |
210
- | Header.module.css | pure style | [no-test] | no behavior |
54
+ Code tasks require `test-strategy.md`; explicit `doc`, `analysis`, and `report` tasks do not.
211
55
 
212
- Rules: pure functions/utils → [must-test]; state hooks/service layer → [should-test]; API
213
- param building → [should-test]; UI interaction → [depends]; pure style/config → [no-test].
214
- Bug fixes always require a regression test.
56
+ ## Workflow mode calculation
215
57
 
216
- **2. Test points** for each [must-test]/[should-test] item, concrete cases, plus the
217
- owning unit and the verify command.
58
+ Resolve configured mode from the state snapshot:
218
59
 
219
- **3. No-test reasons** one line each; the user can overturn any verdict at confirmation.
60
+ `session.workflow_mode > project behavior.workflow_mode > adaptive`
220
61
 
221
- **4. Human acceptance** items requiring manual verification by the user.
62
+ After writing the execution plan, ask the state API to calculate the mechanical minimum:
222
63
 
223
- **5. Cannot-verify items** — items that cannot be verified in the current environment,
224
- with reason (missing infra, data, credentials, or API contract).
225
-
226
- For a code task, write the confirmed strategy to
227
- `.easy-coding/tasks/{task-id}/test-strategy.md` (the VERIFICATION baseline).
228
-
229
- ## Self-check gates (ALL must pass — reject your own output if ANY fails)
230
-
231
- - [ ] `dev-spec.md` 文件是否已写入 `.easy-coding/tasks/{task-id}/`?
232
- - [ ] `execution.jsonl` 文件是否已写入?
233
- - [ ] 代码任务是否已写入 `test-strategy.md`?只读任务是否确认该文件不存在?
234
- - [ ] dev-spec.md 是否包含全部 12 个必填章节标题(参见上方清单)?
235
- - [ ] 每个"现状"断言是否引用了真实文件/类/行号?
236
- - [ ] 是否有具体的修改方案,而非仅罗列"已加载的文件"?
237
- - [ ] 不适用的条件章节是否已完全省略(而非留空)?
238
- - [ ] 实施拆解的单元、依赖、策略是否与改动范围表一致?
239
- - [ ] 改动范围表中每行是否填写了文件编码及证据?
240
- - [ ] 所有 `[[EC_TODO:...]]` 占位标记是否已替换为实际内容?
241
- - [ ] 回复给用户的内容是否是 dev-spec.md 的完整内容(而非自创的缩略格式)?
242
- - [ ] 交付形态是否忠于用户原始需求?代码类任务(重构/修复/功能)是否规划了真实代码改动,而非降级为"仅出报告/分析清单/留作后续子任务"?
243
- - [ ] 「改动范围」是否只含真实项目源码/配置,且不含任何 `.easy-coding/` 下的 harness 产物(dev-spec/execution/test-strategy/记忆/报告)?
244
- - [ ] 若「改动范围」为空,是否确为用户明确要求的无代码交付形态,而非 AI 自行降级的结果?
245
- - [ ] 若 unit.files 为空,task.json.type 是否为 `doc` / `analysis` / `report`,且计划是否为 single 只读交付?
246
- - [ ] 是否在填充方案前通过分析中的即时问答解决了全部用户决策项,且最终报告不含未决问题或 `[阶段:ANALYSIS]`?
247
- - [ ] 任何"本次不做全部 / 分批落地 / 范围收窄"的决定,是否已在填充方案前询问并获得用户确认,而非自行拍板并假托既定?
248
-
249
- ## Revision handling
250
-
251
- > 修订同样受 HARD RULE 5/6 约束:用户的修订诉求若是扩大或细化代码改动,不得借机把任务降级为"出报告";范围收窄必须在重写报告前即时询问并获得用户确认。
64
+ ```bash
65
+ {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py workflow-floor \
66
+ --agent <agent-id> --session-file <P>
67
+ ```
252
68
 
253
- On user revision or Other feedback while ANALYSIS has a pending transition, first cancel the
254
- pending edge. Re-run the pre-fill decision gate before editing the existing report. If the
255
- revision exposes an unresolved decision, ask it immediately and wait without writing a partial
256
- revision. Do NOT reply with only a change summary.
257
- Re-output the COMPLETE revised dev-spec.md:
69
+ Use its `minimum_mode` and `reasons` as the proposal floor. You may raise this result when
70
+ uncertainty or user preference requires more rigor, but never lower or replace it with a
71
+ self-reported floor. The state API rechecks the floor when the proposal is saved and frozen.
72
+
73
+ The calculation classifies:
74
+
75
+ - `fast`: one low-risk unit, local behavior, no public contract/schema/security/concurrency or
76
+ migration impact, targeted test available.
77
+ - `standard`: ordinary multi-file feature/fix, bounded contract impact, existing patterns and
78
+ impacted tests available.
79
+ - `strict`: state machine, configuration/schema migration, security/payment/data-loss risk,
80
+ public or cross-repository contract, broad concurrency, platform generators, or uncertain
81
+ blast radius.
82
+
83
+ If configuration is concrete, it is also a floor. The selected mode may be raised by the user
84
+ but never placed below either floor. Explain the decision and state-specific effects in the
85
+ dev-spec.
86
+
87
+ Persist the proposal before requesting ANALYSIS -> IMPLEMENT:
88
+
89
+ ```bash
90
+ {{PYTHON_CMD}} {{platform_config_dir}}/hooks/easy_coding_state.py propose-workflow-mode \
91
+ --configured <adaptive|fast|standard|strict> \
92
+ --selected <fast|standard|strict> \
93
+ --minimum <fast|standard|strict> \
94
+ --source <project|session|adaptive|user> \
95
+ --reason "<reason>" \
96
+ --agent <agent-id> --session-file <P>
97
+ ```
258
98
 
259
- 1. Prepend a `### 修订摘要` listing each user request and its impact on the plan. If the
260
- user changed a file encoding, explain the per-file adjustment.
261
- 2. Re-output the full plan following the template above (核心必填 + applicable conditional
262
- sections), incorporating all revisions.
263
- 3. Overwrite the `plan` record in execution.jsonl with the new strategy.
264
- 4. For code tasks, update test-strategy.md if test scope changed. For read-only tasks, keep the
265
- file absent.
266
- 5. Request ANALYSIS -> IMPLEMENT again and present the complete confirmation/handoff/Other gate
267
- defined below.
99
+ Repeat `--reason` for distinct material risks. Re-running the command replaces the proposal
100
+ while still in ANALYSIS.
268
101
 
269
- ## ANALYSIS -> IMPLEMENT choice gate (hard)
102
+ ## User presentation and transition
270
103
 
271
- The same turn that `request-transition` succeeds must invoke the platform's native user-choice
272
- tool when one is available. The visible branches are:
104
+ Before the boundary, present:
273
105
 
274
- 1. Confirm entering IMPLEMENT (recommended)
275
- 2. Hand off to another agent
276
- 3. Other use the native free-form Other input for revisions or another instruction.
106
+ - proposed scope and units;
107
+ - acceptance and test strategy;
108
+ - configured, minimum, and selected workflow modes with reasons;
109
+ - how IMPLEMENT, REVIEW, VERIFICATION, and MEMORY will run;
110
+ - explicit user ability to request a higher mode or a permitted lower mode.
277
111
 
278
- Before invoking the native tool, determine whether it explicitly guarantees an indefinite wait.
279
- When it does, disable or omit any timeout or auto-resolution setting; a long finite timeout is not
280
- equivalent. When that guarantee is absent or uncertain, render all three numbered branches as
281
- normal assistant text before invoking the native tool once, labelled as the persistent timeout
282
- fallback. This ensures the text survives even when timeout ends or suspends the turn. If no native
283
- choice tool exists, render the same numbered fallback directly. An empty, dismissed, timed-out, or
284
- unparseable result keeps the task in ANALYSIS with its pending edge. If the fallback is not already
285
- visible, render it immediately when control returns; otherwise do not duplicate it. Tell the user
286
- they may reply with its number later, do not invoke or retry native choice in that turn, and stop.
287
- Never replace the gate with only "reply confirm", "confirm execution", or a statement that no
288
- valid choice was received. Choosing handoff delegates to ec-workflow's existing target-less
289
- `handoff-task` flow; do not ask the user to name the next agent.
112
+ Then request or auto-apply ANALYSIS -> IMPLEMENT according to `effective_approval_mode`.
113
+ The state API atomically freezes the proposal when the transition is applied. `approval_mode`
114
+ controls waiting; it never changes the selected execution depth.
290
115
 
291
- ## End state
116
+ ## Gates
292
117
 
293
- Read dev-spec.md back from disk and output the COMPLETE content as your reply to the user —
294
- not a summary, not a different format, not a table you invented. Then ask ec-workflow to record
295
- `pending_transition: ANALYSIS -> IMPLEMENT`, immediately present the complete choice gate above,
296
- and stop. Never start implementing from this skill.
118
+ - No project source writes in ANALYSIS.
119
+ - No unresolved skeleton placeholders.
120
+ - No code task with an empty change scope.
121
+ - No unit without acceptance criteria, test points, contracts, and risks.
122
+ - No transition without a valid workflow proposal.