aes-cli 0.2.0__py3-none-any.whl

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 (48) hide show
  1. aes/__init__.py +5 -0
  2. aes/__main__.py +37 -0
  3. aes/analyzer.py +487 -0
  4. aes/commands/__init__.py +0 -0
  5. aes/commands/init.py +727 -0
  6. aes/commands/inspect.py +204 -0
  7. aes/commands/install.py +379 -0
  8. aes/commands/publish.py +432 -0
  9. aes/commands/search.py +65 -0
  10. aes/commands/status.py +153 -0
  11. aes/commands/sync.py +413 -0
  12. aes/commands/validate.py +77 -0
  13. aes/config.py +43 -0
  14. aes/domains.py +1382 -0
  15. aes/frameworks.py +522 -0
  16. aes/mcp_server.py +213 -0
  17. aes/registry.py +294 -0
  18. aes/scaffold/agent.yaml.jinja +135 -0
  19. aes/scaffold/agentignore.jinja +61 -0
  20. aes/scaffold/instructions.md.jinja +311 -0
  21. aes/scaffold/local.example.yaml.jinja +35 -0
  22. aes/scaffold/local.yaml.jinja +29 -0
  23. aes/scaffold/operations.md.jinja +33 -0
  24. aes/scaffold/orchestrator.md.jinja +95 -0
  25. aes/scaffold/permissions.yaml.jinja +151 -0
  26. aes/scaffold/setup.md.jinja +244 -0
  27. aes/scaffold/skill.md.jinja +27 -0
  28. aes/scaffold/skill.yaml.jinja +175 -0
  29. aes/scaffold/workflow.yaml.jinja +44 -0
  30. aes/scaffold/workflow_command.md.jinja +48 -0
  31. aes/schemas/agent.schema.json +188 -0
  32. aes/schemas/permissions.schema.json +100 -0
  33. aes/schemas/registry.schema.json +72 -0
  34. aes/schemas/skill.schema.json +209 -0
  35. aes/schemas/workflow.schema.json +92 -0
  36. aes/targets/__init__.py +29 -0
  37. aes/targets/_base.py +77 -0
  38. aes/targets/_composer.py +338 -0
  39. aes/targets/claude.py +153 -0
  40. aes/targets/copilot.py +48 -0
  41. aes/targets/cursor.py +46 -0
  42. aes/targets/windsurf.py +46 -0
  43. aes/validator.py +394 -0
  44. aes_cli-0.2.0.dist-info/METADATA +110 -0
  45. aes_cli-0.2.0.dist-info/RECORD +48 -0
  46. aes_cli-0.2.0.dist-info/WHEEL +5 -0
  47. aes_cli-0.2.0.dist-info/entry_points.txt +3 -0
  48. aes_cli-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,244 @@
1
+ {% if domain_config %}
2
+ # Command: /setup
3
+
4
+ Review and customize .agent/ configuration for your project.
5
+ Your `.agent/` directory was initialized with **{{ domain }}** domain defaults. This command helps you tailor the pre-filled content to your specific project.
6
+
7
+ ## Phase 0: Detect Context
8
+
9
+ Determine which path to follow:
10
+ - **If source files exist** (src/, lib/, app/, or language-specific code) → **Codebase path**: read code to refine the pre-filled config
11
+ - **If the project is empty** (no source code, only .agent/) → **Interview path**: ask the user what they're building to customize the config
12
+
13
+ All subsequent phases note both approaches where they differ.
14
+
15
+ ## Phase 1: Understand the Project
16
+
17
+ **Codebase path:**
18
+ 1. Read README.md, package config (pyproject.toml / package.json / go.mod / Cargo.toml)
19
+ 2. List top-level directories — identify: source code, tests, config, scripts, docs
20
+ 3. Identify framework and key dependencies
21
+ 4. Note entry point(s) and build system
22
+
23
+ **Interview path:**
24
+ 1. Ask: "What are you building? (1-2 sentences)"
25
+ 2. Ask: "What's the tech stack? (language, framework, database, deployment target)"
26
+ 3. Based on complexity of answers, optionally ask:
27
+ - "What are the main operations this system performs?"
28
+ - "What entities does it manage and what are their lifecycle states?"
29
+ - "Any security constraints, resource limits, or team conventions?"
30
+ Stop asking when you have enough to generate useful content.
31
+
32
+ ## Phase 2: Refine Instructions
33
+
34
+ Edit `.agent/instructions.md` — review and customize the pre-filled content:
35
+ 1. **Description**: verify the project purpose matches your actual system
36
+ 2. **Quick Reference**: update commands to match your actual scripts and tools
37
+ - Codebase: extract from package scripts / Makefile / CI config
38
+ - Interview: confirm with user
39
+ 3. **Project Structure**: update directory tree to match reality
40
+ - Codebase: run directory listing, annotate key dirs
41
+ - Interview: describe planned structure
42
+ 4. **Critical Rules**: add project-specific constraints
43
+ - Codebase: extract from linter configs, CI checks, README, code comments
44
+ - Interview: ask about language version, security requirements
45
+ 5. **Primary Workflow**: adjust phases to match your actual dev cycle
46
+ 6. **Gotchas**: add project-specific hard-won lessons
47
+ - Codebase: look for workarounds in comments, error-prone patterns
48
+ - Interview: ask "anything that's bitten you before?"
49
+
50
+ ## Phase 3: Review Skills
51
+
52
+ Skills have been pre-populated for the **{{ domain }}** domain. For each skill in `skills/`:
53
+ 1. Review the `.skill.yaml` manifest — verify inputs, outputs, and triggers match your system
54
+ 2. Review the `.md` runbook — customize the decision tree and error handling
55
+ 3. Add any missing skills specific to your project
56
+ 4. Remove any pre-filled skills that don't apply
57
+ 5. Update `skills/ORCHESTRATOR.md` — adjust pipeline order and decision tree
58
+
59
+ ## Phase 4: Review Workflow
60
+
61
+ {% if domain_config.workflow %}
62
+ A workflow has been pre-populated: `workflows/{{ domain_config.workflow.id }}.yaml`
63
+ 1. Review the states — add, remove, or rename to match your actual entity lifecycle
64
+ 2. Review transitions — verify the flow matches your process
65
+ 3. Update `agent.yaml` if you add/remove workflows
66
+ {% else %}
67
+ No workflow was pre-populated. If your project has entities with lifecycle states:
68
+ 1. Identify the primary entity (feature, order, dataset, service, etc.)
69
+ 2. Map lifecycle states and transitions
70
+ 3. Create `workflows/{id}.yaml`
71
+ 4. Update `agent.yaml` workflows list
72
+ {% endif %}
73
+
74
+ ## Phase 5: Review Workflow Commands
75
+
76
+ Workflow commands define repeating multi-phase workflows the agent executes.
77
+ {% if domain_config.workflow_commands %}
78
+ Pre-populated for the **{{ domain }}** domain:
79
+ {% for cmd in domain_config.workflow_commands %}
80
+ - `{{ cmd.trigger }}` — `.agent/commands/{{ cmd.id }}.md`
81
+ {% endfor %}
82
+
83
+ For each command:
84
+ 1. Review the phases — verify they match your actual workflow
85
+ 2. Customize phase content with project-specific scripts, paths, and checks
86
+ 3. Add any missing commands, remove any that don't apply
87
+ 4. Update `agent.yaml` commands list if you add/remove
88
+ {% else %}
89
+ No workflow commands were pre-populated. Consider adding commands for recurring workflows:
90
+ 1. `/build` — project construction
91
+ 2. `/run` — execute primary workflow
92
+ 3. Create command files in `.agent/commands/`
93
+ 4. Register in `agent.yaml` commands list
94
+ {% endif %}
95
+
96
+ ## Phase 6: Review Permissions
97
+
98
+ Edit `.agent/permissions.yaml`:
99
+ 1. Verify **shell read** commands match your inspection tools
100
+ 2. Verify **shell execute** commands match your build/test/run tools
101
+ - Codebase: cross-reference with package scripts, Makefile
102
+ - Interview: confirm with user
103
+ 3. Verify **file write** patterns cover your source directories
104
+ 4. Add any project-specific **deny** rules (destructive commands)
105
+ 5. Add any **confirm** rules (high-impact commands like deploy, publish)
106
+ 6. Update **resource limits** if your project has compute constraints
107
+
108
+ ## Phase 7: Configure Environment
109
+
110
+ Edit `agent.yaml` environment section:
111
+ - Codebase: scan for `os.environ`, `process.env`, `.env`, `.env.example`
112
+ - Interview: ask "any API keys or config vars needed?"
113
+ List required vars and optional vars with defaults.
114
+
115
+ ## Phase 8: Validate and Sync
116
+
117
+ ```bash
118
+ aes validate
119
+ ```
120
+
121
+ Report: what was customized, any validation errors to fix.
122
+
123
+ ```bash
124
+ aes sync
125
+ ```
126
+
127
+ Re-sync to update tool-specific config files (CLAUDE.md, .cursorrules, etc.) with your changes.
128
+ {% else %}
129
+ # Command: /setup
130
+
131
+ Populate .agent/ configuration by analyzing the codebase or interviewing the user.
132
+ Run this after `aes init` to replace placeholder content with real project-specific config.
133
+
134
+ ## Phase 0: Detect Context
135
+
136
+ Determine which path to follow:
137
+ - **If source files exist** (src/, lib/, app/, or language-specific code) → **Codebase path**: read code to extract project knowledge
138
+ - **If the project is empty** (no source code, only .agent/) → **Interview path**: ask the user what they're building
139
+
140
+ All subsequent phases note both approaches where they differ.
141
+
142
+ ## Phase 1: Understand the Project
143
+
144
+ **Codebase path:**
145
+ 1. Read README.md, package config (pyproject.toml / package.json / go.mod / Cargo.toml)
146
+ 2. List top-level directories — identify: source code, tests, config, scripts, docs
147
+ 3. Identify framework and key dependencies
148
+ 4. Note entry point(s) and build system
149
+
150
+ **Interview path:**
151
+ 1. Ask: "What are you building? (1-2 sentences)"
152
+ 2. Ask: "What's the tech stack? (language, framework, database, deployment target)"
153
+ 3. Based on complexity of answers, optionally ask:
154
+ - "What are the main operations this system performs?"
155
+ - "What entities does it manage and what are their lifecycle states?"
156
+ - "Any security constraints, resource limits, or team conventions?"
157
+ Stop asking when you have enough to generate useful content.
158
+
159
+ ## Phase 2: Fill Instructions
160
+
161
+ Edit `.agent/instructions.md` — replace all `<!-- AGENT: -->` comments:
162
+ 1. **Description**: project purpose and primary constraints
163
+ 2. **Quick Reference**: 3-5 most common commands
164
+ - Codebase: extract from package scripts / Makefile / CI config
165
+ - Interview: ask user or infer from tech stack
166
+ 3. **Project Structure**: annotated directory tree
167
+ - Codebase: run directory listing, annotate key dirs
168
+ - Interview: describe planned structure
169
+ 4. **Critical Rules**: 3-5 inviolable constraints
170
+ - Codebase: extract from linter configs, CI checks, README, code comments
171
+ - Interview: ask about language version, security requirements, conventions
172
+ 5. **Primary Workflow**: 3-5 phases of the typical dev cycle
173
+ 6. **Gotchas**: hard-won lessons
174
+ - Codebase: look for workarounds in comments, error-prone patterns
175
+ - Interview: ask "anything that's bitten you before?"
176
+
177
+ ## Phase 3: Define Skills (if skills/ exists)
178
+
179
+ **Codebase path:** Identify major operations from: CLI commands, API endpoints, scripts/, pipeline stages, scheduled jobs. Each becomes a skill.
180
+
181
+ **Interview path:** Ask "What are the 2-4 main things this system does?" Each answer becomes a skill.
182
+
183
+ For each skill:
184
+ 1. Create `skills/{id}.skill.yaml` — inputs, outputs, trigger command, error strategy, code location
185
+ 2. Create `skills/{id}.md` runbook — purpose, how it works, decision tree, error handling
186
+ 3. Update `agent.yaml` skills list
187
+ 4. Fill `skills/ORCHESTRATOR.md` — pipeline order, status flow, decision tree
188
+
189
+ ## Phase 4: Define Workflow (if workflows/ exists)
190
+
191
+ 1. Identify the primary entity (feature, order, dataset, service, etc.)
192
+ - Codebase: look for status columns, enums, state machines
193
+ - Interview: ask "what's the main thing that moves through your system?"
194
+ 2. Map lifecycle states and transitions
195
+ 3. Create `workflows/{id}.yaml`
196
+ 4. Update `agent.yaml` workflows list
197
+
198
+ ## Phase 5: Define Workflow Commands
199
+
200
+ Workflow commands define repeating multi-phase workflows the agent executes (e.g. `/build`, `/run`).
201
+
202
+ If commands exist in `.agent/commands/` (besides `setup.md`):
203
+ 1. Review each command's phases — verify they match your actual workflow
204
+ 2. Customize phase content with project-specific scripts, paths, and checks
205
+
206
+ If no workflow commands exist, consider adding:
207
+ 1. `/build` — project construction (structure, modules, tests)
208
+ 2. `/run` — execute primary workflow end-to-end
209
+ 3. Create command files in `.agent/commands/`
210
+ 4. Register in `agent.yaml` commands list
211
+
212
+ ## Phase 6: Set Permissions
213
+
214
+ Edit `.agent/permissions.yaml`:
215
+ 1. **Shell read**: inspection commands (git, ls, status)
216
+ 2. **Shell execute**: work commands (build, test, run)
217
+ - Codebase: extract from package scripts, Makefile
218
+ - Interview: infer from tech stack
219
+ 3. **File write**: source directories the agent should modify
220
+ 4. **Deny**: destructive commands (rm -rf, DROP, force-push)
221
+ 5. **Confirm**: high-impact commands (deploy, publish, push)
222
+ 6. **Resource limits**: if the project has compute constraints
223
+
224
+ ## Phase 7: Configure Environment
225
+
226
+ Edit `agent.yaml` environment section:
227
+ - Codebase: scan for `os.environ`, `process.env`, `.env`, `.env.example`
228
+ - Interview: ask "any API keys or config vars needed?"
229
+ List required vars and optional vars with defaults.
230
+
231
+ ## Phase 8: Validate and Sync
232
+
233
+ ```bash
234
+ aes validate
235
+ ```
236
+
237
+ Report: what was generated, how many skills/states/rules, any validation errors to fix.
238
+
239
+ ```bash
240
+ aes sync
241
+ ```
242
+
243
+ Re-sync to update tool-specific config files (CLAUDE.md, .cursorrules, etc.) with your changes.
244
+ {% endif %}
@@ -0,0 +1,27 @@
1
+ # Skill: {{ skill.name }}
2
+
3
+ ## Purpose
4
+
5
+ {{ skill.runbook_purpose }}
6
+
7
+ ## When to Run
8
+
9
+ {{ skill.runbook_when }}
10
+
11
+ ## How It Works
12
+
13
+ {{ skill.runbook_how }}
14
+
15
+ ## Decision Tree
16
+
17
+ ```
18
+ {{ skill.runbook_decision_tree }}
19
+ ```
20
+
21
+ ## Error Handling
22
+
23
+ {{ skill.runbook_error_handling }}
24
+
25
+ ## Code Location
26
+
27
+ - Primary: `{{ skill.code_primary }}`
@@ -0,0 +1,175 @@
1
+ {% if skill %}
2
+ # .agent/skills/{{ skill.id }}.skill.yaml
3
+ aes_skill: "1.0"
4
+
5
+ id: "{{ skill.id }}"
6
+ name: "{{ skill.name }}"
7
+ version: "{{ skill.version }}"
8
+ description: "{{ skill.description }}"
9
+ {% if skill.negative_triggers %}
10
+ negative_triggers:
11
+ {% for nt in skill.negative_triggers %} - "{{ nt }}"
12
+ {% endfor %}{% endif %}
13
+ {% if skill.activation != "explicit" %}
14
+ activation: "{{ skill.activation }}"
15
+ {% endif %}
16
+
17
+ stage: {{ skill.stage }}
18
+ phase: "{{ skill.phase }}"
19
+
20
+ inputs:
21
+ {% if skill.inputs_required %}
22
+ required:
23
+ {% for inp in skill.inputs_required %}
24
+ - name: "{{ inp.name }}"
25
+ type: "{{ inp.type }}"
26
+ description: "{{ inp.description }}"
27
+ {% endfor %}
28
+ {% else %}
29
+ required: []
30
+ {% endif %}
31
+ {% if skill.inputs_optional %}
32
+ optional:
33
+ {% for inp in skill.inputs_optional %}
34
+ - name: "{{ inp.name }}"
35
+ type: "{{ inp.type }}"
36
+ {% if inp.default is defined %}
37
+ default: {{ inp.default }}
38
+ {% endif %}
39
+ description: "{{ inp.description }}"
40
+ {% endfor %}
41
+ {% else %}
42
+ optional: []
43
+ {% endif %}
44
+ {% if skill.inputs_environment %}
45
+ environment:
46
+ {% for env in skill.inputs_environment %}
47
+ - "{{ env }}"
48
+ {% endfor %}
49
+ {% else %}
50
+ environment: []
51
+ {% endif %}
52
+
53
+ {% if skill.outputs %}
54
+ outputs:
55
+ {% for out in skill.outputs %}
56
+ - name: "{{ out.name }}"
57
+ type: "{{ out.type }}"
58
+ description: "{{ out.description }}"
59
+ {% endfor %}
60
+ {% else %}
61
+ outputs: []
62
+ {% endif %}
63
+
64
+ prerequisites: []
65
+
66
+ triggers:
67
+ - type: "manual"
68
+ command: "{{ skill.trigger_command }}"
69
+
70
+ error_handling:
71
+ strategy: "{{ skill.error_strategy }}"
72
+ {% if skill.allowed_tools %}
73
+
74
+ allowed_tools:
75
+ {% if skill.allowed_tools.shell is defined %} shell: {{ skill.allowed_tools.shell | lower }}
76
+ {% endif %}{% if skill.allowed_tools.files is defined %} files:
77
+ {% if skill.allowed_tools.files.read is defined %}{% if skill.allowed_tools.files.read is sameas true or skill.allowed_tools.files.read is sameas false %} read: {{ skill.allowed_tools.files.read | lower }}
78
+ {% else %} read:
79
+ {% for p in skill.allowed_tools.files.read %} - "{{ p }}"
80
+ {% endfor %}{% endif %}{% endif %}{% if skill.allowed_tools.files.write is defined %}{% if skill.allowed_tools.files.write is sameas true or skill.allowed_tools.files.write is sameas false %} write: {{ skill.allowed_tools.files.write | lower }}
81
+ {% else %} write:
82
+ {% for p in skill.allowed_tools.files.write %} - "{{ p }}"
83
+ {% endfor %}{% endif %}{% endif %}{% endif %}{% if skill.allowed_tools.network is defined %} network: {{ skill.allowed_tools.network | lower }}
84
+ {% endif %}{% if skill.allowed_tools.mcp_servers is defined %} mcp_servers:
85
+ {% for srv in skill.allowed_tools.mcp_servers %} - "{{ srv }}"
86
+ {% endfor %}{% endif %}{% endif %}
87
+
88
+ code:
89
+ primary: "{{ skill.code_primary }}"
90
+ {% if skill.depends_on %}
91
+
92
+ depends_on:
93
+ {% for dep in skill.depends_on %}
94
+ - "{{ dep }}"
95
+ {% endfor %}
96
+ {% endif %}
97
+ {% if skill.blocks %}
98
+ blocks:
99
+ {% for b in skill.blocks %}
100
+ - "{{ b }}"
101
+ {% endfor %}
102
+ {% endif %}
103
+
104
+ tags:
105
+ {% for tag in skill.tags %}
106
+ - "{{ tag }}"
107
+ {% endfor %}
108
+ {% else %}
109
+ # .agent/skills/{{ skill_id }}.skill.yaml
110
+ aes_skill: "1.0"
111
+
112
+ id: "{{ skill_id }}"
113
+ name: "{{ skill_name }}"
114
+ version: "1.0.0"
115
+ # Description formula: [What it does] + [When to use it] + [Key capabilities]
116
+ # Example: "Discover new datasets from OpenML and Kaggle APIs. Use when the pipeline
117
+ # needs fresh data or no datasets are in discovered status. Queries multiple
118
+ # sources, deduplicates, and filters by quality criteria."
119
+ # Keep under 1024 characters. Be specific about triggers and capabilities.
120
+ # <!-- AGENT: Describe what this skill does following the formula above.
121
+ # If code exists: read the primary source file and summarize its purpose.
122
+ # If greenfield: ask the user what this operation does. -->
123
+ description: "TODO: describe what this skill does"
124
+
125
+ # Phrases describing when this skill should NOT be used (optional)
126
+ # negative_triggers:
127
+ # - "Do NOT use for manual data entry"
128
+ # - "Do NOT use when API keys are not configured"
129
+
130
+ # Activation mode: "explicit" (slash command only, default),
131
+ # "auto" (loaded when description matches), "hybrid" (both)
132
+ # activation: "explicit"
133
+
134
+ inputs:
135
+ # <!-- AGENT: Define required and optional inputs for this skill.
136
+ # If code exists: look at function signatures, CLI args, config params.
137
+ # If greenfield: ask "what does this operation need to run?" -->
138
+ required: []
139
+ optional: []
140
+ environment: []
141
+
142
+ # <!-- AGENT: Define what this skill produces.
143
+ # If code exists: look at return values, output files, side effects.
144
+ # If greenfield: ask "what does this operation produce?" -->
145
+ outputs: []
146
+
147
+ prerequisites: []
148
+
149
+ triggers:
150
+ - type: "manual"
151
+ # <!-- AGENT: Set the trigger command.
152
+ # If code exists: use the actual CLI command or script path.
153
+ # If greenfield: infer from tech stack or ask. -->
154
+ command: "# TODO: add trigger command"
155
+
156
+ error_handling:
157
+ strategy: "per-item-isolation"
158
+
159
+ # Per-skill tool permissions (optional, tool-agnostic format)
160
+ # allowed_tools:
161
+ # shell: true
162
+ # files:
163
+ # read: true
164
+ # write: ["src/**", "config/**"]
165
+ # network: true
166
+ # mcp_servers: ["fetch"]
167
+
168
+ code:
169
+ # <!-- AGENT: Set the path to the primary source file for this skill.
170
+ # If code exists: identify the main file that implements this operation.
171
+ # If greenfield: set to the planned file path. -->
172
+ primary: "# TODO: path to primary source file"
173
+
174
+ tags: []
175
+ {% endif %}
@@ -0,0 +1,44 @@
1
+ aes_workflow: "1.0"
2
+
3
+ id: "{{ workflow.id }}"
4
+ entity: "{{ workflow.entity }}"
5
+ description: "{{ workflow.description }}"
6
+
7
+ states:
8
+ {% for state in workflow.states %}
9
+ {{ state.id }}:
10
+ description: "{{ state.description }}"
11
+ {% if state.initial %}
12
+ initial: true
13
+ {% endif %}
14
+ {% if state.terminal %}
15
+ terminal: true
16
+ {% endif %}
17
+ {% if state.active %}
18
+ active: true
19
+ {% endif %}
20
+ {% endfor %}
21
+
22
+ transitions:
23
+ {% for t in workflow.transitions %}
24
+ - from: "{{ t.from_state }}"
25
+ to: "{{ t.to_state }}"
26
+ {% if t.skill %}
27
+ skill: "{{ t.skill }}"
28
+ {% endif %}
29
+ {% if t.conditions %}
30
+ conditions:
31
+ {% for c in t.conditions %}
32
+ - "{{ c }}"
33
+ {% endfor %}
34
+ {% endif %}
35
+ {% if t.on_failure %}
36
+ on_failure: "{{ t.on_failure }}"
37
+ {% endif %}
38
+ {% if t.description %}
39
+ description: "{{ t.description }}"
40
+ {% endif %}
41
+ {% endfor %}
42
+
43
+ idempotency:
44
+ pattern: "status-gated"
@@ -0,0 +1,48 @@
1
+ # Command: {{ cmd.trigger }}
2
+
3
+ {{ cmd.runbook_purpose }}
4
+
5
+ ## Worker Identity
6
+
7
+ You are the **{{ cmd.trigger }}** worker — {{ cmd.worker_specialty or cmd.description }}.
8
+
9
+ ## Memory
10
+
11
+ Before starting, read **all** of `.agent/memory/operations.md`.
12
+ Check the Activity Log for entries since your last **Read Cursor** — these are things other workers did that you haven't seen yet.
13
+ Use this context to inform your work (e.g. what `/build` constructed, what `/run` encountered, decisions made).
14
+
15
+ After each phase, append a numbered entry to the Activity Log tagged with `{{ cmd.trigger }}`:
16
+ ```
17
+ N. [{{ cmd.trigger }}] YYYY-MM-DD: what was done — outcome
18
+ ```
19
+
20
+ When done, update your **Read Cursor** in the Workers table to the last entry number.
21
+
22
+ ## Completion Check
23
+
24
+ After reading the Activity Log, check if the pipeline is already complete (all items at terminal status and no new items to process). If so:
25
+
26
+ 1. Report the current state summary (counts, statuses, last activity)
27
+ 2. Ask the user what to do:
28
+ - **Re-run**: Clear state and start the pipeline fresh
29
+ - **New session**: Start a new pipeline with new inputs
30
+ - **Re-validate**: Re-run validation only on existing artifacts
31
+ - **Exit**: Nothing to do
32
+ 3. Do NOT silently re-execute phases on a finished pipeline
33
+
34
+ ## Phases
35
+ {% for phase in cmd.runbook_phases %}
36
+
37
+ ### {{ loop.index }}. {{ phase.title }}
38
+
39
+ {{ phase.content }}
40
+ {% endfor %}
41
+
42
+ ## After Completion
43
+
44
+ 1. Update `.agent/memory/operations.md`:
45
+ - Append final entries to the Activity Log
46
+ - Update your **Read Cursor** to the last entry number
47
+ - Add any cross-cutting issues or decisions to the Issues & Decisions section
48
+ 2. Report: phases completed, items processed, errors encountered