easy-coding-harness 0.1.8 → 0.2.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 (32) hide show
  1. package/CHANGELOG.md +110 -0
  2. package/README.md +10 -78
  3. package/dist/cli.js +1187 -282
  4. package/dist/cli.js.map +1 -1
  5. package/package.json +2 -1
  6. package/templates/common/bundled-skills/ec-init/SKILL.md +174 -0
  7. package/templates/common/bundled-skills/ec-init/references/memory-migration.md +87 -0
  8. package/templates/common/bundled-skills/ec-meta/SKILL.md +5 -2
  9. package/templates/common/bundled-skills/ec-meta/references/customize-local/README.md +2 -1
  10. package/templates/common/bundled-skills/ec-meta/references/local-architecture/README.md +14 -11
  11. package/templates/common/bundled-skills/ec-meta/references/platform-files/README.md +8 -4
  12. package/templates/common/skills/ec-analysis/SKILL.md +104 -126
  13. package/templates/common/skills/ec-brainstorming/SKILL.md +1 -1
  14. package/templates/common/skills/ec-git/SKILL.md +10 -10
  15. package/templates/common/skills/ec-memory/SKILL.md +25 -8
  16. package/templates/common/skills/ec-task-close/SKILL.md +4 -3
  17. package/templates/common/skills/ec-task-management/SKILL.md +9 -24
  18. package/templates/common/skills/ec-verification/SKILL.md +10 -4
  19. package/templates/common/skills/ec-workflow/SKILL.md +43 -16
  20. package/templates/main-constraint/AGENTS.md.tpl +16 -3
  21. package/templates/main-constraint/CLAUDE.md.tpl +16 -3
  22. package/templates/runtime/memory/SHORT_MEMORY_TEMPLATE.md +75 -0
  23. package/templates/runtime/memory/long/BUSINESS.md +42 -9
  24. package/templates/runtime/memory/long/MEMORY.md +37 -2
  25. package/templates/runtime/memory/long/TECHNICAL.md +45 -1
  26. package/templates/runtime/templates/dev-spec-skeleton.md +80 -0
  27. package/templates/shared-hooks/easy_coding_state.py +516 -0
  28. package/templates/shared-hooks/easy_coding_status.py +72 -81
  29. package/templates/shared-hooks/inject-subagent-context.py +5 -12
  30. package/templates/shared-hooks/inject-workflow-state.py +2 -1
  31. package/templates/shared-hooks/session-start.py +2 -1
  32. package/templates/common/skills/ec-init/SKILL.md +0 -96
@@ -37,18 +37,31 @@ First run `ec-init`; daily work goes through `ec-workflow`.
37
37
 
38
38
  - Stages do not skip. WAITING_CONFIRM is a real gate — implement only after the user confirms
39
39
  the plan and test strategy (unless `behavior.auto_mode` is on and the user asked for it).
40
+ - ANALYSIS must follow template-first: read `.easy-coding/templates/dev-spec-skeleton.md` then
41
+ write its exact content to the task's dev-spec.md as the FIRST tool calls, then fill sections
42
+ incrementally via edits. Reply to the user with the complete dev-spec.md content — never a
43
+ summary table or custom format.
40
44
  - VERIFICATION is a hard gate: lint + typecheck + test must pass on fresh evidence, and
41
45
  coverage must match the test strategy, before a task can complete.
42
46
  - Archive (memory flow) runs only after explicit user acceptance — an unaccepted task's
43
47
  memory is dirty data.
44
48
  - NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.
49
+ - All cross-platform modules (skills, hooks, references) must use universal agent protocols.
50
+ Do not rely on any specific agent's proprietary conventions unless the module is explicitly
51
+ a platform-specific compatibility layer. Reference files use descriptive filenames (e.g.,
52
+ `memory-migration.md`), not platform convention names.
45
53
 
46
54
  ## Runtime contract
47
55
 
48
- - Workflow state lives at `{{workflow_state_path}}`; the CLI only installs files and creates
49
- the project-init task agent skills perform all project analysis.
56
+ - Workflow state operations go through `{{platform_config_dir}}/hooks/easy_coding_state.py`;
57
+ do not hand-edit session files, `current_task`, task `status`, `stage_history`, or
58
+ `last_agent`.
59
+ - The hook injects `[easy-coding:session-file:P]`; pass that path to the state script with
60
+ `--session-file <P>` when changing the current task or stage.
61
+ - Workflow session files live at `{{workflow_state_path}}`; the CLI only installs files and
62
+ creates the project-init task — agent skills perform all project analysis.
50
63
  - Cross-repo references in git-tracked task artifacts use repo NAMES, never local paths.
51
- Cache local paths only in `.easy-coding/state.json.repo_paths`.
64
+ Cache local paths only through the state script so they land on the current task.
52
65
 
53
66
  <!-- ═══ end easy-coding-harness generated ═══ -->
54
67
 
@@ -35,18 +35,31 @@ First run `/ec-init`; daily work goes through `/ec-workflow`.
35
35
 
36
36
  - Stages do not skip. WAITING_CONFIRM is a real gate — implement only after the user confirms
37
37
  the plan and test strategy (unless `behavior.auto_mode` is on and the user asked for it).
38
+ - ANALYSIS must follow template-first: read `.easy-coding/templates/dev-spec-skeleton.md` then
39
+ write its exact content to the task's dev-spec.md as the FIRST tool calls, then fill sections
40
+ incrementally via edits. Reply to the user with the complete dev-spec.md content — never a
41
+ summary table or custom format.
38
42
  - VERIFICATION is a hard gate: lint + typecheck + test must pass on fresh evidence, and
39
43
  coverage must match the test strategy, before a task can complete.
40
44
  - Archive (memory flow) runs only after explicit user acceptance — an unaccepted task's
41
45
  memory is dirty data.
42
46
  - NO COMPLETION CLAIMS WITHOUT FRESH VERIFICATION EVIDENCE.
47
+ - All cross-platform modules (skills, hooks, references) must use universal agent protocols.
48
+ Do not rely on any specific agent's proprietary conventions unless the module is explicitly
49
+ a platform-specific compatibility layer. Reference files use descriptive filenames (e.g.,
50
+ `memory-migration.md`), not platform convention names.
43
51
 
44
52
  ## Runtime contract
45
53
 
46
- - Workflow state lives at `{{workflow_state_path}}`; the CLI only installs files and creates
47
- the project-init task agent skills perform all project analysis.
54
+ - Workflow state operations go through `{{platform_config_dir}}/hooks/easy_coding_state.py`;
55
+ do not hand-edit session files, `current_task`, task `status`, `stage_history`, or
56
+ `last_agent`.
57
+ - The hook injects `[easy-coding:session-file:P]`; pass that path to the state script with
58
+ `--session-file <P>` when changing the current task or stage.
59
+ - Workflow session files live at `{{workflow_state_path}}`; the CLI only installs files and
60
+ creates the project-init task — agent skills perform all project analysis.
48
61
  - Cross-repo references in git-tracked task artifacts use repo NAMES, never local paths.
49
- Cache local paths only in `.easy-coding/state.json.repo_paths`.
62
+ Cache local paths only through the state script so they land on the current task.
50
63
 
51
64
  <!-- ═══ end easy-coding-harness generated ═══ -->
52
65
 
@@ -0,0 +1,75 @@
1
+ ---
2
+ memory_schema: 2
3
+ id: SM-YYYYMMDD-001
4
+ date: YYYY-MM-DD
5
+ task_type: feature | bugfix | refactor | perf | doc | workflow
6
+ project_mode: startup | iteration
7
+ domain:
8
+ - "{business domain or module}"
9
+ tags:
10
+ - "{keyword}"
11
+ related_files:
12
+ - "{key file or module}"
13
+ commit: none
14
+ verification: passed | partial | not_run
15
+ memory_value: business | technical | both | none
16
+ target_long: BUSINESS | TECHNICAL | BOTH | NONE
17
+ ---
18
+
19
+ # Short Memory Template
20
+
21
+ > This template defines the format for files under `.easy-coding/memory/short/`.
22
+ > File naming convention: `{NNN}_{YYYYMMDD}_{smart_name}.md`
23
+ > Short memories are immutable after creation — they serve as a sliding window of recent
24
+ > details and a buffer for long-term distillation candidates.
25
+ > When short memories reach the threshold (default 10), the newest 5 are kept as recent
26
+ > context; older entries are distillation candidates for long-term memory.
27
+ > Sorting: by frontmatter `date` ascending; if date is missing or tied, by filename prefix
28
+ > number ascending; then by filename ascending.
29
+
30
+ ## Task Summary
31
+
32
+ - Goal: {the actual problem solved}
33
+ - Scope: {modules, pages, interfaces, or files involved}
34
+ - Result: {completed / partially completed / not completed, with reasons}
35
+ - Key Constraints: {encoding, compatibility, interface, spec, or user-specified constraints; "none" if none}
36
+
37
+ ## Execution Evidence
38
+
39
+ | Type | Content |
40
+ |---|---|
41
+ | Key Files | {file or module list; "none" if none} |
42
+ | Verification Commands | {test / build / lint commands and results; explain if not run} |
43
+ | Manual Acceptance | {key behaviors checked; "none" if none} |
44
+ | Commit Info | {commit hash; "none" if not committed} |
45
+
46
+ ## Business Memory Candidates
47
+
48
+ > Only record business facts with future reuse value. Write "none" if none.
49
+
50
+ - Concepts / Field Semantics: {concepts, fields, enums, state meanings}
51
+ - Workflows / State Transitions: {chain steps, pre/post conditions, exception branches}
52
+ - Business Rules / Compatibility: {admission criteria, decision basis, grayscale or legacy reasons}
53
+ - Upstream/Downstream Contracts: {producers, consumers, interface or message fields}
54
+ - Business Troubleshooting: {common misdiagnosis, priority check paths}
55
+
56
+ ## Technical Memory Candidates
57
+
58
+ > Only record engineering facts with future reuse value. Write "none" if none.
59
+
60
+ - Architecture / Interface Decisions: {module boundaries, dependency direction, interface contracts}
61
+ - Engineering Rules / Workflows: {coding, commit, release, installation, directory boundaries}
62
+ - Implementation Patterns / Reusable Approaches: {recommended approaches, fallback strategies, compatibility patterns}
63
+ - Pitfalls / Fix Strategies: {root cause, fix approach, verification method}
64
+ - Verification Experience: {test commands, environment constraints, acceptance paths}
65
+
66
+ ## Non-Distillation Content
67
+
68
+ > Content that should NOT enter long-term memory, with reasons — prevents accidental absorption of noise.
69
+
70
+ - {routine file lists / temp logs / one-time data / non-reusable implementation details; "none" if none}
71
+
72
+ ## Related Memories
73
+
74
+ - Predecessor: {related short memory id, long-term topic, or "none"}
75
+ - Successor: {follow-up task; "none" if none}
@@ -1,14 +1,47 @@
1
+ ---
2
+ memory_schema: 2
3
+ memory_file: BUSINESS
4
+ last_updated: YYYY-MM-DD
5
+ ---
6
+
1
7
  # Business Memory
2
8
 
3
- Durable business rules, product decisions, and domain context. Maintained by ec-memory
4
- during MEMORY_LONG; entries are distilled from short memories whose `target_long` is
5
- `business` or `both`.
9
+ > Durable facts about "what the business is, why it works this way, and how upstream/downstream systems interact."
10
+
11
+ ## Core Concepts & Field Semantics
12
+
13
+ | Concept / Field | Meaning | Applicable Scenario | Source | Status |
14
+ |---|---|---|---|---|
15
+ | (none) | — | — | — | — |
16
+
17
+ ## Business Workflows & State Transitions
18
+
19
+ | Workflow / State | Trigger | Key Steps | Exception Branches | Source | Status |
20
+ |---|---|---|---|---|---|
21
+ | (none) | — | — | — | — | — |
22
+
23
+ ## Business Rules & Compatibility Background
24
+
25
+ | Rule | Applicable Scenario | Decision Basis | Impact Scope | Source | Status |
26
+ |---|---|---|---|---|---|
27
+ | (none) | — | — | — | — | — |
28
+
29
+ ## Upstream/Downstream Contracts
30
+
31
+ | Contract | Producer | Consumer | Fields / Interface | Notes | Source |
32
+ |---|---|---|---|---|---|
33
+ | (none) | — | — | — | — | — |
34
+
35
+ ## Business Troubleshooting Experience
36
+
37
+ | Problem | Common Misdiagnosis | Priority Checks | Fix / Handling | Source |
38
+ |---|---|---|---|---|
39
+ | (none) | — | — | — | — |
6
40
 
7
- Entry format — one `##` section per entry:
41
+ ## Deprecated Records
8
42
 
9
- - Heading: `## BM-{NNN} {short title}`
10
- - First line: `status: active` (active | deprecated | superseded | deleted)
11
- - Body: the rule or decision, why it holds, and which tasks/files evidence it.
43
+ > Audit zone short summaries only. Not loaded into ANALYSIS context by default.
12
44
 
13
- Conflict priority when distilling: current code > latest user confirmation > this round's
14
- candidate > existing entries. Index every entry in MEMORY.md.
45
+ | Deprecated Date | Original Summary | Reason | Replacement / Source |
46
+ |---|---|---|---|
47
+ | (none) | — | — | — |
@@ -1,3 +1,38 @@
1
- # Easy Coding Memory Index
1
+ ---
2
+ memory_schema: 2
3
+ memory_file: MEMORY
4
+ last_updated: YYYY-MM-DD
5
+ ---
2
6
 
3
- Long-term memory entries are indexed here by ec-memory.
7
+ # Long-Term Memory Index
8
+
9
+ > This file is an index and navigation aid only — it does not hold detailed content.
10
+ > Business facts go in `BUSINESS.md`; technical/architecture/engineering facts go in `TECHNICAL.md`.
11
+ > Status values: `active / deprecated / superseded`. Default analysis reads only `active` topics.
12
+
13
+ ## Quick Navigation
14
+
15
+ | Topic | Type | Keywords | Detail File | Status | Last Updated | Source |
16
+ |---|---|---|---|---|---|---|
17
+ | (none) | — | — | — | — | — | — |
18
+
19
+ ## Current Priority Business Domains
20
+
21
+ - (none)
22
+
23
+ ## Current Priority Technical Domains
24
+
25
+ - (none)
26
+
27
+ ## Reading Strategy
28
+
29
+ - For business concepts, field semantics, workflows, rules, contracts, or troubleshooting → read `BUSINESS.md`.
30
+ - For architecture decisions, interface decisions, engineering rules, patterns, pitfalls, or verification experience → read `TECHNICAL.md`.
31
+ - Default: read only `active` topics. Read `deprecated` / `superseded` only during migration, conflict investigation, or user-requested history tracing.
32
+ - If long-term memory conflicts with current code or the user's latest statement, trust current code and user — update memory status during the next distillation.
33
+
34
+ ## Migration Audit
35
+
36
+ | Date | Source | Result |
37
+ |---|---|---|
38
+ | (none) | — | — |
@@ -1,3 +1,47 @@
1
+ ---
2
+ memory_schema: 2
3
+ memory_file: TECHNICAL
4
+ last_updated: YYYY-MM-DD
5
+ ---
6
+
1
7
  # Technical Memory
2
8
 
3
- Durable architecture decisions, implementation patterns, and verification lessons live here.
9
+ > Durable facts about "how code is organized, how engineering works, and how to avoid past pitfalls."
10
+
11
+ ## Architecture & Interface Decisions
12
+
13
+ | Decision | Reason | Impact Scope | Source | Status |
14
+ |---|---|---|---|---|
15
+ | (none) | — | — | — | — |
16
+
17
+ ## Engineering Rules & Workflows
18
+
19
+ | Rule | Applicable Scenario | Enforcement | Source | Status |
20
+ |---|---|---|---|---|
21
+ | (none) | — | — | — | — |
22
+
23
+ ## Implementation Patterns & Reusable Approaches
24
+
25
+ | Pattern | Applicable Scenario | Recommended Approach | Anti-pattern / Caveats | Source |
26
+ |---|---|---|---|---|
27
+ | (none) | — | — | — | — |
28
+
29
+ ## Pitfalls & Fix Strategies
30
+
31
+ | Problem | Root Cause | Fix | Verification | Source |
32
+ |---|---|---|---|---|
33
+ | (none) | — | — | — | — |
34
+
35
+ ## Verification, Release & Installation Experience
36
+
37
+ | Scenario | Recommended Command / Path | Notes | Source |
38
+ |---|---|---|---|
39
+ | (none) | — | — | — |
40
+
41
+ ## Deprecated Records
42
+
43
+ > Audit zone — short summaries only. Not loaded into ANALYSIS context by default.
44
+
45
+ | Deprecated Date | Original Summary | Reason | Replacement / Source |
46
+ |---|---|---|---|
47
+ | (none) | — | — | — |
@@ -0,0 +1,80 @@
1
+ [阶段:ANALYSIS]
2
+
3
+ ## 技术方案:{任务标题}
4
+
5
+ ### 项目模式
6
+ {初创项目/迭代项目}
7
+
8
+ ### 任务类型
9
+ {新功能 / Bug 修复 / 重构 / 性能优化 / 前端设计实现}
10
+
11
+ ### 需求解析
12
+ - **目标**:{待填写 — 真正要解决的问题}
13
+ - **输入**:{待填写 — 用户输入 / 系统输入 / 触发条件}
14
+ - **输出**:{待填写 — 先声明交付形态(改代码 / 出文档),再写最终交付结果。交付形态须忠于用户原始需求,不得擅自降级}
15
+ - **边界**:{待填写 — 明确不做什么}
16
+
17
+ ### 现状
18
+ - **相关代码 / 页面 / 接口 / 模块**:{待填写 — 基于实际文件与代码的现状说明}
19
+ - **当前实现方式**:{待填写 — 现在是如何工作的}
20
+ - **现有问题 / 缺口**:{待填写 — 为什么需要改}
21
+ - **证据**:{待填写 — 引用的关键文件、类、页面、接口,含 file:line}
22
+
23
+ ### 冲突摘要
24
+ - 需求 vs RULES:{待填写 或 "无冲突"}
25
+ - 需求 vs ABSTRACT:{待填写 或 "无冲突"}
26
+ - 需求 vs 现有代码:{待填写 或 "无冲突"}
27
+ - Dev-Spec vs 现有代码:{待填写 或 "无冲突"}
28
+
29
+ ### 待用户决策
30
+ - {待填写 — 影响技术路线、接口、改动范围的问题逐条列出;任何"本次不做全部 / 分批落地 / 范围或交付形态收窄"必须列入此处交由用户拍板,不得自行决定并假托既定;若无则写"无"}
31
+
32
+ ### 影响面分析
33
+ - **涉及模块**:{待填写}
34
+ - **核心类 / 页面 / 接口**:{待填写}
35
+ - **数据库变更**:{有/无}
36
+ - **接口变更**:{有/无}
37
+ - **关联历史任务**:{待填写 — 相关短期记忆序号;无则"无"}
38
+
39
+ ### 改动范围
40
+ > 只列真实项目源码/配置文件的改动。禁止把 `.easy-coding/` 下的 harness 产物(dev-spec / execution.jsonl / test-strategy / 记忆 / 报告等)当作改动对象。本表为空仅允许用于"用户明确要求的无代码交付形态";代码类任务(重构/修复/功能)若此表为空,即为自我降级。
41
+
42
+ | 改动文件 | 改动类型 | 文件编码 | 改动核心内容 |
43
+ |----------|---------|---------|-------------|
44
+ | `{文件路径}` | 新增 | 项目编码 {X},依据:{xxx} | {核心改动} |
45
+ | `{文件路径}` | 修改 | 保持原编码 {X} | {核心改动} |
46
+ | `{文件路径}` | 删除 | — | {删除原因} |
47
+
48
+ ### 修改方案
49
+ - **总体改法**:{待填写 — 一句话说清改哪里、怎么改}
50
+ - **后端改动**:{待填写;不涉及则写"不涉及"}
51
+ - **前端改动**:{待填写;不涉及则写"不涉及"}
52
+ - **兼容处理**:{待填写 — 旧逻辑如何迁移、保留或替换}
53
+ - **风险点**:{待填写 — 最容易出问题的位置}
54
+
55
+ ### 实施拆解
56
+
57
+ | 单元 | 说明 | 类型 | 涉及文件 | 依赖 |
58
+ |------|------|------|---------|------|
59
+ | U1 | {title} | {backend/frontend/test/...} | {files} | — |
60
+ | U2 | {title} | {type} | {files} | — |
61
+ | U3 | {title} | {type} | {files} | U1, U2 |
62
+
63
+ **执行策略**:{parallel / sequential / single}
64
+ - 第一批(并行):U1 {title} | U2 {title}
65
+ - 第二批(等待第一批):U3 {title}
66
+ (若 single:单一实施单元,主 agent 直接执行)
67
+
68
+ ### 测试策略
69
+
70
+ | 测试点 | 级别 | 归属单元 | 方式 | 验证命令 |
71
+ |--------|------|---------|------|---------|
72
+ | {描述} | 必测 | U1 | 单测 | `npm test -- --filter=xxx` |
73
+ | {描述} | 应测 | U2 | 快照 | `npm test -- --snapshot` |
74
+
75
+ - **人工验收**:{待填写 — 用户需要检查的关键行为}
76
+ - **无法验证项**:{待填写 — 无 / 说明缺失环境、数据或权限}
77
+
78
+ ### 风险与注意事项
79
+ - {风险 1}
80
+ - {风险 2}