secufusion-mcp 1.2.7 → 2.0.0
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/.claude/settings.json +9 -0
- package/.claude-plugin/plugin.json +5 -6
- package/.mcp.json +19 -0
- package/{AGENTS.md → agents/AGENTS.md} +3 -3
- package/agents/claude.md +50 -0
- package/agents/coder.md +80 -0
- package/agents/planner.md +354 -0
- package/agents/reviewer.md +384 -0
- package/commands/analyze.md +15 -0
- package/commands/blast-radius.md +14 -0
- package/commands/map-architecture.md +10 -0
- package/commands/map-services.md +3 -0
- package/commands/watch-dna.md +9 -0
- package/hooks/hooks.json +17 -0
- package/hooks/knowledge-drift.sh +48 -0
- package/mcp/dist/parsers/api.js +30 -0
- package/mcp/dist/parsers/backend-node.js +26 -0
- package/mcp/dist/parsers/config.js +74 -0
- package/mcp/dist/parsers/database.js +40 -0
- package/mcp/dist/parsers/domain.js +21 -0
- package/mcp/dist/parsers/events.js +36 -0
- package/mcp/dist/parsers/frontend.js +34 -0
- package/mcp/dist/parsers/infra.js +42 -0
- package/mcp/dist/parsers/patterns.js +49 -0
- package/mcp/dist/parsers/security.js +16 -0
- package/{index.js → mcp/dist/server.js} +408 -4
- package/package.json +19 -15
- package/scripts/sfn-pr-check.js +108 -0
- package/scripts/sfn-pr-check.ts +121 -0
- package/scripts/utils.js +29 -0
- package/scripts/utils.ts +31 -0
- package/.secufusion-project-spec.json +0 -1068
- /package/commands/{code.md → sfn-code.md} +0 -0
- /package/commands/{init.md → sfn-init.md} +0 -0
- /package/commands/{plan.md → sfn-plan.md} +0 -0
- /package/commands/{review.md → sfn-review.md} +0 -0
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"description": "SecuFusion
|
|
4
|
-
"version": "
|
|
2
|
+
"name": "secufusion-mcp",
|
|
3
|
+
"description": "SecuFusion MSSP platform dev agent — project-level spec driven, tenant-isolation enforced, zero-trust guardrails. Slash commands: /sfn:task (classify+plan+init), /sfn:resume (instant context restore), /sfn:build (implement AC), /sfn:checks (pre-PR gates), /sfn:review (adversarial review), /sfn:pr (ADO+PR docs), /sfn:retro (retrospective), /sfn:init (dynamic DNA generation), /sfn:refresh (update stale docs), /sfn:doctor (health check), /sfn:estate (cross-service map), /sfn:impact (blast radius), /sfn:status (dashboard), /sfn:search (past tasks).",
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"author": {
|
|
6
|
-
"name": "
|
|
6
|
+
"name": "Motivity Labs"
|
|
7
7
|
},
|
|
8
|
-
"homepage": "https://
|
|
9
|
-
"repository": "https://github.com/sutaryash/secufusion-mcp",
|
|
8
|
+
"homepage": "https://github.com/MLMCPS/secufusion-mcp",
|
|
10
9
|
"license": "ISC"
|
|
11
10
|
}
|
package/.mcp.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "MCP server bundled WITH the plugin. ${CLAUDE_PLUGIN_ROOT}",
|
|
3
|
+
"//1": "resolves wherever plugin is installed — no absolute paths,",
|
|
4
|
+
"//2": "no per-machine configuration, works on fresh clone.",
|
|
5
|
+
"//3": "",
|
|
6
|
+
"//4": "--root . means server reads whichever repo session is in.",
|
|
7
|
+
"//5": "This replaces the npx -y hack and claude_desktop_config",
|
|
8
|
+
"//6": "absolute path entries. One install, works everywhere.",
|
|
9
|
+
"mcpServers": {
|
|
10
|
+
"secufusion-mcp": {
|
|
11
|
+
"command": "node",
|
|
12
|
+
"args": [
|
|
13
|
+
"${CLAUDE_PLUGIN_ROOT}/mcp/dist/server.js",
|
|
14
|
+
"--root",
|
|
15
|
+
"."
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -5,9 +5,9 @@ You are an elite Senior Developer and Architect. You prioritize robust cross-ser
|
|
|
5
5
|
## Thin Index Routing
|
|
6
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
7
|
|
|
8
|
-
1. **Planning Phase (Phase 00 to 1):** Read `[planner.md](
|
|
9
|
-
2. **Execution Phase (Phase 2 to 3):** Read `[coder.md](
|
|
10
|
-
3. **Review Phase (Phase 4 to 5):** Read `[reviewer.md](
|
|
8
|
+
1. **Planning Phase (Phase 00 to 1):** Read `[planner.md](${CLAUDE_PLUGIN_ROOT}/agents/planner.md)`
|
|
9
|
+
2. **Execution Phase (Phase 2 to 3):** Read `[coder.md](${CLAUDE_PLUGIN_ROOT}/agents/coder.md)`
|
|
10
|
+
3. **Review Phase (Phase 4 to 5):** Read `[reviewer.md](${CLAUDE_PLUGIN_ROOT}/agents/reviewer.md)`
|
|
11
11
|
|
|
12
12
|
---
|
|
13
13
|
|
package/agents/claude.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# SecuFusion System Prompt & Memory
|
|
2
|
+
|
|
3
|
+
This file serves as the primary system prompt and state memory for Claude when working within the SecuFusion ecosystem.
|
|
4
|
+
|
|
5
|
+
**Rule Zero:** Always check the `<MEMORY>` block below before executing any commands to ensure the project DNA has been loaded.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The 4-Command Pipeline
|
|
10
|
+
|
|
11
|
+
You must strictly execute these commands in the prescribed order by calling the underlying MCP tools or personas.
|
|
12
|
+
|
|
13
|
+
### 1. `sfn:init`
|
|
14
|
+
**Purpose:** Prime the ecosystem for the first time.
|
|
15
|
+
**Execution Sequence:**
|
|
16
|
+
1. Call the `secufusion-dna-plugin` tools to scan the repository.
|
|
17
|
+
2. Generate the architectural map and configuration extracts.
|
|
18
|
+
3. Update the `<MEMORY>` block in this file with a summary of the architecture and set `DNA_LOADED = true`.
|
|
19
|
+
|
|
20
|
+
### 2. `sfn:plan [task_id]`
|
|
21
|
+
**Purpose:** Architect the solution based on the loaded DNA and initialize the task workspace.
|
|
22
|
+
**Execution Sequence:**
|
|
23
|
+
1. Verify `DNA_LOADED == true` in the `<MEMORY>` block. If false, abort and tell the user to run `sfn:init`.
|
|
24
|
+
2. Call `manage_task(action: "initialize", work_item_id: [task_id])` to create the dedicated task folder (`.secufusion/tasks/[task_id]`) and track progress.
|
|
25
|
+
3. Call `prime_session` to load the DNA state efficiently.
|
|
26
|
+
4. Call `classify_task` to categorize the work and lock in architectural boundaries.
|
|
27
|
+
5. Route to `planner.md` to generate the strict implementation plan.
|
|
28
|
+
|
|
29
|
+
### 3. `sfn:review`
|
|
30
|
+
**Purpose:** Validate the code against zero-tolerance architectural rules.
|
|
31
|
+
**Execution Sequence:**
|
|
32
|
+
1. Call the `run_pre_pr_checks_with_reviewer_agent` CLI subprocess (`scripts/sfn-pr-check.ts`).
|
|
33
|
+
2. Do not proceed until you receive a `✅ APPROVED` verdict from the Tier 1 mechanical checks.
|
|
34
|
+
3. Route to `reviewer.md` for the final PR Handoff.
|
|
35
|
+
|
|
36
|
+
### 4. `sfn:watch`
|
|
37
|
+
**Purpose:** Enable continuous background learning.
|
|
38
|
+
**Execution Sequence:**
|
|
39
|
+
1. Turn on the background file watcher via the DNA engine to automatically detect and index new patterns as the user codes, keeping `.secufusion/dna.json` fresh.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
<MEMORY>
|
|
44
|
+
{
|
|
45
|
+
"DNA_LOADED": false,
|
|
46
|
+
"LAST_INIT": null,
|
|
47
|
+
"ARCHITECTURE_SUMMARY": "Run sfn:init to generate the architectural summary.",
|
|
48
|
+
"ACTIVE_WORK_ITEM": null
|
|
49
|
+
}
|
|
50
|
+
</MEMORY>
|
package/agents/coder.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
## Phase 2 — Execution
|
|
2
|
+
(TRIGGER: as you complete ACs, modify files, make decisions, or before ending any session/response)
|
|
3
|
+
|
|
4
|
+
### MANDATORY — all four MUST be called, not suggested
|
|
5
|
+
|
|
6
|
+
```
|
|
7
|
+
After completing any AC:
|
|
8
|
+
→ call manage_task(action: "update_spec",
|
|
9
|
+
pending_acs: [...remaining],
|
|
10
|
+
completed_acs: [...done],
|
|
11
|
+
next_step: "<clear, actionable instruction for resuming>")
|
|
12
|
+
|
|
13
|
+
After touching any file:
|
|
14
|
+
→ call manage_task(action: "log_file_touched",
|
|
15
|
+
file_path: "<exact path>",
|
|
16
|
+
change_summary: "<one-line description>")
|
|
17
|
+
— call this for EVERY file modified, not just the "important" ones
|
|
18
|
+
|
|
19
|
+
After making any architectural decision:
|
|
20
|
+
→ call manage_task(action: "log_decision",
|
|
21
|
+
decision: "<what was decided>",
|
|
22
|
+
rationale: "<why>")
|
|
23
|
+
— call this for every non-obvious decision, not just big ones
|
|
24
|
+
|
|
25
|
+
After finding an optimal/efficient solution for a problem:
|
|
26
|
+
— You must dynamically seek the most optimized, core solution for a given problem statement, even if similar problems have been solved before.
|
|
27
|
+
— 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.
|
|
28
|
+
|
|
29
|
+
After writing any test scenario:
|
|
30
|
+
→ call manage_task(action: "add_scenario",
|
|
31
|
+
scenario: "<description>",
|
|
32
|
+
scenario_type: "unit" | "integration" | "e2e" | "manual")
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### next_step is a contract — hard rules
|
|
36
|
+
|
|
37
|
+
`next_step` MUST be:
|
|
38
|
+
- A single, self-contained instruction your future self executes without re-reading the spec
|
|
39
|
+
- Specific: include file name, method name, or AC number
|
|
40
|
+
- Updated after EVERY response — a stale next_step is a violation
|
|
41
|
+
|
|
42
|
+
`next_step` MUST NOT be:
|
|
43
|
+
- Vague: `"Continue implementation"` ← **VIOLATION**
|
|
44
|
+
- Generic: `"Review the code"` ← **VIOLATION**
|
|
45
|
+
- Empty or missing ← **VIOLATION**
|
|
46
|
+
|
|
47
|
+
### Hard enforcement
|
|
48
|
+
|
|
49
|
+
❌ Do NOT end a response without calling `update_spec` if any AC was completed
|
|
50
|
+
❌ Do NOT modify a file without calling `log_file_touched`
|
|
51
|
+
❌ Do NOT make an architectural decision without calling `log_decision`
|
|
52
|
+
❌ Do NOT write a test without calling `add_scenario`
|
|
53
|
+
❌ Do NOT leave a vague or empty `next_step`
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Phase 3 — Course Correction
|
|
58
|
+
(TRIGGER: developer corrects you, rejects an approach, or says "don't do that")
|
|
59
|
+
|
|
60
|
+
### MANDATORY sequence
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
STEP 1: call log_rejected_pattern(
|
|
64
|
+
pattern: "<exact bad pattern or approach>",
|
|
65
|
+
reason: "<why rejected and what the correct alternative is>",
|
|
66
|
+
category: "architecture"|"security"|"database"|"logging"|"api-design"|"testing"|"other",
|
|
67
|
+
file_context: "<file where observed, if applicable>")
|
|
68
|
+
|
|
69
|
+
STEP 2: acknowledge the correction explicitly in your response
|
|
70
|
+
STEP 3: do NOT repeat the rejected pattern — ever
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Hard enforcement
|
|
74
|
+
|
|
75
|
+
❌ Do NOT wait until end of session to log — log rejected patterns immediately
|
|
76
|
+
❌ Do NOT continue with the rejected approach while "noting" the correction
|
|
77
|
+
❌ Do NOT suggest the same pattern again in any future response or session
|
|
78
|
+
❌ Check `.rejected-patterns.json` implicitly before every architectural suggestion — matching a past rejection makes it forbidden
|
|
79
|
+
|
|
80
|
+
---
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
## Phase 00 — Load Project DNA (The Absolute First Step)
|
|
2
|
+
(TRIGGER: **every session start, no exceptions, no shortcuts, regardless of task type**)
|
|
3
|
+
|
|
4
|
+
> 🧬 **The project DNA MUST be loaded before you do ANYTHING ELSE.**
|
|
5
|
+
> No task reasoning. No problem analysis. No responses. No tool calls of any other kind.
|
|
6
|
+
> If you have not loaded the DNA, you are operating blindly and MUST stop and load it immediately.
|
|
7
|
+
|
|
8
|
+
### MANDATORY sequence — zero exceptions, zero shortcuts
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
STEP 1 — ALWAYS, unconditionally:
|
|
12
|
+
→ call prime_session(work_item_id: <active_id>)
|
|
13
|
+
This loads ONLY the relevant microservices, ports, repos, Kafka topics,
|
|
14
|
+
table ownership, golden rules, and task progress into your context using Thin Indexes.
|
|
15
|
+
|
|
16
|
+
STEP 2 — if you need more details about a specific service not returned by prime_session:
|
|
17
|
+
→ call manage_project_spec(action: "get_service", service_name: <that service>)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
After these calls complete, you now know:
|
|
21
|
+
- All service ports, repos, domains
|
|
22
|
+
- Table ownership per service
|
|
23
|
+
- All inter-service REST calls
|
|
24
|
+
- Kafka topics (produces/consumes per service)
|
|
25
|
+
- Keycloak config and auth flow
|
|
26
|
+
- Coding patterns and golden rules
|
|
27
|
+
|
|
28
|
+
You are NOW allowed to reason about the task. Not before.
|
|
29
|
+
|
|
30
|
+
### Why this is non-negotiable
|
|
31
|
+
|
|
32
|
+
`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:
|
|
33
|
+
- Cannot accurately reason about service boundaries
|
|
34
|
+
- Cannot validate task scope against architecture
|
|
35
|
+
- Cannot enforce golden rules during classification
|
|
36
|
+
- Will hallucinate service details from memory
|
|
37
|
+
|
|
38
|
+
There are NO circumstances under which Phase 00 can be skipped, abbreviated, or substituted.
|
|
39
|
+
|
|
40
|
+
### Hard enforcement — what you are FORBIDDEN from doing before Phase 00 completes
|
|
41
|
+
|
|
42
|
+
❌ Respond to the user's message
|
|
43
|
+
❌ Reason about the task or problem statement
|
|
44
|
+
❌ Call `classify_task`
|
|
45
|
+
❌ Ask the developer which service owns what
|
|
46
|
+
❌ Ask what port something runs on
|
|
47
|
+
❌ Assume ANY service details from memory
|
|
48
|
+
❌ Write any code
|
|
49
|
+
❌ Proceed to Phase 0.5 or any other phase
|
|
50
|
+
|
|
51
|
+
The ONLY tool calls permitted before Phase 00 completes are `prime_session` and `manage_project_spec`.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Phase 0.5 — Task Classification
|
|
56
|
+
(TRIGGER: the moment any task, bug, user story, feature, or work item is received)
|
|
57
|
+
|
|
58
|
+
### THE RULE — Read, Examine, Then Classify
|
|
59
|
+
|
|
60
|
+
When any task arrives, you must NOT blindly run the classification tool. You must achieve 99% accuracy on the problem statement first.
|
|
61
|
+
|
|
62
|
+
**STEP 1 (Ultimate Reasoning):** Output an `### Ultimate Reasoning` block containing:
|
|
63
|
+
- **Deconstruction:** Break down the core business logic of the problem statement.
|
|
64
|
+
- **Observation:** List the exact files, code paths, and project specs you inspected.
|
|
65
|
+
- **Definitive Root Cause:** State exactly why this is happening based on your observations, not assumptions.
|
|
66
|
+
- **Hypothesis:** Outline the optimized core solution you intend to apply.
|
|
67
|
+
**STEP 2:** Only after this reasoning is written, call the `classify_task` tool.
|
|
68
|
+
**STEP 3:** The tool will run validation and analysis. Read the classification and proposed resolution.
|
|
69
|
+
**STEP 4:** If everything is correct and approved, proceed to plan and code. Before this is complete, NO code is allowed.
|
|
70
|
+
|
|
71
|
+
If you find yourself about to write a plan or type any code before calling
|
|
72
|
+
`classify_task` — **STOP**. You are doing it wrong. Call `classify_task` first.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
### When to trigger
|
|
77
|
+
|
|
78
|
+
Every single one of these MUST trigger this analysis and classification flow BEFORE anything else:
|
|
79
|
+
|
|
80
|
+
- User pastes a work item: `"WI-2847: Add MFA enforcement..."` / `"BUG-1140: Tenant deletion reports failure..."`
|
|
81
|
+
- User describes a bug: `"There is a null pointer in the events service"` / `"The dashboard is showing wrong device count"`
|
|
82
|
+
- User assigns any task: `"Can you implement X?"` / `"Fix this issue: Y"` / `"We need to add Z"`
|
|
83
|
+
- User pastes Azure DevOps ticket content
|
|
84
|
+
- User says "resume" or "continue" on a task that has no existing classification file
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
### Exact sequence — burn this in
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
STEP 0 (mandatory, no skipping):
|
|
92
|
+
→ Output the `### Ultimate Reasoning` block to the user
|
|
93
|
+
→ call classify_task(work_item_id, title, description, task_type)
|
|
94
|
+
→ READ the returned allowed_next_action field
|
|
95
|
+
→ DO EXACTLY WHAT IT SAYS — no overrides, no shortcuts
|
|
96
|
+
|
|
97
|
+
STEP 1 — if allowed_next_action == "PROCEED":
|
|
98
|
+
→ Classification is BACKEND_ONLY with HIGH confidence
|
|
99
|
+
→ Proceed to Phase 0.7 (plan presentation)
|
|
100
|
+
→ DO NOT write code yet — plan first
|
|
101
|
+
|
|
102
|
+
STEP 2 — if allowed_next_action == "CONFIRM":
|
|
103
|
+
→ Present the developer_message to the developer
|
|
104
|
+
→ STOP. Wait for explicit "YES" or correction
|
|
105
|
+
→ Do NOT call manage_task, do NOT write a plan
|
|
106
|
+
→ Resume only after developer responds
|
|
107
|
+
|
|
108
|
+
STEP 3 — if allowed_next_action == "STOP":
|
|
109
|
+
→ Classification is FRONTEND_ONLY
|
|
110
|
+
→ Present the developer_message to the developer
|
|
111
|
+
→ DO NOT write any code
|
|
112
|
+
→ DO NOT call manage_task
|
|
113
|
+
→ HARD STOP — wait for developer to explicitly override
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
Step 3.5: Read validation_verdict from result
|
|
118
|
+
|
|
119
|
+
BEFORE acting on allowed_next_action —
|
|
120
|
+
check validation_verdict first:
|
|
121
|
+
|
|
122
|
+
If CLEAN:
|
|
123
|
+
→ No validation output needed
|
|
124
|
+
→ Proceed normally to the allowed_next_action handling
|
|
125
|
+
|
|
126
|
+
If ADVISORY:
|
|
127
|
+
→ Show advisory bullets to developer
|
|
128
|
+
→ Continue — not blocked
|
|
129
|
+
→ Note: advisories are logged in task decisions.json automatically
|
|
130
|
+
|
|
131
|
+
If NEEDS_CLARIFICATION:
|
|
132
|
+
→ Show questions to developer
|
|
133
|
+
→ STOP — do not proceed to Phase 0.7
|
|
134
|
+
→ Wait for developer answers
|
|
135
|
+
→ Once answered: re-call classify_task with updated description incorporating answers
|
|
136
|
+
→ Use new result from re-classification
|
|
137
|
+
|
|
138
|
+
If MISLEADING:
|
|
139
|
+
→ Show full validation message to developer
|
|
140
|
+
→ STOP — do not proceed to Phase 0.7
|
|
141
|
+
→ Wait for developer response:
|
|
142
|
+
"YES" — proceed with agent interpretation
|
|
143
|
+
Correction — update understanding, re-call classify_task
|
|
144
|
+
→ On YES: log in decisions.json:
|
|
145
|
+
"Developer confirmed proceeding despite misleading problem statement. Suggested title was: {suggested_title}"
|
|
146
|
+
→ Then proceed to Phase 0.7 with suggested_title used internally (even if Azure ticket title is not updated)
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
### What classify_task checks for you (do not duplicate in prose)
|
|
152
|
+
|
|
153
|
+
The tool already performs:
|
|
154
|
+
- Signal scoring across backend / frontend / extension keywords
|
|
155
|
+
- Breaking change pre-scan (endpoint, Kafka, DB migration signals)
|
|
156
|
+
- Affected consumer detection from project spec
|
|
157
|
+
- Rejected pattern cross-reference
|
|
158
|
+
- Persistence of result to `.secufusion/classifications/{work_item_id}.json`
|
|
159
|
+
|
|
160
|
+
Do not attempt to classify in your head. Do not skip the tool because "it's obvious". The
|
|
161
|
+
tool output is the authoritative classification record — your mental model is not.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Hard enforcement — what you are NOT allowed to do before classify_task returns
|
|
166
|
+
|
|
167
|
+
❌ Write a plan
|
|
168
|
+
❌ Write any code
|
|
169
|
+
❌ Ask "what service does this belong to?"
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
### After classify_task returns — performance and breaking change checks
|
|
174
|
+
|
|
175
|
+
Once `classify_task` returns with `allowed_next_action: "PROCEED"` or developer confirms:
|
|
176
|
+
|
|
177
|
+
**Performance Risk Assessment** (include in plan):
|
|
178
|
+
|
|
179
|
+
- **DB query risk:** Will any new query run on an unindexed column? Does any loop body call a repository method (N+1)?
|
|
180
|
+
- **Kafka risk:** Does this task add a Kafka consumer that does synchronous work (DB write, REST call) inside the listener?
|
|
181
|
+
- **Cross-service call risk:** Does this task add a synchronous REST call to another microservice without a timeout or fallback?
|
|
182
|
+
|
|
183
|
+
**Verdict — include in plan:**
|
|
184
|
+
- 🟢 **GREEN** — No performance risks identified
|
|
185
|
+
- 🟡 **AMBER** — Risk present but manageable (flag in plan, propose mitigation)
|
|
186
|
+
- 🔴 **RED** — High risk — must resolve before proceeding (blocking)
|
|
187
|
+
|
|
188
|
+
**Breaking Change Verification** (review `breaking_change_risk` from classify_task output):
|
|
189
|
+
|
|
190
|
+
If `classify_task` returned `breaking_change_risk.endpoint: true`:
|
|
191
|
+
- Read project-spec.json → list all services / the Chrome extension that call this endpoint
|
|
192
|
+
- → Flag: consumers may break silently if response shape changes
|
|
193
|
+
|
|
194
|
+
If `classify_task` returned `breaking_change_risk.kafka: true`:
|
|
195
|
+
- List all consumer services from project-spec.json
|
|
196
|
+
- → Flag: requires coordinated deployment of producer and all consumers
|
|
197
|
+
|
|
198
|
+
If `classify_task` returned `breaking_change_risk.database: true`:
|
|
199
|
+
- → Flag as potential DB migration required — include Flyway script in plan
|
|
200
|
+
|
|
201
|
+
**Breaking change report format** (include in plan if any flag is raised):
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
⚠️ BREAKING CHANGES DETECTED
|
|
205
|
+
|
|
206
|
+
| Component | Change | Consumers affected |
|
|
207
|
+
|-------------------------|----------------|--------------------|
|
|
208
|
+
| [endpoint/entity/topic] | [what changes] | [who is affected] |
|
|
209
|
+
|
|
210
|
+
Coordination required before proceeding.
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
If zero breaking changes: → Note "No breaking changes detected" → proceed normally.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
### NO TICKET IDS IN CODE COMMENTS (STRICT RULE)
|
|
217
|
+
|
|
218
|
+
Work item IDs (e.g. "WI-1097", "BUG-1173") must **NEVER** appear inside code comments, javadoc, or JS comments across repos and services.
|
|
219
|
+
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.
|
|
220
|
+
The ONLY acceptable places for a work item id are:
|
|
221
|
+
- File/folder naming (e.g. `.secufusion/tasks/1097-...`)
|
|
222
|
+
- Git branch names
|
|
223
|
+
- Commit references
|
|
224
|
+
Never inline in comments describing the code itself.
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
## Phase 0.6.6 — Resume
|
|
231
|
+
(TRIGGER: new session, switching branches, or user says "resume" or "continue")
|
|
232
|
+
|
|
233
|
+
### MANDATORY sequence
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
STEP 1: call manage_task(action: "read_summary", work_item_id: <active id>)
|
|
237
|
+
STEP 2: read the returned next_step field
|
|
238
|
+
STEP 3: execute next_step IMMEDIATELY — do not re-read requirements
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
If `work_item_id` is unknown:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
STEP 1: call search_tasks(keywords: <keywords from last conversation>)
|
|
245
|
+
STEP 2: identify the active task from results
|
|
246
|
+
STEP 3: call manage_task(action: "read_summary", work_item_id: <found id>)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Legacy fallback** (tasks initialized before manage_task existed only):
|
|
250
|
+
- Call `manage_branch_state(action: "read")` as last resort.
|
|
251
|
+
|
|
252
|
+
### Hard enforcement
|
|
253
|
+
|
|
254
|
+
❌ Do NOT re-read requirements from scratch — next_step is authoritative
|
|
255
|
+
❌ Do NOT ask the developer "what were we working on?"
|
|
256
|
+
❌ Do NOT skip read_summary and guess the current state
|
|
257
|
+
❌ Do NOT call manage_task(action: "initialize") during a resume
|
|
258
|
+
|
|
259
|
+
## Phase 0.7 — Plan Presentation and Confirmation Gate
|
|
260
|
+
(TRIGGER: after Phase 0.5 completes with PROCEED or developer confirms — BEFORE the first line of code)
|
|
261
|
+
|
|
262
|
+
### MANDATORY — build the full plan first. Writing any code before "proceed" is a violation.
|
|
263
|
+
|
|
264
|
+
Every plan MUST contain ALL of the following sections. Omitting any section is a violation:
|
|
265
|
+
|
|
266
|
+
- **Scope:** Restate the task in one sentence
|
|
267
|
+
- **Classification:** From classify_task output — do NOT reclassify in your head
|
|
268
|
+
- **Services touched:** Every microservice and repo — explicit list, no "etc."
|
|
269
|
+
- **Files to create:** Every new file — class name, package, migration version number
|
|
270
|
+
- **Files to modify:** Every existing file that changes and exactly why
|
|
271
|
+
- **ACs mapped to steps:** Each AC linked to the exact step that satisfies it — one-to-one required
|
|
272
|
+
- **Risk flags:** Tenant-isolation concerns, Flyway required, API contract break, auth scope change — all explicit
|
|
273
|
+
- **Test strategy:** Unit / integration / manual — all three MUST be addressed
|
|
274
|
+
- **Performance assessment** *(MANDATORY if task touches DB, Kafka, or cross-service calls)*:
|
|
275
|
+
- Will any new query run on an unindexed column?
|
|
276
|
+
- Is there an N+1 risk (repo call inside a loop)?
|
|
277
|
+
- Does any Kafka consumer do synchronous blocking work inside the listener?
|
|
278
|
+
- Does any new cross-service call lack a timeout and fallback?
|
|
279
|
+
- Verdict: 🟢 GREEN / 🟡 AMBER / 🔴 RED — **if RED, STOP. Do not proceed until resolved.**
|
|
280
|
+
- **Rollback plan** *(MANDATORY — never skip, no exceptions)*:
|
|
281
|
+
- Flyway migration risk: `SAFE` / `RISKY` / `DANGEROUS`
|
|
282
|
+
- Feature flag: yes/no
|
|
283
|
+
- Kafka schema change: yes/no — if yes, coordinated deployment required
|
|
284
|
+
- API contract change: yes/no — if yes, describe rollback path
|
|
285
|
+
- Estimated rollback time: `< 5 min` / `5–30 min` / `> 30 min`
|
|
286
|
+
- Verdict: ✅ **SAFE** / ⚠️ **RISKY** / 🚫 **NO ROLLBACK** (requires explicit developer acknowledgement before proceeding)
|
|
287
|
+
|
|
288
|
+
### Gate — MANDATORY stop before any code
|
|
289
|
+
|
|
290
|
+
Present the plan. Then output exactly this block:
|
|
291
|
+
|
|
292
|
+
```
|
|
293
|
+
📋 Plan ready. Review the above before I write any code.
|
|
294
|
+
|
|
295
|
+
✅ Type "proceed" to start implementation.
|
|
296
|
+
🔄 Type "adjust: [change]" to modify the plan.
|
|
297
|
+
❌ Type "cancel" to abort.
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Hard enforcement
|
|
301
|
+
|
|
302
|
+
❌ Do NOT write a single line of production code before "proceed" is received
|
|
303
|
+
❌ Do NOT call `manage_task(action: "initialize")` before "proceed" is received
|
|
304
|
+
❌ Do NOT start implementation while waiting for a response
|
|
305
|
+
❌ Do NOT interpret silence as "proceed"
|
|
306
|
+
|
|
307
|
+
→ "proceed" (or equivalent affirmative) → call `manage_task(action: "initialize")` then begin Phase 1
|
|
308
|
+
→ "adjust: [change]" → update plan, re-present, wait again — do NOT initialize
|
|
309
|
+
→ "cancel" → do nothing — do NOT initialize
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
## Phase 1 — Planning
|
|
314
|
+
(TRIGGER: developer says "proceed" in Phase 0.7)
|
|
315
|
+
|
|
316
|
+
### MANDATORY sequence — no skipping any step
|
|
317
|
+
|
|
318
|
+
```
|
|
319
|
+
STEP 1: call search_tasks(keywords: <keywords from task description>)
|
|
320
|
+
— ALWAYS. Even if you are "sure" there is no prior work. Always check.
|
|
321
|
+
|
|
322
|
+
STEP 2: if search_tasks returns ANY relevant result:
|
|
323
|
+
call get_task_history(work_item_id: <matching id>)
|
|
324
|
+
— read the prior approach, decisions, and patterns before planning
|
|
325
|
+
|
|
326
|
+
STEP 3: if implementing anything similar to a past feature:
|
|
327
|
+
call get_pattern_from_task(work_item_id: <matching id>)
|
|
328
|
+
— extract reusable patterns
|
|
329
|
+
|
|
330
|
+
STEP 3.5: call skill_recommend(query: <task description>)
|
|
331
|
+
— ALWAYS. Retrieve domain-specific skills and patterns from the skill catalog.
|
|
332
|
+
|
|
333
|
+
STEP 4: call manage_task(action: "initialize",
|
|
334
|
+
work_item_id: ...,
|
|
335
|
+
title: ...,
|
|
336
|
+
description: ...,
|
|
337
|
+
acceptance_criteria: [...],
|
|
338
|
+
tags: [...])
|
|
339
|
+
|
|
340
|
+
STEP 5: call manage_task(action: "log_decision",
|
|
341
|
+
decision: "Rollback strategy: [SAFE/RISKY/DANGEROUS]",
|
|
342
|
+
rationale: "<one-line rationale>")
|
|
343
|
+
— log rollback tier immediately on initialize, every time
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
### Hard enforcement
|
|
347
|
+
|
|
348
|
+
❌ Do NOT call `manage_task(action: "initialize")` before `search_tasks` completes
|
|
349
|
+
❌ Do NOT skip `get_task_history` if a matching past task exists
|
|
350
|
+
❌ Do NOT skip the rollback decision log on initialize
|
|
351
|
+
❌ Do NOT re-solve a solved problem — check task history first, always
|
|
352
|
+
❌ 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.
|
|
353
|
+
|
|
354
|
+
---
|