self-evolving-workflow 0.0.0-stage → 0.1.3
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.
- package/LICENSE +27 -0
- package/README.md +90 -2
- package/dist/agent-memory-prompts.d.ts +13 -0
- package/dist/agent-memory-prompts.js +55 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +6 -0
- package/dist/closeout.d.ts +105 -0
- package/dist/closeout.js +479 -0
- package/dist/code.d.ts +39 -0
- package/dist/code.js +124 -0
- package/dist/common.d.ts +9 -0
- package/dist/common.js +42 -0
- package/dist/context-envelope.d.ts +59 -0
- package/dist/context-envelope.js +23 -0
- package/dist/host-adapters.d.ts +34 -0
- package/dist/host-adapters.js +151 -0
- package/dist/http.d.ts +3 -0
- package/dist/http.js +90 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +13 -0
- package/dist/knowledge-cli.d.ts +183 -0
- package/dist/knowledge-cli.js +654 -0
- package/dist/knowledge-reads.d.ts +71 -0
- package/dist/knowledge-reads.js +193 -0
- package/dist/memory.d.ts +97 -0
- package/dist/memory.js +250 -0
- package/dist/retrospective.d.ts +57 -0
- package/dist/retrospective.js +248 -0
- package/dist/search.d.ts +36 -0
- package/dist/search.js +112 -0
- package/dist/skill-addition.d.ts +25 -0
- package/dist/skill-addition.js +89 -0
- package/dist/skill-design.d.ts +96 -0
- package/dist/skill-design.js +226 -0
- package/dist/skill-replay.d.ts +55 -0
- package/dist/skill-replay.js +451 -0
- package/dist/skill-route.d.ts +30 -0
- package/dist/skill-route.js +75 -0
- package/dist/transcript-evidence.d.ts +3 -0
- package/dist/transcript-evidence.js +58 -0
- package/dist/upstream/chunker.d.ts +24 -0
- package/dist/upstream/chunker.js +96 -0
- package/dist/upstream/file-protocol.d.ts +45 -0
- package/dist/upstream/file-protocol.js +117 -0
- package/dist/upstream/frontmatter.d.ts +47 -0
- package/dist/upstream/frontmatter.js +86 -0
- package/dist/upstream/graph-search.d.ts +33 -0
- package/dist/upstream/graph-search.js +67 -0
- package/dist/upstream/l1-extraction.d.ts +26 -0
- package/dist/upstream/l1-extraction.js +405 -0
- package/dist/upstream/llm.d.ts +8 -0
- package/dist/upstream/llm.js +1 -0
- package/dist/upstream/merge.d.ts +50 -0
- package/dist/upstream/merge.js +153 -0
- package/dist/upstream/prompts.d.ts +53 -0
- package/dist/upstream/prompts.js +185 -0
- package/dist/upstream/search-utils.d.ts +34 -0
- package/dist/upstream/search-utils.js +55 -0
- package/dist/upstream/slug.d.ts +26 -0
- package/dist/upstream/slug.js +103 -0
- package/dist/upstream/template.d.ts +29 -0
- package/dist/upstream/template.js +80 -0
- package/dist/upstream/tokenize.d.ts +4 -0
- package/dist/upstream/tokenize.js +29 -0
- package/dist/wiki-change.d.ts +76 -0
- package/dist/wiki-change.js +299 -0
- package/dist/wiki-entry.d.ts +26 -0
- package/dist/wiki-entry.js +93 -0
- package/dist/wiki-ingest.d.ts +12 -0
- package/dist/wiki-ingest.js +126 -0
- package/dist/wiki-migration.d.ts +16 -0
- package/dist/wiki-migration.js +268 -0
- package/dist/wiki-tokens.d.ts +1 -0
- package/dist/wiki-tokens.js +46 -0
- package/dist/wiki.d.ts +103 -0
- package/dist/wiki.js +330 -0
- package/dist/workflow-cli.d.ts +2 -0
- package/dist/workflow-cli.js +258 -0
- package/dist/workflow-install.d.ts +36 -0
- package/dist/workflow-install.js +148 -0
- package/dist/workflow-knowledge.d.ts +16 -0
- package/dist/workflow-knowledge.js +24 -0
- package/dist/workflow-mcp.d.ts +2 -0
- package/dist/workflow-mcp.js +144 -0
- package/dist/workflow-names.d.ts +4 -0
- package/dist/workflow-names.js +18 -0
- package/dist/workflow-runtime.d.ts +622 -0
- package/dist/workflow-runtime.js +627 -0
- package/dist/workflow-skills.d.ts +48 -0
- package/dist/workflow-skills.js +141 -0
- package/package.json +76 -4
- package/skills/ew-odyssey/SKILL.md +237 -0
- package/skills/ew-odyssey/references/audit-artifacts.md +7 -0
- package/skills/ew-odyssey/references/odyssey-base-codex.md +3 -0
- package/skills/ew-odyssey/references/odyssey-base.md +278 -0
- package/skills/ew-odyssey/references/odyssey-debug.codex.md +305 -0
- package/skills/ew-odyssey/references/odyssey-debug.md +283 -0
- package/skills/ew-odyssey/references/odyssey-defensive.codex.md +395 -0
- package/skills/ew-odyssey/references/odyssey-defensive.md +369 -0
- package/skills/ew-odyssey/references/odyssey-improve.codex.md +270 -0
- package/skills/ew-odyssey/references/odyssey-improve.md +248 -0
- package/skills/ew-odyssey/references/odyssey-planex.codex.md +352 -0
- package/skills/ew-odyssey/references/odyssey-planex.md +312 -0
- package/skills/ew-odyssey/references/odyssey-review.codex.md +283 -0
- package/skills/ew-odyssey/references/odyssey-review.md +251 -0
- package/skills/ew-odyssey/references/odyssey-security.md +249 -0
- package/skills/ew-odyssey/references/odyssey-ui.codex.md +294 -0
- package/skills/ew-odyssey/references/odyssey-ui.md +250 -0
- package/skills/ew-odyssey/references/prepare/odyssey-debug.md +105 -0
- package/skills/ew-odyssey/references/prepare/odyssey-defensive.md +121 -0
- package/skills/ew-odyssey/references/prepare/odyssey-improve.md +93 -0
- package/skills/ew-odyssey/references/prepare/odyssey-planex.md +104 -0
- package/skills/ew-odyssey/references/prepare/odyssey-review.md +98 -0
- package/skills/ew-odyssey/references/prepare/odyssey-security.md +94 -0
- package/skills/ew-odyssey/references/prepare/odyssey-ui.md +87 -0
- package/skills/ew-orchestrate/SKILL.md +236 -0
- package/skills/ew-orchestrate/references/auto-policy.md +165 -0
- package/skills/ew-orchestrate/references/companion-route.md +52 -0
- package/skills/ew-orchestrate/references/ew-orchestrate.md +27 -0
- package/skills/ew-orchestrate/references/goal.md +53 -0
- package/skills/ew-orchestrate/references/knowledge-route.md +163 -0
- package/skills/ew-orchestrate/references/orchestrator-run-loop.md +36 -0
- package/skills/ew-orchestrate/references/planning.md +137 -0
- package/skills/ew-orchestrate/steps/ew-analyze/SKILL.md +62 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/boundary-grill.md +50 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/issue-gaps-analyze.md +59 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/prepare.md +42 -0
- package/skills/ew-orchestrate/steps/ew-analyze/references/workflow.md +401 -0
- package/skills/ew-orchestrate/steps/ew-brainstorm/SKILL.md +32 -0
- package/skills/ew-orchestrate/steps/ew-companion/SKILL.md +9 -0
- package/skills/ew-orchestrate/steps/ew-execute/SKILL.md +71 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/prepare.md +69 -0
- package/skills/ew-orchestrate/steps/ew-execute/references/workflow.md +373 -0
- package/skills/ew-orchestrate/steps/ew-plan/SKILL.md +102 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/boundary-grill.md +50 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/prepare.md +51 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/tdd.md +53 -0
- package/skills/ew-orchestrate/steps/ew-plan/references/workflow.md +278 -0
- package/skills/ew-orchestrate/steps/ew-review/SKILL.md +44 -0
- package/skills/ew-orchestrate/steps/ew-review/references/odyssey-base-codex.md +3 -0
- package/skills/ew-orchestrate/steps/ew-review/references/prepare.md +76 -0
- package/skills/ew-orchestrate/steps/ew-review/references/workflow.md +283 -0
- package/skills/ew-skill-design/SKILL.md +28 -0
- package/skills/ew-skill-design/references/package-contract.md +28 -0
- package/skills/ew-skill-design/references/validation.md +7 -0
- package/skills/team-swarm/SKILL.md +231 -0
- package/skills/team-swarm/references/mcp-coordination.md +10 -0
- package/skills/team-swarm/roles/analyst/role.md +181 -0
- package/skills/team-swarm/roles/ant/role.md +149 -0
- package/skills/team-swarm/roles/coordinator/commands/converge.md +154 -0
- package/skills/team-swarm/roles/coordinator/commands/init-swarm.md +134 -0
- package/skills/team-swarm/roles/coordinator/commands/iterate.md +202 -0
- package/skills/team-swarm/roles/coordinator/role.md +228 -0
- package/skills/team-swarm/roles/scorer/role.md +150 -0
- package/skills/team-swarm/scripts/aco.py +646 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +111 -0
- package/skills/team-swarm/scripts/test_aco.py +606 -0
- package/skills/team-swarm/specs/ant-output-schema.md +127 -0
- package/skills/team-swarm/specs/convergence-criteria.md +108 -0
- package/skills/team-swarm/specs/pheromone-schema.md +125 -0
- package/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/skills/team-swarm/specs/swarm-protocol.md +123 -0
- package/skills/workflow-closeout/SKILL.md +10 -0
- package/skills/workflow-evolve/SKILL.md +79 -0
- package/skills/workflow-evolve/references/agy-gate.md +27 -0
- package/skills/workflow-evolve/references/auto-loop.md +20 -0
- package/skills/workflow-evolve/references/history-review.md +14 -0
- package/skills/workflow-evolve/scripts/codex-memory-replay.mjs +76 -0
- package/skills/workflow-evolve/scripts/codex-replay.mjs +1 -0
- package/skills/workflow-evolve/scripts/evolve-loop.mjs +259 -0
- package/skills/workflow-evolve/scripts/memory-codex-mcp.mjs +124 -0
- package/workflows/index.json +23 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ew-orchestrate
|
|
3
|
+
disable-model-invocation: false
|
|
4
|
+
description: Route, brainstorm, analyze, plan, execute, review and recover work over one canonical Session/Run chain
|
|
5
|
+
argument-hint: <intent> [--goal <goal>] [--auto] [--resume <session-id>] [-y] [-c] [--amend]
|
|
6
|
+
allowed-tools:
|
|
7
|
+
- Bash
|
|
8
|
+
- Edit
|
|
9
|
+
- Glob
|
|
10
|
+
- Grep
|
|
11
|
+
- Read
|
|
12
|
+
- Write
|
|
13
|
+
- followup_task
|
|
14
|
+
- interrupt_agent
|
|
15
|
+
- list_agents
|
|
16
|
+
- request_user_input
|
|
17
|
+
- send_message
|
|
18
|
+
- spawn_agent
|
|
19
|
+
- spawn_agents_on_csv
|
|
20
|
+
- update_plan
|
|
21
|
+
- wait_agent
|
|
22
|
+
session-mode: run
|
|
23
|
+
contract:
|
|
24
|
+
discovery: self-described
|
|
25
|
+
consumes: []
|
|
26
|
+
produces: []
|
|
27
|
+
version: 0.5.93
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<deferred_reading>
|
|
31
|
+
- [Chain catalog](references/ew-orchestrate.md) — read before initial intent classification.
|
|
32
|
+
- [Planning and chain creation](references/planning.md) — read when creating a Session chain.
|
|
33
|
+
- [Goal long-chain policy](references/goal.md) — read when `--goal` or a multi-stage outcome is present.
|
|
34
|
+
- [Brainstorm step](steps/ew-brainstorm/SKILL.md) — read for exploration-first work.
|
|
35
|
+
- [Analyze step](steps/ew-analyze/SKILL.md) — read for investigation and evidence production.
|
|
36
|
+
- [Plan step](steps/ew-plan/SKILL.md) — read for decomposition and executable task planning.
|
|
37
|
+
- [Execute step](steps/ew-execute/SKILL.md) — read for implementation and self-checks.
|
|
38
|
+
- [Review step](steps/ew-review/SKILL.md) — read for quality review and findings.
|
|
39
|
+
- [Run loop and recovery](references/orchestrator-run-loop.md) — read before dispatching or resuming a Run.
|
|
40
|
+
- [Automatic execution policy](references/auto-policy.md) — read for `--auto` or goal long-chain mode.
|
|
41
|
+
- [Goal amendment](references/goal.md) — read for `--amend`.
|
|
42
|
+
- [Knowledge route](references/knowledge-route.md) — read for Wiki, Closeout, migration and knowledge intents.
|
|
43
|
+
- [Companion route](references/companion-route.md) — read for small, mechanically clear tasks.
|
|
44
|
+
</deferred_reading>
|
|
45
|
+
|
|
46
|
+
<purpose>
|
|
47
|
+
Route a user intent to the lightest sufficient execution path. For work requiring a durable chain, create one canonical topic Session through `evolve session open --chain <commands...>` and drive it through the shared Run loop. Recovery, verification and bounded retries use that same loop.
|
|
48
|
+
</purpose>
|
|
49
|
+
|
|
50
|
+
<goal_long_chain>
|
|
51
|
+
`--goal <goal>` selects the long-chain mode. Read `references/goal.md`, derive a boundary contract, observable completion conditions and a goal-to-step lifecycle, then keep every required stage in one Session chain. Insert a final goal audit before `session complete` when the chain has decomposition. A goal mode may add `ew-brainstorm`, `ew-analyze`, `ew-plan`, `ew-execute` and `ew-review` steps, but those steps remain child steps of this Evolve Skill and never become separate top-level Skill invocations.
|
|
52
|
+
</goal_long_chain>
|
|
53
|
+
|
|
54
|
+
<knowledge_route>
|
|
55
|
+
Knowledge, Wiki, closeout, migration, constraint and reference intents stay inside this Evolve Skill. Read `references/knowledge-route.md` and route them to the unified Agent Memory Wiki flow. `workflow-closeout` is a compatibility entry that points back to the same route. Do not dispatch independent legacy knowledge Skills.
|
|
56
|
+
</knowledge_route>
|
|
57
|
+
|
|
58
|
+
<companion_route>
|
|
59
|
+
Small, mechanically clear tasks stay inside this Evolve Skill through `references/companion-route.md`. Companion uses the canonical Session/Run lifecycle with one bounded `ew-companion` step. It never becomes an independent Skill and escalates to `ew-analyze`, `ew-plan`, `ew-execute` or `ew-review` when its self-check fails.
|
|
60
|
+
</companion_route>
|
|
61
|
+
|
|
62
|
+
<interface>
|
|
63
|
+
Only these user flags are accepted:
|
|
64
|
+
|
|
65
|
+
- `-y` — skip all confirmation/clarification interactions, use default choices. Does NOT change data semantics (no auto-deferred decisions). Never bypasses: high-risk classification, confidence <60, ambiguity requiring user input, failed gates, or drift escalation.
|
|
66
|
+
- `-c` — continue the unique live compatible Session.
|
|
67
|
+
- `--resume <session-id>` — resume that exact Session using its status and current evidence. Resolve stuck Runs through the shared recovery procedure.
|
|
68
|
+
- `--auto` — use the bounded recovery and retry policy for this invocation. It retains the current authorization scope and the risk limits below.
|
|
69
|
+
- `--goal <goal>` — build a durable long-chain Session around the declared outcome.
|
|
70
|
+
- `--amend` — amend that Session's goal; remaining text is the change request.
|
|
71
|
+
|
|
72
|
+
Execution always dispatches run-executor (the default behavior); this never changes Session type or chain semantics.
|
|
73
|
+
|
|
74
|
+
All other text is intent. Unknown flags are not silently reinterpreted. Platform, roadmap, quality, template reuse, parallelism and adversarial depth are inferred.
|
|
75
|
+
|
|
76
|
+
All routing, chain creation, long-chain goal auditing and recovery stay inside this Evolve Skill. A confirmed single-Run route or a single Run authorized by the original `-y` proceeds through the shared loop. Lightweight work uses the internal Companion route, campaign work recommends the exact campaign Skill, and multiple-step work stays in Evolve. Propose `--auto` for a route that needs bounded recovery and confirm before execution.
|
|
77
|
+
</interface>
|
|
78
|
+
|
|
79
|
+
<invariants>
|
|
80
|
+
1. **One chain** — every task uses the same Session/Run protocol; no static/dynamic or executor-specific Session type.
|
|
81
|
+
2. **Session before execution** — open via `evolve session open "<objective>" --id <slug> --chain <commands...>` before allocating a step Run.
|
|
82
|
+
3. **Creator owns decomposition** — Evolve creates `boundary_contract` and outcome-oriented goals; later orchestrators consume rather than overwrite them.
|
|
83
|
+
4. **Runtime owns mutation** — prompt never writes session.json/run.json and never auto-uses admin chain commands.
|
|
84
|
+
5. **Skill owns domain adaptation** — optional chain changes come only from the current Skill's validated `chain-proposal/1.0`.
|
|
85
|
+
6. **Verdict advances** — execution steps advance only through fenced `evolve run complete ... --advance --verdict done|done_with_concerns`; decision steps only through fenced `evolve run decide`.
|
|
86
|
+
7. **Historical similarity remains read-only evidence** — it never selects a Session or binds outputs.
|
|
87
|
+
8. **Compatibility commands are out of band** — normal orchestration calls only `evolve run …`.
|
|
88
|
+
9. **Auto is bounded** — `-y` never bypasses high risk, low confidence, ambiguity, failed gates or drift escalation.
|
|
89
|
+
10. **Entry commands stay outside the chain** — each persisted step names the executing Skill or decision point directly.
|
|
90
|
+
11. **Running means continue** — while canonical continuation authority is `automatic`, execute it and re-read the receipt in the same turn; `suggest_only` is Runtime passivity, not a reason to end the turn.
|
|
91
|
+
</invariants>
|
|
92
|
+
|
|
93
|
+
<state_machine>
|
|
94
|
+
|
|
95
|
+
<states>
|
|
96
|
+
S_PARSE — parse intent and flags
|
|
97
|
+
S_CONTINUE — locate the unique live Session
|
|
98
|
+
S_RECOVER — run the shared recovery procedure for the selected Session
|
|
99
|
+
S_AMEND — audited goal amendment
|
|
100
|
+
S_CLASSIFY — select the smallest sufficient initial chain
|
|
101
|
+
S_COMPANION — execute the internal bounded Companion route
|
|
102
|
+
S_DECOMPOSE — derive boundary, criteria and observable goals
|
|
103
|
+
S_CREATE — open via `session open --chain`
|
|
104
|
+
S_CONFIRM — confirm classification unless `-y`
|
|
105
|
+
S_RUN_LOOP — execute `orchestrator-run-loop.md`
|
|
106
|
+
S_FALLBACK — request missing intent or disambiguation
|
|
107
|
+
</states>
|
|
108
|
+
|
|
109
|
+
<transitions>
|
|
110
|
+
S_PARSE:
|
|
111
|
+
→ S_AMEND WHEN: `--amend`
|
|
112
|
+
→ S_CONTINUE WHEN: `--resume <session-id>` OR `-c`
|
|
113
|
+
→ S_CLASSIFY WHEN: intent present
|
|
114
|
+
→ S_FALLBACK OTHERWISE
|
|
115
|
+
|
|
116
|
+
S_CONTINUE:
|
|
117
|
+
→ S_RECOVER WHEN: selected Session has a stuck Run
|
|
118
|
+
→ S_RUN_LOOP WHEN: selected Session can continue, including an open decision gate
|
|
119
|
+
→ S_FALLBACK WHEN: the explicit ID is invalid, or legacy selection has none or multiple
|
|
120
|
+
|
|
121
|
+
S_RECOVER:
|
|
122
|
+
→ S_RUN_LOOP WHEN: shared recovery returns an executable continuation
|
|
123
|
+
→ END WHEN: recovery remains blocked or requires a user decision
|
|
124
|
+
|
|
125
|
+
S_AMEND:
|
|
126
|
+
→ S_RUN_LOOP WHEN: shared amend protocol committed
|
|
127
|
+
→ END WHEN: cancelled or blocked
|
|
128
|
+
|
|
129
|
+
S_CLASSIFY:
|
|
130
|
+
→ S_RUN_LOOP WHEN: existing compatible Session found (do not rebuild)
|
|
131
|
+
→ END WHEN: lightweight direct task completed and verified
|
|
132
|
+
→ S_COMPANION WHEN: intent satisfies the Companion self-check
|
|
133
|
+
→ S_DECOMPOSE WHEN: multi-step chain
|
|
134
|
+
→ S_CREATE WHEN: narrow/single-step chain
|
|
135
|
+
→ S_FALLBACK WHEN: confidence < 60
|
|
136
|
+
|
|
137
|
+
S_DECOMPOSE → S_CREATE
|
|
138
|
+
S_CREATE → S_RUN_LOOP WHEN: `-y` AND risk ≠ high AND confidence ≥ 60
|
|
139
|
+
S_CREATE → S_CONFIRM WHEN: `-y` AND (risk == high OR confidence < 60)
|
|
140
|
+
S_CREATE → S_CONFIRM OTHERWISE
|
|
141
|
+
S_CREATE → S_FALLBACK WHEN: creation fails (delete temp file, report error)
|
|
142
|
+
S_CONFIRM → S_RUN_LOOP WHEN: confirmed
|
|
143
|
+
S_CONFIRM → S_CLASSIFY WHEN: revised intent may reshape the chain
|
|
144
|
+
S_CONFIRM → END WHEN: cancelled
|
|
145
|
+
S_COMPANION → END WHEN: bounded Run completed and verified
|
|
146
|
+
S_COMPANION → S_CLASSIFY WHEN: self-check fails or the task expands
|
|
147
|
+
</transitions>
|
|
148
|
+
|
|
149
|
+
<actions>
|
|
150
|
+
|
|
151
|
+
### A_CLASSIFY
|
|
152
|
+
|
|
153
|
+
Read the linked chain catalog. Record matched evidence, excluded alternatives and confidence before creation. Execute clear, bounded work directly when it has no typed handoff, recovery or gate requirement. Select a single Run when one Skill provides all necessary evidence. Build a chain when several steps or decision points are required. Keep an explicit request for only a recommendation read-only.
|
|
154
|
+
|
|
155
|
+
Minimum chain rules:
|
|
156
|
+
|
|
157
|
+
| Intent evidence | Initial chain |
|
|
158
|
+
|---|---|
|
|
159
|
+
| narrow fix/change | analyze → plan → execute → review/test as required |
|
|
160
|
+
| broad rewrite/migration | analyze-macro → scope decision → plan/roadmap path |
|
|
161
|
+
| brainstorm/explore | `steps/brainstorm`, then only Skill-proposed continuation |
|
|
162
|
+
| stress/grill | grill, then only Skill-proposed continuation |
|
|
163
|
+
| formal specification | blueprint → plan path |
|
|
164
|
+
| existing compatible Session | do not rebuild; enter shared loop |
|
|
165
|
+
|
|
166
|
+
Roadmap is inferred only for multi-release evidence. Quality depth follows project specs, UI evidence needs frontend verification, and every executable command is resolved by Run Runtime.
|
|
167
|
+
|
|
168
|
+
### A_COMPANION
|
|
169
|
+
|
|
170
|
+
Read `references/companion-route.md`. Confirm the task has one bounded concern, a named target and a direct verification path. Create one Session chain with a single `ew-companion` step, then use the shared Run loop. If the task requires investigation, planning, multiple execution stages, a typed handoff or a separate gate, return to classification and choose the smallest sufficient full route.
|
|
171
|
+
|
|
172
|
+
### A_DECOMPOSE
|
|
173
|
+
|
|
174
|
+
For broad intent, ask at most 3 questions covering scope, constraints and observable done criteria; broad ambiguity is not skipped by `-y`. (broad = affects ≥3 modules OR requires cross-package interface changes OR ≥2 of 3 decomposition questions remain unanswered.) Produce:
|
|
175
|
+
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"boundary_contract": { "in_scope": [], "out_of_scope": [], "constraints": [], "definition_of_done": "" },
|
|
179
|
+
"decomposition": {
|
|
180
|
+
"execution_criteria": [],
|
|
181
|
+
"goals": [{ "id": "G1", "goal": "", "boundary": "", "done_when": "", "evidence": "", "lifecycle": [], "status": "pending" }],
|
|
182
|
+
"changelog": []
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Goals describe outcomes, not lifecycle stages.
|
|
188
|
+
|
|
189
|
+
### A_CREATE
|
|
190
|
+
|
|
191
|
+
Follow the linked planning and chain-creation procedure for knowledge checks, Skill discovery, and chain creation.
|
|
192
|
+
|
|
193
|
+
- With `--auto` or `--goal`, a final quality, scope and goal decision is mandatory. Use the linked automatic execution policy for stage mapping, periodic checks for long chains, and the requirement for at least 2 independently releasable milestones before adding roadmap work. Regular chains retain their quality steps and gates.
|
|
194
|
+
- For narrow/single-step chains, generate a minimal implicit boundary_contract: in_scope = [intent], out_of_scope = [], constraints = [], definition_of_done = 'step completed with passing gates'.
|
|
195
|
+
- Do not inline unescaped JSON.
|
|
196
|
+
|
|
197
|
+
### A_CONTINUE
|
|
198
|
+
|
|
199
|
+
For `--resume`, read `evolve session status --session {session_id} --json` and reattach the exact Run using its Resume Packet. For `-c`, resolve a unique compatible live Session from the read-only list and status views, and ask when several match. A pending decision follows the declared continuation. A stuck Run follows the recovery section of `orchestrator-run-loop.md`. A completed or archived Session stays terminal for this invocation.
|
|
200
|
+
|
|
201
|
+
### A_AUTO
|
|
202
|
+
|
|
203
|
+
At an actionable continuation, evaluate the remaining scope, goal evidence and risks. Allow a retry only if the error is recoverable, the step is pending, and the retry budget permits it. Use the returned next action and current revision. A retry must consume new evidence or change the failing approach. Escalate exhausted retries, missing authorization, unresolved decisions, low confidence or a material departure from the confirmed goal.
|
|
204
|
+
|
|
205
|
+
At a decision gate, compare every pending goal's completion condition against the accumulated evidence. Use the linked automatic execution policy's confidence and risk rules before advancing. Keep the chain open when a decision needs more evidence or a user ruling.
|
|
206
|
+
|
|
207
|
+
Use the Evolve lifecycle from the shared execution guide. Retain the current revision after each mutation and follow continuation.action. Confidence below 60 requires review before proceeding.
|
|
208
|
+
|
|
209
|
+
### A_AMEND
|
|
210
|
+
|
|
211
|
+
Read `goal.md`, use `evolve session status --session {session_id} --json` for the snapshot, perform read-only impact analysis, confirm, then apply the amendment through a chain-aware typed proposal: goal/decomposition metadata is committed with fenced `evolve session chain insert|replace` (per-step `--goal-ref` / `--stage` / `--decision-ref`). Any pending-tail change must come from a planning step inside this Evolve Skill.
|
|
212
|
+
|
|
213
|
+
</actions>
|
|
214
|
+
|
|
215
|
+
</state_machine>
|
|
216
|
+
|
|
217
|
+
<task_tracking>
|
|
218
|
+
|
|
219
|
+
**时机与操作**(plan 是 session 权威状态的 UI 镜像,不替代 session 状态):
|
|
220
|
+
|
|
221
|
+
| 时机 | 操作 | 示例 |
|
|
222
|
+
|------|------|------|
|
|
223
|
+
| Session 创建后 | update_plan 初始化步骤清单 | `update_plan({ plan: [{ step: "Step {index}: {step.skill}", status: "pending" }, ...] })` |
|
|
224
|
+
| Step 派发时 | update_plan 标记当前 step | `update_plan({ plan: [..., 当前 step status: "in_progress"] })` |
|
|
225
|
+
| Step 完成时 | update_plan 标记完成 | `update_plan({ plan: [..., 该 step status: "completed"] })` |
|
|
226
|
+
| Step 失败时 | update_plan + explanation 说明 | `update_plan({ explanation: "Step {index} failed: {reason}", plan: [...] })` |
|
|
227
|
+
|
|
228
|
+
</task_tracking>
|
|
229
|
+
|
|
230
|
+
<success_criteria>
|
|
231
|
+
- Public flags include `--auto`, `--resume <session-id>`, `-y`, `-c`, and `--amend`.
|
|
232
|
+
- Initial classification is auditable and the Session exists before step execution.
|
|
233
|
+
- Follow the packet from `run next`, execute the step and seal it with `run complete`. Use `run decide` at decision nodes and `run check` to diagnose a failed completion.
|
|
234
|
+
- Chain adaptation is Skill-proposed and atomically applied by the producing Run (`session chain insert|replace|skip`).
|
|
235
|
+
- Normal output and recommendations contain only `evolve run …` lifecycle commands.
|
|
236
|
+
</success_criteria>
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ew-goal-policy
|
|
3
|
+
description: "Closed-loop policy over the canonical Session/Run chain — retry, confidence, drift, goal-audit and stopping policy"
|
|
4
|
+
argument-hint: "<intent> [-y] [-c] [--amend]"
|
|
5
|
+
contract:
|
|
6
|
+
refs:
|
|
7
|
+
- path: goal.md
|
|
8
|
+
goal: true
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Prepare: Evolve goal long-chain policy
|
|
12
|
+
|
|
13
|
+
Evolve goal policy 是闭环长链策略层。本文件定义 **命令选择**(Stage Mapping)和 **建链规则**(Build Rules)。
|
|
14
|
+
分派和恢复使用[执行循环](orchestrator-run-loop.md)。
|
|
15
|
+
|
|
16
|
+
## Execution Authority Invariants
|
|
17
|
+
|
|
18
|
+
1. 首次变更前用 evolve capabilities 读取运行时能力,随后沿回执处理 Session 和 Run 的修订号。
|
|
19
|
+
2. Evolve 长链模式全程保留 exact `session_id + orchestration_revision`(run-target mutation 另含 `run_revision`)和单一 authorized `actor_id`,并把同一值传给 `--participant` 与 `--actor`。每个 orchestration mutation 使用 stable request ID unique to payload + 当前 `--expected-orchestration-revision`;run-target mutation 按 contract 另带 `--expected-run-revision`。每次 receipt(`Evolve mutation receipt`)后刷新 fence,禁止按 Session status 或目录扫描猜 authority。
|
|
20
|
+
3. chain/gate/decision 只能在 Session chain 内 mutation:dispatch 用 fenced `evolve run next`(birth packet 含 exact locator、`run_dir`/`upstream`/`guidance`/`knowledge_context`/`brief.command`、resolved `task`、structured executable `continuation`、`run_already_created=true`),重挂用 `evolve run brief`(`Evolve Run brief` Resume Packet 含相同 task/continuation contract 与 `orchestration_revision`),completion 用 fenced `evolve run complete ... --advance`(verdict `done`/`done_with_concerns`),决策用 `evolve run decide`(`proceed`/`fix`/`escalate`),链调整用 `session chain insert|replace|update|skip`,冲突先读 `evolve session status`,最终只走 `evolve session complete`。Run 封存后不可变,retry 经 `run next` 重新派发 pending step;无 Execution、无 lease、无 paused。
|
|
21
|
+
|
|
22
|
+
## Stage Mapping
|
|
23
|
+
|
|
24
|
+
从 `lifecycle_position` 到 `session-complete` 的完整命令目录。每个 chain step 由 Skill 执行;decision step 由只读 evaluator 评估。Session(`evolve-session/1.0`)提供 durable topic identity 与 chain;所有节点、gate 和终结条件都属于 Session chain。
|
|
25
|
+
|
|
26
|
+
| Stage | Skill 命令 | Decision after | quality_mode |
|
|
27
|
+
|-------|-----------|----------------|--------------|
|
|
28
|
+
| grill | `grill "{intent}"` | — | all(`-y` 时透传 `-y` 到 grill args) |
|
|
29
|
+
| brainstorm | `brainstorm "{intent}" [--from grill:{grill_id}]` | — | all |
|
|
30
|
+
| blueprint | `blueprint "{intent}"` | — | all |
|
|
31
|
+
| init | `init` | — | all |
|
|
32
|
+
| specs-setup | `specs-setup` | — | all(仅当 `.workflow/specs/` 不存在时插入) |
|
|
33
|
+
| analyze-macro | `analyze "{intent}"` | `post-analyze-scope` | all |
|
|
34
|
+
| roadmap | `roadmap --from analyze:{analyze_macro_id}` | — | all(仅 scope_verdict=large + wants_roadmap) |
|
|
35
|
+
| analyze | `analyze --session {session}` | — | all |
|
|
36
|
+
| plan | `plan --session {session}` 或 `plan --from analyze:{id}` 或 `plan --from blueprint:{id}` | — | all |
|
|
37
|
+
| execute | `execute --session {session}` | `post-execute` | all |
|
|
38
|
+
| business-test | `auto-test --session {session}` | `post-business-test` | full only |
|
|
39
|
+
| review | `review --session {session} [--tier quick]` | `post-review` | all(quick 模式追加 `--tier quick`) |
|
|
40
|
+
| test-gen | `auto-test --session {session}` | — | full / standard if coverage<80% |
|
|
41
|
+
| test | `test --session {session}` | `post-test` | full, standard |
|
|
42
|
+
| frontend-verify | `test --session {session} --frontend-verify` | `post-frontend-verify` | all(仅当交付 UI 时插入) |
|
|
43
|
+
| goal-audit | *(decision-only)* | `post-goal-audit` | all(仅当有 decomposition 时) |
|
|
44
|
+
| session-complete | *(decision-only)* | `post-execution` | all |
|
|
45
|
+
| debug-escalate | *(decision-only)* | `post-debug-escalate` | all(仅当 debug step 升级时插入) |
|
|
46
|
+
|
|
47
|
+
## Build Rules(按顺序应用)
|
|
48
|
+
|
|
49
|
+
0.5. **specs 预检**:`lifecycle_position ∉ {grill, brainstorm, blueprint, init}` 且 `.workflow/specs/` 不存在 → 链路最前面插入 `specs-setup`(step 名是复数 `specs-setup`,对应 `workflows/specs-setup.md`;`spec-setup` 不是可解析 step 名)。
|
|
50
|
+
1. **起点**:从 `lifecycle_position` 开始。
|
|
51
|
+
2. **跳过已完成**:跳过当前 session 下已有 completed artifact 的 stage。
|
|
52
|
+
3. **quality_mode 过滤**:按 `quality_mode` 排除不匹配 stage。
|
|
53
|
+
3.5. **grill -y 透传**:`-y` 时为 grill args 追加 `-y`;保留 grill stage 与 brainstorm 的 `--from grill:*`。
|
|
54
|
+
3.6. **frontend-verify UI 门控**:仅当交付前端(检出 `dashboard/` 或 UI 关键词)时保留;纯后端删除。
|
|
55
|
+
4. **决策节点**:每个 Decision after 非空的 stage 后绑定 post-step gate(`decision_ref: "<gate>"`)+ 对应 `decision_points` 条目;该 stage 的 Run 先完成并封存,随后必须 `run decide`,gate resolve 前不得派发下一 step。
|
|
56
|
+
5. **goal-audit 插入**:有 `task_decomposition` 时,在最后一个 evidence-producing stage 后、`session-complete` 前插入 `post-goal-audit`。
|
|
57
|
+
5.5. **re-grounding 插入**:有 decomposition 且执行 step ≥3 → 从第 3 个执行 step 起每隔 3 个插入 `post-reground`(不与已有 quality-gate 相邻)。
|
|
58
|
+
6. **终点硬约束**:当前 Session 的 chain 以 `session-complete`(decision:post-execution) 结尾;standalone read-only 分析以最后一个质量门结尾。`evolve session complete` 完成 Session 身份,不销毁它(可 `unarchive` 再扩展)。
|
|
59
|
+
7. **goal_ref 传播**:有 decomposition 时,每个 step 按 `stage ∈ goal.lifecycle` 匹配 `goal_ref`。
|
|
60
|
+
8. **占位符**:`{session}` `{intent}` 由运行时替换。
|
|
61
|
+
9. **Skill 名预校验**:用 `evolve skills` 列出内置步骤,逐个执行 `evolve skills validate <command>` 核对目标项目提交中的契约。未通过校验时报告 E005,先解决步骤绑定问题。
|
|
62
|
+
10. **step 形态**:Session chain step 仅 `command/args?/stage?/goal_ref?/retry_max?/decision_ref?`。chain definition 是 `evolve-session/1.0` 状态的一部分(`session open --chain` / `session chain insert`),不得作为任何独立 Execution/lifecycle 状态持久化。
|
|
63
|
+
11. **scope_verdict gating**(起点 = analyze-macro 时):
|
|
64
|
+
- `large` + `wants_roadmap` → 保留 roadmap + analyze;plan 用 `--session`
|
|
65
|
+
- 其余 → 跳过 roadmap + analyze;plan 用 `--from analyze:{id}`
|
|
66
|
+
- `unknown` → 默认 standalone,由 `post-analyze-scope` 决策纠正
|
|
67
|
+
12. **--from 自动注入**:
|
|
68
|
+
- `analyze_macro_id` + roadmap → `--from analyze:{id}`
|
|
69
|
+
- `analyze_macro_id` + standalone plan → `--from analyze:{id}`
|
|
70
|
+
- `blueprint_id` + plan → `--from blueprint:{id}`(优先级低于 `--session`)
|
|
71
|
+
- Session 内来源由 Run upstream 审计,不复制到 args
|
|
72
|
+
13. **动态插入步骤**同样应用规则 7-12。
|
|
73
|
+
|
|
74
|
+
## Decision Gate 分类与评估
|
|
75
|
+
|
|
76
|
+
每个 decision step 按 `decision_ref` 分为 5 类,各类由不同的评估方法处理:
|
|
77
|
+
|
|
78
|
+
| 类型 | decision_ref | 评估方法 | 读取文件 |
|
|
79
|
+
|------|-------------|---------|----------|
|
|
80
|
+
| quality-gate | post-execute | A_AGENT_EVALUATE | verification.json |
|
|
81
|
+
| quality-gate | post-business-test | A_AGENT_EVALUATE | .tests/auto-test/report.json |
|
|
82
|
+
| quality-gate | post-review | A_AGENT_EVALUATE | review.json |
|
|
83
|
+
| quality-gate | post-test | A_AGENT_EVALUATE | uat.md, .tests/test-results.json |
|
|
84
|
+
| quality-gate | post-frontend-verify | A_AGENT_EVALUATE | e2e-results.json |
|
|
85
|
+
| goal-gate | post-goal-audit | A_AGENT_GOAL_AUDIT | session.json goals + evidence |
|
|
86
|
+
| scope-gate | post-analyze-scope | A_SCOPE_EVALUATE | analyze conclusions.scope_verdict |
|
|
87
|
+
| reground-gate | post-reground | A_AGENT_REGROUND | intent + handoffs + goals |
|
|
88
|
+
| structural | post-execution | A_STRUCTURAL_EVALUATE | 全量核验(exact Session、Runs sealed + chain terminal) |
|
|
89
|
+
| structural | post-debug-escalate | A_PAUSE_ESCALATE | —(始终 escalate,阻止链推进;无 paused 状态) |
|
|
90
|
+
|
|
91
|
+
### Evaluator 输出格式(quality-gate / goal-gate / reground)
|
|
92
|
+
|
|
93
|
+
```text
|
|
94
|
+
---VERDICT---
|
|
95
|
+
STATUS: proceed|fix|escalate|PASS|FAIL|PARTIAL|BLOCKED|aligned|drifted|all_met|has_unmet
|
|
96
|
+
REASON: <一句话原因>
|
|
97
|
+
CONFIDENCE: high|medium|low
|
|
98
|
+
CONFIDENCE_SCORE: 0-100
|
|
99
|
+
---END---
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Goal Audit 详细流程(post-goal-audit)
|
|
103
|
+
|
|
104
|
+
1. 读取 `orchestration.decomposition.goals` 中 status≠done 的子目标
|
|
105
|
+
2. 打开 evidence 产物,对照 `done_when` 严格判定 met/unmet
|
|
106
|
+
3. 对照 intent + definition_of_done 判定意图保真
|
|
107
|
+
4. 结果路由:
|
|
108
|
+
- `has_unmet` → **fix loop**:按 `target_stage` 插入修复 step(由 Skill proposal 产生)
|
|
109
|
+
- `all_met` + `INTENT_ALIGNED=true` → proceed → session complete
|
|
110
|
+
- `all_met` + `INTENT_ALIGNED=false` → **REGROUND_HALT**(即使 -y)
|
|
111
|
+
|
|
112
|
+
### Reground 详细流程(post-reground)
|
|
113
|
+
|
|
114
|
+
1. 读取 intent + boundary_contract + 已完成 steps 的 handoff + 已 done goals
|
|
115
|
+
2. 判定累积产出是否仍服务 intent
|
|
116
|
+
3. 结果路由:
|
|
117
|
+
- `aligned` → proceed
|
|
118
|
+
- `drifted` + confidence ≥ 60 → **REGROUND_HALT**(-y 不跳过)
|
|
119
|
+
- `drifted` + confidence < 60 → proceed(标记 LOW CONFIDENCE)
|
|
120
|
+
|
|
121
|
+
### Scope Verdict 应用(post-analyze-scope)
|
|
122
|
+
|
|
123
|
+
1. 读取 macro analyze 的 `conclusions.scope_verdict`(large/medium/small/unknown)
|
|
124
|
+
2. 写入当前 Session 的 scope_verdict + analyze_macro_id
|
|
125
|
+
3. 路由:
|
|
126
|
+
- `large` + wants_roadmap → 保留 roadmap + analyze;plan 用 `--session`
|
|
127
|
+
- 其余 → 跳过 roadmap + analyze;plan 用 `--from analyze:{id}`
|
|
128
|
+
- `unknown` → 默认 standalone,询问用户(-y 不猜测)
|
|
129
|
+
|
|
130
|
+
### Post-Execution Preflight(post-execution)
|
|
131
|
+
|
|
132
|
+
1. 只读核验 exact `session_id + orchestration_revision`:所有 Run 已 sealed、chain terminal(completed/skipped with evidence)、无 open decision gate、goal audit 已通过。
|
|
133
|
+
2. preflight clean -> verdict=proceed -> 通过当前 locator/revision 调用 `evolve run decide <post-execution> ... --verdict proceed --json`,消费新的 `Evolve mutation receipt` fence,然后调用 `evolve session complete ... --json`。
|
|
134
|
+
3. preflight blocking -> verdict=fix + 精确 blocker;Session 保持 open,不得完成 Session 或报告整体完成。
|
|
135
|
+
|
|
136
|
+
## Chain Definition 格式
|
|
137
|
+
|
|
138
|
+
定义交给 Evolve Session。保留 Session ID 和最新修订号,并为每次变更提供 actor。
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"intent": "<intent>",
|
|
143
|
+
"engine": "evolve",
|
|
144
|
+
"quality_mode": "standard",
|
|
145
|
+
"auto_mode": false,
|
|
146
|
+
"boundary_contract": {
|
|
147
|
+
"in_scope": [], "out_of_scope": [], "constraints": [], "definition_of_done": ""
|
|
148
|
+
},
|
|
149
|
+
"steps": [
|
|
150
|
+
{ "command": "ew-analyze", "args": "--session {session}", "stage": "analyze", "goal_ref": "G1", "retry_max": 1 },
|
|
151
|
+
{ "command": "post-execute", "stage": "execute", "decision_ref": "post-execute" },
|
|
152
|
+
{ "command": "ew-execute", "args": "--session {session}", "stage": "execute", "goal_ref": "G1", "retry_max": 2 }
|
|
153
|
+
],
|
|
154
|
+
"decision_points": [
|
|
155
|
+
{ "point_id": "post-execute", "max_retries": 2 }
|
|
156
|
+
],
|
|
157
|
+
"decomposition": {
|
|
158
|
+
"goals": [
|
|
159
|
+
{ "id": "G1", "goal": "...", "done_when": "...", "lifecycle": ["execute", "review"], "status": "pending" }
|
|
160
|
+
]
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
新运行时创建顺序:`evolve session open "{intent}" --id {slug} [--definition-of-done ...] [--chain <commands...>] --participant ... --actor ... --request-id ... --reason ... --json` -> `session chain insert` 补齐 step 元数据(goal_ref/stage/decision_ref)-> `evolve run next` 派发首个 step。chain 是 `evolve-session/1.0` 状态的一部分,不存在独立的 Execution bootstrap surface。
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Evolve Companion 内部路由
|
|
2
|
+
|
|
3
|
+
Companion 是 Evolve 内部的轻量执行通道。它使用同一套 Session/Run 生命周期,只省略不需要的多阶段分解、额外决策门和下游工件交接。它不是独立 Skill,也不创建第二套执行协议。
|
|
4
|
+
|
|
5
|
+
## 适用条件
|
|
6
|
+
|
|
7
|
+
以下条件必须同时满足。
|
|
8
|
+
|
|
9
|
+
- 任务目标具体、边界明确,包含文件、函数、错误或可直接定位的操作对象。
|
|
10
|
+
- 只有一个关注点,执行方式可以直接判断,不需要架构或方案选择。
|
|
11
|
+
- 不需要下游步骤消费类型化工件。
|
|
12
|
+
- 不需要独立决策门、长链恢复或多轮质量循环。
|
|
13
|
+
- 完成条件可以通过直接检查、测试或命令结果验证。
|
|
14
|
+
|
|
15
|
+
文件数量不决定是否使用 Companion。任务一旦出现根因不明、需要协调多个阶段、需要新的计划工件或需要独立审查,就回到 Evolve 的 `ew-analyze`、`ew-plan`、`ew-execute` 和 `ew-review` 路由。
|
|
16
|
+
|
|
17
|
+
## 最小生命周期
|
|
18
|
+
|
|
19
|
+
1. 读取通用 Run 规则和本文件,记录任务边界、目标文件和完成条件。
|
|
20
|
+
2. 通过 `evolve capabilities --json` 校验 Session/Run 能力。
|
|
21
|
+
3. 创建一条只有 `ew-companion` 步骤的 Session 链。
|
|
22
|
+
|
|
23
|
+
```text
|
|
24
|
+
evolve session open "<intent>" --id <slug> --actor <actor> --json
|
|
25
|
+
evolve session chain insert --session <session-id> --step-id companion-1 --command ew-companion --arg "<intent>" --actor <actor> --expected-orchestration-revision <revision> --json
|
|
26
|
+
evolve run next --session <session-id> --actor <actor> --expected-orchestration-revision <revision> --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
4. 使用 `run next` 返回的 `task`、`continuation`、Run 定位和修订号。按共享循环执行准备、操作、检查和完成。
|
|
30
|
+
5. 将最小证据追加到 `{run_dir}/evidence/companion-log.md`,记录目标、关键发现、执行结果和验证命令。
|
|
31
|
+
6. 通过 `evolve run complete --advance --verdict done|done_with_concerns` 完成 Run,再用 `evolve session complete` 完成终态 Session。
|
|
32
|
+
|
|
33
|
+
Companion 不修改 `session.json`、`run.json` 或其他协议状态文件。所有状态变更都经过 Runtime 的受控命令。`-y` 只跳过低风险任务确认,不授予 Wiki 发布或 Skill 修改授权。
|
|
34
|
+
|
|
35
|
+
## 执行规则
|
|
36
|
+
|
|
37
|
+
- 先读取目标和相邻实现,确认边界后再修改。
|
|
38
|
+
- 复用现有模式,保持修改集中,不为轻量任务扩大范围。
|
|
39
|
+
- 每个关键动作都保留可回查的文件、命令或测试证据。
|
|
40
|
+
- 任务失败时先检查是否属于可恢复的执行错误。需要新的方法或新的证据时,按共享 Run 恢复规则处理。
|
|
41
|
+
- 发现任务不再满足适用条件时停止 Companion 执行,把新的边界和已收集证据交回 Evolve 重新分类。
|
|
42
|
+
- Session 完成后按 [知识路由](knowledge-route.md) 处理证据和候选。候选可以为零。
|
|
43
|
+
|
|
44
|
+
## 退出与升级
|
|
45
|
+
|
|
46
|
+
| 发现 | 处理 |
|
|
47
|
+
| --- | --- |
|
|
48
|
+
| 目标不明确或缺少完成条件 | 回到 Evolve 分类并请求必要信息 |
|
|
49
|
+
| 需要调查根因或跨模块分析 | 路由到 `ew-analyze` |
|
|
50
|
+
| 需要拆解任务或产出计划 | 路由到 `ew-plan` |
|
|
51
|
+
| 需要多阶段实现和验证 | 路由到 `ew-execute`,必要时追加 `ew-review` |
|
|
52
|
+
| 需要长期迭代、全面审计或并行协作 | 转交对应的 Odyssey 或 Swarm 入口 |
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Evolve chain catalog
|
|
2
|
+
|
|
3
|
+
Match the intent to the smallest Evolve chain that can produce and verify the requested result. Confirm the boundary, completion criteria and required handoffs before opening the Session. The execution guide owns dispatch and recovery.
|
|
4
|
+
|
|
5
|
+
| Intent | Route |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| Mechanically clear operation with a direct check | ew-companion |
|
|
8
|
+
| Explore alternatives or challenge a proposal | ew-brainstorm → ew-analyze when scope evidence is needed |
|
|
9
|
+
| Investigate behavior or evaluate existing code | ew-analyze |
|
|
10
|
+
| Produce requirements, a roadmap or an implementation plan | ew-brainstorm or ew-analyze → ew-plan |
|
|
11
|
+
| Implement or refactor with known scope | ew-plan → ew-execute → ew-review |
|
|
12
|
+
| Inspect changes or verify a completed implementation | ew-review |
|
|
13
|
+
| Design, fix and verify a UI change | ew-analyze → ew-plan → ew-execute → ew-review, or the explicit Odyssey UI mode |
|
|
14
|
+
| Diagnose a defect, verify the fix and look for related cases | Explicit Odyssey Debug mode |
|
|
15
|
+
| Audit quality, supply-chain risk or defensive fallbacks | Explicit Odyssey mode appropriate to the audit |
|
|
16
|
+
| Explore and score multiple search paths | team-swarm when the user requests a Swarm |
|
|
17
|
+
| Analyze and fix a tracked issue | ew-analyze --gaps → ew-plan --gaps → ew-execute → ew-review. Keep the issue ID in the task and update its tracker after verification. |
|
|
18
|
+
| Create, list or close tracking items | Use the project's issue tracker with the user's authorization. |
|
|
19
|
+
| View progress or continue | Read evolve session list or evolve session status; resume the exact Session. |
|
|
20
|
+
| Query, review or harvest knowledge | Follow the internal [knowledge route](knowledge-route.md). |
|
|
21
|
+
| Rebuild the project code index | agent-memory code build |
|
|
22
|
+
| Provision Skill packages | evolve skills install |
|
|
23
|
+
| Create or merge a requested worktree | Use Git worktree and merge operations in the selected repository. |
|
|
24
|
+
|
|
25
|
+
Use evolve skills validate for each selected step. A project-provided step can participate when it is committed and declares its Skill contract. Record step arguments with the chain so the next host resumes the same task.
|
|
26
|
+
|
|
27
|
+
Resolve a phase or issue from the user's exact identifier, the chosen Session or the project tracker. Carry `goal_ref` on long-chain steps and add an explicit decision wherever verification needs a coordinator verdict. After the Session completes, process reusable evidence through the knowledge route.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
<!-- session-mode: inherited -->
|
|
2
|
+
|
|
3
|
+
Read the [Run loop](orchestrator-run-loop.md) when resuming the Session after the amendment.
|
|
4
|
+
# Evolve Goal Long-Chain Flow
|
|
5
|
+
|
|
6
|
+
Under `evolve-session/1.0`, goal, boundary, decomposition and pending-tail changes belong to the Session chain and this Evolve policy. They never become a separate Execution or durable Session metadata command. Runs advance through fenced `evolve run next` and `evolve run complete`.
|
|
7
|
+
|
|
8
|
+
## 1. Capability and Snapshot
|
|
9
|
+
|
|
10
|
+
1. Read the Evolve capability receipt and retain the Session ID and current revision.
|
|
11
|
+
2. Resolve exactly one compatible Session through read-only recall, then read `evolve session status --session {session_id} --json`.
|
|
12
|
+
3. Retain exact `session_id + orchestration_revision` (plus `run_revision` for run-target mutations) and one authorized `actor_id`; pass it to `--actor` (`--participant` defaults to it). Never infer current authority from Session status.
|
|
13
|
+
4. Snapshot current Session objective, completion criteria, sealed Run handoffs, pending chain, decisions and revision. Apply amendments to an open Session.
|
|
14
|
+
|
|
15
|
+
## 2. Parse and Assess
|
|
16
|
+
|
|
17
|
+
Use remaining `--amend` text as `change_request`; ask when empty. Classify `modify|add|remove|boundary` and derive affected goals, invalidated steps, new gaps, boundary additions, risk, reason, and evidence.
|
|
18
|
+
|
|
19
|
+
Assessment is read-only. Completed Run evidence remains immutable. High risk always requires explicit confirmation; `-y` cannot bypass it.
|
|
20
|
+
|
|
21
|
+
## 3. Build the Pending-Tail Chain Change
|
|
22
|
+
|
|
23
|
+
Construct the pending-tail chain change in memory:
|
|
24
|
+
|
|
25
|
+
- Append one `CHG-NNN` entry with before/after goals, reason, risk, and evidence.
|
|
26
|
+
- Supersede only unfinished affected goals; completed goals remain immutable evidence.
|
|
27
|
+
- Give modified goals versioned IDs and added goals the next `G{n}` ID.
|
|
28
|
+
- Add boundaries without deleting historical constraints.
|
|
29
|
+
- Preserve the chain step shape: `command/args?/stage?/goal_ref?/decision_ref?`.
|
|
30
|
+
|
|
31
|
+
Do not edit protocol JSON or issue direct chain mutations from a Skill. The orchestrator applies the pending-tail change through the fenced chain surface after Skill assessment:
|
|
32
|
+
|
|
33
|
+
`evolve session chain replace --session {session_id} --step-id <id> --command <name> --actor {actor_id} --expected-orchestration-revision {orchestration_revision} --json`
|
|
34
|
+
|
|
35
|
+
or `evolve session chain insert --session {session_id} --step-id <id> --command <name> [--arg <value> ...] [--after-step <id>] [--goal-ref <id>] [--stage <name>] [--decision-ref <id>] --actor {actor_id} --expected-orchestration-revision {orchestration_revision} --json` for added steps. Skipping a non-running step uses the fully fenced `session chain skip` form with evidence.
|
|
36
|
+
|
|
37
|
+
## 4. Commit the Amendment
|
|
38
|
+
|
|
39
|
+
After confirmation, record the new objective and completion criteria with `evolve session amend "<objective>" --definition-of-done "<criteria>" --session <session> --actor <actor> --expected-orchestration-revision <revision> --evidence <confirmation>`. Apply the approved pending-tail changes and dispatch with the current fence:
|
|
40
|
+
|
|
41
|
+
`evolve run next --session {session_id} --actor {actor_id} --expected-orchestration-revision {orchestration_revision} --json`
|
|
42
|
+
|
|
43
|
+
and complete it with:
|
|
44
|
+
|
|
45
|
+
`evolve run complete {run_id} --session {session_id} --actor {actor_id} --expected-orchestration-revision {orchestration_revision} --expected-run-revision {run_revision} --verdict {done|done_with_concerns} --advance --json`
|
|
46
|
+
|
|
47
|
+
Runtime must atomically validate and seal the Run plus advance the chain step and return `Evolve mutation receipt`. Consume its fresh `orchestration_revision` before continuing. Reject by recording a blocking concern; revise by re-reading `evolve session status` and applying another fenced chain mutation.
|
|
48
|
+
|
|
49
|
+
If the installed Runtime cannot express the complete goal/decomposition replacement as a Session-chain pending-tail change, stop with a capability blocker. Do not silently call a Session metadata command in the canonical branch.
|
|
50
|
+
|
|
51
|
+
## 5. Continue
|
|
52
|
+
|
|
53
|
+
Display amendment ID, risk, superseded/added goal counts, and chain disposition. Re-read exact `evolve session status`, then continue through fenced `evolve run next`. Recovery reads `evolve run check {run_id} --session {session_id} --json` and transitions/cancels the stuck Run; final completion remains `evolve session complete`.
|