easy-coding-harness 0.1.4

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 (42) hide show
  1. package/README.md +112 -0
  2. package/dist/cli.d.ts +2 -0
  3. package/dist/cli.js +979 -0
  4. package/dist/cli.js.map +1 -0
  5. package/package.json +53 -0
  6. package/templates/claude/agents/ec-implementer.md +26 -0
  7. package/templates/claude/agents/ec-reviewer.md +30 -0
  8. package/templates/claude/agents/ec-verifier.md +30 -0
  9. package/templates/claude/settings.json +40 -0
  10. package/templates/codex/agents/ec-implementer.toml +25 -0
  11. package/templates/codex/agents/ec-reviewer.toml +28 -0
  12. package/templates/codex/agents/ec-verifier.toml +26 -0
  13. package/templates/codex/config.toml +9 -0
  14. package/templates/codex/hooks.json +24 -0
  15. package/templates/common/bundled-skills/ec-meta/SKILL.md +56 -0
  16. package/templates/common/bundled-skills/ec-meta/references/customize-local/README.md +54 -0
  17. package/templates/common/bundled-skills/ec-meta/references/local-architecture/README.md +76 -0
  18. package/templates/common/bundled-skills/ec-meta/references/platform-files/README.md +52 -0
  19. package/templates/common/skills/ec-analysis/SKILL.md +113 -0
  20. package/templates/common/skills/ec-brainstorming/SKILL.md +70 -0
  21. package/templates/common/skills/ec-git/SKILL.md +47 -0
  22. package/templates/common/skills/ec-implementing/SKILL.md +89 -0
  23. package/templates/common/skills/ec-init/SKILL.md +96 -0
  24. package/templates/common/skills/ec-memory/SKILL.md +69 -0
  25. package/templates/common/skills/ec-reviewing/SKILL.md +61 -0
  26. package/templates/common/skills/ec-task-close/SKILL.md +35 -0
  27. package/templates/common/skills/ec-task-management/SKILL.md +45 -0
  28. package/templates/common/skills/ec-verification/SKILL.md +78 -0
  29. package/templates/common/skills/ec-workflow/SKILL.md +120 -0
  30. package/templates/main-constraint/AGENTS.md.tpl +58 -0
  31. package/templates/main-constraint/CLAUDE.md.tpl +56 -0
  32. package/templates/qoder/agents/ec-implementer.md +28 -0
  33. package/templates/qoder/agents/ec-reviewer.md +32 -0
  34. package/templates/qoder/agents/ec-verifier.md +32 -0
  35. package/templates/qoder/settings.json +36 -0
  36. package/templates/runtime/memory/long/BUSINESS.md +14 -0
  37. package/templates/runtime/memory/long/MEMORY.md +3 -0
  38. package/templates/runtime/memory/long/TECHNICAL.md +3 -0
  39. package/templates/shared-hooks/easy_coding_status.py +73 -0
  40. package/templates/shared-hooks/inject-subagent-context.py +80 -0
  41. package/templates/shared-hooks/inject-workflow-state.py +92 -0
  42. package/templates/shared-hooks/session-start.py +111 -0
@@ -0,0 +1,76 @@
1
+ # Local Architecture
2
+
3
+ How an installed Easy Coding harness is laid out and why.
4
+
5
+ ## Two layers
6
+
7
+ The harness deliberately separates **platform-native files** from **shared runtime data**:
8
+
9
+ - **Platform-native** (agent discovers these natively): skills, hooks, sub-agent definitions,
10
+ and the main constraint file. They live in each platform's standard directory
11
+ (`.claude/`, `.agents/` + `.codex/`, `.qoder/`). The agent's own `/` or `$` discovery finds
12
+ them — the harness invents no new discovery mechanism.
13
+ - **Shared runtime data** (`.easy-coding/`): `config.yaml`, `state.json`, `tasks/`, `memory/`,
14
+ `spec/`, and the project knowledge assets (SOUL/RULES/ABSTRACT/TEST_STRATEGY/CHANGELOG).
15
+ Skills and hooks read and write these.
16
+
17
+ The CLI installs the platform-native files. Agent skills do all the thinking (project
18
+ analysis, workflow operation). The CLI never analyzes the project.
19
+
20
+ ## `.easy-coding/` runtime layout
21
+
22
+ ```
23
+ .easy-coding/
24
+ config.yaml shared project config (in git)
25
+ state.json personal workflow state (NOT in git)
26
+ SOUL.md project identity + dialogue standards
27
+ RULES.md coding rules (per-language sections)
28
+ ABSTRACT.md architecture cognition
29
+ TEST_STRATEGY.md project-level test baseline
30
+ CHANGELOG.md architecture change log (follows ABSTRACT)
31
+ tasks/ one folder per task
32
+ project-init/ created by the CLI; ec-init completes it
33
+ {MM-DD-name}/ task.json · dev-spec.md · test-strategy.md · execution.jsonl
34
+ memory/
35
+ short/ sliding-window short memories (max 10, keep 5)
36
+ long/ MEMORY.md index · BUSINESS.md · TECHNICAL.md
37
+ spec/
38
+ main/ confirmed designs from ec-brainstorming
39
+ dev/ dev-spec candidates (default out of normal commits)
40
+ ```
41
+
42
+ ## Workflow state machine
43
+
44
+ 8 stages + 2 terminals, owned by ec-workflow:
45
+ `INIT → ANALYSIS → WAITING_CONFIRM → IMPLEMENT → REVIEW → VERIFICATION → MEMORY_SHORT →
46
+ MEMORY_LONG → COMPLETE`, plus `CLOSED` (user abort, no memory flow). WAITING_CONFIRM and
47
+ VERIFICATION are hard gates. The current stage persists in `state.json`; hooks inject it as a
48
+ breadcrumb so every reply can render the status line.
49
+
50
+ ## Task persistence
51
+
52
+ Each task is a folder. `task.json` is metadata; `dev-spec.md` is the human-readable plan;
53
+ `execution.jsonl` is an append-only plan-and-log (one `plan` record, then `dispatch`/`result`
54
+ /`review`/`verify`/`handoff` records). Because plan and log live on disk, not in an agent's
55
+ context window, a task survives session end and agent switches with zero information loss.
56
+
57
+ ## Memory system
58
+
59
+ Short memory: one schema-v2 file per task, sliding window (max 10, keep 5). Long memory:
60
+ three files (index + business + technical), distilled from out-of-window short memories with
61
+ explicit conflict resolution. ABSTRACT.md is backfilled/updated when memory distillation
62
+ detects an architecture change.
63
+
64
+ ## Project knowledge — four layers
65
+
66
+ Identity (SOUL, rarely changes) · Constraints (RULES, stable) · Cognition (ABSTRACT, updated
67
+ on architecture change) · Memory (short + long, updated every task). ec-workflow always reads
68
+ SOUL + RULES + recent short memory; ec-analysis loads ABSTRACT and matching long memory on
69
+ demand.
70
+
71
+ ## Dead-drop coordination
72
+
73
+ `.easy-coding/` is a dead drop. Agent A writes results and leaves; agent B reads them and
74
+ continues. All platform-agnostic artifacts (dev-spec, execution.jsonl, task.json, memory)
75
+ make cross-agent handoff lossless. `state.json` records `last_agent` so a new agent knows a
76
+ task was handed off rather than self-interrupted.
@@ -0,0 +1,52 @@
1
+ # Platform Files
2
+
3
+ What lives in each platform directory and how the three platforms differ.
4
+
5
+ ## Directory map
6
+
7
+ | | Claude Code | Codex | Qoder |
8
+ |---|---|---|---|
9
+ | Skills dir | `.claude/skills/` | `.agents/skills/` | `.qoder/skills/` |
10
+ | Skill trigger | `/` | `$` | `/` |
11
+ | Hooks dir | `.claude/hooks/` | `.codex/hooks/` | `.qoder/hooks/` |
12
+ | Hook config | `.claude/settings.json` | `.codex/hooks.json` | `.qoder/settings.json` |
13
+ | Main constraint | `CLAUDE.md` | `AGENTS.md` | `AGENTS.md` |
14
+ | Sub-agent defs | `.claude/agents/*.md` | `.codex/agents/*.toml` | `.qoder/agents/*.md` |
15
+ | CN variant | — | — | `.qodercn/` |
16
+
17
+ Each skill is installed as `{skills-dir}/ec-{name}/SKILL.md`. The 12 skills are
18
+ platform-agnostic — one template, resolved per platform at write time. The agent's native
19
+ discovery surfaces them under `/ec-` or `$ec-`.
20
+
21
+ ## Skills and agents
22
+
23
+ - **Skills** (`SKILL.md`): frontmatter `name` + `description`, then markdown instructions.
24
+ They carry the workflow logic. Platform differences — the skill trigger (`/` vs `$`), the
25
+ state-file path, and the sub-agent spawn instruction — are filled in from a small
26
+ placeholder map at install time, so one source template serves all three platforms.
27
+ - **Sub-agent definitions**: role baselines for the implementer / reviewer / verifier
28
+ sub-agents. Claude/Qoder use markdown frontmatter; Codex uses TOML with
29
+ `developer_instructions`. At runtime the main agent still builds a concrete task card per
30
+ unit — these files are the standing role contract, not the per-unit card.
31
+
32
+ ## Hooks and settings
33
+
34
+ Three Python hooks, shared verbatim across platforms (only the JSON wrapper differs):
35
+
36
+ - `session-start.py` — ensures `state.json` exists; injects resume / init-required / handoff
37
+ breadcrumbs. Idempotent.
38
+ - `inject-workflow-state.py` — injects the `workflow-state` and `current-task` breadcrumbs so
39
+ the status line can render.
40
+ - `inject-subagent-context.py` — injects the sub-agent guard before an Agent tool call.
41
+
42
+ Wrapper differences:
43
+
44
+ - **Claude Code**: full event set — `SessionStart`, `UserPromptSubmit`, `PreToolUse(Agent)`.
45
+ - **Codex**: no `SessionStart` and no Agent tool. `session-start.py` and
46
+ `inject-workflow-state.py` both hang off `UserPromptSubmit`; `inject-subagent-context.py`
47
+ is skipped. Codex hooks also require user-level enablement (`[features] hooks = true`).
48
+ - **Qoder**: like Claude Code (has Agent tool + Stop) but uses `UserPromptSubmit` for state
49
+ injection. The `.qoder/settings.json` wrapper nests an extra `hooks` array.
50
+
51
+ `session-start.py` is designed to be idempotent precisely because Codex/Qoder fire it on
52
+ `UserPromptSubmit` rather than a real session-start event — repeated calls are safe.
@@ -0,0 +1,113 @@
1
+ ---
2
+ name: ec-analysis
3
+ description: ANALYSIS-stage skill. Use when ec-workflow enters ANALYSIS. Produces the dev-spec (narrative plan), the execution plan (execution.jsonl), and the test strategy, then ends in WAITING_CONFIRM. Grounds every conclusion in real code, never restates the requirement.
4
+ ---
5
+
6
+ # ec-analysis — turn a requirement into a confirmable plan
7
+
8
+ ec-workflow dispatches you when a task enters ANALYSIS. You read the codebase, decide *how*
9
+ to implement, and present a plan the user can confirm. You do not write business code.
10
+
11
+ Communicate with the user in the user's language.
12
+
13
+ ## Inputs to load (in this order)
14
+
15
+ 1. `.easy-coding/SOUL.md`, `.easy-coding/RULES.md` (always).
16
+ 2. `.easy-coding/ABSTRACT.md` — only when the task touches architecture, crosses modules, or
17
+ adds a feature. A single-file bugfix or doc edit can skip it.
18
+ 3. Long memory: read `MEMORY.md` index, then only the `BUSINESS.md`/`TECHNICAL.md` entries
19
+ whose domain/tags/related_files match this task. No unbounded full scans.
20
+ 4. The actual source files the task touches — read them. A plan that does not cite real
21
+ files, classes, and call paths is rejected by your own self-check below.
22
+
23
+ ## Cross-repo handling
24
+
25
+ If the task spans repositories: declare them in the dev-spec (trigger repo + involved repos
26
+ by **name**, never local paths). For each involved repo, read its ABSTRACT to understand the
27
+ interface. Cache any local path the user provides only in `state.json.repo_paths`. If a repo
28
+ name cannot be located locally, ask the user for the path before proceeding.
29
+
30
+ ## Required output: the analysis document
31
+
32
+ Write `.easy-coding/tasks/{task-id}/dev-spec.md` covering these mandatory sections. Omit a
33
+ conditional section entirely if it does not apply — never pad to fill the template.
34
+
35
+ ```
36
+ ### Project mode {startup | iterative}
37
+ ### Task type {feature | bugfix | refactor | perf | frontend}
38
+ ### Requirement parse goal / input / output / boundary (what it explicitly will NOT do)
39
+ ### Current state real code, files, call paths, existing interfaces — with evidence
40
+ ### Conflicts requirement vs RULES / vs ABSTRACT / vs current code / vs dev-spec
41
+ ### Decisions needed anything affecting tech route, interface, or scope; else "none"
42
+ ### Impact modules / core classes / DB change y-n / interface change y-n / related memories
43
+ ### Change scope table below — FILE ENCODING column is mandatory
44
+ ### Change plan one-line overall approach / backend / frontend / migration / risk
45
+ ### Implementation units the unit table below — drives execution.jsonl
46
+ ### Test strategy the testability table + test points below
47
+ ### Risks concrete failure points
48
+ ```
49
+
50
+ **Change-scope table** (the encoding column prevents corrupting project files):
51
+
52
+ | File | Change type | Encoding | Core change |
53
+ |---|---|---|---|
54
+ | `path` | new/modify/delete | "project encoding X, evidence: ..." or "keep original X" | ... |
55
+
56
+ Encoding rule: modifying an existing file must keep its original encoding; new files declare
57
+ the project encoding with evidence; if evidence conflicts or is unknown, mark "needs user
58
+ confirmation". The user may override any encoding cell before confirming.
59
+
60
+ ## Implementation units → execution.jsonl
61
+
62
+ Decompose the work into units, then append ONE `plan` record to
63
+ `.easy-coding/tasks/{task-id}/execution.jsonl`:
64
+
65
+ ```json
66
+ {"type":"plan","strategy":"parallel","units":[{"id":"U1","title":"...","type":"backend","files":["..."],"depends_on":[],"rules_sections":["naming","error-handling"],"abstract_modules":["user-service"]}],"parallel_groups":[{"level":0,"units":["U1","U2"]},{"level":1,"units":["U3"]}]}
67
+ ```
68
+
69
+ Strategy selection (drives whether ec-implementing spawns sub-agents):
70
+ - `single` — one unit. Main agent implements directly.
71
+ - `sequential` — multiple units with a hard dependency chain.
72
+ - `parallel` — two or more independent units. ec-implementing MUST use sub-agents.
73
+
74
+ Each unit carries `rules_sections` and `abstract_modules` so ec-implementing can build a
75
+ precise task card without the sub-agent re-reading the whole repo. `depends_on` sets the
76
+ parallel-group levels.
77
+
78
+ ## Test strategy (presented with the plan, saved for VERIFICATION)
79
+
80
+ **1. Testability table** — classify every change:
81
+
82
+ | Change | Kind | Verdict | Reason |
83
+ |---|---|---|---|
84
+ | calculateDiscount | pure function | [must-test] | clear input/output |
85
+ | useCartStore | state hook | [should-test] | transitions assertable |
86
+ | SearchPanel | UI interaction | [depends] | on project test infra |
87
+ | Header.module.css | pure style | [no-test] | no behavior |
88
+
89
+ Rules: pure functions/utils → [must-test]; state hooks/service layer → [should-test]; API
90
+ param building → [should-test]; UI interaction → [depends]; pure style/config → [no-test].
91
+ Bug fixes always require a regression test.
92
+
93
+ **2. Test points** — for each [must-test]/[should-test] item, concrete cases, plus the
94
+ owning unit and the verify command.
95
+
96
+ **3. No-test reasons** — one line each; the user can overturn any verdict at confirmation.
97
+
98
+ Write the confirmed strategy to `.easy-coding/tasks/{task-id}/test-strategy.md` (the
99
+ VERIFICATION baseline).
100
+
101
+ ## Self-check before presenting (reject your own draft if any fails)
102
+
103
+ - Does every "Current state" claim cite a real file/class/line?
104
+ - Is there a concrete change plan, not just "loaded these files"?
105
+ - Did you omit conditional sections that do not apply?
106
+ - Are units, dependencies, and strategy internally consistent with the change scope?
107
+
108
+ ## End state
109
+
110
+ Present the full plan, then set stage to WAITING_CONFIRM and hand control back to
111
+ ec-workflow. On a revision request, re-output the COMPLETE revised plan (not just a diff)
112
+ and re-enter WAITING_CONFIRM; overwrite the `plan` record in execution.jsonl with the new
113
+ strategy. Never start implementing from this skill.
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: ec-brainstorming
3
+ description: Pre-implementation design skill. Use when the user runs {{skill_trigger}}ec-brainstorming, asks to brainstorm/explore/shape a design, or when a startup project needs its first direction after ec-init. Turns an idea into a confirmed design doc through one-question-at-a-time dialogue. Hard gate — no implementation before the user approves the design.
4
+ ---
5
+
6
+ # ec-brainstorming — ideas into confirmed designs
7
+
8
+ Adapted from the Superpowers brainstorming method for the Easy Coding context. You turn a
9
+ raw idea into a validated design through natural, collaborative, one-question-at-a-time
10
+ dialogue, then hand a confirmed design doc to ec-workflow. You never write implementation
11
+ code here.
12
+
13
+ Communicate with the user in the user's language.
14
+
15
+ ## Hard gate
16
+
17
+ ```
18
+ <HARD-GATE>
19
+ Do NOT invoke any implementation skill, write any code, or scaffold anything until you have
20
+ presented a design AND the user has approved it. This applies to EVERY idea regardless of
21
+ perceived simplicity.
22
+ </HARD-GATE>
23
+ ```
24
+
25
+ ### Anti-pattern: "this is too simple to need a design"
26
+
27
+ Every idea goes through this. A todo list, a one-function utility, a config change — all of
28
+ them. "Simple" work is exactly where unexamined assumptions waste the most effort. The design
29
+ can be three sentences for a truly simple idea, but you MUST present it and get approval.
30
+
31
+ ## Flow
32
+
33
+ 1. **Explore context.** Read `.easy-coding/SOUL.md`, `.easy-coding/RULES.md`, and (for
34
+ iterative projects) `.easy-coding/ABSTRACT.md` to understand positioning and existing
35
+ architecture. Check recent files and commits.
36
+ 2. **Scope check first.** If the idea describes multiple independent subsystems (e.g. "a
37
+ platform with chat, billing, and analytics"), flag it immediately. Help the user
38
+ decompose into independent pieces — what they are, how they relate, what order to build —
39
+ then brainstorm only the first piece through the normal flow. Do not spend questions
40
+ refining a thing that must be split first.
41
+ 3. **Clarify, one question at a time.** Multiple-choice preferred to lower the user's load;
42
+ open questions are fine but never stacked. Focus on purpose, constraints, success
43
+ criteria, boundaries. One question per message.
44
+ 4. **Propose 2-3 approaches** with tradeoffs and complexity. Lead with your recommendation
45
+ and the reason for it.
46
+ 5. **Present the design in sections** scaled to complexity (a few sentences if simple, more
47
+ if nuanced). Confirm each section before moving on. Cover: goal, core design, interfaces,
48
+ data flow, error handling, boundary conditions.
49
+ 6. **Design self-review** (fix inline, no second pass needed):
50
+ - Placeholder scan — any TBD/TODO/incomplete sections?
51
+ - Internal consistency — do sections contradict each other?
52
+ - Scope check — focused enough for one implementation cycle, or needs decomposition?
53
+ - Ambiguity — could any requirement be read two ways? Pick one, make it explicit.
54
+ - RULES check — does anything violate `.easy-coding/RULES.md`?
55
+ - YAGNI — strip features that do not serve the stated goal.
56
+ 7. **User review gate.** Save the design to `.easy-coding/spec/{topic}-design.md`, then ask
57
+ the user to review the written doc before proceeding. Make requested changes and re-run
58
+ the self-review. Proceed only on explicit approval.
59
+
60
+ ## Relationship to ec-workflow
61
+
62
+ The confirmed design doc is an INPUT to ec-workflow's ANALYSIS stage — it does not replace
63
+ ANALYSIS (brainstorming is design; ANALYSIS is the implementation plan). After approval, tell
64
+ the user to run `{{skill_trigger}}ec-workflow` to start building.
65
+
66
+ ## Boundaries
67
+
68
+ - Write no implementation code, scaffold nothing, take no implementation action.
69
+ - Do not call other ec-* skills or touch state.json / the state machine.
70
+ - One question per message — never overwhelm.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: ec-git
3
+ description: Git discipline skill for Easy Coding projects. Use when the task involves git pull/merge/rebase/commit/push/PR. Enforces the .easy-coding commit policy, warns on committing in-progress tasks, handles .easy-coding conflicts with user-confirmed semantic merge, and covers cross-repo commit sets. Does not touch the workflow state machine.
4
+ ---
5
+
6
+ # ec-git — git discipline
7
+
8
+ Activate for any git operation inside an Easy Coding project: pull, merge, rebase, commit,
9
+ push, PR. You manage git hygiene only — you never change `state.json` stage fields or trigger
10
+ stage transitions.
11
+
12
+ Communicate with the user in the user's language.
13
+
14
+ ## Commit policy for .easy-coding/
15
+
16
+ | Path | In commit set? | Why |
17
+ |---|---|---|
18
+ | `state.json` | **never** | personal runtime state, differs per developer |
19
+ | `config.yaml` | yes | shared team config |
20
+ | `tasks/*/task.json` `dev-spec.md` `execution.jsonl` `test-strategy.md` | yes | per-task folders, no merge conflicts; team-readable decision record |
21
+ | `SOUL.md` `RULES.md` `ABSTRACT.md` `TEST_STRATEGY.md` `CHANGELOG.md` | yes | shared project knowledge |
22
+ | `memory/` | yes | shared knowledge sinks |
23
+ | `spec/` | yes | spec store |
24
+ | `spec/dev/` | only if user explicitly asks | dev-spec candidates for the *current* requirement, default out of commit |
25
+
26
+ `.easy-coding/` changes are part of the commit set by default (treated like code changes),
27
+ with `state.json` always excluded. The CLI already added `state.json` to `.gitignore`.
28
+
29
+ ## Rules
30
+
31
+ 1. **In-progress warning.** If the commit touches a task folder whose status is not COMPLETE,
32
+ warn: "Task «X» is not finished — commit the intermediate state?" and wait.
33
+ 2. **Conflict handling for `.easy-coding/`** (mostly `memory/`): first explain the conflict
34
+ details to the user, get confirmation, then do an inductive semantic merge — never blindly
35
+ pick ours/theirs. This requirement applies only to conflicts inside `.easy-coding/`.
36
+ 3. **Cross-repo commit sets.** When a task spans repos (per the dev-spec / `state.json`
37
+ `repo_paths`), the commit/push covers every involved repo. Read `repo_paths` to locate
38
+ each one, check changes, and commit/push them as one coherent change set — do not leave a
39
+ sub-repo behind.
40
+ 4. **No false success.** Never claim a commit or push succeeded without reading the command
41
+ output. A failed push reported as success is a serious error.
42
+
43
+ ## Boundaries
44
+
45
+ - Do not touch `state.json` stage fields or run stage transitions — git only.
46
+ - Do not commit `state.json`.
47
+ - Do not commit `spec/dev/` unless the user explicitly asks.
@@ -0,0 +1,89 @@
1
+ ---
2
+ name: ec-implementing
3
+ description: IMPLEMENT-stage skill. Use when ec-workflow enters IMPLEMENT with a confirmed plan. Executes execution.jsonl units under strict file-scope control, enforces RULES compliance and encoding preservation, writes tests per strategy, and dispatches sub-agents for parallel work.
4
+ ---
5
+
6
+ # ec-implementing — execute the confirmed plan
7
+
8
+ ec-workflow dispatches you when a confirmed task enters IMPLEMENT. You turn the plan into
9
+ code without re-opening decisions. Inputs: `dev-spec.md` (confirmed), `execution.jsonl`
10
+ (plan record), `.easy-coding/RULES.md`, `.easy-coding/ABSTRACT.md`, `test-strategy.md`.
11
+
12
+ Communicate with the user in the user's language.
13
+
14
+ ## Core discipline (non-negotiable)
15
+
16
+ 1. **Scope is law.** Only modify files listed in the dev-spec change-scope table. If you
17
+ discover you need another file, STOP and return to ANALYSIS to amend the plan. No
18
+ "while I'm here" edits.
19
+ 2. **RULES compliance.** Before each write, re-check the RULES sections relevant to that
20
+ file (use the unit's `rules_sections`). Violation → fix before writing, not after.
21
+ 3. **Encoding preservation.** Modifying an existing file keeps its original encoding
22
+ (UTF-8 / GBK / ...); never silently convert. New files follow the encoding declared in
23
+ the dev-spec.
24
+ 4. **Comment language.** Follow the project's existing comment language as recorded in RULES.
25
+ Do not decide it here.
26
+ 5. **Step-wise reporting.** After each file/module, emit a one-line progress note (file +
27
+ what changed). Do not batch everything into one final dump.
28
+ 6. **Self-audit gate.** When the unit is done, audit: are all edits within scope? any
29
+ undeclared dependency change? any leftover TODO/FIXME you introduced? Report failures;
30
+ never skip silently.
31
+ 7. **Tests (soft rule).** Write tests for [must-test]/[should-test] items per
32
+ test-strategy.md. Soft means: no project test infra → not forced; infra exists → required.
33
+
34
+ ## Sub-agent dispatch (mandatory when strategy = parallel)
35
+
36
+ Read the `plan` record. Then:
37
+
38
+ - `single` → main agent implements directly, no sub-agents.
39
+ - `sequential` → main agent implements units one by one in dependency order.
40
+ - `parallel` → you MUST use sub-agents, one per unit, batched by `parallel_groups` level.
41
+
42
+ Parallel dispatch loop:
43
+ 1. Sort `parallel_groups` by level.
44
+ 2. Read RULES.md and ABSTRACT.md once.
45
+ 3. For each unit in the current level, build a **task card** (next section) and dispatch.
46
+ 4. Dispatch all units in the level concurrently via {{sub_agent_dispatch}}.
47
+ Platform spawn rule: {{platform_spawn_instruction}}
48
+ 5. Append a `dispatch` record per unit, then a `result` record per returned unit, to
49
+ execution.jsonl.
50
+ 6. After the level returns: check for file conflicts (two units touched the same file),
51
+ collect `issues` and `needs_attention`. Resolve conflicts before advancing.
52
+ 7. Advance to the next level. After all levels, summarize.
53
+
54
+ ## Task card — the sub-agent contract
55
+
56
+ The main agent builds the card; the sub-agent never hunts for context itself. Card template:
57
+
58
+ ```
59
+ # Task Card
60
+ ## Identity
61
+ You are an Easy Coding implementation sub-agent. Complete the assigned unit and return
62
+ structured results. Reply content IS the return value, not a message to a human.
63
+ ## Hard constraints
64
+ - Do not call any Skill tool.
65
+ - Do not read .claude/skills, .agents/skills, or any .easy-coding/ file.
66
+ - Modify only files in "Editable scope".
67
+ - Make no stage-transition decisions.
68
+ ## Task {unit description extracted from dev-spec}
69
+ ## Editable scope {unit.files}
70
+ ## Coding rules {RULES.md sections selected by unit.rules_sections}
71
+ ## Architecture {ABSTRACT.md sections selected by unit.abstract_modules}
72
+ ## Output format
73
+ Return: changed_files[], summary (one line), issues[], needs_attention[].
74
+ ```
75
+
76
+ This enforces the three-layer escape guard: task boundary (only its files), stage boundary
77
+ (no knowledge of the state machine), output boundary (structured return only). The sub-agent
78
+ gets pre-digested context — it does not open RULES or ABSTRACT itself.
79
+
80
+ ## On unit failure or conflict
81
+
82
+ A returned `issues` entry or a detected file conflict is handled by the MAIN agent. If a fix
83
+ is needed, re-dispatch the unit with a `dispatch` record carrying a `reason` field. Do not
84
+ let sub-agents re-dispatch each other.
85
+
86
+ ## End state
87
+
88
+ All units done and self-audited → hand back to ec-workflow to advance to REVIEW. If you
89
+ hit something that invalidates the plan, return to ANALYSIS instead of improvising.
@@ -0,0 +1,96 @@
1
+ ---
2
+ name: ec-init
3
+ description: One-time project knowledge initialization after the easy-coding CLI install. Use when the user runs {{skill_trigger}}ec-init or hook context shows [easy-coding:init-required]. Idempotent. Detects startup vs iterative projects automatically and generates SOUL, RULES, ABSTRACT, and TEST_STRATEGY.
4
+ ---
5
+
6
+ # ec-init — project knowledge initialization
7
+
8
+ The CLI is a dumb file mover; you are the smart half. You analyze the project and produce
9
+ the knowledge assets every later stage depends on. This runs once per project; re-runs are
10
+ safe.
11
+
12
+ Communicate with the user in the user's language.
13
+
14
+ ## Entry guard (idempotency — run first)
15
+
16
+ 1. Read `.easy-coding/tasks/project-init/task.json`.
17
+ - File missing → the CLI never ran. Tell the user to run `easy-coding init` first. Stop.
18
+ - `status == "COMPLETE"` → already initialized. Show a short summary (project mode,
19
+ generated files, init date from `init_log`) and exit without changing anything.
20
+ - `status == "PENDING"` → proceed.
21
+ 2. Repeated calls must never duplicate files or corrupt existing ones.
22
+
23
+ ## Project mode detection (automatic — never ask the user)
24
+
25
+ Scan the project root, excluding `.easy-coding/`, platform dirs (`.claude/`, `.agents/`,
26
+ `.codex/`, `.qoder/`), lockfiles, and pure config skeletons (package.json, tsconfig,
27
+ linter configs, CI yaml).
28
+
29
+ - Substantive source files exist (.ts/.js/.java/.py/.go/.rs/... containing real logic)
30
+ → **iterative** (existing project).
31
+ - Empty, or config skeleton only → **startup** (new project).
32
+
33
+ Record the verdict in `config.yaml` under `project.mode` and in `init_log`.
34
+
35
+ ## Iterative project flow
36
+
37
+ After each step append `{step, summary, timestamp}` to `init_log` in task.json — a later
38
+ agent must be able to see what was generated and on what evidence.
39
+
40
+ 1. **SOUL.md — project identity.** Analyze README, package metadata, and code purpose. Write:
41
+ - What this project is (2-3 sentences, concrete, no marketing fluff)
42
+ - Dialogue standards (language to use with the user, tone, verbosity expectations)
43
+ - Hard prohibitions (e.g. never commit secrets, never edit generated directories)
44
+ Keep it under ~40 lines; SOUL is loaded on every task.
45
+ 2. **RULES.md — coding rules grounded in evidence,** not generic best practice. Detect:
46
+ - Languages and versions (from configs and sources)
47
+ - Naming conventions actually in use (scan representative files)
48
+ - Comment language: if more than 70% of existing comments are Chinese, the rule is
49
+ "comments in Chinese"; same logic for English; mixed → follow each file's dominant language
50
+ - Error handling style, import ordering, formatter/linter in use (read their configs)
51
+ Structure as one section per language plus a General section. Every rule must be
52
+ mechanically checkable — "be clean" is not a rule; "exported functions carry explicit
53
+ return types" is.
54
+ 3. **ABSTRACT.md — architecture cognition.** Scan directory structure and entrypoints. Write:
55
+ modules and their responsibilities, core data flow, tech stack with versions, external
56
+ dependencies and services, build and run commands. Use a named section per module —
57
+ later stages extract sections by name (the `abstract_modules` field in execution plans).
58
+ 4. **TEST_STRATEGY.md — project test baseline:** detected framework, test command, where
59
+ tests live, naming conventions, coverage expectations, which classes of code this project
60
+ tests vs skips. Also fill `config.yaml` `test.framework` and `test.command` with commands
61
+ you verified exist (read package.json scripts or equivalent — do not guess).
62
+ 5. **Memory init** — ensure `.easy-coding/memory/short/` and `memory/long/` exist with the
63
+ three long files (MEMORY.md, BUSINESS.md, TECHNICAL.md). Never write fake entries.
64
+ 6. **Mark complete** — task.json `status:"COMPLETE"` plus a final `init_log` entry. Tell the
65
+ user initialization is done and daily work goes through `{{skill_trigger}}ec-workflow`.
66
+
67
+ ## Startup project flow
68
+
69
+ 1. **Lightweight interview** — 3-5 questions, strictly one at a time, multiple-choice
70
+ preferred: project name and positioning, primary language and framework, test framework
71
+ preference, special coding conventions (optional), comment language (optional).
72
+ 2. Generate from the answers:
73
+ - SOUL.md (identity from answers, dialogue standards, prohibitions)
74
+ - RULES.md (baseline rules for the chosen language; mark sections "refine as code grows")
75
+ - TEST_STRATEGY.md (skeleton for the chosen framework)
76
+ 3. **Skip ABSTRACT.md** — no architecture exists yet. Note in init_log:
77
+ "ABSTRACT pending; ec-memory backfills after the first substantive task." (ec-memory
78
+ detects the missing file during MEMORY_LONG and generates it from the then-current code.)
79
+ 4. Memory init and completion marking, same as iterative steps 5-6.
80
+ 5. Recommend: design first with `{{skill_trigger}}ec-brainstorming`, then build via
81
+ `{{skill_trigger}}ec-workflow`.
82
+
83
+ ## Quality bar for generated files
84
+
85
+ - Every claim grounded in observed evidence — file paths and configs you actually read.
86
+ No filler like "follow best practices".
87
+ - SOUL stays short. RULES and ABSTRACT run as long as the evidence supports, in named
88
+ sections. TEST_STRATEGY must be concrete enough that ec-verification can derive runnable
89
+ commands from it.
90
+
91
+ ## Boundaries
92
+
93
+ - Never modify business source code, dependencies, or git state.
94
+ - Never create workflow tasks or touch `current_task` / `current_stage` in state.json.
95
+ - Never regenerate knowledge files for a COMPLETE project-init — the user edits them
96
+ manually or asks ec-meta for guided customization.
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: ec-memory
3
+ description: MEMORY_SHORT and MEMORY_LONG stage skill — part of the archive flow, triggered only after user acceptance. Use when ec-workflow enters the memory stages. Writes schema-v2 short memory with a sliding window, distills long memory into BUSINESS/TECHNICAL with conflict resolution, and backfills ABSTRACT on architecture changes.
4
+ ---
5
+
6
+ # ec-memory — archive what was learned
7
+
8
+ ec-workflow dispatches you during MEMORY_SHORT and MEMORY_LONG, which run only after the
9
+ user accepts the task. Inputs: the task's `dev-spec.md`, `execution.jsonl` (the `result` and
10
+ `verify` records are precise source material), the changed-files list, existing memory files.
11
+
12
+ Communicate with the user in the user's language. Memory file content follows the project's
13
+ recorded comment/doc language.
14
+
15
+ ## MEMORY_SHORT — write one short memory entry
16
+
17
+ Create one file under `.easy-coding/memory/short/` with schema-v2 frontmatter:
18
+
19
+ ```yaml
20
+ ---
21
+ id: SM-{YYYYMMDD}-{NN}
22
+ date: {YYYY-MM-DD}
23
+ task_type: {feature | bugfix | refactor | perf}
24
+ domain: {business domain}
25
+ tags: [tag1, tag2]
26
+ related_files: [file1, file2]
27
+ target_long: {business | technical | both | none}
28
+ ---
29
+ {body: what was done, why this approach, key decisions. Pull facts from execution.jsonl
30
+ result/verify records, not from a fuzzy memory of the conversation.}
31
+ ```
32
+
33
+ If the task was cross-repo, record the repo names involved and the collaboration reason.
34
+
35
+ **Sliding window:** keep at most 10 short memories. When the count exceeds 10, keep the
36
+ latest 5; the rest become long-term distillation candidates (do not delete them here — the
37
+ MEMORY_LONG retirement check decides their fate).
38
+
39
+ ## MEMORY_LONG — distill durable knowledge
40
+
41
+ Three-file long memory:
42
+ - `MEMORY.md` — index of all entries with status (active | deprecated | superseded | deleted).
43
+ - `BUSINESS.md` — business rules, domain knowledge, product decisions.
44
+ - `TECHNICAL.md` — architecture decisions, implementation patterns, gotchas.
45
+
46
+ Distillation flow:
47
+ 1. Read the `target_long` of out-of-window short memories; route to business/technical.
48
+ 2. **Progressive loading** — read only the existing long entries matching this round's
49
+ domain/tags/related_files. No unbounded whole-repo memory scan.
50
+ 3. **Conflict resolution** by priority: current code > latest user confirmation > this
51
+ round's candidate > older long memory. On conflict, explain it before consolidating —
52
+ never silently pick a side.
53
+ 4. **Retirement check** (triggered when short memories >= 10): for older entries decide
54
+ delete (no value) / merge (semantic duplicate) / deprecate (was valid, now superseded).
55
+ 5. Update the `MEMORY.md` index to reflect every change.
56
+
57
+ ## ABSTRACT backfill / update
58
+
59
+ While distilling technical memory, if you detect an architecture change — module added or
60
+ removed, core flow changed, tech stack changed, or (startup projects) ABSTRACT.md does not
61
+ exist yet — update `.easy-coding/ABSTRACT.md` and append a CHANGELOG.md entry (what changed,
62
+ why). For startup projects this is where the first ABSTRACT gets generated from the now-real
63
+ code.
64
+
65
+ ## Boundaries
66
+
67
+ - Run only inside the archive flow. Memory for an unaccepted or closed task is dirty data.
68
+ - Prefer merge/deprecate over destructive delete. Ask before destructive consolidation.
69
+ - The main agent confirms and writes; a memory sub-agent may draft but not finalize.