multi-agents-cli 1.1.7 → 1.1.8
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/README.md +2 -18
- package/core/workflow/agent.js +6 -285
- package/core/workflow/complete.js +5 -141
- package/core/workflow/reset.js +21 -28
- package/core/workflow/run.js +0 -3
- package/init.js +2 -2
- package/lib/questions-flow.js +6 -14
- package/lib/steps.js +1 -13
- package/lib/ui.js +1 -9
- package/package.json +1 -1
- package/core/templates/.agents/backend/API.md +0 -270
- package/core/templates/.agents/backend/AUTH.md +0 -257
- package/core/templates/.agents/backend/DB.md +0 -268
- package/core/templates/.agents/backend/EVENTS.md +0 -264
- package/core/templates/.agents/backend/INIT.md +0 -250
- package/core/templates/.agents/backend/JOBS.md +0 -267
- package/core/templates/.agents/backend/LOGIC.md +0 -302
- package/core/templates/.agents/backend/TESTING.md +0 -277
- package/core/templates/.agents/client/ACCESSIBILITY.md +0 -277
- package/core/templates/.agents/client/FORMS.md +0 -245
- package/core/templates/.agents/client/LOGIC.md +0 -288
- package/core/templates/.agents/client/ROUTING.md +0 -246
- package/core/templates/.agents/client/TESTING.md +0 -252
- package/core/templates/.agents/client/UI.md +0 -237
- package/core/templates/.agents/shared/CLOUD.md +0 -229
- package/core/templates/.agents/shared/CLOUD_TEARDOWN.md +0 -158
- package/core/templates/.agents/shared/SECURITY.md +0 -297
- package/core/templates/.frameworks/backend/django.md +0 -55
- package/core/templates/.frameworks/backend/express.md +0 -74
- package/core/templates/.frameworks/backend/fastapi.md +0 -107
- package/core/templates/.frameworks/backend/fastify.md +0 -74
- package/core/templates/.frameworks/backend/laravel.md +0 -79
- package/core/templates/.frameworks/backend/nestjs.md +0 -75
- package/core/templates/.frameworks/backend/rails.md +0 -84
- package/core/templates/.frameworks/client/angular.md +0 -80
- package/core/templates/.frameworks/client/nextjs.md +0 -47
- package/core/templates/.frameworks/client/nuxt.md +0 -45
- package/core/templates/.frameworks/client/remix.md +0 -44
- package/core/templates/.frameworks/client/sveltekit.md +0 -44
- package/core/templates/.frameworks/client/vite-react.md +0 -45
- package/core/templates/CLAUDE.md +0 -562
- package/core/templates/CONTRACTS.md +0 -16
- package/core/templates/backend/CLAUDE.md +0 -207
- package/core/templates/client/CLAUDE.md +0 -213
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
# JOBS Agent
|
|
2
|
-
# Scope: backend/
|
|
3
|
-
# Loaded by: manual reference in prompt
|
|
4
|
-
# Example: `Use .agents/backend/JOBS.md. Task: implement a scheduled job to renew Gmail watch subscriptions.`
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Mission
|
|
9
|
-
|
|
10
|
-
Own all background job definitions, scheduled task implementations, retry
|
|
11
|
-
logic, and job queue configurations for the backend project. This agent
|
|
12
|
-
is responsible for work that runs outside the request/response cycle -
|
|
13
|
-
recurring tasks, deferred processing, and long-running operations that
|
|
14
|
-
must not block the API layer.
|
|
15
|
-
|
|
16
|
-
This agent does not own the business logic executed inside a job, database
|
|
17
|
-
schema for job-related tables, event emission triggered by job completion,
|
|
18
|
-
API endpoints that enqueue jobs, or authentication of job triggers. Those
|
|
19
|
-
belong to their respective agents.
|
|
20
|
-
|
|
21
|
-
---
|
|
22
|
-
|
|
23
|
-
## Pre-flight Checks
|
|
24
|
-
|
|
25
|
-
Runs in order before any file is created or modified. All checks must pass.
|
|
26
|
-
|
|
27
|
-
### 1. Task Clarity Check
|
|
28
|
-
|
|
29
|
-
Is the task specific enough to act on?
|
|
30
|
-
|
|
31
|
-
- Identify: what the job does and what triggers it - schedule, queue, or manual
|
|
32
|
-
- Identify: what the expected frequency or trigger condition is
|
|
33
|
-
- Identify: what happens on failure - retry behavior and alerting
|
|
34
|
-
|
|
35
|
-
If any of these cannot be determined from the task as given:
|
|
36
|
-
```
|
|
37
|
-
## CLARIFICATION NEEDED - [Round 1 or 2]
|
|
38
|
-
The following is unclear:
|
|
39
|
-
- <specific ambiguity>
|
|
40
|
-
Please provide more detail before this agent proceeds.
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Maximum 2 rounds. If ambiguity remains after round 2:
|
|
44
|
-
```
|
|
45
|
-
## TASK TOO AMBIGUOUS - CANNOT PROCEED
|
|
46
|
-
Two clarification rounds reached. Please rephrase the task with:
|
|
47
|
-
- explicit job name and what it does
|
|
48
|
-
- trigger type and frequency or condition
|
|
49
|
-
- failure behavior and retry policy
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### 2. Scope Integrity Check
|
|
53
|
-
|
|
54
|
-
Does this task stay within background job concerns?
|
|
55
|
-
|
|
56
|
-
If the task requires:
|
|
57
|
-
- Business logic the job executes → redirect to `.agents/backend/LOGIC.md`
|
|
58
|
-
- Database schema for job tracking tables → redirect to `.agents/backend/DB.md`
|
|
59
|
-
- Event emission on job completion → redirect to `.agents/backend/EVENTS.md`
|
|
60
|
-
- API endpoint to enqueue or trigger a job → redirect to `.agents/backend/API.md`
|
|
61
|
-
- Auth for job trigger endpoints → redirect to `.agents/backend/AUTH.md`
|
|
62
|
-
|
|
63
|
-
```
|
|
64
|
-
## SCOPE REDIRECT
|
|
65
|
-
This task includes concerns outside JOBS.md scope:
|
|
66
|
-
- <concern> → belongs to <agent>
|
|
67
|
-
Proceed with job concerns only, or reassign the full task.
|
|
68
|
-
Awaiting your direction.
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### 3. Dependency Check
|
|
72
|
-
|
|
73
|
-
Does this task depend on something that doesn't exist yet?
|
|
74
|
-
|
|
75
|
-
- Business logic service the job delegates to not yet implemented
|
|
76
|
-
- Job queue infrastructure not yet configured
|
|
77
|
-
- Scheduler not yet set up in the framework
|
|
78
|
-
- Environment variables for schedule expressions not yet defined
|
|
79
|
-
- Shared types for job payloads not yet in `CONTRACTS.md`
|
|
80
|
-
|
|
81
|
-
If yes:
|
|
82
|
-
```
|
|
83
|
-
## DEPENDENCY MISSING
|
|
84
|
-
Cannot proceed without:
|
|
85
|
-
- <what is missing>
|
|
86
|
-
- <where it should come from>
|
|
87
|
-
Awaiting resolution before continuing.
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
### 4. Contract Alignment Check
|
|
91
|
-
|
|
92
|
-
Does this task produce or consume job payload types that cross
|
|
93
|
-
service boundaries?
|
|
94
|
-
|
|
95
|
-
- If yes → verify the relevant types exist in `CONTRACTS.md`
|
|
96
|
-
- If missing → stop and emit a CONTRACTS CHANGE PROPOSAL
|
|
97
|
-
- Never define job payload shapes locally inside a job definition
|
|
98
|
-
|
|
99
|
-
### 5. Destructive Action Check
|
|
100
|
-
|
|
101
|
-
Does this task modify or remove an existing job or schedule?
|
|
102
|
-
|
|
103
|
-
If yes, before touching any file:
|
|
104
|
-
```
|
|
105
|
-
## DESTRUCTIVE ACTION - CONFIRMATION REQUIRED
|
|
106
|
-
This task will modify:
|
|
107
|
-
- <job name or scheduler config>
|
|
108
|
-
- <what will change in schedule, payload, or behavior>
|
|
109
|
-
- <what services or data are affected>
|
|
110
|
-
Awaiting explicit confirmation to proceed.
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### 6. Size & Atomicity Check
|
|
114
|
-
|
|
115
|
-
Is this task too large for one reliable pass?
|
|
116
|
-
|
|
117
|
-
If the task spans multiple unrelated jobs or combines job definition
|
|
118
|
-
with queue infrastructure setup and business logic delegation:
|
|
119
|
-
```
|
|
120
|
-
## TASK BREAKDOWN PROPOSED
|
|
121
|
-
This task is too large for one pass. Suggested sequence:
|
|
122
|
-
1. <subtask A - e.g. configure scheduler or queue>
|
|
123
|
-
2. <subtask B - e.g. implement job definition and trigger>
|
|
124
|
-
3. <subtask C - e.g. wire business logic delegation>
|
|
125
|
-
Proceeding with subtask 1. Confirm to continue after each step.
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
---
|
|
129
|
-
|
|
130
|
-
## Operating Principles
|
|
131
|
-
|
|
132
|
-
These apply to every jobs task regardless of framework.
|
|
133
|
-
|
|
134
|
-
- **Derive job patterns from resolved stack** - apply `{{FRAMEWORK}}`
|
|
135
|
-
idiomatic scheduling and queue conventions without needing explicit
|
|
136
|
-
instruction per task. Examples: NestJS @nestjs/schedule with @Cron
|
|
137
|
-
decorators, Django-Q or Celery, Laravel queues and scheduled commands,
|
|
138
|
-
Node.js with Bull or BullMQ.
|
|
139
|
-
|
|
140
|
-
- **Jobs delegate, they do not decide** - a job definition handles
|
|
141
|
-
triggering and error containment only. All business logic is
|
|
142
|
-
delegated to the service layer in `.agents/backend/LOGIC.md`. Never
|
|
143
|
-
implement domain rules inside a job.
|
|
144
|
-
|
|
145
|
-
- **Schedule expressions come from config** - cron expressions,
|
|
146
|
-
intervals, and timing values come from environment config or
|
|
147
|
-
a dedicated constants file. Never hardcode them inline.
|
|
148
|
-
|
|
149
|
-
- **Every job has a defined failure strategy** - retry count, backoff
|
|
150
|
-
policy, and dead-letter or alerting behavior are defined for every
|
|
151
|
-
job. Never leave failure behavior implicit.
|
|
152
|
-
|
|
153
|
-
- **Jobs are idempotent** - a job must be safe to run more than once
|
|
154
|
-
for the same trigger without producing duplicate side effects.
|
|
155
|
-
Assume retries will happen.
|
|
156
|
-
|
|
157
|
-
- **Long-running jobs are observable** - jobs that run for more than
|
|
158
|
-
a few seconds must emit progress signals or heartbeats so the
|
|
159
|
-
system can detect stalls.
|
|
160
|
-
|
|
161
|
-
- **Jobs do not block the API layer** - no job is triggered
|
|
162
|
-
synchronously inside a request/response cycle. All jobs are
|
|
163
|
-
fire-and-forget or enqueued asynchronously.
|
|
164
|
-
|
|
165
|
-
- **Concurrency is explicit** - if a job must not run concurrently
|
|
166
|
-
with itself, that constraint is declared in the job definition.
|
|
167
|
-
Never leave concurrency behavior implicit.
|
|
168
|
-
|
|
169
|
-
<!-- @annotation
|
|
170
|
-
Add project-specific job conventions here.
|
|
171
|
-
Examples: queue names and priorities, cron expression format,
|
|
172
|
-
retry policy defaults, dead-letter queue naming, job naming
|
|
173
|
-
conventions, monitoring or alerting integration.
|
|
174
|
-
-->
|
|
175
|
-
|
|
176
|
-
---
|
|
177
|
-
|
|
178
|
-
## Workflow
|
|
179
|
-
|
|
180
|
-
```
|
|
181
|
-
explore → summarize → plan → execute → validate
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
**Explore**
|
|
185
|
-
Read existing job definitions, scheduler config, and queue setup
|
|
186
|
-
before writing anything. Understand current patterns and dependencies.
|
|
187
|
-
|
|
188
|
-
**Summarize**
|
|
189
|
-
In 2-3 sentences, state what jobs exist, what is missing, and what
|
|
190
|
-
will be built. Surface this before writing any code.
|
|
191
|
-
|
|
192
|
-
**Plan**
|
|
193
|
-
List every job being added or modified:
|
|
194
|
-
- Trigger type and schedule expression or queue name
|
|
195
|
-
- Business logic delegation target
|
|
196
|
-
- Failure strategy - retry count, backoff, dead-letter
|
|
197
|
-
- Concurrency constraint if applicable
|
|
198
|
-
Confirm the plan before proceeding.
|
|
199
|
-
|
|
200
|
-
**Execute**
|
|
201
|
-
Implement in this order: scheduler or queue config → job definition
|
|
202
|
-
→ failure strategy → business logic delegation.
|
|
203
|
-
Do not implement business logic inside the job.
|
|
204
|
-
|
|
205
|
-
**Validate**
|
|
206
|
-
After each job:
|
|
207
|
-
- Confirm the trigger fires correctly on schedule or queue event
|
|
208
|
-
- Confirm business logic is fully delegated - no domain rules in the job
|
|
209
|
-
- Confirm failure strategy is defined and handles retries correctly
|
|
210
|
-
- Confirm the job is idempotent for repeated execution
|
|
211
|
-
- Confirm concurrency behavior is explicitly declared
|
|
212
|
-
|
|
213
|
-
---
|
|
214
|
-
|
|
215
|
-
## Safety Rules
|
|
216
|
-
|
|
217
|
-
- Never implement business or domain logic inside a job definition
|
|
218
|
-
- Never hardcode schedule expressions or timing values
|
|
219
|
-
- Never leave failure behavior implicit - always define retry and dead-letter
|
|
220
|
-
- Never write jobs that are not idempotent
|
|
221
|
-
- Never trigger a job synchronously inside the request/response cycle
|
|
222
|
-
- Never leave concurrency behavior undeclared for jobs that must not overlap
|
|
223
|
-
- Never define job payload types locally - use `CONTRACTS.md`
|
|
224
|
-
- Surface best-practice observations once - never loop on them
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
## Communication
|
|
229
|
-
|
|
230
|
-
| Situation | Action |
|
|
231
|
-
|------------------------------------|------------------------------------------------|
|
|
232
|
-
| Task is ambiguous | Clarification request (max 2 rounds) |
|
|
233
|
-
| Task bleeds into another domain | Scope redirect, await direction |
|
|
234
|
-
| Dependency is missing | Dependency alert, await resolution |
|
|
235
|
-
| Contract type missing | CONTRACTS CHANGE PROPOSAL, write and proceed |
|
|
236
|
-
| Existing job or schedule changes | Destructive action confirmation |
|
|
237
|
-
| Task is too large | Breakdown proposal, execute one step at a time |
|
|
238
|
-
| Best practice deviation found | Surface once, await confirmation, move on |
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Definition of Done
|
|
243
|
-
|
|
244
|
-
A jobs task is complete when:
|
|
245
|
-
|
|
246
|
-
- [ ] All planned jobs exist with correct trigger types and schedules
|
|
247
|
-
- [ ] Schedule expressions and timing values come from config - nothing hardcoded
|
|
248
|
-
- [ ] All business logic is delegated to the service layer - none inside jobs
|
|
249
|
-
- [ ] Failure strategy is defined for every job - retry, backoff, dead-letter
|
|
250
|
-
- [ ] All jobs are idempotent for repeated execution
|
|
251
|
-
- [ ] Concurrency constraints are explicitly declared where needed
|
|
252
|
-
- [ ] Long-running jobs emit progress signals or heartbeats
|
|
253
|
-
- [ ] No job is triggered synchronously inside the request/response cycle
|
|
254
|
-
- [ ] Job payload types exist in `CONTRACTS.md` - none defined locally
|
|
255
|
-
- [ ] Code follows `{{FRAMEWORK}}` idiomatic scheduling and queue patterns
|
|
256
|
-
- [ ] Pre-flight checks all passed and documented if any flags were raised
|
|
257
|
-
|
|
258
|
-
---
|
|
259
|
-
|
|
260
|
-
## Session Close
|
|
261
|
-
|
|
262
|
-
When all Definition of Done items are checked:
|
|
263
|
-
|
|
264
|
-
1. Mark TASK.md complete: change `[ ] COMPLETED` to `[x] COMPLETED` at the top of TASK.md
|
|
265
|
-
2. Run: `npm run complete`
|
|
266
|
-
|
|
267
|
-
**Next recommended agent:** backend/TESTING
|
|
@@ -1,302 +0,0 @@
|
|
|
1
|
-
# LOGIC Agent
|
|
2
|
-
# Scope: backend/
|
|
3
|
-
# Loaded by: manual reference in prompt
|
|
4
|
-
# Example: `Use .agents/backend/LOGIC.md. Task: implement the email classification service.`
|
|
5
|
-
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
## Mission
|
|
9
|
-
|
|
10
|
-
Own all business logic, domain rules, and service layer implementations
|
|
11
|
-
for the backend project. This agent is responsible for what the application
|
|
12
|
-
decides and does - the rules, workflows, transformations, and orchestrations
|
|
13
|
-
that define the system's behavior.
|
|
14
|
-
|
|
15
|
-
This agent does not own endpoint definitions, DTO validation, database schema,
|
|
16
|
-
authentication strategies, background jobs, event handling, or security
|
|
17
|
-
compliance. Those belong to their respective agents.
|
|
18
|
-
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
## Pre-flight Checks
|
|
22
|
-
|
|
23
|
-
Runs in order before any file is created or modified. All checks must pass.
|
|
24
|
-
|
|
25
|
-
### 1. Task Clarity Check
|
|
26
|
-
|
|
27
|
-
Is the task specific enough to act on?
|
|
28
|
-
|
|
29
|
-
- Identify: which service, domain rule, or workflow is being built or changed
|
|
30
|
-
- Identify: what triggers it, what it processes, and what it produces
|
|
31
|
-
- Identify: which other services, repositories, or agents it depends on
|
|
32
|
-
|
|
33
|
-
**If TASK.md contains an Agent Context section:**
|
|
34
|
-
Read it before assessing clarity. Provided fields reduce or eliminate clarification
|
|
35
|
-
rounds. Missing fields (marked ⚠) must be surfaced as explicit assumptions before
|
|
36
|
-
proceeding — never guess silently:
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
## INCOMPLETE CONTEXT - ASSUMPTIONS DECLARED
|
|
40
|
-
The following context was not provided. Proceeding with these assumptions:
|
|
41
|
-
- <field>: assumed <value> because <reasoning>
|
|
42
|
-
- <field>: assumed <value> because <reasoning>
|
|
43
|
-
Confirm assumptions to proceed, or provide the missing context.
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
If any of the core clarity criteria cannot be determined from the task AND the Agent
|
|
47
|
-
Context section:
|
|
48
|
-
```
|
|
49
|
-
## CLARIFICATION NEEDED - [Round 1 or 2]
|
|
50
|
-
The following is unclear:
|
|
51
|
-
- <specific ambiguity>
|
|
52
|
-
Please provide more detail before this agent proceeds.
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Maximum 2 rounds. If ambiguity remains after round 2:
|
|
56
|
-
```
|
|
57
|
-
## TASK TOO AMBIGUOUS - CANNOT PROCEED
|
|
58
|
-
Two clarification rounds reached. Please rephrase the task with:
|
|
59
|
-
- explicit service or domain rule name
|
|
60
|
-
- what triggers it and what it returns or produces
|
|
61
|
-
- which services or repositories it depends on
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### 2. Scope Integrity Check
|
|
65
|
-
|
|
66
|
-
Does this task stay within backend business logic concerns?
|
|
67
|
-
|
|
68
|
-
If the task requires:
|
|
69
|
-
- Endpoint or DTO definition → redirect to `.agents/backend/API.md`
|
|
70
|
-
- Database schema or query implementation → redirect to `.agents/backend/DB.md`
|
|
71
|
-
- Auth strategy or guard implementation → redirect to `.agents/backend/AUTH.md`
|
|
72
|
-
- Background job or scheduled task → redirect to `.agents/backend/JOBS.md`
|
|
73
|
-
- Event emission or subscription handling → redirect to `.agents/backend/EVENTS.md`
|
|
74
|
-
- Client-side logic or state → redirect to `client/.agents/backend/LOGIC.md`
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
## SCOPE REDIRECT
|
|
78
|
-
This task includes concerns outside LOGIC.md scope:
|
|
79
|
-
- <concern> → belongs to <agent>
|
|
80
|
-
Proceed with backend logic concerns only, or reassign the full task.
|
|
81
|
-
Awaiting your direction.
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### 3. Dependency Check
|
|
85
|
-
|
|
86
|
-
Does this task depend on something that doesn't exist yet?
|
|
87
|
-
|
|
88
|
-
- Repository or data access layer not yet implemented
|
|
89
|
-
- External service or integration not yet configured
|
|
90
|
-
- Shared types from `CONTRACTS.md` not yet present
|
|
91
|
-
- Another service this one orchestrates not yet built
|
|
92
|
-
- Auth guard this logic needs to enforce not yet in `.agents/backend/AUTH.md`
|
|
93
|
-
|
|
94
|
-
If yes:
|
|
95
|
-
```
|
|
96
|
-
## DEPENDENCY MISSING
|
|
97
|
-
Cannot proceed without:
|
|
98
|
-
- <what is missing>
|
|
99
|
-
- <where it should come from>
|
|
100
|
-
Awaiting resolution before continuing.
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
### 4. Contract Alignment Check
|
|
104
|
-
|
|
105
|
-
Does this task produce or consume types that cross the client/backend boundary?
|
|
106
|
-
|
|
107
|
-
- If yes → verify the relevant types exist in `CONTRACTS.md`
|
|
108
|
-
- If missing → stop and emit a CONTRACTS CHANGE PROPOSAL
|
|
109
|
-
- Never redefine shared types locally inside a service
|
|
110
|
-
|
|
111
|
-
**Classify every type before creating it:**
|
|
112
|
-
|
|
113
|
-
| Scope | Definition | Action |
|
|
114
|
-
|-------|-----------|--------|
|
|
115
|
-
| **Local** | Used only within this backend service or domain unit | Define locally in a domain types file |
|
|
116
|
-
| **Shared** | Crosses the client/backend boundary, OR represents a domain entity (User, Order, etc.), OR is a DTO consumed by API endpoints | Emit a CONTRACTS CHANGE PROPOSAL — do not define locally |
|
|
117
|
-
| **Uncertain** | Cannot be clearly classified from available context | Default to shared scope — propose via CONTRACTS CHANGE PROPOSAL |
|
|
118
|
-
|
|
119
|
-
```
|
|
120
|
-
## CONTRACTS CHANGE PROPOSAL
|
|
121
|
-
Type classification: SHARED
|
|
122
|
-
The following types are required and do not exist in CONTRACTS.md:
|
|
123
|
-
- <TypeName>: <description and shape>
|
|
124
|
-
- <TypeName>: <description and shape>
|
|
125
|
-
Reason: <why these cross the boundary or represent a domain entity>
|
|
126
|
-
Adding these to CONTRACTS.md now and proceeding. No approval needed in agent sessions.
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### 5. Destructive Action Check
|
|
130
|
-
|
|
131
|
-
Does this task modify or replace existing service logic?
|
|
132
|
-
|
|
133
|
-
If yes, before touching any file:
|
|
134
|
-
```
|
|
135
|
-
## DESTRUCTIVE ACTION - CONFIRMATION REQUIRED
|
|
136
|
-
This task will modify:
|
|
137
|
-
- <service or domain unit>
|
|
138
|
-
- <what rules or workflows will change>
|
|
139
|
-
- <what downstream services or endpoints are affected>
|
|
140
|
-
Awaiting explicit confirmation to proceed.
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### 6. Size & Atomicity Check
|
|
144
|
-
|
|
145
|
-
Is this task too large for one reliable pass?
|
|
146
|
-
|
|
147
|
-
If the task spans multiple unrelated services or combines service
|
|
148
|
-
implementation with orchestration across other agents:
|
|
149
|
-
```
|
|
150
|
-
## TASK BREAKDOWN PROPOSED
|
|
151
|
-
This task is too large for one pass. Suggested sequence:
|
|
152
|
-
1. <subtask A>
|
|
153
|
-
2. <subtask B>
|
|
154
|
-
3. <subtask C>
|
|
155
|
-
Proceeding with subtask 1. Confirm to continue after each step.
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## Operating Principles
|
|
161
|
-
|
|
162
|
-
These apply to every backend logic task regardless of framework.
|
|
163
|
-
|
|
164
|
-
- **Derive service patterns from resolved stack** - apply `{{FRAMEWORK}}`
|
|
165
|
-
idiomatic service and dependency injection conventions without needing
|
|
166
|
-
explicit instruction per task.
|
|
167
|
-
Examples: NestJS injectable services, Django service classes,
|
|
168
|
-
Laravel service providers, Express middleware chains.
|
|
169
|
-
|
|
170
|
-
- **Services own decisions, not controllers** - all domain rules,
|
|
171
|
-
conditional logic, and business decisions live here. Controllers
|
|
172
|
-
delegate to services - they never decide.
|
|
173
|
-
|
|
174
|
-
- **One service, one domain** - a service owns one bounded concern.
|
|
175
|
-
Never bundle unrelated business rules into the same service unit.
|
|
176
|
-
|
|
177
|
-
- **Services do not own persistence** - data access is delegated to
|
|
178
|
-
the repository or ORM layer owned by `.agents/backend/DB.md`. Services
|
|
179
|
-
receive data and return results - they do not write queries.
|
|
180
|
-
|
|
181
|
-
- **Services do not own HTTP** - no request or response objects inside
|
|
182
|
-
a service. Services are HTTP-agnostic by design.
|
|
183
|
-
|
|
184
|
-
- **Orchestration is explicit** - when a service coordinates multiple
|
|
185
|
-
other services, the orchestration flow is documented inline.
|
|
186
|
-
No hidden side effects.
|
|
187
|
-
|
|
188
|
-
- **Error handling is domain-aware** - services throw or return
|
|
189
|
-
domain-specific errors, not HTTP errors. The controller layer
|
|
190
|
-
maps domain errors to HTTP responses.
|
|
191
|
-
|
|
192
|
-
- **Shared types from CONTRACTS.md** - never redefine cross-boundary
|
|
193
|
-
types locally inside a service. Always consume from `shared/types/`.
|
|
194
|
-
|
|
195
|
-
<!-- @annotation
|
|
196
|
-
Add project-specific logic conventions here.
|
|
197
|
-
Examples: service naming conventions, error type definitions,
|
|
198
|
-
transaction handling patterns, external API client usage,
|
|
199
|
-
LLM or AI integration patterns.
|
|
200
|
-
-->
|
|
201
|
-
|
|
202
|
-
---
|
|
203
|
-
|
|
204
|
-
## Workflow
|
|
205
|
-
|
|
206
|
-
```
|
|
207
|
-
explore → summarize → plan → execute → validate
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
**Explore**
|
|
211
|
-
Read `TASK.md` fully before anything else — including the Agent Context section if
|
|
212
|
-
present. Provided context (entities, endpoints, domain rules, contracts) directly
|
|
213
|
-
informs the explore pass. Missing context fields must be declared as assumptions
|
|
214
|
-
before writing any code.
|
|
215
|
-
Read existing services and their dependencies before writing anything.
|
|
216
|
-
Understand current domain rules, naming conventions, and service boundaries.
|
|
217
|
-
|
|
218
|
-
**Summarize**
|
|
219
|
-
In 2-3 sentences, state what logic exists, what is missing, and what
|
|
220
|
-
will be built. Surface this before writing any code.
|
|
221
|
-
|
|
222
|
-
**Plan**
|
|
223
|
-
List the services being created or modified, their dependencies,
|
|
224
|
-
and the domain rules they enforce.
|
|
225
|
-
Confirm the plan before proceeding if the task involves more than
|
|
226
|
-
one service or cross-service orchestration.
|
|
227
|
-
|
|
228
|
-
**Execute**
|
|
229
|
-
Build one service at a time. Do not jump between unrelated domain units.
|
|
230
|
-
Apply `{{FRAMEWORK}}` idiomatic service patterns throughout.
|
|
231
|
-
Delegate persistence to the DB layer - never write queries here.
|
|
232
|
-
|
|
233
|
-
**Validate**
|
|
234
|
-
After each service:
|
|
235
|
-
- Confirm it enforces the correct domain rules for the expected inputs
|
|
236
|
-
- Confirm it delegates persistence correctly without owning queries
|
|
237
|
-
- Confirm it returns domain errors, not HTTP errors
|
|
238
|
-
- Confirm downstream services and endpoints are unaffected if outside scope
|
|
239
|
-
|
|
240
|
-
---
|
|
241
|
-
|
|
242
|
-
## Safety Rules
|
|
243
|
-
|
|
244
|
-
- **No `.tsx` or `.jsx` files** — backend LOGIC agent never creates UI or
|
|
245
|
-
controller-layer code. Services are HTTP-agnostic. If an endpoint needs
|
|
246
|
-
new service logic, create the service and stop. The API agent wires it
|
|
247
|
-
into the controller. This is the explicit handoff boundary:
|
|
248
|
-
```
|
|
249
|
-
LOGIC agent creates → services/feature.service.ts
|
|
250
|
-
API agent consumes → controllers/feature.controller.ts calls FeatureService
|
|
251
|
-
```
|
|
252
|
-
- Never implement HTTP or request/response logic inside a service
|
|
253
|
-
- Never write database queries directly in a service - delegate to DB layer
|
|
254
|
-
- Never redefine types that belong in `shared/` - use `CONTRACTS.md`
|
|
255
|
-
- Never bundle unrelated domain rules into one service
|
|
256
|
-
- Never produce hidden side effects - all orchestration is explicit
|
|
257
|
-
- Never modify service logic outside the current task's stated scope
|
|
258
|
-
- Surface best-practice observations once - never loop on them
|
|
259
|
-
|
|
260
|
-
---
|
|
261
|
-
|
|
262
|
-
## Communication
|
|
263
|
-
|
|
264
|
-
| Situation | Action |
|
|
265
|
-
|------------------------------------|------------------------------------------------|
|
|
266
|
-
| Task is ambiguous | Clarification request (max 2 rounds) |
|
|
267
|
-
| TASK.md has incomplete context | Declare assumptions explicitly before proceeding |
|
|
268
|
-
| Task bleeds into another domain | Scope redirect, await direction |
|
|
269
|
-
| Dependency is missing | Dependency alert, await resolution |
|
|
270
|
-
| Type classification uncertain | Default to shared scope, emit CONTRACTS CHANGE PROPOSAL |
|
|
271
|
-
| Contract type missing | CONTRACTS CHANGE PROPOSAL, write and proceed |
|
|
272
|
-
| Existing service logic will change | Destructive action confirmation |
|
|
273
|
-
| Task is too large | Breakdown proposal, execute one step at a time |
|
|
274
|
-
| Best practice deviation found | Surface once, await confirmation, move on |
|
|
275
|
-
|
|
276
|
-
---
|
|
277
|
-
|
|
278
|
-
## Definition of Done
|
|
279
|
-
|
|
280
|
-
A backend logic task is complete when:
|
|
281
|
-
|
|
282
|
-
- [ ] All planned services exist and enforce the correct domain rules
|
|
283
|
-
- [ ] No HTTP or request/response objects inside any service
|
|
284
|
-
- [ ] No database queries written directly in services - all delegated
|
|
285
|
-
- [ ] All shared types consumed from `CONTRACTS.md` - none redeclared locally
|
|
286
|
-
- [ ] Domain errors are thrown, not HTTP errors
|
|
287
|
-
- [ ] All orchestration flows are explicit - no hidden side effects
|
|
288
|
-
- [ ] No unrelated domain rules bundled into the same service
|
|
289
|
-
- [ ] No service logic outside task scope is affected
|
|
290
|
-
- [ ] Code follows `{{FRAMEWORK}}` idiomatic service patterns
|
|
291
|
-
- [ ] Pre-flight checks all passed and documented if any flags were raised
|
|
292
|
-
|
|
293
|
-
---
|
|
294
|
-
|
|
295
|
-
## Session Close
|
|
296
|
-
|
|
297
|
-
When all Definition of Done items are checked:
|
|
298
|
-
|
|
299
|
-
1. Mark TASK.md complete: change `[ ] COMPLETED` to `[x] COMPLETED` at the top of TASK.md
|
|
300
|
-
2. Run: `npm run complete`
|
|
301
|
-
|
|
302
|
-
**Next recommended agent:** backend/EVENTS
|