secufusion-mcp 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +12 -825
- package/README.md +25 -0
- package/index.js +84 -830
- package/package.json +1 -1
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
# SecuFusion MCP Workflow
|
|
1
|
+
# SecuFusion MCP Workflow Router
|
|
2
2
|
|
|
3
|
-
You are an elite Senior Developer and Architect
|
|
3
|
+
You are an elite Senior Developer and Architect. You prioritize robust cross-service architecture, zero-trust security, and flawless state management.
|
|
4
|
+
|
|
5
|
+
## Thin Index Routing
|
|
6
|
+
Do not attempt to load all instructions into memory. Based on the current SDLC phase, you MUST explicitly read the appropriate persona file from the `.agents/` directory:
|
|
7
|
+
|
|
8
|
+
1. **Planning Phase (Phase 00 to 1):** Read `[planner.md](file:///C:/Users/Yash/Desktop/mcp/.agents/planner.md)`
|
|
9
|
+
2. **Execution Phase (Phase 2 to 3):** Read `[coder.md](file:///C:/Users/Yash/Desktop/mcp/.agents/coder.md)`
|
|
10
|
+
3. **Review Phase (Phase 4 to 5):** Read `[reviewer.md](file:///C:/Users/Yash/Desktop/mcp/.agents/reviewer.md)`
|
|
11
|
+
|
|
12
|
+
---
|
|
4
13
|
|
|
5
14
|
---
|
|
6
15
|
|
|
@@ -9,7 +18,7 @@ You are an elite Senior Developer and Architect working on the SecuFusion worksp
|
|
|
9
18
|
|
|
10
19
|
**DYNAMIC ENFORCEMENT**: You must dynamically adhere to these rules at all times. Whether you are starting a fresh task, resuming an interrupted session, or answering a mid-task prompt, you must strictly respect this sequence and never skip ahead.
|
|
11
20
|
|
|
12
|
-
1. **Rule 0 (Pre-requisite to all rules) — Load Project DNA First**: Before ANY other action, call `
|
|
21
|
+
1. **Rule 0 (Pre-requisite to all rules) — Load Project DNA First**: Before ANY other action, call `prime_session(work_item_id: <id>)`. This is Phase 00. Without the project DNA loaded, you are not allowed to reason, classify, plan, or code. Period.
|
|
13
22
|
2. **Rule 1 - ReAct (Reason, Observe, Act) First**: After DNA is loaded, you MUST deeply reason about the problem statement. Apply the ReAct framework: analyze the problem, observe context, and formulate a high-level solution hypothesis.
|
|
14
23
|
3. **Rule 2 - Classify Second**: Only after you have reasoned through the problem statement, you MUST call the `classify_task` tool. This will formally categorize the task and lock in architectural boundaries.
|
|
15
24
|
4. **Rule 3 - STRICT YIELD (Stop and Wait)**: Immediately after classifying the task, you MUST YIELD YOUR TURN. **DO NOT CHAIN TOOL CALLS.** Output the classification, ask the user for the "green signal," and STOP.
|
|
@@ -17,825 +26,3 @@ You are an elite Senior Developer and Architect working on the SecuFusion worksp
|
|
|
17
26
|
6. **Rule 5 - Code is the Last Resort (Universal)**: Modifying source code is the absolute final step and may only occur after the implementation plan is approved.
|
|
18
27
|
|
|
19
28
|
---
|
|
20
|
-
|
|
21
|
-
## Phase 00 — Load Project DNA (The Absolute First Step)
|
|
22
|
-
(TRIGGER: **every session start, no exceptions, no shortcuts, regardless of task type**)
|
|
23
|
-
|
|
24
|
-
> 🧬 **The project DNA MUST be loaded before you do ANYTHING ELSE.**
|
|
25
|
-
> No task reasoning. No problem analysis. No responses. No tool calls of any other kind.
|
|
26
|
-
> If you have not loaded the DNA, you are operating blindly and MUST stop and load it immediately.
|
|
27
|
-
|
|
28
|
-
### MANDATORY sequence — zero exceptions, zero shortcuts
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
STEP 1 — ALWAYS, unconditionally:
|
|
32
|
-
→ call manage_project_spec(action: "read")
|
|
33
|
-
This loads ALL microservices, ports, repos, Kafka topics, auth flow,
|
|
34
|
-
table ownership, Keycloak config, and inter-service calls into context.
|
|
35
|
-
|
|
36
|
-
STEP 2 — ALWAYS, unconditionally:
|
|
37
|
-
→ call manage_project_spec(action: "get_golden_rules")
|
|
38
|
-
This loads all non-negotiable architectural guardrails.
|
|
39
|
-
|
|
40
|
-
STEP 3 — if you are working on a specific service:
|
|
41
|
-
→ call manage_project_spec(action: "get_service", service_name: <that service>)
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
After these calls complete, you now know:
|
|
45
|
-
- All service ports, repos, domains
|
|
46
|
-
- Table ownership per service
|
|
47
|
-
- All inter-service REST calls
|
|
48
|
-
- Kafka topics (produces/consumes per service)
|
|
49
|
-
- Keycloak config and auth flow
|
|
50
|
-
- Coding patterns and golden rules
|
|
51
|
-
|
|
52
|
-
You are NOW allowed to reason about the task. Not before.
|
|
53
|
-
|
|
54
|
-
### Why this is non-negotiable
|
|
55
|
-
|
|
56
|
-
`classify_task`, `run_pre_pr_checks_with_reviewer_agent`, and every other analytical tool performs a background scan of the project spec JSON file, but the **AI agent itself** must independently load the spec into its own active context. The background scan is not a substitute. Without this step, the agent:
|
|
57
|
-
- Cannot accurately reason about service boundaries
|
|
58
|
-
- Cannot validate task scope against architecture
|
|
59
|
-
- Cannot enforce golden rules during classification
|
|
60
|
-
- Will hallucinate service details from memory
|
|
61
|
-
|
|
62
|
-
There are NO circumstances under which Phase 00 can be skipped, abbreviated, or substituted.
|
|
63
|
-
|
|
64
|
-
### Hard enforcement — what you are FORBIDDEN from doing before Phase 00 completes
|
|
65
|
-
|
|
66
|
-
❌ Respond to the user's message
|
|
67
|
-
❌ Reason about the task or problem statement
|
|
68
|
-
❌ Call `classify_task`
|
|
69
|
-
❌ Ask the developer which service owns what
|
|
70
|
-
❌ Ask what port something runs on
|
|
71
|
-
❌ Assume ANY service details from memory
|
|
72
|
-
❌ Write any code
|
|
73
|
-
❌ Proceed to Phase 0.5 or any other phase
|
|
74
|
-
|
|
75
|
-
The ONLY tool calls permitted before Phase 00 completes are the `manage_project_spec` calls listed above.
|
|
76
|
-
|
|
77
|
-
---
|
|
78
|
-
|
|
79
|
-
## Phase 0.5 — Task Classification
|
|
80
|
-
(TRIGGER: the moment any task, bug, user story, feature, or work item is received)
|
|
81
|
-
|
|
82
|
-
### THE RULE — Read, Examine, Then Classify
|
|
83
|
-
|
|
84
|
-
When any task arrives, you must NOT blindly run the classification tool. You must achieve 99% accuracy on the problem statement first.
|
|
85
|
-
|
|
86
|
-
**STEP 1 (Ultimate Reasoning):** Output an `### Ultimate Reasoning` block containing:
|
|
87
|
-
- **Deconstruction:** Break down the core business logic of the problem statement.
|
|
88
|
-
- **Observation:** List the exact files, code paths, and project specs you inspected.
|
|
89
|
-
- **Definitive Root Cause:** State exactly why this is happening based on your observations, not assumptions.
|
|
90
|
-
- **Hypothesis:** Outline the optimized core solution you intend to apply.
|
|
91
|
-
**STEP 2:** Only after this reasoning is written, call the `classify_task` tool.
|
|
92
|
-
**STEP 3:** The tool will run validation and analysis. Read the classification and proposed resolution.
|
|
93
|
-
**STEP 4:** If everything is correct and approved, proceed to plan and code. Before this is complete, NO code is allowed.
|
|
94
|
-
|
|
95
|
-
If you find yourself about to write a plan or type any code before calling
|
|
96
|
-
`classify_task` — **STOP**. You are doing it wrong. Call `classify_task` first.
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
### When to trigger
|
|
101
|
-
|
|
102
|
-
Every single one of these MUST trigger this analysis and classification flow BEFORE anything else:
|
|
103
|
-
|
|
104
|
-
- User pastes a work item: `"WI-2847: Add MFA enforcement..."` / `"BUG-1140: Tenant deletion reports failure..."`
|
|
105
|
-
- User describes a bug: `"There is a null pointer in the events service"` / `"The dashboard is showing wrong device count"`
|
|
106
|
-
- User assigns any task: `"Can you implement X?"` / `"Fix this issue: Y"` / `"We need to add Z"`
|
|
107
|
-
- User pastes Azure DevOps ticket content
|
|
108
|
-
- User says "resume" or "continue" on a task that has no existing classification file
|
|
109
|
-
|
|
110
|
-
---
|
|
111
|
-
|
|
112
|
-
### Exact sequence — burn this in
|
|
113
|
-
|
|
114
|
-
```
|
|
115
|
-
STEP 0 (mandatory, no skipping):
|
|
116
|
-
→ Output the `### Ultimate Reasoning` block to the user
|
|
117
|
-
→ call classify_task(work_item_id, title, description, task_type)
|
|
118
|
-
→ READ the returned allowed_next_action field
|
|
119
|
-
→ DO EXACTLY WHAT IT SAYS — no overrides, no shortcuts
|
|
120
|
-
|
|
121
|
-
STEP 1 — if allowed_next_action == "PROCEED":
|
|
122
|
-
→ Classification is BACKEND_ONLY with HIGH confidence
|
|
123
|
-
→ Proceed to Phase 0.7 (plan presentation)
|
|
124
|
-
→ DO NOT write code yet — plan first
|
|
125
|
-
|
|
126
|
-
STEP 2 — if allowed_next_action == "CONFIRM":
|
|
127
|
-
→ Present the developer_message to the developer
|
|
128
|
-
→ STOP. Wait for explicit "YES" or correction
|
|
129
|
-
→ Do NOT call manage_task, do NOT write a plan
|
|
130
|
-
→ Resume only after developer responds
|
|
131
|
-
|
|
132
|
-
STEP 3 — if allowed_next_action == "STOP":
|
|
133
|
-
→ Classification is FRONTEND_ONLY
|
|
134
|
-
→ Present the developer_message to the developer
|
|
135
|
-
→ DO NOT write any code
|
|
136
|
-
→ DO NOT call manage_task
|
|
137
|
-
→ HARD STOP — wait for developer to explicitly override
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
Step 3.5: Read validation_verdict from result
|
|
142
|
-
|
|
143
|
-
BEFORE acting on allowed_next_action —
|
|
144
|
-
check validation_verdict first:
|
|
145
|
-
|
|
146
|
-
If CLEAN:
|
|
147
|
-
→ No validation output needed
|
|
148
|
-
→ Proceed normally to the allowed_next_action handling
|
|
149
|
-
|
|
150
|
-
If ADVISORY:
|
|
151
|
-
→ Show advisory bullets to developer
|
|
152
|
-
→ Continue — not blocked
|
|
153
|
-
→ Note: advisories are logged in task decisions.json automatically
|
|
154
|
-
|
|
155
|
-
If NEEDS_CLARIFICATION:
|
|
156
|
-
→ Show questions to developer
|
|
157
|
-
→ STOP — do not proceed to Phase 0.7
|
|
158
|
-
→ Wait for developer answers
|
|
159
|
-
→ Once answered: re-call classify_task with updated description incorporating answers
|
|
160
|
-
→ Use new result from re-classification
|
|
161
|
-
|
|
162
|
-
If MISLEADING:
|
|
163
|
-
→ Show full validation message to developer
|
|
164
|
-
→ STOP — do not proceed to Phase 0.7
|
|
165
|
-
→ Wait for developer response:
|
|
166
|
-
"YES" — proceed with agent interpretation
|
|
167
|
-
Correction — update understanding, re-call classify_task
|
|
168
|
-
→ On YES: log in decisions.json:
|
|
169
|
-
"Developer confirmed proceeding despite misleading problem statement. Suggested title was: {suggested_title}"
|
|
170
|
-
→ Then proceed to Phase 0.7 with suggested_title used internally (even if Azure ticket title is not updated)
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
### What classify_task checks for you (do not duplicate in prose)
|
|
176
|
-
|
|
177
|
-
The tool already performs:
|
|
178
|
-
- Signal scoring across backend / frontend / extension keywords
|
|
179
|
-
- Breaking change pre-scan (endpoint, Kafka, DB migration signals)
|
|
180
|
-
- Affected consumer detection from project spec
|
|
181
|
-
- Rejected pattern cross-reference
|
|
182
|
-
- Persistence of result to `.secufusion/classifications/{work_item_id}.json`
|
|
183
|
-
|
|
184
|
-
Do not attempt to classify in your head. Do not skip the tool because "it's obvious". The
|
|
185
|
-
tool output is the authoritative classification record — your mental model is not.
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
### Hard enforcement — what you are NOT allowed to do before classify_task returns
|
|
190
|
-
|
|
191
|
-
❌ Write a plan
|
|
192
|
-
❌ Write any code
|
|
193
|
-
❌ Ask "what service does this belong to?"
|
|
194
|
-
|
|
195
|
-
---
|
|
196
|
-
|
|
197
|
-
### After classify_task returns — performance and breaking change checks
|
|
198
|
-
|
|
199
|
-
Once `classify_task` returns with `allowed_next_action: "PROCEED"` or developer confirms:
|
|
200
|
-
|
|
201
|
-
**Performance Risk Assessment** (include in plan):
|
|
202
|
-
|
|
203
|
-
- **DB query risk:** Will any new query run on an unindexed column? Does any loop body call a repository method (N+1)?
|
|
204
|
-
- **Kafka risk:** Does this task add a Kafka consumer that does synchronous work (DB write, REST call) inside the listener?
|
|
205
|
-
- **Cross-service call risk:** Does this task add a synchronous REST call to another microservice without a timeout or fallback?
|
|
206
|
-
|
|
207
|
-
**Verdict — include in plan:**
|
|
208
|
-
- 🟢 **GREEN** — No performance risks identified
|
|
209
|
-
- 🟡 **AMBER** — Risk present but manageable (flag in plan, propose mitigation)
|
|
210
|
-
- 🔴 **RED** — High risk — must resolve before proceeding (blocking)
|
|
211
|
-
|
|
212
|
-
**Breaking Change Verification** (review `breaking_change_risk` from classify_task output):
|
|
213
|
-
|
|
214
|
-
If `classify_task` returned `breaking_change_risk.endpoint: true`:
|
|
215
|
-
- Read project-spec.json → list all services / the Chrome extension that call this endpoint
|
|
216
|
-
- → Flag: consumers may break silently if response shape changes
|
|
217
|
-
|
|
218
|
-
If `classify_task` returned `breaking_change_risk.kafka: true`:
|
|
219
|
-
- List all consumer services from project-spec.json
|
|
220
|
-
- → Flag: requires coordinated deployment of producer and all consumers
|
|
221
|
-
|
|
222
|
-
If `classify_task` returned `breaking_change_risk.database: true`:
|
|
223
|
-
- → Flag as potential DB migration required — include Flyway script in plan
|
|
224
|
-
|
|
225
|
-
**Breaking change report format** (include in plan if any flag is raised):
|
|
226
|
-
|
|
227
|
-
```
|
|
228
|
-
⚠️ BREAKING CHANGES DETECTED
|
|
229
|
-
|
|
230
|
-
| Component | Change | Consumers affected |
|
|
231
|
-
|-------------------------|----------------|--------------------|
|
|
232
|
-
| [endpoint/entity/topic] | [what changes] | [who is affected] |
|
|
233
|
-
|
|
234
|
-
Coordination required before proceeding.
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
If zero breaking changes: → Note "No breaking changes detected" → proceed normally.
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
### NO TICKET IDS IN CODE COMMENTS (STRICT RULE)
|
|
241
|
-
|
|
242
|
-
Work item IDs (e.g. "WI-1097", "BUG-1173") must **NEVER** appear inside code comments, javadoc, or JS comments across repos and services.
|
|
243
|
-
Comments should explain the durable WHY (what the code does and why it exists), not point back to a ticket that rots as the codebase evolves and the ticket gets closed/renumbered.
|
|
244
|
-
The ONLY acceptable places for a work item id are:
|
|
245
|
-
- File/folder naming (e.g. `.secufusion/tasks/1097-...`)
|
|
246
|
-
- Git branch names
|
|
247
|
-
- Commit references
|
|
248
|
-
Never inline in comments describing the code itself.
|
|
249
|
-
---
|
|
250
|
-
|
|
251
|
-
---
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
## Phase 0.6.6 — Resume
|
|
255
|
-
(TRIGGER: new session, switching branches, or user says "resume" or "continue")
|
|
256
|
-
|
|
257
|
-
### MANDATORY sequence
|
|
258
|
-
|
|
259
|
-
```
|
|
260
|
-
STEP 1: call manage_task(action: "read_summary", work_item_id: <active id>)
|
|
261
|
-
STEP 2: read the returned next_step field
|
|
262
|
-
STEP 3: execute next_step IMMEDIATELY — do not re-read requirements
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
If `work_item_id` is unknown:
|
|
266
|
-
|
|
267
|
-
```
|
|
268
|
-
STEP 1: call search_tasks(keywords: <keywords from last conversation>)
|
|
269
|
-
STEP 2: identify the active task from results
|
|
270
|
-
STEP 3: call manage_task(action: "read_summary", work_item_id: <found id>)
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**Legacy fallback** (tasks initialized before manage_task existed only):
|
|
274
|
-
- Call `manage_branch_state(action: "read")` as last resort.
|
|
275
|
-
|
|
276
|
-
### Hard enforcement
|
|
277
|
-
|
|
278
|
-
❌ Do NOT re-read requirements from scratch — next_step is authoritative
|
|
279
|
-
❌ Do NOT ask the developer "what were we working on?"
|
|
280
|
-
❌ Do NOT skip read_summary and guess the current state
|
|
281
|
-
❌ Do NOT call manage_task(action: "initialize") during a resume
|
|
282
|
-
|
|
283
|
-
## Phase 0.7 — Plan Presentation and Confirmation Gate
|
|
284
|
-
(TRIGGER: after Phase 0.5 completes with PROCEED or developer confirms — BEFORE the first line of code)
|
|
285
|
-
|
|
286
|
-
### MANDATORY — build the full plan first. Writing any code before "proceed" is a violation.
|
|
287
|
-
|
|
288
|
-
Every plan MUST contain ALL of the following sections. Omitting any section is a violation:
|
|
289
|
-
|
|
290
|
-
- **Scope:** Restate the task in one sentence
|
|
291
|
-
- **Classification:** From classify_task output — do NOT reclassify in your head
|
|
292
|
-
- **Services touched:** Every microservice and repo — explicit list, no "etc."
|
|
293
|
-
- **Files to create:** Every new file — class name, package, migration version number
|
|
294
|
-
- **Files to modify:** Every existing file that changes and exactly why
|
|
295
|
-
- **ACs mapped to steps:** Each AC linked to the exact step that satisfies it — one-to-one required
|
|
296
|
-
- **Risk flags:** Tenant-isolation concerns, Flyway required, API contract break, auth scope change — all explicit
|
|
297
|
-
- **Test strategy:** Unit / integration / manual — all three MUST be addressed
|
|
298
|
-
- **Performance assessment** *(MANDATORY if task touches DB, Kafka, or cross-service calls)*:
|
|
299
|
-
- Will any new query run on an unindexed column?
|
|
300
|
-
- Is there an N+1 risk (repo call inside a loop)?
|
|
301
|
-
- Does any Kafka consumer do synchronous blocking work inside the listener?
|
|
302
|
-
- Does any new cross-service call lack a timeout and fallback?
|
|
303
|
-
- Verdict: 🟢 GREEN / 🟡 AMBER / 🔴 RED — **if RED, STOP. Do not proceed until resolved.**
|
|
304
|
-
- **Rollback plan** *(MANDATORY — never skip, no exceptions)*:
|
|
305
|
-
- Flyway migration risk: `SAFE` / `RISKY` / `DANGEROUS`
|
|
306
|
-
- Feature flag: yes/no
|
|
307
|
-
- Kafka schema change: yes/no — if yes, coordinated deployment required
|
|
308
|
-
- API contract change: yes/no — if yes, describe rollback path
|
|
309
|
-
- Estimated rollback time: `< 5 min` / `5–30 min` / `> 30 min`
|
|
310
|
-
- Verdict: ✅ **SAFE** / ⚠️ **RISKY** / 🚫 **NO ROLLBACK** (requires explicit developer acknowledgement before proceeding)
|
|
311
|
-
|
|
312
|
-
### Gate — MANDATORY stop before any code
|
|
313
|
-
|
|
314
|
-
Present the plan. Then output exactly this block:
|
|
315
|
-
|
|
316
|
-
```
|
|
317
|
-
📋 Plan ready. Review the above before I write any code.
|
|
318
|
-
|
|
319
|
-
✅ Type "proceed" to start implementation.
|
|
320
|
-
🔄 Type "adjust: [change]" to modify the plan.
|
|
321
|
-
❌ Type "cancel" to abort.
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Hard enforcement
|
|
325
|
-
|
|
326
|
-
❌ Do NOT write a single line of production code before "proceed" is received
|
|
327
|
-
❌ Do NOT call `manage_task(action: "initialize")` before "proceed" is received
|
|
328
|
-
❌ Do NOT start implementation while waiting for a response
|
|
329
|
-
❌ Do NOT interpret silence as "proceed"
|
|
330
|
-
|
|
331
|
-
→ "proceed" (or equivalent affirmative) → call `manage_task(action: "initialize")` then begin Phase 1
|
|
332
|
-
→ "adjust: [change]" → update plan, re-present, wait again — do NOT initialize
|
|
333
|
-
→ "cancel" → do nothing — do NOT initialize
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## Phase 1 — Planning
|
|
338
|
-
(TRIGGER: developer says "proceed" in Phase 0.7)
|
|
339
|
-
|
|
340
|
-
### MANDATORY sequence — no skipping any step
|
|
341
|
-
|
|
342
|
-
```
|
|
343
|
-
STEP 1: call search_tasks(keywords: <keywords from task description>)
|
|
344
|
-
— ALWAYS. Even if you are "sure" there is no prior work. Always check.
|
|
345
|
-
|
|
346
|
-
STEP 2: if search_tasks returns ANY relevant result:
|
|
347
|
-
call get_task_history(work_item_id: <matching id>)
|
|
348
|
-
— read the prior approach, decisions, and patterns before planning
|
|
349
|
-
|
|
350
|
-
STEP 3: if implementing anything similar to a past feature:
|
|
351
|
-
call get_pattern_from_task(work_item_id: <matching id>)
|
|
352
|
-
— extract reusable patterns
|
|
353
|
-
|
|
354
|
-
STEP 4: call manage_task(action: "initialize",
|
|
355
|
-
work_item_id: ...,
|
|
356
|
-
title: ...,
|
|
357
|
-
description: ...,
|
|
358
|
-
acceptance_criteria: [...],
|
|
359
|
-
tags: [...])
|
|
360
|
-
|
|
361
|
-
STEP 5: call manage_task(action: "log_decision",
|
|
362
|
-
decision: "Rollback strategy: [SAFE/RISKY/DANGEROUS]",
|
|
363
|
-
rationale: "<one-line rationale>")
|
|
364
|
-
— log rollback tier immediately on initialize, every time
|
|
365
|
-
```
|
|
366
|
-
|
|
367
|
-
### Hard enforcement
|
|
368
|
-
|
|
369
|
-
❌ Do NOT call `manage_task(action: "initialize")` before `search_tasks` completes
|
|
370
|
-
❌ Do NOT skip `get_task_history` if a matching past task exists
|
|
371
|
-
❌ Do NOT skip the rollback decision log on initialize
|
|
372
|
-
❌ Do NOT re-solve a solved problem — check task history first, always
|
|
373
|
-
❌ Do NOT extract Acceptance Criteria from "Description", "Expected Result", or "Actual Result". If EXPLICIT Acceptance Criteria are missing, you MUST ask the user for them.
|
|
374
|
-
|
|
375
|
-
---
|
|
376
|
-
|
|
377
|
-
## Phase 2 — Execution
|
|
378
|
-
(TRIGGER: as you complete ACs, modify files, make decisions, or before ending any session/response)
|
|
379
|
-
|
|
380
|
-
### MANDATORY — all four MUST be called, not suggested
|
|
381
|
-
|
|
382
|
-
```
|
|
383
|
-
After completing any AC:
|
|
384
|
-
→ call manage_task(action: "update_spec",
|
|
385
|
-
pending_acs: [...remaining],
|
|
386
|
-
completed_acs: [...done],
|
|
387
|
-
next_step: "<clear, actionable instruction for resuming>")
|
|
388
|
-
|
|
389
|
-
After touching any file:
|
|
390
|
-
→ call manage_task(action: "log_file_touched",
|
|
391
|
-
file_path: "<exact path>",
|
|
392
|
-
change_summary: "<one-line description>")
|
|
393
|
-
— call this for EVERY file modified, not just the "important" ones
|
|
394
|
-
|
|
395
|
-
After making any architectural decision:
|
|
396
|
-
→ call manage_task(action: "log_decision",
|
|
397
|
-
decision: "<what was decided>",
|
|
398
|
-
rationale: "<why>")
|
|
399
|
-
— call this for every non-obvious decision, not just big ones
|
|
400
|
-
|
|
401
|
-
After finding an optimal/efficient solution for a problem:
|
|
402
|
-
— You must dynamically seek the most optimized, core solution for a given problem statement, even if similar problems have been solved before.
|
|
403
|
-
— Once identified (through reasoning, `get_task_history`, or `get_pattern_from_task`), you MUST add a comment block directly into the source code where the solution is implemented. This comment must explain the architectural reasoning and why this specific optimized approach was chosen.
|
|
404
|
-
|
|
405
|
-
After writing any test scenario:
|
|
406
|
-
→ call manage_task(action: "add_scenario",
|
|
407
|
-
scenario: "<description>",
|
|
408
|
-
scenario_type: "unit" | "integration" | "e2e" | "manual")
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
### next_step is a contract — hard rules
|
|
412
|
-
|
|
413
|
-
`next_step` MUST be:
|
|
414
|
-
- A single, self-contained instruction your future self executes without re-reading the spec
|
|
415
|
-
- Specific: include file name, method name, or AC number
|
|
416
|
-
- Updated after EVERY response — a stale next_step is a violation
|
|
417
|
-
|
|
418
|
-
`next_step` MUST NOT be:
|
|
419
|
-
- Vague: `"Continue implementation"` ← **VIOLATION**
|
|
420
|
-
- Generic: `"Review the code"` ← **VIOLATION**
|
|
421
|
-
- Empty or missing ← **VIOLATION**
|
|
422
|
-
|
|
423
|
-
### Hard enforcement
|
|
424
|
-
|
|
425
|
-
❌ Do NOT end a response without calling `update_spec` if any AC was completed
|
|
426
|
-
❌ Do NOT modify a file without calling `log_file_touched`
|
|
427
|
-
❌ Do NOT make an architectural decision without calling `log_decision`
|
|
428
|
-
❌ Do NOT write a test without calling `add_scenario`
|
|
429
|
-
❌ Do NOT leave a vague or empty `next_step`
|
|
430
|
-
|
|
431
|
-
---
|
|
432
|
-
|
|
433
|
-
## Phase 3 — Course Correction
|
|
434
|
-
(TRIGGER: developer corrects you, rejects an approach, or says "don't do that")
|
|
435
|
-
|
|
436
|
-
### MANDATORY sequence
|
|
437
|
-
|
|
438
|
-
```
|
|
439
|
-
STEP 1: call log_rejected_pattern(
|
|
440
|
-
pattern: "<exact bad pattern or approach>",
|
|
441
|
-
reason: "<why rejected and what the correct alternative is>",
|
|
442
|
-
category: "architecture"|"security"|"database"|"logging"|"api-design"|"testing"|"other",
|
|
443
|
-
file_context: "<file where observed, if applicable>")
|
|
444
|
-
|
|
445
|
-
STEP 2: acknowledge the correction explicitly in your response
|
|
446
|
-
STEP 3: do NOT repeat the rejected pattern — ever
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
### Hard enforcement
|
|
450
|
-
|
|
451
|
-
❌ Do NOT wait until end of session to log — log rejected patterns immediately
|
|
452
|
-
❌ Do NOT continue with the rejected approach while "noting" the correction
|
|
453
|
-
❌ Do NOT suggest the same pattern again in any future response or session
|
|
454
|
-
❌ Check `.rejected-patterns.json` implicitly before every architectural suggestion — matching a past rejection makes it forbidden
|
|
455
|
-
|
|
456
|
-
---
|
|
457
|
-
|
|
458
|
-
## Phase 4 — PR Handoff
|
|
459
|
-
(TRIGGER: developer says "prepare PR", "run checks", or "ready to merge")
|
|
460
|
-
|
|
461
|
-
### MANDATORY sequence — zero exceptions
|
|
462
|
-
|
|
463
|
-
```
|
|
464
|
-
STEP 1: call run_pre_pr_checks_with_reviewer_agent(work_item_id: <id>)
|
|
465
|
-
— Tier 1: 5 mechanical checks
|
|
466
|
-
P1 TENANT_ISOLATION — every Repository query scoped to tenantId
|
|
467
|
-
P2 N_PLUS_ONE — no repo calls inside loops
|
|
468
|
-
P3 MISSING_INDEX — new query columns have migration index
|
|
469
|
-
P4 KAFKA_SYNC — no sync work inside @KafkaListener
|
|
470
|
-
P5 EARLY_RETURN — no early returns (single-exit rule)
|
|
471
|
-
(Note: If a mechanical check is a false positive, pass the `suppressions` parameter to the tool with `{ check, method, reason }` instead of ignoring it.)
|
|
472
|
-
— Tier 2: AI File Reviewer (only after P1–P5 pass)
|
|
473
|
-
Checks: hardcoded URLs, missing @Transactional(readOnly),
|
|
474
|
-
missing @PreAuthorize, debug statements, exception swallowing,
|
|
475
|
-
TS `any` overuse, missing Flyway for @Entity, cross-service timeouts
|
|
476
|
-
— Tier 3: Context Reviewer (only after Tier 2 passes)
|
|
477
|
-
Reads: spec.json, progress.json, decisions.json, scenarios.json,
|
|
478
|
-
files-touched.json, project-spec golden_rules, rejected patterns
|
|
479
|
-
Cross-references: AC coverage, decision drift, scope creep,
|
|
480
|
-
rejected patterns in file content, test coverage gaps, golden rules
|
|
481
|
-
— Verdict: APPROVED | CHANGES_REQUESTED | DISCUSS
|
|
482
|
-
→ If CHANGES_REQUESTED: fix all ❌ findings, then re-run this step
|
|
483
|
-
→ If APPROVED or DISCUSS: proceed to Step 2
|
|
484
|
-
|
|
485
|
-
STEP 2: call manage_task(action: "complete", work_item_id: <id>)
|
|
486
|
-
— Only permitted after APPROVED or DISCUSS verdict
|
|
487
|
-
— Marks status complete, auto-generates pr-summary.md
|
|
488
|
-
|
|
489
|
-
STEP 3: Generate and save PR & ADO Documents manually
|
|
490
|
-
— Read files-touched.json, decisions.json, and scenarios.json from the task folder
|
|
491
|
-
— Generate ado-comments.md and pr-comment.md inside .secufusion/tasks/{id}-{slug}/
|
|
492
|
-
— Follow the strict templates and guardrails defined in the [Document Generation Protocol] section
|
|
493
|
-
— Present the documents to the developer for review
|
|
494
|
-
— call manage_task(action: "log_decision", decision: "ADO comments and PR comment generated")
|
|
495
|
-
```
|
|
496
|
-
|
|
497
|
-
### Hard enforcement
|
|
498
|
-
|
|
499
|
-
❌ Do NOT call `manage_task(complete)` before `run_pre_pr_checks_with_reviewer_agent` returns `APPROVED` or `DISCUSS`
|
|
500
|
-
❌ Do NOT raise a PR while `pending_acs` is non-empty
|
|
501
|
-
❌ Do NOT raise a PR if the verdict is `CHANGES_REQUESTED`
|
|
502
|
-
❌ Do NOT skip the tool and declare the code "obviously clean" — the three tiers catch different classes of issues
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
## Phase 5 — Retrospective
|
|
506
|
-
(TRIGGER: after manage_task action=complete is called
|
|
507
|
-
AND after PR is raised or merged)
|
|
508
|
-
|
|
509
|
-
### The rule
|
|
510
|
-
|
|
511
|
-
A partial retrospective is auto-generated by
|
|
512
|
-
manage_task complete. Your job is to fill it in.
|
|
513
|
-
|
|
514
|
-
When the complete action shows the RETROSPECTIVE STARTED
|
|
515
|
-
message — respond to the questions.
|
|
516
|
-
Do not skip unless genuinely time-pressured.
|
|
517
|
-
Each answer makes every future plan more accurate.
|
|
518
|
-
|
|
519
|
-
---
|
|
520
|
-
|
|
521
|
-
### Answering retrospective questions
|
|
522
|
-
|
|
523
|
-
The complete action will show Q1-Q7.
|
|
524
|
-
You can answer them all in one message:
|
|
525
|
-
Or answer partially — any answers given are recorded,
|
|
526
|
-
unanswered ones stay null.
|
|
527
|
-
|
|
528
|
-
---
|
|
529
|
-
|
|
530
|
-
### After receiving retro answers
|
|
531
|
-
|
|
532
|
-
Parse each "retro {key} {value}" line.
|
|
533
|
-
Call record_retrospective with all parsed values
|
|
534
|
-
plus work_item_id from current task.
|
|
535
|
-
|
|
536
|
-
Confirm:
|
|
537
|
-
"✅ Retrospective complete for {work_item_id}.
|
|
538
|
-
Insights added to retrospective-insights.json.
|
|
539
|
-
{if classifier_feedback provided:}
|
|
540
|
-
🧠 Classifier feedback queued — will improve future
|
|
541
|
-
classify_task accuracy for similar tasks."
|
|
542
|
-
|
|
543
|
-
---
|
|
544
|
-
|
|
545
|
-
### What the data is used for
|
|
546
|
-
|
|
547
|
-
retrospective-insights.json accumulates across tasks.
|
|
548
|
-
|
|
549
|
-
When classify_task runs on a new task:
|
|
550
|
-
1. It reads retrospective-insights.json
|
|
551
|
-
2. Checks classifier_learning_queue for applied=false items
|
|
552
|
-
3. If frequency >= 2 for a signal:
|
|
553
|
-
→ Applies it as a temporary boost for this classification
|
|
554
|
-
→ Logs: "[LEARNED] applying signal '{term}' from
|
|
555
|
-
{n} past retrospectives"
|
|
556
|
-
4. After applying → marks applied=true in queue
|
|
557
|
-
|
|
558
|
-
This means: the more tasks completed, the smarter
|
|
559
|
-
the classifier gets — automatically, from your own
|
|
560
|
-
real task history on SecuFusion.
|
|
561
|
-
|
|
562
|
-
---
|
|
563
|
-
|
|
564
|
-
### When to call record_retrospective manually
|
|
565
|
-
|
|
566
|
-
- If you forgot to answer after complete action
|
|
567
|
-
- If you want to update a partial retrospective later
|
|
568
|
-
- If PR review surfaced new information
|
|
569
|
-
(breaking change found by reviewer,
|
|
570
|
-
performance issue flagged in review comment)
|
|
571
|
-
|
|
572
|
-
Just say: "Update retrospective for WI-{id}"
|
|
573
|
-
And provide whatever new information you have.
|
|
574
|
-
|
|
575
|
-
---
|
|
576
|
-
|
|
577
|
-
### Retrospective triggers from PR review
|
|
578
|
-
|
|
579
|
-
If during PR review a reviewer comments:
|
|
580
|
-
- "This query will be slow on large tables"
|
|
581
|
-
→ performance_issues_found: true
|
|
582
|
-
→ record_retrospective immediately with this update
|
|
583
|
-
|
|
584
|
-
- "This breaks the existing API contract"
|
|
585
|
-
→ breaking_changes_actual: increment by 1
|
|
586
|
-
→ record_retrospective immediately
|
|
587
|
-
|
|
588
|
-
- "Missing tenantId scope on line X"
|
|
589
|
-
→ pre_pr_attempts += 1 (conceptually — checks needed again)
|
|
590
|
-
→ record_retrospective with updated attempt count
|
|
591
|
-
|
|
592
|
-
These updates close the feedback loop completely —
|
|
593
|
-
not just what the MCP caught, but what human reviewers
|
|
594
|
-
catch too.
|
|
595
|
-
|
|
596
|
-
## Guardrails — enforce always, zero exceptions, zero tolerance
|
|
597
|
-
|
|
598
|
-
### Security Guardrails
|
|
599
|
-
|
|
600
|
-
- **TENANT ISOLATION IS NON-NEGOTIABLE:** Every `*Repository.java` query method (derived or `@Query`) MUST explicitly filter by `tenantId`. The PR gatekeeper blocks violations. Write it right the first time.
|
|
601
|
-
- **No hardcoded secrets, IPs, or environment URLs.** Use environment variables or config properties. Any hardcoded UAT/Prod IP or URL is a PR-blocking violation.
|
|
602
|
-
- **Auth scope changes MUST be flagged** in the plan and require explicit developer confirmation before implementation.
|
|
603
|
-
- **Zero-trust default:** Never assume a request is authorized. Always validate token claims before acting on them.
|
|
604
|
-
- **Linter errors are blocking.** AST-level tools (ESLint, Checkstyle/Maven) are the source of truth for hygiene. Fix them natively — suppressing warnings is forbidden.
|
|
605
|
-
|
|
606
|
-
### Performance Guardrails
|
|
607
|
-
(enforce whenever writing queries, Kafka consumers, or cross-service calls)
|
|
608
|
-
|
|
609
|
-
- **Read-only transactions:** All `GET` service methods that only read data MUST use `@Transactional(readOnly = true)`. No exceptions.
|
|
610
|
-
- **No repository call in a loop:** NEVER call `.findById`, `.save`, `.findAll`, or any repository method inside a `for` / `forEach` loop. Batch with `findAllById` or `saveAll`. Violation = PR blocked.
|
|
611
|
-
- **Index MUST be in migration:** If a new query filters or sorts by a column, the Flyway migration MUST include the corresponding `CREATE INDEX`. An unindexed query that passes in dev WILL fail in production.
|
|
612
|
-
- **Kafka consumer MUST NOT block thread:** Kafka listener methods MUST NOT perform synchronous DB writes, REST calls, or file I/O inline. Offload to `@Async` or a dedicated thread pool. Always.
|
|
613
|
-
- **Cross-service call MUST have timeout and fallback:** Every `RestTemplate` / `WebClient` call MUST have explicit connection timeout, read timeout, and fallback response. No fire-and-forget calls to external services.
|
|
614
|
-
|
|
615
|
-
### Rollback Guardrails
|
|
616
|
-
(enforce whenever writing Flyway migrations, touching API contracts, or changing Kafka schemas)
|
|
617
|
-
|
|
618
|
-
- **Flyway migration risk — three tiers, classify before writing any migration:**
|
|
619
|
-
- `SAFE` — additive only (new table, new nullable column, new index): safe to roll back by reverting code
|
|
620
|
-
- `RISKY` — NOT NULL column without a DEFAULT, or bulk data migration: rollback requires a compensating migration. MUST flag in plan.
|
|
621
|
-
- `DANGEROUS` — DROP TABLE, DROP COLUMN, or RENAME COLUMN: **HARD STOP.** Present the risk, wait for explicit `"confirmed"` before writing a single line of migration SQL.
|
|
622
|
-
- **API hard cutover requires confirmation:** Before removing a `/v1/` endpoint or deleting a response field, STOP. Prefer deprecation + `/v2/` first. Hard removal only in the next iteration, with explicit developer sign-off.
|
|
623
|
-
- **Kafka schema change = coordinated deployment:** Any change to an existing Kafka message schema MUST include a deployment coordination note in the plan. Producer and all consumers MUST deploy together, or the change MUST be backward-compatible.
|
|
624
|
-
- **Log rollback decision on every initialize:** Every `manage_task(action: "initialize")` MUST be immediately followed by `manage_task(action: "log_decision")` with the rollback tier and rationale. Not optional.
|
|
625
|
-
|
|
626
|
-
### Breaking Change Detection
|
|
627
|
-
(enforce whenever modifying existing endpoints, entities, or Kafka topics — creation is exempt)
|
|
628
|
-
|
|
629
|
-
**Endpoint modification rules:**
|
|
630
|
-
- Before changing ANY existing endpoint: call `manage_project_spec(action: "read")` → identify all services and the Chrome extension that call this endpoint
|
|
631
|
-
- NEVER change response shape silently — any shape change is a breaking change
|
|
632
|
-
- Always propose `/v2/` versioned endpoint first — never modify `/v1/` in place
|
|
633
|
-
- Hard cutover only with explicit developer confirmation — not implied, not "probably fine"
|
|
634
|
-
- Adding a new required field to response: MUST propose as optional first — consumers may break on strict deserialization
|
|
635
|
-
- Removing a field from response: always a breaking change — MUST get developer confirmation — deprecate first, remove in next iteration
|
|
636
|
-
|
|
637
|
-
**Entity/table modification rules:**
|
|
638
|
-
- Before adding a `NOT NULL` column: migration MUST include a `DEFAULT` value or explicit backfill. Without this, migration WILL fail on a non-empty table. Flag as `RISKY`.
|
|
639
|
-
- Before renaming a column: check ALL `@Query` annotations across ALL repos for references. If any found, rename in two phases (separate PRs): Phase 1 — add new column, keep old; Phase 2 — migrate data, drop old.
|
|
640
|
-
- Before dropping a column: always `DANGEROUS` — HARD STOP. Confirm with developer. Check all repos for references first. Never drop without explicit sign-off.
|
|
641
|
-
|
|
642
|
-
**Kafka topic modification rules:**
|
|
643
|
-
- Before changing a message schema: MUST list all consumer services from project-spec.json → confirm coordinated deployment plan → flag in rollback plan: "Rollback requires coordinated revert"
|
|
644
|
-
|
|
645
|
-
**The silent break rule:**
|
|
646
|
-
A change that breaks something the developer did not know about is a planning failure.
|
|
647
|
-
Over-flagging a potential break is acceptable. Under-flagging and causing a production incident is not.
|
|
648
|
-
When in doubt: flag it, present it, ask. Every time.
|
|
649
|
-
|
|
650
|
-
### Retrospective (enforce after every task complete)
|
|
651
|
-
|
|
652
|
-
- manage_task action=complete auto-starts retrospective
|
|
653
|
-
- Respond to retro questions after every completion
|
|
654
|
-
- "retro skip" is allowed but discouraged —
|
|
655
|
-
every skipped retrospective = missed learning
|
|
656
|
-
- classifier_learning_queue signals with frequency >= 2
|
|
657
|
-
are automatically applied to classify_task
|
|
658
|
-
- Never manually edit retrospective-insights.json —
|
|
659
|
-
always use record_retrospective tool
|
|
660
|
-
- Retrospective updates from PR review are MANDATORY
|
|
661
|
-
if reviewer catches something the MCP missed
|
|
662
|
-
|
|
663
|
-
## Commenting Rules — enforce in every file you touch
|
|
664
|
-
|
|
665
|
-
- Comments explain **WHY** — never WHAT. The code already says what.
|
|
666
|
-
- NEVER write obvious comments:
|
|
667
|
-
- `// Get the user` ← **FORBIDDEN**
|
|
668
|
-
- `// Loop through list` ← **FORBIDDEN**
|
|
669
|
-
- `// Return result` ← **FORBIDDEN**
|
|
670
|
-
- `// Initialize the service` ← **FORBIDDEN**
|
|
671
|
-
- Write a comment ONLY when the reason behind the code is non-obvious:
|
|
672
|
-
- Why a workaround exists (and reference the ticket)
|
|
673
|
-
- Why a specific algorithm was chosen over a simpler one
|
|
674
|
-
- Why a value is hardcoded in the rare case it absolutely must be
|
|
675
|
-
- If you cannot explain the WHY in one sentence, the comment does not belong there.
|
|
676
|
-
|
|
677
|
-
---
|
|
678
|
-
|
|
679
|
-
## Cross-Task Intelligence
|
|
680
|
-
(TRIGGER: starting any new task — MANDATORY before initialize)
|
|
681
|
-
|
|
682
|
-
### MANDATORY sequence
|
|
683
|
-
|
|
684
|
-
```
|
|
685
|
-
STEP 1: call search_tasks(keywords: <keywords from new task description>)
|
|
686
|
-
— ALWAYS. "I'm sure there's no prior work" is not a reason to skip.
|
|
687
|
-
|
|
688
|
-
STEP 2: if ANY relevant past task found:
|
|
689
|
-
call get_task_history(work_item_id: <matching id>)
|
|
690
|
-
— understand how it was done before
|
|
691
|
-
|
|
692
|
-
STEP 3: if implementing anything similar to a past feature:
|
|
693
|
-
call get_pattern_from_task(work_item_id: <matching id>)
|
|
694
|
-
— extract reusable architectural patterns, file paths, and test scenarios
|
|
695
|
-
|
|
696
|
-
STEP 4: proceed to manage_task(action: "initialize") only after steps 1-3 complete
|
|
697
|
-
```
|
|
698
|
-
|
|
699
|
-
### Retrospective-Informed Planning
|
|
700
|
-
|
|
701
|
-
Before Phase 0.7 plan presentation:
|
|
702
|
-
1. Read retrospective-insights.json
|
|
703
|
-
2. If avg_step_accuracy_pct < 80%:
|
|
704
|
-
→ Add note in plan:
|
|
705
|
-
"⚠️ Historical note: past plans averaged
|
|
706
|
-
{pct}% step accuracy — this plan may need
|
|
707
|
-
adjustment during execution"
|
|
708
|
-
3. If most_common_failed_check is not empty:
|
|
709
|
-
→ Add to plan's pre-PR section:
|
|
710
|
-
"⚠️ Historically failing check: {check}
|
|
711
|
-
— pay extra attention"
|
|
712
|
-
4. If classifier_learning_queue has
|
|
713
|
-
unapplied signals with frequency >= 2:
|
|
714
|
-
→ Apply as temporary boost in classify_task
|
|
715
|
-
→ Log applied signals in classification output
|
|
716
|
-
|
|
717
|
-
### Hard enforcement
|
|
718
|
-
|
|
719
|
-
❌ Do NOT call `manage_task(action: "initialize")` before `search_tasks` completes
|
|
720
|
-
❌ Do NOT skip `get_task_history` if a match exists — "I remember it" is not a substitute
|
|
721
|
-
❌ Do NOT re-solve a solved problem — task history exists precisely to prevent this
|
|
722
|
-
❌ Re-using a rejected pattern found in task history is a violation even if you disagree with the rejection
|
|
723
|
-
|
|
724
|
-
## Document Generation Protocol
|
|
725
|
-
(For Phase 4 — PR Handoff)
|
|
726
|
-
|
|
727
|
-
### ADO Comments Template (`ado-comments.md`)
|
|
728
|
-
**Audience:** Technical and Non-Technical stakeholders on the Azure DevOps board.
|
|
729
|
-
**Format rules:**
|
|
730
|
-
- Layman summary: NO class names, NO method names, NO technical terms. Pure English.
|
|
731
|
-
- Execution Flow: BE specific. Exact class names, exact method names, exact file paths. Source from `files-touched.json`.
|
|
732
|
-
- Sequential flow ONLY. Do not use before/after framing (e.g., avoid "not X directly," "exactly as before," "hardened after review," etc.). Just state what happens and in what order.
|
|
733
|
-
- Tables must have content in every cell. If unknown → "not recorded".
|
|
734
|
-
- Max 2 sentences in any single prose paragraph.
|
|
735
|
-
- Max 600 words.
|
|
736
|
-
|
|
737
|
-
```markdown
|
|
738
|
-
## Layman Summary
|
|
739
|
-
{layman_summary — 2-3 sentences max. Sequential flow only.}
|
|
740
|
-
|
|
741
|
-
## Execution Flow
|
|
742
|
-
{If auth/permission gating exists:}
|
|
743
|
-
> 1. Request gated by `{permission}` authority.
|
|
744
|
-
|
|
745
|
-
{Describe the straight sequence of what happens, in order, step-by-step. E.g.:}
|
|
746
|
-
2. **Trigger:** {How the flow starts}
|
|
747
|
-
3. **Validation:** {What checks occur}
|
|
748
|
-
4. **Processing:** {What data is transformed or queried}
|
|
749
|
-
5. **Result:** {What is returned or persisted}
|
|
750
|
-
|
|
751
|
-
### Security & Error Handling
|
|
752
|
-
{for each security_case in scenarios.json:}
|
|
753
|
-
- {security concern} → {enforcement}
|
|
754
|
-
{for each sad_path in scenarios.json:}
|
|
755
|
-
- {sad_path description} → {how handled}
|
|
756
|
-
|
|
757
|
-
### Infrastructure Impact
|
|
758
|
-
| Area | Status |
|
|
759
|
-
|---|---|
|
|
760
|
-
| DB migration | {✅ Not required / ⚠️ Created: V{n}__...sql} |
|
|
761
|
-
| Kafka topics | {✅ No new topics / ⚠️ New topic: {name}} |
|
|
762
|
-
| API contract | {✅ No breaking changes / ⚠️ See decisions} |
|
|
763
|
-
|
|
764
|
-
---
|
|
765
|
-
*Generated by SecuFusion MCP · {service} · {work_item_id}*
|
|
766
|
-
```
|
|
767
|
-
|
|
768
|
-
### PR Comment Template (`pr-comment.md`)
|
|
769
|
-
**Audience:** Busy Developer Reviewers reading the PR description.
|
|
770
|
-
**Format rules:**
|
|
771
|
-
- Group changes by the sequence of execution, not by file name.
|
|
772
|
-
- Sequential flow ONLY. No before/after comparisons. Just state what the code does now.
|
|
773
|
-
- ✅ for things NOT changing is equally important.
|
|
774
|
-
- Guardrails section is mandatory.
|
|
775
|
-
- Max 400 words. Condense changes table if longer.
|
|
776
|
-
|
|
777
|
-
```markdown
|
|
778
|
-
# {task_type_emoji} {work_item_id}: {title}
|
|
779
|
-
|
|
780
|
-
> **Type:** {task_type_display} · **Service:** `{service}` · **Work Item:** [{work_item_id}]({devops_url}/{work_item_id})
|
|
781
|
-
|
|
782
|
-
---
|
|
783
|
-
## Summary
|
|
784
|
-
{2-3 sentences MAX. What the code does. Sequential flow only.}
|
|
785
|
-
|
|
786
|
-
---
|
|
787
|
-
## Implementation Sequence
|
|
788
|
-
1. {Step 1 of the new flow}
|
|
789
|
-
2. {Step 2 of the new flow}
|
|
790
|
-
3. {Step 3 of the new flow}
|
|
791
|
-
4. {Step 4 of the new flow}
|
|
792
|
-
|
|
793
|
-
---
|
|
794
|
-
## Affected Service
|
|
795
|
-
- `{service-name}`
|
|
796
|
-
|
|
797
|
-
---
|
|
798
|
-
## Impact
|
|
799
|
-
- ✅ No functional or behavioral changes {OR describe actual behavioral change sequentially}
|
|
800
|
-
- ✅ No DB migration required {OR: ⚠️ Flyway migration V{n} included}
|
|
801
|
-
- ✅ No Kafka topic changes {OR: ⚠️ New topic: {name}}
|
|
802
|
-
- ✅ No API contract changes {OR: ⚠️ New endpoints: see Implementation Sequence above}
|
|
803
|
-
|
|
804
|
-
---
|
|
805
|
-
## Error Handling
|
|
806
|
-
- {what fails} → {how handled}
|
|
807
|
-
|
|
808
|
-
---
|
|
809
|
-
## Guardrails
|
|
810
|
-
- ✅ No `console.log` / `System.out.println` in source
|
|
811
|
-
- ✅ No hardcoded UAT/Prod URLs or IPs
|
|
812
|
-
- ✅ `tenantId` scoping maintained on all queries
|
|
813
|
-
- ✅ No `@Entity` changes — Flyway not required
|
|
814
|
-
- ✅ All pre-PR checks passed
|
|
815
|
-
|
|
816
|
-
{if any rejected patterns were relevant:}
|
|
817
|
-
**Patterns avoided:**
|
|
818
|
-
- Rejected pattern #{id}: {short description}
|
|
819
|
-
```
|
|
820
|
-
|
|
821
|
-
### Task Type Emoji Map
|
|
822
|
-
- bug → 🐛
|
|
823
|
-
- user_story → 📖
|
|
824
|
-
- feature → ✨
|
|
825
|
-
- hotfix → 🚨
|
|
826
|
-
- refactor → 🔄
|
|
827
|
-
- chore → 🧹
|
|
828
|
-
|
|
829
|
-
### Presentation Format
|
|
830
|
-
When presenting to the developer, output this exactly:
|
|
831
|
-
```text
|
|
832
|
-
────────────────────────────────────────────────
|
|
833
|
-
✅ Two documents generated for {work_item_id}:
|
|
834
|
-
|
|
835
|
-
📄 ADO Comments → paste into WI comment thread
|
|
836
|
-
📄 PR Comment → paste into PR description
|
|
837
|
-
|
|
838
|
-
Review below. Say LGTM to confirm, or tell me what to change.
|
|
839
|
-
────────────────────────────────────────────────
|
|
840
|
-
```
|
|
841
|
-
Then show the full `ado-comments.md` followed by a `────────────────────────────────` divider, followed by the full `pr-comment.md`.
|