nurosys-agents 2.0.0 → 2.1.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.
Files changed (50) hide show
  1. package/.agent/INSTRUCTIONS.md +31 -1
  2. package/.agent/frontend/skills/architect/SKILL.md +309 -467
  3. package/.agent/frontend/skills/auth-and-permissions/SKILL.md +185 -41
  4. package/.agent/frontend/skills/brainstorm/SKILL.md +127 -0
  5. package/.agent/frontend/skills/code-reviewer/SKILL.md +307 -0
  6. package/.agent/frontend/skills/{react-quality-review → code-reviewer}/examples.md +2 -2
  7. package/.agent/frontend/skills/create-blueprint/SKILL.md +280 -130
  8. package/.agent/frontend/skills/debug-issue/SKILL.md +76 -18
  9. package/.agent/frontend/skills/explore-codebase/SKILL.md +38 -19
  10. package/.agent/frontend/skills/quick-execute/SKILL.md +105 -0
  11. package/.agent/frontend/skills/refactor-safely/SKILL.md +47 -19
  12. package/.agent/frontend/skills/security-assessment/SKILL.md +182 -0
  13. package/.agent/frontend/skills/ux-architect/SKILL.md +198 -0
  14. package/.agent/frontend/skills/vuexy-component-guide/SKILL.md +51 -0
  15. package/.agent/frontend/workflows/module-runner.claude.md +233 -0
  16. package/.agent/frontend/workflows/module-runner.codex.md +159 -0
  17. package/.agent/frontend/workflows/module-runner.cursor.md +218 -0
  18. package/.agent/templates/UX_PLAN.md +228 -0
  19. package/README.md +28 -3
  20. package/package.json +2 -2
  21. package/scripts/setup-rules.js +13 -4
  22. package/.agent/frontend/skills/feature-workflow/SKILL.md +0 -61
  23. package/.agent/frontend/skills/react-quality-review/SKILL.md +0 -126
  24. package/.agent/frontend/workflows/build-feature-react.workflow.md +0 -82
  25. package/.agent/frontend/workflows/feature-module-runner.md +0 -101
  26. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/_sections.md +0 -0
  27. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/_template.md +0 -0
  28. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/advanced-event-handler-refs.md +0 -0
  29. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/advanced-init-once.md +0 -0
  30. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-calling.md +0 -0
  31. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-hooks.md +0 -0
  32. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/react-rules-purity.md +0 -0
  33. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-activity.md +0 -0
  34. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-conditional-render.md +0 -0
  35. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-content-visibility.md +0 -0
  36. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-hoist-jsx.md +0 -0
  37. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rendering-usetransition-loading.md +0 -0
  38. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-defer-reads.md +0 -0
  39. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-dependencies.md +0 -0
  40. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-derived-state-no-effect.md +0 -0
  41. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-derived-state.md +0 -0
  42. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-functional-setstate.md +0 -0
  43. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-lazy-state-init.md +0 -0
  44. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-memo-with-default-value.md +0 -0
  45. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-memo.md +0 -0
  46. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-move-effect-to-event.md +0 -0
  47. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-no-inline-components.md +0 -0
  48. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-simple-expression-in-memo.md +0 -0
  49. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-transitions.md +0 -0
  50. /package/.agent/frontend/skills/{react-quality-review → code-reviewer}/rules/rerender-use-ref-transient-values.md +0 -0
@@ -367,3 +367,54 @@ For Avatars/Badges: use `skin` prop (`'filled'`, `'light'`, `'light-static'`) to
367
367
 
368
368
  For the complete component reference with every available prop and configuration option, see [reference.md](reference.md).
369
369
  For full interface examples, see [examples.md](examples.md).
370
+
371
+ ---
372
+
373
+ ## Sub-agent mode (used by `/ux-architect`)
374
+
375
+ When invoked as a sub-agent by `/ux-architect`, this skill operates in **structured-output mode** and **does not respond conversationally**. Detect this mode when the parent's prompt contains "sub-agent mode" or "mode=subagent".
376
+
377
+ ### Input contract
378
+
379
+ The parent provides a description of the proposed UI surface — one or more of:
380
+ - A list of pages / routes
381
+ - Dialogs, drawers, modals to be added
382
+ - Forms with their fields and validation needs
383
+ - Lists, tables, cards, or other display surfaces
384
+ - States to render: empty / loading / error
385
+
386
+ ### Output contract
387
+
388
+ Return a JSON object. Do not include narration outside the JSON.
389
+
390
+ ```json
391
+ {
392
+ "reuse_candidates": [
393
+ {
394
+ "ui_element": "<short description of the UI piece from the parent's request>",
395
+ "use_component": "<one or more component names — MUI components, custom wrappers, or composition patterns>",
396
+ "pattern": "<short name of the form/dialog/layout pattern that fits>",
397
+ "ref": "<file:section anchor pointing into examples.md or reference.md, e.g. 'examples.md#user-list-dialog'>",
398
+ "notes": "<one or two sentences on props/composition specifics — what to set, what to avoid>"
399
+ }
400
+ ],
401
+ "gaps": [
402
+ {
403
+ "ui_element": "<UI piece the existing component library does NOT cover well>",
404
+ "why_no_reuse": "<one sentence: what's missing — no matching wrapper, requires new variant, new design token, etc.>",
405
+ "suggested_pattern": "<the closest existing pattern + the specific delta the team would need to add>"
406
+ }
407
+ ]
408
+ }
409
+ ```
410
+
411
+ ### Sub-agent rules
412
+
413
+ - **Reuse-first**: every `ui_element` from the parent's request must appear in `reuse_candidates` OR `gaps` — never both, never neither.
414
+ - **Cite the source**: every `reuse_candidates[].ref` must point to an actual anchor in `examples.md` or `reference.md`. Do not invent references.
415
+ - **Be honest about gaps**: if the existing library genuinely doesn't cover a need, surface it as a `gap` with a concrete suggestion rather than forcing a reuse mapping.
416
+ - **No code in the JSON**: descriptions and component names only — `/ux-architect` is composing a plan, not writing code.
417
+
418
+ ### Standalone mode (unchanged)
419
+
420
+ When invoked directly by the user (no "sub-agent mode" signal in the prompt), the skill behaves as before — conversational guidance with code samples, references to `examples.md` and `reference.md`, and recommendations for the user's described UI need.
@@ -0,0 +1,233 @@
1
+ ---
2
+ name: module-runner
3
+ description: Autonomous per-module executor for frontend features planned by `/architect` (which itself consumed `/ux-architect`'s UX plan). Sequentially runs each module's prompt through a sub-agent pipeline (build → test → lint → 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: UX plan references (specific sections), repo-map excerpts, architecture rules, constitution rules, design-system patterns, auth approach, prior decisions, plus the full module specification.
56
+ >
57
+ > If the prompt references sections of `documentation/features/<feature_name>/<feature>_UX_PLAN.md`, those are the visual/composition source of truth for any UI code you write.
58
+ >
59
+ > Execution rules:
60
+ > - No placeholder code. Implement every file in the New Files / Modified Files tables.
61
+ > - Honor constitution + design-system rules inlined in the prompt's §1.
62
+ > - Use the documented custom wrappers and form pattern — no raw MUI when a wrapper exists.
63
+ > - Honor `'use client'` decisions in the prompt's §1 — don't add it to a server component unintentionally.
64
+ > - Honor the auth approach inlined in the prompt's §1 (if present).
65
+ > - Use Serena for symbol-level edits where appropriate; raw Write for new files.
66
+ > - When done, return a JSON summary:
67
+ > `{ "files_changed": [...], "summary": "<one paragraph>", "blockers": [] }`
68
+ >
69
+ > Do NOT run tests, do NOT commit. Implementation only.
70
+
71
+ Wait for completion. If `blockers` is non-empty, **STOP** and surface to user.
72
+
73
+ ### Step 2 — Build + Test + Lint [Main]
74
+
75
+ In the main agent:
76
+ ```bash
77
+ npm run build
78
+ npm test
79
+ npm run lint # if defined in package.json scripts; otherwise skip
80
+ ```
81
+
82
+ For TypeScript-strict projects, `npm run build` already runs the type-check. If there's a dedicated typecheck script (`tsc --noEmit`), run it too.
83
+
84
+ If all pass → go to Step 3.
85
+
86
+ If either fails:
87
+ - Spawn a [Task sub-agent] with the failure output:
88
+ > 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": "..." }`.
89
+ - Re-run `npm run build` and `npm test`.
90
+ - Allow **at most 2** fixer iterations. On the 3rd consecutive failure, **STOP** and surface to user.
91
+
92
+ ### Step 3 — Code review [Task sub-agent, sub-agent mode]
93
+
94
+ Spawn a sub-agent invoking the `/code-reviewer` skill in sub-agent mode:
95
+
96
+ > Task: Run `/code-reviewer` in sub-agent mode on the diff since the last commit. Module: <N> — <MODULE_NAME>.
97
+ >
98
+ > Auto-approve internal decisions per `/code-reviewer`'s sub-agent contract.
99
+ > Return the structured findings JSON.
100
+
101
+ Wait for completion. Parse the verdict:
102
+ - `verdict = clean` → go to Step 5
103
+ - `verdict = fix_required` → go to Step 4
104
+ - `verdict = block` → **STOP** and surface findings to user
105
+
106
+ ### Step 4 — Code fixer [Task sub-agent]
107
+
108
+ Spawn a sub-agent to apply the code-review findings:
109
+
110
+ > Task: Apply the required-severity findings from this `/code-reviewer` output. JSON below.
111
+ >
112
+ > [paste the findings JSON from Step 3]
113
+ >
114
+ > Rules:
115
+ > - Only fix findings marked BLOCKER, HIGH, or MED-with-`required=true`. Skip LOW and optional.
116
+ > - Use Serena symbolic edits where the fix is symbol-shaped.
117
+ > - Do not change scope beyond the listed findings.
118
+ > - When done, return `{ "fixed": [<finding ids>], "skipped": [<finding ids with reason>], "summary": "..." }`.
119
+
120
+ 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).
121
+
122
+ ### Step 5 — Security audit [Task sub-agent, sub-agent mode]
123
+
124
+ Spawn a sub-agent invoking the `/security-assessment` skill in sub-agent mode, scope = diff:
125
+
126
+ > Task: Run `/security-assessment` in sub-agent mode, scope = diff (since last commit). Module: <N> — <MODULE_NAME>.
127
+ > Return the structured findings JSON.
128
+
129
+ Parse the verdict:
130
+ - `verdict = clean` → go to Step 7
131
+ - `verdict = fix_required` → go to Step 6
132
+ - `verdict = block` → **STOP** and surface findings to user
133
+
134
+ ### Step 6 — Security fixer [Task sub-agent]
135
+
136
+ Spawn a sub-agent to apply CRITICAL/HIGH security findings:
137
+
138
+ > Task: Apply CRITICAL and HIGH security findings. JSON below.
139
+ >
140
+ > [paste findings JSON from Step 5]
141
+ >
142
+ > Rules:
143
+ > - Fix every CRITICAL and HIGH. Skip MEDIUM and LOW unless explicitly tagged `must_fix`.
144
+ > - Use Serena symbolic edits where possible.
145
+ > - Return `{ "fixed": [...], "skipped": [...], "summary": "..." }`.
146
+
147
+ 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).
148
+
149
+ ### Step 7 — Update project-memory [Main]
150
+
151
+ In the main agent:
152
+
153
+ 1. Append a line to `project-memory/core-memory.md` under Completed modules:
154
+ > `<feature_name>: Module <N> completed (<one-line description>); next: Module <N+1>.`
155
+ 2. If the module added new modules/routes/services, update `project-memory/repo-map.md` accordingly.
156
+ 3. Update or create `MODULE.md` in the module's source directory using `.agent/templates/MODULE.md`.
157
+
158
+ ### Step 8 — Commit + push [Main]
159
+
160
+ In the main agent:
161
+
162
+ ```bash
163
+ git add .
164
+ git commit -m "feat(MODULE_<N>): <one-line description from Step 1's implementation summary>"
165
+ git push origin HEAD
166
+ ```
167
+
168
+ If push fails (e.g. protected branch, missing upstream), surface the error and **STOP** — do not force-push, do not change branches.
169
+
170
+ ### Step 9 — Move to next module [Main]
171
+
172
+ Print a one-line status:
173
+ > "✅ Module <N>/<total> done. Moving to Module <N+1>."
174
+
175
+ Return to Step 1 for the next module.
176
+
177
+ ---
178
+
179
+ ## After all modules
180
+
181
+ Print a final summary:
182
+
183
+ ```
184
+ Feature: <feature_name>
185
+ Modules completed: <N>/<total>
186
+ Total commits: <count>
187
+ Branch: <current-branch>
188
+
189
+ Per-module:
190
+ - Module 1: <files changed count>, build ✅, review ✅, security ✅
191
+ - Module 2: ...
192
+ ```
193
+
194
+ Do **not** open a PR. Leave that to the user.
195
+
196
+ ---
197
+
198
+ ## Failure modes — when to STOP
199
+
200
+ The runner **stops and surfaces to the user** (no automatic retry beyond what's specified per phase):
201
+
202
+ - Build or test fails after 2 fixer iterations
203
+ - `/code-reviewer` returns `verdict = block` (CRITICAL or unrecoverable findings)
204
+ - `/security-assessment` returns `verdict = block` (CRITICAL)
205
+ - Security fixer step fails build/tests on its first re-verification
206
+ - `git push` fails
207
+ - Implementation sub-agent returns non-empty `blockers`
208
+ - Any sub-agent Task tool call errors out
209
+
210
+ 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.)
211
+
212
+ ---
213
+
214
+ ## Sub-agent invocation contract (Claude Code Task tool)
215
+
216
+ When spawning a sub-agent, the Task tool call must:
217
+
218
+ - Use `subagent_type: "general-purpose"` (or a dedicated subagent type if one is configured)
219
+ - Pass a fully self-contained prompt — the sub-agent has zero context from the main session
220
+ - Request a JSON-shaped return value when the result will be consumed programmatically (review, security, fixer)
221
+ - 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.
222
+
223
+ ---
224
+
225
+ ## Do not
226
+
227
+ - Implement, review, or audit in the main agent. Always delegate via Task.
228
+ - Skip the build/test verification between phases.
229
+ - Auto-retry beyond the limits specified.
230
+ - Squash commits — one commit per module.
231
+ - Push to `main` / `master` directly.
232
+ - Open a PR — the user does that after reviewing the full branch.
233
+ - Update `project-memory/core-memory.md` in the implementation/fixer/audit sub-agents. Only the main agent does that, in Step 7.
@@ -0,0 +1,159 @@
1
+ ---
2
+ name: module-runner
3
+ description: Sequential per-module executor for frontend features planned by `/architect` (which itself consumed `/ux-architect`'s UX plan). Runs each module's prompt through a foreground pipeline (build → test → lint → review → fix → security audit → fix → commit → push). Codex variant — runs all phases in a single context (no native sub-agent spawning). Trigger with `/module-runner <feature-folder>`.
4
+ ---
5
+
6
+ # Skill: module-runner (Codex variant)
7
+
8
+ Codex does not have native in-session sub-agent spawning (no equivalent of Claude Code's Task tool or Cursor's subagents API callable from within an agent run). This variant runs the same per-module pipeline **sequentially in a single context**.
9
+
10
+ **Limitation acknowledgement:** On long features (10+ modules), this variant will accumulate context as it goes — review/audit phases load diffs and project-memory each iteration. For features with many modules, prefer Claude Code or Cursor where context isolation is native.
11
+
12
+ The pipeline contract (build → test → review → fix → security → fix → commit → push) is identical; only the execution model differs.
13
+
14
+ ---
15
+
16
+ ## Input
17
+
18
+ ```
19
+ /module-runner <feature-folder>
20
+ ```
21
+
22
+ Where `<feature-folder>` is `documentation/features/<feature_name>/`.
23
+
24
+ ---
25
+
26
+ ## Phase 0 — Validate input
27
+
28
+ 1. Folder exists, module files present, sorted by `<N>`
29
+ 2. `_MODULE_WISE_PLAN.md` exists
30
+ 3. On a non-`main` branch
31
+ 4. `project-memory/` intact
32
+
33
+ Confirm with the user before starting. Specifically warn:
34
+ > "Codex variant: all phases run in this single conversation. For features with 10+ modules, context rot is possible. Continue?"
35
+
36
+ ---
37
+
38
+ ## Per-module pipeline
39
+
40
+ For each module file in order:
41
+
42
+ ### Step 1 — Implement
43
+
44
+ In this same conversation:
45
+
46
+ 1. Read the full module spec: `documentation/features/<feature_name>/<feature>_MODULE_<N>_<MODULE_NAME>.md`
47
+ 2. If the prompt references sections of `documentation/features/<feature_name>/<feature>_UX_PLAN.md`, those are the visual/composition source of truth for any UI code.
48
+ 3. Implement every file in the New Files / Modified Files tables.
49
+ 4. Honor constitution + design-system rules inlined in §1. Use the documented custom wrappers and form pattern — no raw MUI when a wrapper exists.
50
+ 5. Honor `'use client'` decisions inlined in §1 — don't add it to a server component unintentionally.
51
+ 6. Honor the auth approach inlined in §1.
52
+ 7. Use Serena for symbol-level edits, raw Write for new files.
53
+ 8. No placeholder code. No skipped validation/auth/error handling.
54
+
55
+ Track files changed in working memory (you'll need them for commit message in Step 8).
56
+
57
+ ### Step 2 — Build + Test + Lint
58
+
59
+ ```bash
60
+ npm run build
61
+ npm test
62
+ npm run lint # if defined; otherwise skip
63
+ ```
64
+
65
+ If all pass → Step 3. If any fail:
66
+ - Inspect failures.
67
+ - Fix.
68
+ - Re-run.
69
+ - Max 2 fix iterations. On 3rd failure, **STOP**.
70
+
71
+ ### Step 3 — Code review
72
+
73
+ Invoke the `/code-reviewer` skill (foreground, same context). Capture findings.
74
+
75
+ Verdict:
76
+ - `clean` → Step 5
77
+ - `fix_required` → Step 4
78
+ - `block` → **STOP**
79
+
80
+ ### Step 4 — Apply code-review fixes
81
+
82
+ Apply BLOCKER, HIGH, and required-MED findings from the review. Skip LOW.
83
+
84
+ Re-run `npm run build && npm test`. If pass → Step 5. If fail → Step 2 retry logic (max 2 total).
85
+
86
+ ### Step 5 — Security audit
87
+
88
+ Invoke the `/security-assessment` skill, scope = diff. Capture findings.
89
+
90
+ Verdict:
91
+ - `clean` → Step 7
92
+ - `fix_required` → Step 6
93
+ - `block` → **STOP**
94
+
95
+ ### Step 6 — Apply security fixes
96
+
97
+ Apply CRITICAL and HIGH findings. Skip MEDIUM/LOW unless tagged `must_fix`.
98
+
99
+ Re-run build/test. If pass → Step 7. If fail → **STOP** (no auto-retry).
100
+
101
+ ### Step 7 — Update project-memory
102
+
103
+ 1. Append to `project-memory/core-memory.md`:
104
+ > `<feature_name>: Module <N> completed (<one-line>); next: Module <N+1>.`
105
+ 2. Update `project-memory/repo-map.md` if new modules/routes added.
106
+ 3. Create/update `MODULE.md` in the module's source directory from `.agent/templates/MODULE.md`.
107
+
108
+ ### Step 8 — Commit + push
109
+
110
+ ```bash
111
+ git add .
112
+ git commit -m "feat(MODULE_<N>): <one-line description>"
113
+ git push origin HEAD
114
+ ```
115
+
116
+ If push fails, **STOP**.
117
+
118
+ ### Step 9 — Context-rot mitigation (Codex-specific)
119
+
120
+ Before moving to the next module:
121
+
122
+ - Discard any large intermediate artifacts from memory (review reports, security reports) — they're already saved as files if needed.
123
+ - Re-summarize for yourself in one short paragraph: "Module <N> done. Files: [count]. Next: Module <N+1> covers [one-line]."
124
+
125
+ This is the best Codex can do without true context isolation. It does not fully solve context rot but reduces it.
126
+
127
+ ### Step 10 — Next module
128
+
129
+ Return to Step 1.
130
+
131
+ ---
132
+
133
+ ## After all modules
134
+
135
+ Print final summary. Do not open a PR.
136
+
137
+ ---
138
+
139
+ ## Failure modes
140
+
141
+ Same STOP conditions as the other variants:
142
+ - Build/test fail after 2 fixer iterations
143
+ - Review or security verdict = `block`
144
+ - Security fixer build/test failure
145
+ - `git push` failure
146
+
147
+ Resume: re-run `/module-runner <feature-folder>`. Skip modules already marked completed in `core-memory.md`.
148
+
149
+ ---
150
+
151
+ ## Do not
152
+
153
+ - Skip build/test between phases
154
+ - Auto-retry beyond specified limits
155
+ - Squash commits
156
+ - Push to `main` / `master`
157
+ - Open a PR
158
+ - Bypass the review or security audit phases
159
+ - Continue past 10 modules without warning the user about context rot
@@ -0,0 +1,218 @@
1
+ ---
2
+ name: module-runner
3
+ description: Autonomous per-module executor for frontend features planned by `/architect` (which itself consumed `/ux-architect`'s UX plan). Sequentially runs each module's prompt through a subagent pipeline (build → test → lint → review → fix → security audit → fix → commit → push), keeping the main agent's context clean. Trigger with `/module-runner <feature-folder>`. Cursor variant — uses Cursor subagents (https://cursor.com/docs/subagents) to spawn independent-context delegates.
4
+ disable-model-invocation: false
5
+ ---
6
+
7
+ # Skill: module-runner (Cursor 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 Cursor subagent (fresh context per https://cursor.com/docs/subagents) and acts on the structured result.
10
+
11
+ The pipeline is identical to the Claude Code variant; only the sub-agent invocation syntax differs.
12
+
13
+ ---
14
+
15
+ ## Required Cursor subagents
16
+
17
+ This skill assumes the following Cursor subagents are configured (created during `npm exec nurosys-agent-setup`):
18
+
19
+ | Subagent name | Purpose | Maps to |
20
+ |---|---|---|
21
+ | `/implementer` | Implements a single module per its prompt file | Step 1 |
22
+ | `/code-reviewer` | Reviews a diff and returns findings JSON | Step 3 |
23
+ | `/code-fixer` | Applies code-review findings to the diff | Step 4 |
24
+ | `/security-auditor` | Audits a diff for security issues | Step 5 |
25
+ | `/security-fixer` | Applies CRITICAL/HIGH security findings | Step 6 |
26
+ | `/build-test-fixer` | Fixes build/test failures | Step 2 retry |
27
+
28
+ If any of these subagents are missing in the Cursor workspace, **STOP** at Phase 0 and tell the user:
29
+ > "This workspace is missing one or more required Cursor subagents: [list]. Run `npm exec nurosys-agent-setup` to install them."
30
+
31
+ These subagents are thin wrappers — each is a Cursor subagent that delegates to the same SKILL.md files used by Claude Code (`/code-reviewer`, `/security-assessment`, `/auth-and-permissions`). The subagent definition lives in `.cursor/subagents/<name>.md` (created by `setup.js`).
32
+
33
+ ---
34
+
35
+ ## Input
36
+
37
+ The user invokes:
38
+ ```
39
+ /module-runner <feature-folder>
40
+ ```
41
+
42
+ Where `<feature-folder>` is `documentation/features/<feature_name>/`, containing:
43
+ - `<feature>_MODULE_WISE_PLAN.md`
44
+ - `<feature>_MODULE_<N>_<MODULE_NAME>.md` per module
45
+
46
+ ---
47
+
48
+ ## Phase 0 — Validate input
49
+
50
+ Same as Claude Code variant:
51
+ 1. Folder exists, module files present, sorted by `<N>`
52
+ 2. `_MODULE_WISE_PLAN.md` exists
53
+ 3. On a non-`main` branch
54
+ 4. `project-memory/` intact
55
+ 5. All required Cursor subagents are configured (see table above)
56
+
57
+ Confirm with user before starting.
58
+
59
+ ---
60
+
61
+ ## Per-module pipeline
62
+
63
+ For each module file in order, run this pipeline. Each numbered step delegates to a Cursor subagent (independent context) **unless marked [Main]**.
64
+
65
+ ### Step 1 — Implement
66
+
67
+ Delegate to `/implementer`:
68
+
69
+ > /implementer module=<N> feature=<feature_name>
70
+ >
71
+ > Read the full spec from: `documentation/features/<feature_name>/<feature>_MODULE_<N>_<MODULE_NAME>.md`.
72
+ >
73
+ > If the prompt references sections of `documentation/features/<feature_name>/<feature>_UX_PLAN.md`, those are the visual/composition source of truth for any UI code you write.
74
+ >
75
+ > Execution rules:
76
+ > - No placeholder code. Implement every file in the New Files / Modified Files tables.
77
+ > - Honor constitution + design-system rules inlined in the prompt's §1.
78
+ > - Use the documented custom wrappers and form pattern — no raw MUI when a wrapper exists.
79
+ > - Honor `'use client'` decisions inlined in the prompt — don't add it to a server component unintentionally.
80
+ > - Honor the auth approach inlined in the prompt's §1.
81
+ > - Use Serena for symbol-level edits; raw write for new files.
82
+ > - When done, return JSON: `{ "files_changed": [...], "summary": "<one paragraph>", "blockers": [] }`.
83
+ > - Do NOT run tests, do NOT commit.
84
+
85
+ Wait for completion (foreground). If `blockers` is non-empty, **STOP** and surface to user.
86
+
87
+ ### Step 2 — Build + Test + Lint [Main]
88
+
89
+ ```bash
90
+ npm run build
91
+ npm test
92
+ npm run lint # if defined; otherwise skip
93
+ ```
94
+
95
+ If all pass → Step 3.
96
+
97
+ If either fails, delegate to `/build-test-fixer`:
98
+ > /build-test-fixer module=<N>
99
+ >
100
+ > Failure output below. The recently changed files are: [from Step 1's `files_changed`]. Fix the failures.
101
+ > Return `{ "fixed": true|false, "summary": "..." }`.
102
+
103
+ Re-run build/test. Max 2 fixer iterations. On 3rd failure, **STOP**.
104
+
105
+ ### Step 3 — Code review
106
+
107
+ Delegate to `/code-reviewer`:
108
+
109
+ > /code-reviewer mode=subagent scope=diff module=<N>
110
+ >
111
+ > Return findings JSON per the `/code-reviewer` SKILL.md sub-agent contract.
112
+
113
+ Parse the verdict:
114
+ - `clean` → Step 5
115
+ - `fix_required` → Step 4
116
+ - `block` → **STOP**
117
+
118
+ ### Step 4 — Code fixer
119
+
120
+ Delegate to `/code-fixer`:
121
+
122
+ > /code-fixer module=<N>
123
+ >
124
+ > Findings JSON: [paste from Step 3]
125
+ >
126
+ > Apply BLOCKER, HIGH, and required-MED findings. Skip LOW and optional. Use Serena symbolic edits where possible.
127
+ > Return `{ "fixed": [...], "skipped": [...], "summary": "..." }`.
128
+
129
+ Re-run build/test. If pass → Step 5. If fail → treat as Step 2 retry (max 2).
130
+
131
+ ### Step 5 — Security audit
132
+
133
+ Delegate to `/security-auditor`:
134
+
135
+ > /security-auditor mode=subagent scope=diff module=<N>
136
+ >
137
+ > Return findings JSON per `/security-assessment` SKILL.md sub-agent contract.
138
+
139
+ Parse the verdict:
140
+ - `clean` → Step 7
141
+ - `fix_required` → Step 6
142
+ - `block` → **STOP**
143
+
144
+ ### Step 6 — Security fixer
145
+
146
+ Delegate to `/security-fixer`:
147
+
148
+ > /security-fixer module=<N>
149
+ >
150
+ > Findings JSON: [paste from Step 5]
151
+ >
152
+ > Apply CRITICAL and HIGH. Skip MEDIUM/LOW unless tagged `must_fix`.
153
+ > Return `{ "fixed": [...], "skipped": [...], "summary": "..." }`.
154
+
155
+ Re-run build/test. If pass → Step 7. If fail → **STOP** (no auto-retry on security fixes).
156
+
157
+ ### Step 7 — Update project-memory [Main]
158
+
159
+ Same as Claude Code variant:
160
+ 1. Append "Module <N> completed" line to `project-memory/core-memory.md`
161
+ 2. Update `project-memory/repo-map.md` if new modules/routes added
162
+ 3. Create/update `MODULE.md` in the module's source directory
163
+
164
+ ### Step 8 — Commit + push [Main]
165
+
166
+ ```bash
167
+ git add .
168
+ git commit -m "feat(MODULE_<N>): <description>"
169
+ git push origin HEAD
170
+ ```
171
+
172
+ If push fails, **STOP**.
173
+
174
+ ### Step 9 — Next module [Main]
175
+
176
+ Print status, return to Step 1 for next module.
177
+
178
+ ---
179
+
180
+ ## After all modules
181
+
182
+ Print final summary (same format as Claude Code variant). Do not open a PR.
183
+
184
+ ---
185
+
186
+ ## Failure modes
187
+
188
+ Same as Claude Code variant — `STOP` on:
189
+ - Build/test failure after 2 fixer iterations
190
+ - Review or security verdict = `block`
191
+ - Security fixer build/test failure
192
+ - `git push` failure
193
+ - Implementation `blockers` non-empty
194
+ - Any subagent call errors out
195
+
196
+ Resume by re-running `/module-runner <feature-folder>` — runner skips modules already marked completed in `core-memory.md`.
197
+
198
+ ---
199
+
200
+ ## Cursor subagent invocation notes
201
+
202
+ - Subagents have **independent context windows** (per https://cursor.com/docs/subagents) — pass everything they need explicitly. No "remember from earlier".
203
+ - Use **foreground mode** for steps where the main agent needs the result to proceed (all steps in this pipeline). Background mode is not needed since the pipeline is strictly sequential.
204
+ - Subagents return their final message to the parent. Request JSON output in the prompt for programmatically-consumed steps (review, security, fixers).
205
+ - Parallelism is not used here — module-runner is sequential by design. (Cursor supports parallel subagent dispatch, but per-module steps depend on each other.)
206
+
207
+ ---
208
+
209
+ ## Do not
210
+
211
+ Same prohibitions as Claude Code variant:
212
+ - Don't implement/review/audit in the main agent
213
+ - Don't skip build/test verification
214
+ - Don't auto-retry beyond specified limits
215
+ - Don't squash commits
216
+ - Don't push to `main` / `master`
217
+ - Don't open a PR
218
+ - Don't update `core-memory.md` from inside subagents (Main only, Step 7)