nurosys-agents 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/.agent/INSTRUCTIONS.md +82 -0
- package/.agent/README.md +483 -0
- package/.agent/backend/skills/architect/SKILL.md +436 -0
- package/.agent/backend/skills/auth-and-permissions/SKILL.md +168 -0
- package/.agent/backend/skills/brainstorm/SKILL.md +127 -0
- package/.agent/backend/skills/code-reviewer/SKILL.md +324 -0
- package/.agent/backend/skills/create-blueprint/SKILL.md +650 -0
- package/.agent/backend/skills/debug-issue/SKILL.md +53 -0
- package/.agent/backend/skills/explore-codebase/SKILL.md +45 -0
- package/.agent/backend/skills/quick-execute/SKILL.md +99 -0
- package/.agent/backend/skills/refactor-safely/SKILL.md +46 -0
- package/.agent/backend/skills/security-assessment/SKILL.md +174 -0
- package/.agent/backend/workflows/module-runner.claude.md +226 -0
- package/.agent/backend/workflows/module-runner.codex.md +155 -0
- package/.agent/backend/workflows/module-runner.cursor.md +212 -0
- package/.agent/frontend/skills/architect/SKILL.md +644 -0
- package/.agent/frontend/skills/auth-and-permissions/SKILL.md +43 -0
- package/.agent/frontend/skills/create-blueprint/SKILL.md +635 -0
- package/.agent/frontend/skills/debug-issue/SKILL.md +28 -0
- package/.agent/frontend/skills/explore-codebase/SKILL.md +29 -0
- package/.agent/frontend/skills/feature-workflow/SKILL.md +61 -0
- package/.agent/frontend/skills/react-quality-review/SKILL.md +126 -0
- package/.agent/frontend/skills/react-quality-review/examples.md +24 -0
- package/.agent/frontend/skills/react-quality-review/rules/_sections.md +26 -0
- package/.agent/frontend/skills/react-quality-review/rules/_template.md +28 -0
- package/.agent/frontend/skills/react-quality-review/rules/advanced-event-handler-refs.md +55 -0
- package/.agent/frontend/skills/react-quality-review/rules/advanced-init-once.md +42 -0
- package/.agent/frontend/skills/react-quality-review/rules/react-rules-calling.md +66 -0
- package/.agent/frontend/skills/react-quality-review/rules/react-rules-hooks.md +91 -0
- package/.agent/frontend/skills/react-quality-review/rules/react-rules-purity.md +121 -0
- package/.agent/frontend/skills/react-quality-review/rules/rendering-activity.md +26 -0
- package/.agent/frontend/skills/react-quality-review/rules/rendering-conditional-render.md +40 -0
- package/.agent/frontend/skills/react-quality-review/rules/rendering-content-visibility.md +38 -0
- package/.agent/frontend/skills/react-quality-review/rules/rendering-hoist-jsx.md +46 -0
- package/.agent/frontend/skills/react-quality-review/rules/rendering-usetransition-loading.md +75 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-defer-reads.md +39 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-dependencies.md +45 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-derived-state-no-effect.md +40 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-derived-state.md +29 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-functional-setstate.md +74 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-lazy-state-init.md +58 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-memo-with-default-value.md +38 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-memo.md +44 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-move-effect-to-event.md +45 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-no-inline-components.md +82 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-simple-expression-in-memo.md +35 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-transitions.md +40 -0
- package/.agent/frontend/skills/react-quality-review/rules/rerender-use-ref-transient-values.md +73 -0
- package/.agent/frontend/skills/refactor-safely/SKILL.md +29 -0
- package/.agent/frontend/skills/vuexy-component-guide/SKILL.md +369 -0
- package/.agent/frontend/skills/vuexy-component-guide/examples.md +662 -0
- package/.agent/frontend/skills/vuexy-component-guide/reference.md +1036 -0
- package/.agent/frontend/workflows/build-feature-react.workflow.md +82 -0
- package/.agent/frontend/workflows/feature-module-runner.md +101 -0
- package/.agent/monolith/skills/architect/SKILL.md +648 -0
- package/.agent/monolith/skills/auth-and-permissions/SKILL.md +43 -0
- package/.agent/monolith/skills/code-reviewer/SKILL.md +281 -0
- package/.agent/monolith/skills/create-blueprint/SKILL.md +635 -0
- package/.agent/monolith/skills/debug-issue/SKILL.md +28 -0
- package/.agent/monolith/skills/explore-codebase/SKILL.md +29 -0
- package/.agent/monolith/skills/feature-workflow/SKILL.md +61 -0
- package/.agent/monolith/skills/react-quality-review/SKILL.md +126 -0
- package/.agent/monolith/skills/react-quality-review/examples.md +24 -0
- package/.agent/monolith/skills/react-quality-review/rules/_sections.md +26 -0
- package/.agent/monolith/skills/react-quality-review/rules/_template.md +28 -0
- package/.agent/monolith/skills/react-quality-review/rules/advanced-event-handler-refs.md +55 -0
- package/.agent/monolith/skills/react-quality-review/rules/advanced-init-once.md +42 -0
- package/.agent/monolith/skills/react-quality-review/rules/react-rules-calling.md +66 -0
- package/.agent/monolith/skills/react-quality-review/rules/react-rules-hooks.md +91 -0
- package/.agent/monolith/skills/react-quality-review/rules/react-rules-purity.md +121 -0
- package/.agent/monolith/skills/react-quality-review/rules/rendering-activity.md +26 -0
- package/.agent/monolith/skills/react-quality-review/rules/rendering-conditional-render.md +40 -0
- package/.agent/monolith/skills/react-quality-review/rules/rendering-content-visibility.md +38 -0
- package/.agent/monolith/skills/react-quality-review/rules/rendering-hoist-jsx.md +46 -0
- package/.agent/monolith/skills/react-quality-review/rules/rendering-usetransition-loading.md +75 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-defer-reads.md +39 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-dependencies.md +45 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-derived-state-no-effect.md +40 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-derived-state.md +29 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-functional-setstate.md +74 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-lazy-state-init.md +58 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-memo-with-default-value.md +38 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-memo.md +44 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-move-effect-to-event.md +45 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-no-inline-components.md +82 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-simple-expression-in-memo.md +35 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-transitions.md +40 -0
- package/.agent/monolith/skills/react-quality-review/rules/rerender-use-ref-transient-values.md +73 -0
- package/.agent/monolith/skills/refactor-safely/SKILL.md +29 -0
- package/.agent/monolith/skills/vuexy-component-guide/SKILL.md +369 -0
- package/.agent/monolith/skills/vuexy-component-guide/examples.md +662 -0
- package/.agent/monolith/skills/vuexy-component-guide/reference.md +1036 -0
- package/.agent/monolith/workflows/add-new-api-feature-module.md +63 -0
- package/.agent/monolith/workflows/backend-quality-review.md +27 -0
- package/.agent/monolith/workflows/build-feature-backend.workflow.md +91 -0
- package/.agent/monolith/workflows/build-feature-react.workflow.md +82 -0
- package/.agent/monolith/workflows/feature-module-runner.md +97 -0
- package/.agent/templates/FEATURE_PLAN.md +42 -0
- package/.agent/templates/MODULE.md +45 -0
- package/.agent/templates/REVIEW_REPORT.md +44 -0
- package/.agent/templates/SECURITY_REPORT.md +70 -0
- package/.agent/templates/TEST_PLAN.md +49 -0
- package/README.md +131 -0
- package/package.json +42 -0
- package/scripts/setup-rules.js +224 -0
- package/scripts/setup.js +518 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-issue
|
|
3
|
+
description: Systematically trace and diagnose backend issues using Serena's symbolic tools. Trigger on "debug", "why is X failing", "trace this error", or any user-reported bug with a stack trace or symptom. Symbol-level, not full-file reads.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: debug-issue
|
|
7
|
+
|
|
8
|
+
Trace bugs through the codebase using symbolic navigation. The rule: **follow the stack, don't grep the world**.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Capture the symptom precisely**
|
|
13
|
+
- Error message, stack trace, reproduction steps, expected vs actual behavior.
|
|
14
|
+
- If the user gave a stack trace, the top frame is your starting symbol.
|
|
15
|
+
|
|
16
|
+
2. **Locate the suspected entry point**
|
|
17
|
+
- `find_symbol(name_path="<name from stack trace>", include_body=true)` — read the function/method where the error occurs.
|
|
18
|
+
|
|
19
|
+
3. **Trace upstream callers**
|
|
20
|
+
- `find_referencing_symbols(name_path="...", relative_path="...")` — who calls this? The bug may be in a caller passing bad input.
|
|
21
|
+
|
|
22
|
+
4. **Trace downstream callees**
|
|
23
|
+
- Read the body and identify what the suspect function calls into. `find_symbol(include_body=true)` on each callee that handles relevant data.
|
|
24
|
+
|
|
25
|
+
5. **Check recent changes**
|
|
26
|
+
- `git log -p --follow <suspect-file>` — what changed recently in this file?
|
|
27
|
+
- If the issue is in a function that was just modified, that's likely the cause.
|
|
28
|
+
|
|
29
|
+
6. **Read targeted memories**
|
|
30
|
+
- `list_memories` then `read_memory` if any look relevant (e.g. a prior bug in the same area).
|
|
31
|
+
|
|
32
|
+
7. **Form a hypothesis and confirm**
|
|
33
|
+
- State the suspected cause concisely.
|
|
34
|
+
- Confirm by running the reproduction, adding a temporary log, or reading one more symbol.
|
|
35
|
+
- Don't write a fix until you can explain the root cause in one sentence.
|
|
36
|
+
|
|
37
|
+
## Tips
|
|
38
|
+
|
|
39
|
+
- **Stack trace is the map.** Walk frames from top down, reading symbol bodies along the way. Don't try to understand the whole module first.
|
|
40
|
+
- **Recent changes are the most common cause** of a newly-reported bug. Check `git log` early.
|
|
41
|
+
- **Callers AND callees.** A function can fail because of bad input (caller's fault) or bad logic (its own fault) — check both before concluding.
|
|
42
|
+
- **Avoid speculative grepping.** If you find yourself searching for "this might be related", you've lost the trail — go back to the stack trace.
|
|
43
|
+
|
|
44
|
+
## Token Efficiency
|
|
45
|
+
|
|
46
|
+
- Target ≤6 Serena calls for typical debugging tasks: locate entry (1) + read body (1) + callers (1) + key callees (1-2) + verify (1).
|
|
47
|
+
- If you need more, you're either solving the wrong problem or the bug is genuinely cross-cutting — pause and tell the user what you've found.
|
|
48
|
+
|
|
49
|
+
## Do not
|
|
50
|
+
|
|
51
|
+
- Fix the bug in this skill. This skill diagnoses; fixes go through `/quick-execute` (small) or `/architect` → `/module-runner` (large).
|
|
52
|
+
- Read whole files when a symbol body suffices.
|
|
53
|
+
- Add debug logging in production code paths without flagging it to the user.
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: explore-codebase
|
|
3
|
+
description: Navigate and understand a backend codebase efficiently using Serena's symbolic tools. Trigger when the user asks "where is X", "what does Y do", "how is Z wired", or asks for a tour of a module. Symbol-level navigation, not full-file reads.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: explore-codebase
|
|
7
|
+
|
|
8
|
+
Use Serena to understand the codebase's structure and find specific code, without reading whole files.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Orient with project-memory first**
|
|
13
|
+
- If `project-memory/repo-map.md` exists, read it — it's the curated map of where things live.
|
|
14
|
+
- If `project-memory/architecture.md` exists, skim its module-topology section.
|
|
15
|
+
- This alone often answers "where is X" without any tool calls.
|
|
16
|
+
|
|
17
|
+
2. **List symbols in candidate files**
|
|
18
|
+
- `get_symbols_overview(relative_path="<file or dir>")` — shows top-level symbols (classes, functions, modules) without reading their bodies.
|
|
19
|
+
|
|
20
|
+
3. **Locate by name**
|
|
21
|
+
- `find_symbol(name_path="<name>", include_body=false)` — find a class/function/method by name. Add `substring_matching=true` for fuzzy match.
|
|
22
|
+
- Use `name_path="ClassName/methodName"` to scope to a class method.
|
|
23
|
+
|
|
24
|
+
4. **Read targeted symbol bodies**
|
|
25
|
+
- `find_symbol(name_path="...", include_body=true)` — read only the symbol you need, not the whole file.
|
|
26
|
+
|
|
27
|
+
5. **Trace relationships**
|
|
28
|
+
- `find_referencing_symbols(name_path="...", relative_path="...")` — find all callers of a function/class/method.
|
|
29
|
+
- This is the right tool for "what depends on this?" and impact analysis.
|
|
30
|
+
|
|
31
|
+
6. **Check Serena memories**
|
|
32
|
+
- `list_memories` — see if prior sessions left notes (project_overview, tech_stack, etc.)
|
|
33
|
+
- `read_memory(memory_name="...")` if any look relevant.
|
|
34
|
+
|
|
35
|
+
## Tips
|
|
36
|
+
|
|
37
|
+
- **Project-memory before any tool call.** If `repo-map.md` answers the question, don't query Serena.
|
|
38
|
+
- **Symbols before files.** Default to `get_symbols_overview` over `Read`; default to `find_symbol(include_body=true)` over `Read` on a known file.
|
|
39
|
+
- **Narrow the search.** Always pass `relative_path` when you can — it's much faster than searching the whole repo.
|
|
40
|
+
|
|
41
|
+
## Token Efficiency
|
|
42
|
+
|
|
43
|
+
- Target ≤5 Serena calls for any exploration task.
|
|
44
|
+
- If you can't pinpoint what you need in 5 calls, the question is too broad — ask the user to narrow it.
|
|
45
|
+
- Never read a file's whole content just to find one symbol. Use Serena.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: quick-execute
|
|
3
|
+
description: Fast execution for small backend tasks (bug fixes, tiny features, quick refactors). No planning gate, no approval cycle. Use when the user asks for a short, well-scoped change and there is no need for architectural design. Trigger with `/quick-execute <task>` or natural-language descriptions of a small change.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill: quick-execute
|
|
8
|
+
|
|
9
|
+
A no-friction execution skill. Skip planning, skip approval gates, ship the change.
|
|
10
|
+
|
|
11
|
+
**Use it for:** typo fixes, single-function bug fixes, swapping a constant, adding a missing validation, renaming a variable, tightening a log message, small refactors confined to one file.
|
|
12
|
+
|
|
13
|
+
**Do NOT use it for:** anything touching auth, data models, public API contracts, or more than ~3 files. Those go through `/architect`.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Phase 1 — Understand the task
|
|
18
|
+
|
|
19
|
+
Read the user's request. If anything is genuinely ambiguous (not a stylistic preference — a load-bearing decision), ask **exactly one** clarifying question. Otherwise proceed.
|
|
20
|
+
|
|
21
|
+
If the task description references a file or symbol the user already has open, treat that as the starting point — don't re-search for it.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Phase 2 — Locate (Serena-first, ≤3 calls)
|
|
26
|
+
|
|
27
|
+
Use Serena to pinpoint the code that needs to change.
|
|
28
|
+
|
|
29
|
+
| Need | Tool |
|
|
30
|
+
|---|---|
|
|
31
|
+
| Find a symbol by name | `find_symbol(name_path="...", include_body=false)` |
|
|
32
|
+
| Inspect a file's structure | `get_symbols_overview(relative_path="...")` |
|
|
33
|
+
| Find callers before changing a function | `find_referencing_symbols(...)` |
|
|
34
|
+
| Read a specific symbol's body | `find_symbol(name_path="...", include_body=true)` |
|
|
35
|
+
|
|
36
|
+
**Hard cap: 3 Serena calls.** If you can't pinpoint the change in 3 calls, the task is too vague for `/quick-execute` — STOP and recommend `/explore-codebase` or `/architect`.
|
|
37
|
+
|
|
38
|
+
Project-memory: do **not** read project-memory docs in this skill. If the change is small enough for `/quick-execute`, it's small enough that constitution-level rules apply only if obviously violated.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 3 — Execute
|
|
43
|
+
|
|
44
|
+
Make the change. Use Serena's symbolic edit tools where the change is symbol-shaped:
|
|
45
|
+
|
|
46
|
+
- Replacing a whole function/class → `replace_symbol_body`
|
|
47
|
+
- Inserting a new function near an existing one → `insert_after_symbol` / `insert_before_symbol`
|
|
48
|
+
- Small in-line edits inside a larger symbol → `replace_content` (regex/string)
|
|
49
|
+
|
|
50
|
+
No approval gate. No "here's what I'm about to do" preamble. Just do it.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Phase 4 — Verify
|
|
55
|
+
|
|
56
|
+
Run the smallest verification that covers the change:
|
|
57
|
+
|
|
58
|
+
1. **If a test file exists for the affected code** — run `npm test -- <scoped pattern>`. If it passes, done.
|
|
59
|
+
2. **If no test exists but there's a build step** — run `npm run build` (or the project's equivalent from `package.json` scripts).
|
|
60
|
+
3. **If neither applies** — state explicitly: "No automated verification available. Manual check: [one concrete thing the user should try]."
|
|
61
|
+
|
|
62
|
+
Do not write a new test just to verify a `/quick-execute` change. If the change needs new tests, it's outside this skill's scope.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Phase 5 — Summarize
|
|
67
|
+
|
|
68
|
+
One paragraph. State:
|
|
69
|
+
|
|
70
|
+
- What changed (1 sentence, file + symbol)
|
|
71
|
+
- Why (1 sentence, the user's intent restated)
|
|
72
|
+
- How it was verified (1 sentence)
|
|
73
|
+
|
|
74
|
+
No bulleted lists, no headings, no "what's next" section. Just the paragraph.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Hard Guardrails (STOP and recommend `/architect`)
|
|
79
|
+
|
|
80
|
+
If during execution you discover any of the following, **stop immediately** and tell the user the task needs `/architect`:
|
|
81
|
+
|
|
82
|
+
- The change requires editing more than 3 files
|
|
83
|
+
- The change touches `project-memory/auth-model.md` concerns (guards, permissions, tenant scoping)
|
|
84
|
+
- The change touches a database model, migration, or schema
|
|
85
|
+
- The change modifies a public API contract (request/response shape of any endpoint)
|
|
86
|
+
- The change requires installing or upgrading a dependency
|
|
87
|
+
- You realize there are callers/consumers that need coordinated updates
|
|
88
|
+
|
|
89
|
+
Tell the user: "This is bigger than `/quick-execute` is designed for. Recommend `/architect <task>` to plan it properly." Do not partially execute and leave the system in an inconsistent state.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Do not
|
|
94
|
+
|
|
95
|
+
- Plan. There is no plan phase in this skill.
|
|
96
|
+
- Ask for approval. The user invoked `/quick-execute` precisely to skip that.
|
|
97
|
+
- Make unrelated improvements ("while I'm here, I also cleaned up..."). Stay in scope.
|
|
98
|
+
- Update `project-memory/core-memory.md`. Small changes don't earn a history entry.
|
|
99
|
+
- Commit or push. Leave that to the user.
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactor-safely
|
|
3
|
+
description: Plan and execute backend refactors with confidence. Uses Serena's symbolic tools for impact analysis (callers, references) and symbolic edits (rename, replace_symbol_body, safe_delete_symbol). Trigger on "rename", "refactor", "extract", "split", "consolidate", "move" requests.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skill: refactor-safely
|
|
7
|
+
|
|
8
|
+
Symbol-level refactors with bounded blast radius. The rule: **map impact first, then edit**.
|
|
9
|
+
|
|
10
|
+
## Steps
|
|
11
|
+
|
|
12
|
+
1. **Locate the target symbol**
|
|
13
|
+
- `find_symbol(name_path="<name>", include_body=true)` — read the current definition.
|
|
14
|
+
|
|
15
|
+
2. **Map blast radius**
|
|
16
|
+
- `find_referencing_symbols(name_path="<name>", relative_path="<file>")` — every caller/reference site.
|
|
17
|
+
- Count and review the result. If >20 references and the user asked for a quick rename, surface the impact: "This affects N call sites — confirm before I proceed."
|
|
18
|
+
|
|
19
|
+
3. **Preview the plan**
|
|
20
|
+
- List the files and line ranges that will change.
|
|
21
|
+
- For renames: state the old → new name and how many sites update.
|
|
22
|
+
- For signature changes: list each caller and how it needs to adapt.
|
|
23
|
+
- Get user confirmation if the refactor touches more than a single file.
|
|
24
|
+
|
|
25
|
+
4. **Apply the edit symbolically**
|
|
26
|
+
- **Rename**: `rename_symbol(name_path="...", relative_path="...", new_name="...")` — updates definition + all references in one call.
|
|
27
|
+
- **Replace a symbol's body**: `replace_symbol_body(name_path="...", relative_path="...", body="<new body>")`.
|
|
28
|
+
- **Insert near a symbol**: `insert_after_symbol` / `insert_before_symbol`.
|
|
29
|
+
- **Delete a symbol safely**: `safe_delete_symbol(name_path="...", relative_path="...")` — verifies no remaining references first.
|
|
30
|
+
- **Small in-line edits** (not symbol-shaped): `replace_content(relative_path="...", pattern="...", replacement="...")`.
|
|
31
|
+
|
|
32
|
+
5. **Verify**
|
|
33
|
+
- `find_referencing_symbols` again on the new name (rename) or surrounding callers (signature change) — confirm everything was updated.
|
|
34
|
+
- Run `npm run build` and tests scoped to the affected modules.
|
|
35
|
+
|
|
36
|
+
## Safety rules
|
|
37
|
+
|
|
38
|
+
- **Never delete a symbol without `find_referencing_symbols` first.** Use `safe_delete_symbol` which does this check for you.
|
|
39
|
+
- **For cross-module renames** (the symbol is exported and used by other modules), confirm with the user before running `rename_symbol`.
|
|
40
|
+
- **For signature changes** (changing parameters), every caller must be updated. Don't apply a partial change — either update all sites or surface the list and stop.
|
|
41
|
+
- **If `project-memory/architecture.md` documents the refactored area as stable / public API**, surface that to the user before proceeding.
|
|
42
|
+
|
|
43
|
+
## Token Efficiency
|
|
44
|
+
|
|
45
|
+
- Target ≤6 Serena calls per refactor: locate (1) + impact (1) + edit (1) + verify (1-3).
|
|
46
|
+
- Don't re-read files after symbolic edits — Serena's edit tools are reliable; if they returned without error, the change is applied.
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-assessment
|
|
3
|
+
description: Run a standalone security audit on the backend codebase, a diff, or a specific path. Covers auth, input surface, injection, dependencies, data exposure, crypto/secrets. Outputs a structured SECURITY_ASSESSMENT report with CRITICAL/HIGH/MEDIUM/LOW findings. Trigger with `/security-assessment [scope]` where scope is `diff`, `path:<path>`, or `full`. Also invoked as a sub-agent by `/module-runner` and `/architect`.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill: security-assessment
|
|
8
|
+
|
|
9
|
+
A focused security audit. Distinct from `/code-reviewer` — that skill checks quality + security together; this one goes deep on security only and produces a security-specific report.
|
|
10
|
+
|
|
11
|
+
**Two invocation modes:**
|
|
12
|
+
|
|
13
|
+
1. **Standalone (default)** — Triggered by user. Writes `documentation/reports/SECURITY_ASSESSMENT_<YYYY-MM-DD>.md` and presents a summary to the user.
|
|
14
|
+
2. **Sub-agent mode** — Invoked by `/module-runner` (or `/architect` for a pre-design review). Returns a JSON object with findings and **does not write a file**. Detect this mode when invoked via a parent agent's Task call; the parent's prompt will say "sub-agent mode".
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Phase 1 — Determine scope
|
|
19
|
+
|
|
20
|
+
Parse the invocation:
|
|
21
|
+
|
|
22
|
+
| Invocation | Scope |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `/security-assessment` (no args) | `diff` — audit changed files only (current branch vs main/master) |
|
|
25
|
+
| `/security-assessment diff` | Same as above, explicit |
|
|
26
|
+
| `/security-assessment path:src/auth` | Audit a specific path |
|
|
27
|
+
| `/security-assessment full` | Audit the entire codebase (slow — confirm before proceeding) |
|
|
28
|
+
|
|
29
|
+
If `full`, ask the user once: "Full-codebase audit may take significant time and tokens. Proceed?" Wait for confirmation. Skip this confirmation in sub-agent mode.
|
|
30
|
+
|
|
31
|
+
For `diff` scope: run `git diff --name-only origin/main...HEAD` (fall back to `main` → `master` → `develop` if the prior branch doesn't exist) to get the file list.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Phase 2 — Load auth model
|
|
36
|
+
|
|
37
|
+
Read `project-memory/auth-model.md`. This is **non-optional** — the audit's auth checks are driven entirely by what's documented there (guard names, RBAC entities, tenant scoping rules, JWT claims, etc.).
|
|
38
|
+
|
|
39
|
+
If `project-memory/auth-model.md` does not exist, **STOP**. Tell the user: "Cannot run security-assessment without `project-memory/auth-model.md`. Run `/create-blueprint auth-model` first."
|
|
40
|
+
|
|
41
|
+
Also read these if they exist (skip silently if absent):
|
|
42
|
+
- `project-memory/constitution.md` — for rules on logging/PII/secrets/error handling
|
|
43
|
+
- `project-memory/models.md` — to identify which fields are sensitive (PII, credentials, tokens)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Phase 3 — Map the audit surface with Serena
|
|
48
|
+
|
|
49
|
+
Use Serena to identify what to check. Target ≤8 calls total.
|
|
50
|
+
|
|
51
|
+
| Need | Tool |
|
|
52
|
+
|---|---|
|
|
53
|
+
| Find all controllers / route handlers in scope | `find_symbol(name_path="...Controller", substring_matching=true)` |
|
|
54
|
+
| Find all guards/middleware referenced | `find_symbol` on guard class names from `auth-model.md` |
|
|
55
|
+
| For each changed/in-scope file, get its structure | `get_symbols_overview(relative_path="...")` |
|
|
56
|
+
| Find callers of sensitive functions (e.g. raw SQL, exec, JSON.parse) | `find_referencing_symbols` |
|
|
57
|
+
| Locate auth-sensitive entry points | `find_symbol` on patterns like `@Post`, `@Put`, `@Delete` (or framework equivalents from `auth-model.md`) |
|
|
58
|
+
|
|
59
|
+
**Do not read full files yet.** Build a list of audit targets first, then read only the bodies you need for specific checks in Phase 4.
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Phase 4 — Run the audit checks
|
|
64
|
+
|
|
65
|
+
For each audit category, walk the relevant code paths. Use `find_symbol(..., include_body=true)` or `Read` (targeted, with offset/limit if the file is large) to inspect specific functions.
|
|
66
|
+
|
|
67
|
+
### 4.1 Auth audit
|
|
68
|
+
|
|
69
|
+
For every protected endpoint discovered in Phase 3:
|
|
70
|
+
- Is the correct guard/middleware applied? (Compare against `auth-model.md`'s guard chain.)
|
|
71
|
+
- Is the authenticated context extracted via the documented pattern (e.g. `@CurrentUser()`), not from request body/params?
|
|
72
|
+
- Do queries reachable from this endpoint filter by user/tenant where ownership applies?
|
|
73
|
+
- Are there any endpoints in scope that should be protected but aren't?
|
|
74
|
+
|
|
75
|
+
### 4.2 Input surface audit
|
|
76
|
+
|
|
77
|
+
For every controller/handler in scope:
|
|
78
|
+
- Is input validated at the boundary (DTO + validation pipe, Zod schema, or equivalent from project conventions)?
|
|
79
|
+
- Are any `req.body.*`, `req.params.*`, or `req.query.*` values flowing into queries, file paths, shell commands, or template rendering without escape?
|
|
80
|
+
- Is user-supplied ID used as a trust boundary? (e.g. `body.userId` controlling whose data is fetched — should come from auth context)
|
|
81
|
+
|
|
82
|
+
### 4.3 Injection audit
|
|
83
|
+
|
|
84
|
+
Grep/search the changed code for:
|
|
85
|
+
- Raw SQL strings concatenating variables (`` `SELECT ... ${var}` `` patterns)
|
|
86
|
+
- ORM escape hatches: `Sequelize.literal`, `raw(`, `$queryRaw`, `query(` with string interpolation
|
|
87
|
+
- `child_process.exec`/`execSync`/`spawn` with non-static argument arrays
|
|
88
|
+
- Template rendering with `eval`, `Function`, or unescaped user input
|
|
89
|
+
|
|
90
|
+
### 4.4 Dependency audit
|
|
91
|
+
|
|
92
|
+
- If `package.json` changed in scope, examine each added/changed dep — is it reputable, maintained, and minimum-necessary?
|
|
93
|
+
- Recommend running `npm audit --omit=dev` and capture summary if available (best-effort; do not block the audit if it errors).
|
|
94
|
+
- Flag any deps known-vulnerable in security-critical paths (jsonwebtoken pre-9, lodash pre-4.17.21, etc.).
|
|
95
|
+
|
|
96
|
+
### 4.5 Data exposure audit
|
|
97
|
+
|
|
98
|
+
- Search for log calls (`console.log`, `logger.info`, etc.) in scope. For each, ask: does it include any field from `project-memory/models.md` that is marked sensitive? Does it include `password`, `token`, `secret`, `apiKey`, raw `email` if PII rules forbid it?
|
|
99
|
+
- For each API response shape in scope, check that sensitive fields are excluded (compare response DTO/serializer against the model's sensitive fields).
|
|
100
|
+
- Check error responses: do they leak stack traces, internal paths, or DB error text to clients?
|
|
101
|
+
|
|
102
|
+
### 4.6 Crypto & secrets
|
|
103
|
+
|
|
104
|
+
- Password hashing: bcrypt cost ≥ 10, argon2 with reasonable params, no MD5/SHA1 for passwords.
|
|
105
|
+
- JWT: signing algorithm strong (HS256+ with strong secret, or RS/ES). No `alg: none`. Reasonable expiry.
|
|
106
|
+
- Secrets: no hardcoded API keys, DB URIs, JWT secrets. All from `process.env` or a secret manager.
|
|
107
|
+
- TLS: no `http://` to non-localhost services handling auth/PII; no `rejectUnauthorized: false` in production paths.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Phase 5 — Synthesize findings
|
|
112
|
+
|
|
113
|
+
For each issue discovered, assign a severity (see `templates/SECURITY_REPORT.md` for definitions):
|
|
114
|
+
|
|
115
|
+
- **CRITICAL** — Exploitable now: auth bypass, RCE, cross-tenant data access, secret in repo
|
|
116
|
+
- **HIGH** — Real risk with specific conditions: missing guard on sensitive endpoint, injection vector behind auth, known-vulnerable dep in active use
|
|
117
|
+
- **MEDIUM** — Defense-in-depth gap: missing rate limit, verbose errors, weak validation
|
|
118
|
+
- **LOW** — Hygiene: minor PII in logs, missing security header, etc.
|
|
119
|
+
|
|
120
|
+
Discard speculative findings. If you can't articulate a concrete exploit path or concrete risk, it's not a finding.
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
## Phase 6 — Output
|
|
125
|
+
|
|
126
|
+
### 6.1 Standalone mode
|
|
127
|
+
|
|
128
|
+
Write the report to:
|
|
129
|
+
```
|
|
130
|
+
documentation/reports/SECURITY_ASSESSMENT_<YYYY-MM-DD>.md
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Use `.agent/templates/SECURITY_REPORT.md` as the template. Fill every section. If a section has no findings, write "No findings." — do not delete the section.
|
|
134
|
+
|
|
135
|
+
Then in the chat, present a **brief summary**:
|
|
136
|
+
- Total findings by severity (e.g. "0 CRITICAL, 2 HIGH, 3 MEDIUM, 1 LOW")
|
|
137
|
+
- The HIGH/CRITICAL findings in one line each
|
|
138
|
+
- The report path
|
|
139
|
+
|
|
140
|
+
Do not paste the full report into chat.
|
|
141
|
+
|
|
142
|
+
### 6.2 Sub-agent mode
|
|
143
|
+
|
|
144
|
+
Do **not** write a file. Return a JSON object to the parent agent:
|
|
145
|
+
|
|
146
|
+
```json
|
|
147
|
+
{
|
|
148
|
+
"verdict": "clean" | "fix_required" | "block",
|
|
149
|
+
"counts": { "critical": 0, "high": 0, "medium": 0, "low": 0 },
|
|
150
|
+
"findings": [
|
|
151
|
+
{
|
|
152
|
+
"severity": "CRITICAL" | "HIGH" | "MEDIUM" | "LOW",
|
|
153
|
+
"category": "auth" | "input" | "injection" | "deps" | "data_exposure" | "crypto" | "secrets" | "other",
|
|
154
|
+
"title": "<short>",
|
|
155
|
+
"files": ["<path:line>"],
|
|
156
|
+
"fix": "<one sentence>"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
`verdict = block` if any CRITICAL. `verdict = fix_required` if any HIGH. `verdict = clean` otherwise.
|
|
163
|
+
|
|
164
|
+
The parent agent (typically `/module-runner`'s security-fixer phase) consumes this JSON and decides what to fix automatically.
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Do not
|
|
169
|
+
|
|
170
|
+
- Write code fixes in this skill. This skill only audits and reports. Fixes happen in `/module-runner`'s security-fixer phase (which is a separate sub-agent call) or are surfaced to the user in standalone mode.
|
|
171
|
+
- Update `project-memory/`. Audit findings don't change the source of truth.
|
|
172
|
+
- Speculate. Every finding must be backed by a specific file:line reference.
|
|
173
|
+
- Run `/security-assessment full` without explicit confirmation (in standalone mode).
|
|
174
|
+
- Run more than 8 Serena calls in Phase 3 — escalate to targeted Read instead.
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: module-runner
|
|
3
|
+
description: Autonomous per-module executor for backend features planned by `/architect`. Sequentially runs each module's prompt through a sub-agent pipeline (build → test → review → fix → security audit → fix → commit → push), keeping the main agent's context clean. Trigger with `/module-runner <feature-folder>`. Claude Code variant — uses the Task tool to spawn independent-context sub-agents.
|
|
4
|
+
disable-model-invocation: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Skill: module-runner (Claude Code variant)
|
|
8
|
+
|
|
9
|
+
The main agent here is the **orchestrator**. It does not implement, review, or audit anything itself. It dispatches each per-module phase to a sub-agent (Task tool, fresh context) and acts on the structured result.
|
|
10
|
+
|
|
11
|
+
This keeps the main agent's context clean across 10+ module features — every heavy phase (loading project-memory, reading diffs, running review/audit logic) happens in a sub-agent that exits when done.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Input
|
|
16
|
+
|
|
17
|
+
The user invokes:
|
|
18
|
+
```
|
|
19
|
+
/module-runner <feature-folder>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Where `<feature-folder>` is `documentation/features/<feature_name>/`, containing:
|
|
23
|
+
- `<feature>_MODULE_WISE_PLAN.md` — master plan
|
|
24
|
+
- `<feature>_MODULE_<N>_<MODULE_NAME>.md` — one prompt per module
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Phase 0 — Validate input
|
|
29
|
+
|
|
30
|
+
1. Confirm the folder exists.
|
|
31
|
+
2. List `<feature>_MODULE_<N>_*.md` files. Sort by `<N>`.
|
|
32
|
+
3. Confirm `<feature>_MODULE_WISE_PLAN.md` exists. Read it once to extract feature name and module count.
|
|
33
|
+
4. Check git state: must be on a non-`main`/non-`master` branch. If on `main`, **STOP** and ask the user to create a feature branch first.
|
|
34
|
+
5. Confirm `project-memory/` is intact (constitution, repo-map, auth-model, core-memory all present).
|
|
35
|
+
|
|
36
|
+
Present a one-line summary to the user:
|
|
37
|
+
> "Found N modules in <feature-folder>. Starting from Module 1. I'll commit + push after each module passes. Confirm to proceed?"
|
|
38
|
+
|
|
39
|
+
Wait for confirmation.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Per-module pipeline
|
|
44
|
+
|
|
45
|
+
For each module file in order, run this pipeline. **Each numbered step is a sub-agent invocation** (Task tool, fresh context) **unless marked [Main]**.
|
|
46
|
+
|
|
47
|
+
### Step 1 — Implement [Task sub-agent]
|
|
48
|
+
|
|
49
|
+
Spawn a sub-agent with a self-contained prompt:
|
|
50
|
+
|
|
51
|
+
> Task: Implement Module <N> — <MODULE_NAME> of feature `<feature_name>`.
|
|
52
|
+
>
|
|
53
|
+
> Read the full spec from: `documentation/features/<feature_name>/<feature>_MODULE_<N>_<MODULE_NAME>.md`.
|
|
54
|
+
>
|
|
55
|
+
> The prompt contains all curated context (repo-map excerpts, constitution rules, auth approach, prior decisions) and the full module specification.
|
|
56
|
+
>
|
|
57
|
+
> Execution rules:
|
|
58
|
+
> - No placeholder code. Implement every file in the New Files / Modified Files tables.
|
|
59
|
+
> - Honor the constitution rules inlined in the prompt's §1.
|
|
60
|
+
> - Honor the auth approach inlined in the prompt's §1 (if present).
|
|
61
|
+
> - Use Serena for symbol-level edits where appropriate; raw Write for new files.
|
|
62
|
+
> - When done, return a JSON summary:
|
|
63
|
+
> `{ "files_changed": [...], "summary": "<one paragraph>", "blockers": [] }`
|
|
64
|
+
>
|
|
65
|
+
> Do NOT run tests, do NOT commit. Implementation only.
|
|
66
|
+
|
|
67
|
+
Wait for completion. If `blockers` is non-empty, **STOP** and surface to user.
|
|
68
|
+
|
|
69
|
+
### Step 2 — Build + Test [Main]
|
|
70
|
+
|
|
71
|
+
In the main agent:
|
|
72
|
+
```bash
|
|
73
|
+
npm run build
|
|
74
|
+
npm test
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
If both pass → go to Step 3.
|
|
78
|
+
|
|
79
|
+
If either fails:
|
|
80
|
+
- Spawn a [Task sub-agent] with the failure output:
|
|
81
|
+
> Task: The Module <N> implementation has build/test failures. Output below. Read the changed files (from the prior implementation summary) and fix the failures. Return `{ "fixed": true|false, "summary": "..." }`.
|
|
82
|
+
- Re-run `npm run build` and `npm test`.
|
|
83
|
+
- Allow **at most 2** fixer iterations. On the 3rd consecutive failure, **STOP** and surface to user.
|
|
84
|
+
|
|
85
|
+
### Step 3 — Code review [Task sub-agent, sub-agent mode]
|
|
86
|
+
|
|
87
|
+
Spawn a sub-agent invoking the `/code-reviewer` skill in sub-agent mode:
|
|
88
|
+
|
|
89
|
+
> Task: Run `/code-reviewer` in sub-agent mode on the diff since the last commit. Module: <N> — <MODULE_NAME>.
|
|
90
|
+
>
|
|
91
|
+
> Auto-approve internal decisions per `/code-reviewer`'s sub-agent contract.
|
|
92
|
+
> Return the structured findings JSON.
|
|
93
|
+
|
|
94
|
+
Wait for completion. Parse the verdict:
|
|
95
|
+
- `verdict = clean` → go to Step 5
|
|
96
|
+
- `verdict = fix_required` → go to Step 4
|
|
97
|
+
- `verdict = block` → **STOP** and surface findings to user
|
|
98
|
+
|
|
99
|
+
### Step 4 — Code fixer [Task sub-agent]
|
|
100
|
+
|
|
101
|
+
Spawn a sub-agent to apply the code-review findings:
|
|
102
|
+
|
|
103
|
+
> Task: Apply the required-severity findings from this `/code-reviewer` output. JSON below.
|
|
104
|
+
>
|
|
105
|
+
> [paste the findings JSON from Step 3]
|
|
106
|
+
>
|
|
107
|
+
> Rules:
|
|
108
|
+
> - Only fix findings marked BLOCKER, HIGH, or MED-with-`required=true`. Skip LOW and optional.
|
|
109
|
+
> - Use Serena symbolic edits where the fix is symbol-shaped.
|
|
110
|
+
> - Do not change scope beyond the listed findings.
|
|
111
|
+
> - When done, return `{ "fixed": [<finding ids>], "skipped": [<finding ids with reason>], "summary": "..." }`.
|
|
112
|
+
|
|
113
|
+
After the fixer returns, re-run `npm run build` and `npm test`. If they pass, go to Step 5. If they fail, treat as Step 2 retry (max 2 total fixer iterations before STOP).
|
|
114
|
+
|
|
115
|
+
### Step 5 — Security audit [Task sub-agent, sub-agent mode]
|
|
116
|
+
|
|
117
|
+
Spawn a sub-agent invoking the `/security-assessment` skill in sub-agent mode, scope = diff:
|
|
118
|
+
|
|
119
|
+
> Task: Run `/security-assessment` in sub-agent mode, scope = diff (since last commit). Module: <N> — <MODULE_NAME>.
|
|
120
|
+
> Return the structured findings JSON.
|
|
121
|
+
|
|
122
|
+
Parse the verdict:
|
|
123
|
+
- `verdict = clean` → go to Step 7
|
|
124
|
+
- `verdict = fix_required` → go to Step 6
|
|
125
|
+
- `verdict = block` → **STOP** and surface findings to user
|
|
126
|
+
|
|
127
|
+
### Step 6 — Security fixer [Task sub-agent]
|
|
128
|
+
|
|
129
|
+
Spawn a sub-agent to apply CRITICAL/HIGH security findings:
|
|
130
|
+
|
|
131
|
+
> Task: Apply CRITICAL and HIGH security findings. JSON below.
|
|
132
|
+
>
|
|
133
|
+
> [paste findings JSON from Step 5]
|
|
134
|
+
>
|
|
135
|
+
> Rules:
|
|
136
|
+
> - Fix every CRITICAL and HIGH. Skip MEDIUM and LOW unless explicitly tagged `must_fix`.
|
|
137
|
+
> - Use Serena symbolic edits where possible.
|
|
138
|
+
> - Return `{ "fixed": [...], "skipped": [...], "summary": "..." }`.
|
|
139
|
+
|
|
140
|
+
After fixer returns, re-run `npm run build` and `npm test`. If they pass, go to Step 7. If they fail, **STOP** and surface to user (do not auto-retry security fixes).
|
|
141
|
+
|
|
142
|
+
### Step 7 — Update project-memory [Main]
|
|
143
|
+
|
|
144
|
+
In the main agent:
|
|
145
|
+
|
|
146
|
+
1. Append a line to `project-memory/core-memory.md` under Completed modules:
|
|
147
|
+
> `<feature_name>: Module <N> completed (<one-line description>); next: Module <N+1>.`
|
|
148
|
+
2. If the module added new modules/routes/services, update `project-memory/repo-map.md` accordingly.
|
|
149
|
+
3. Update or create `MODULE.md` in the module's source directory using `.agent/templates/MODULE.md`.
|
|
150
|
+
|
|
151
|
+
### Step 8 — Commit + push [Main]
|
|
152
|
+
|
|
153
|
+
In the main agent:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
git add .
|
|
157
|
+
git commit -m "feat(MODULE_<N>): <one-line description from Step 1's implementation summary>"
|
|
158
|
+
git push origin HEAD
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
If push fails (e.g. protected branch, missing upstream), surface the error and **STOP** — do not force-push, do not change branches.
|
|
162
|
+
|
|
163
|
+
### Step 9 — Move to next module [Main]
|
|
164
|
+
|
|
165
|
+
Print a one-line status:
|
|
166
|
+
> "✅ Module <N>/<total> done. Moving to Module <N+1>."
|
|
167
|
+
|
|
168
|
+
Return to Step 1 for the next module.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## After all modules
|
|
173
|
+
|
|
174
|
+
Print a final summary:
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
Feature: <feature_name>
|
|
178
|
+
Modules completed: <N>/<total>
|
|
179
|
+
Total commits: <count>
|
|
180
|
+
Branch: <current-branch>
|
|
181
|
+
|
|
182
|
+
Per-module:
|
|
183
|
+
- Module 1: <files changed count>, build ✅, review ✅, security ✅
|
|
184
|
+
- Module 2: ...
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Do **not** open a PR. Leave that to the user.
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Failure modes — when to STOP
|
|
192
|
+
|
|
193
|
+
The runner **stops and surfaces to the user** (no automatic retry beyond what's specified per phase):
|
|
194
|
+
|
|
195
|
+
- Build or test fails after 2 fixer iterations
|
|
196
|
+
- `/code-reviewer` returns `verdict = block` (CRITICAL or unrecoverable findings)
|
|
197
|
+
- `/security-assessment` returns `verdict = block` (CRITICAL)
|
|
198
|
+
- Security fixer step fails build/tests on its first re-verification
|
|
199
|
+
- `git push` fails
|
|
200
|
+
- Implementation sub-agent returns non-empty `blockers`
|
|
201
|
+
- Any sub-agent Task tool call errors out
|
|
202
|
+
|
|
203
|
+
On STOP: clearly state which step failed, which module it was on, paste the relevant error/findings, and **do not** delete uncommitted work. The user resumes by re-running `/module-runner <feature-folder>` after fixing the blocker — the runner skips modules whose source files match the last committed state. (Detect this by checking `project-memory/core-memory.md` for "Module <N> completed" lines.)
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Sub-agent invocation contract (Claude Code Task tool)
|
|
208
|
+
|
|
209
|
+
When spawning a sub-agent, the Task tool call must:
|
|
210
|
+
|
|
211
|
+
- Use `subagent_type: "general-purpose"` (or a dedicated subagent type if one is configured)
|
|
212
|
+
- Pass a fully self-contained prompt — the sub-agent has zero context from the main session
|
|
213
|
+
- Request a JSON-shaped return value when the result will be consumed programmatically (review, security, fixer)
|
|
214
|
+
- For background-friendly phases (review, security audit), use `run_in_background: true` only if Step ordering allows. The pipeline above is strictly sequential, so default to foreground.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
## Do not
|
|
219
|
+
|
|
220
|
+
- Implement, review, or audit in the main agent. Always delegate via Task.
|
|
221
|
+
- Skip the build/test verification between phases.
|
|
222
|
+
- Auto-retry beyond the limits specified.
|
|
223
|
+
- Squash commits — one commit per module.
|
|
224
|
+
- Push to `main` / `master` directly.
|
|
225
|
+
- Open a PR — the user does that after reviewing the full branch.
|
|
226
|
+
- Update `project-memory/core-memory.md` in the implementation/fixer/audit sub-agents. Only the main agent does that, in Step 7.
|