@northbridge-security/secureai 0.1.13

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/.claude/README.md +122 -0
  2. package/.claude/commands/architect/clean.md +978 -0
  3. package/.claude/commands/architect/kiss.md +762 -0
  4. package/.claude/commands/architect/review.md +704 -0
  5. package/.claude/commands/catchup.md +90 -0
  6. package/.claude/commands/code.md +115 -0
  7. package/.claude/commands/commit.md +1218 -0
  8. package/.claude/commands/cover.md +1298 -0
  9. package/.claude/commands/fmea.md +275 -0
  10. package/.claude/commands/kaizen.md +312 -0
  11. package/.claude/commands/pr.md +503 -0
  12. package/.claude/commands/todo.md +99 -0
  13. package/.claude/commands/worktree.md +738 -0
  14. package/.claude/commands/wrapup.md +103 -0
  15. package/LICENSE +183 -0
  16. package/README.md +108 -0
  17. package/dist/cli.js +75634 -0
  18. package/docs/agents/devops-reviewer.md +889 -0
  19. package/docs/agents/kiss-simplifier.md +1088 -0
  20. package/docs/agents/typescript.md +8 -0
  21. package/docs/guides/README.md +109 -0
  22. package/docs/guides/agents.clean.arch.md +244 -0
  23. package/docs/guides/agents.clean.arch.ts.md +1314 -0
  24. package/docs/guides/agents.gotask.md +1037 -0
  25. package/docs/guides/agents.markdown.md +1209 -0
  26. package/docs/guides/agents.onepassword.md +285 -0
  27. package/docs/guides/agents.sonar.md +857 -0
  28. package/docs/guides/agents.tdd.md +838 -0
  29. package/docs/guides/agents.tdd.ts.md +1062 -0
  30. package/docs/guides/agents.typesript.md +1389 -0
  31. package/docs/guides/github-mcp.md +1075 -0
  32. package/package.json +130 -0
  33. package/packages/secureai-cli/src/cli.ts +21 -0
  34. package/tasks/README.md +880 -0
  35. package/tasks/aws.yml +64 -0
  36. package/tasks/bash.yml +118 -0
  37. package/tasks/bun.yml +738 -0
  38. package/tasks/claude.yml +183 -0
  39. package/tasks/docker.yml +420 -0
  40. package/tasks/docs.yml +127 -0
  41. package/tasks/git.yml +1336 -0
  42. package/tasks/gotask.yml +132 -0
  43. package/tasks/json.yml +77 -0
  44. package/tasks/markdown.yml +95 -0
  45. package/tasks/onepassword.yml +350 -0
  46. package/tasks/security.yml +102 -0
  47. package/tasks/sonar.yml +437 -0
  48. package/tasks/template.yml +74 -0
  49. package/tasks/vscode.yml +103 -0
  50. package/tasks/yaml.yml +121 -0
@@ -0,0 +1,275 @@
1
+ ---
2
+ description: Generate FMEA report for workflow failures or tool issues
3
+ argument-hint: [failure description]
4
+ allowed-tools:
5
+ - Read
6
+ - Write
7
+ - Grep
8
+ - Glob
9
+ - AskUserQuestion
10
+ plan-mode: false
11
+ ---
12
+
13
+ # FMEA Report: $ARGUMENTS
14
+
15
+ Generate a Failure Mode and Effects Analysis report for workflow deviations, tool failures, or skill execution issues.
16
+
17
+ ## Context
18
+
19
+ The user has identified a problem with:
20
+
21
+ - An AI agent missing steps in a workflow
22
+ - A CLI tool, MCP server, or slash command failing
23
+ - A deviation from expected behavior
24
+
25
+ Your job: Analyze the conversation history and generate a structured FMEA report at `.tmp/fmea.md`.
26
+
27
+ ## Information Gathering
28
+
29
+ ### Step 1: Get Repository Context
30
+
31
+ ```bash
32
+ git remote get-url origin | sed 's/.*[:/]\([^/]*\/[^/]*\)\.git/\1/'
33
+ git branch --show-current
34
+ ```
35
+
36
+ Use these to populate the frontmatter `repository` and `branch` fields.
37
+
38
+ ### Step 2: Identify the Failure
39
+
40
+ From conversation history, determine:
41
+
42
+ 1. **What tool/workflow failed?** (CLI, MCP, slash command, agent behavior)
43
+ 2. **What was the expected behavior?**
44
+ 3. **What actually happened?**
45
+ 4. **At what point did the deviation occur?**
46
+
47
+ ### Step 3: Clarify if Needed
48
+
49
+ If the failure is unclear from context, ask the user:
50
+
51
+ ```
52
+ I see there was an issue with [tool/workflow]. To create an accurate FMEA report, I need to understand:
53
+
54
+ 1. What were you trying to accomplish?
55
+ 2. What step or command failed or was skipped?
56
+ 3. What did you observe that indicated something was wrong?
57
+ ```
58
+
59
+ Use AskUserQuestion for quick clarification if context is ambiguous.
60
+
61
+ ## FMEA Report Structure
62
+
63
+ Create `.tmp/fmea.md` with the following structure:
64
+
65
+ ````markdown
66
+ ---
67
+ title: [Brief Title]
68
+ date: [ISO date]
69
+ context: [Tool/workflow that failed]
70
+ repository: [owner/repo from git remote]
71
+ branch: [current branch name]
72
+ reporter: User via /fmea command
73
+ ---
74
+
75
+ # FMEA Report: [Brief Title]
76
+
77
+ ## 1. Failure Description
78
+
79
+ ### What Happened
80
+
81
+ [Chronological sequence of events, including:]
82
+
83
+ - Commands run and their outputs
84
+ - Decisions made by the agent
85
+ - Points where deviation occurred
86
+
87
+ ### Expected Behavior
88
+
89
+ [What should have happened according to documentation/workflow]
90
+
91
+ ### Commands Skipped or Misused
92
+
93
+ | Command | Purpose | What Happened |
94
+ | --------- | ---------------- | ---------------------- |
95
+ | `command` | Expected purpose | Skipped/failed/misused |
96
+
97
+ ---
98
+
99
+ ## 2. Effects Analysis
100
+
101
+ ### Severity Assessment
102
+
103
+ | Area | Effect | Severity (1-10) |
104
+ | ------ | ---------------------------- | --------------- |
105
+ | [area] | [what broke or was impacted] | [score] |
106
+
107
+ **Severity Scale:**
108
+
109
+ - 1-3: Minor inconvenience, easily recoverable
110
+ - 4-6: Moderate impact, requires manual intervention
111
+ - 7-9: Significant impact, data loss or major rework
112
+ - 10: Critical failure, security risk or unrecoverable
113
+
114
+ ### Downstream Impact
115
+
116
+ - [What this failure affects going forward]
117
+ - [What state is now inconsistent]
118
+ - [What user expectations were violated]
119
+
120
+ ---
121
+
122
+ ## 3. Root Cause Analysis
123
+
124
+ ### Contributing Factors
125
+
126
+ | Factor | Description | Likelihood (1-10) |
127
+ | -------------------------- | --------------- | ----------------- |
128
+ | **Ambiguous instructions** | [if applicable] | |
129
+ | **Missing enforcement** | [if applicable] | |
130
+ | **Tool error** | [if applicable] | |
131
+ | **Context loss** | [if applicable] | |
132
+
133
+ ### Detection Difficulty
134
+
135
+ How easy is it to detect this failure before impact?
136
+
137
+ | Detection Method | Effectiveness (1-10) |
138
+ | ---------------- | -------------------- |
139
+ | [method] | [score] |
140
+
141
+ **Detection Scale:**
142
+
143
+ - 1-3: Obvious failure, immediate feedback
144
+ - 4-6: Requires checking output or state
145
+ - 7-9: Subtle, only noticed by downstream effects
146
+ - 10: Undetectable until major impact
147
+
148
+ ---
149
+
150
+ ## 4. Risk Priority Number (RPN)
151
+
152
+ | Metric | Score | Rationale |
153
+ | ---------- | --------- | --------------------------------- |
154
+ | Severity | /10 | |
155
+ | Occurrence | /10 | How likely to happen again |
156
+ | Detection | /10 | How hard to detect |
157
+ | **RPN** | **/1000** | Severity × Occurrence × Detection |
158
+
159
+ **RPN Interpretation:**
160
+
161
+ - < 100: Low priority, monitor
162
+ - 100-300: Medium priority, improve when convenient
163
+ - 300-500: High priority, address soon
164
+ - > 500: Critical, address immediately
165
+
166
+ ---
167
+
168
+ ## 5. Recommended Actions
169
+
170
+ ### Immediate Recovery
171
+
172
+ [Steps to recover from this specific failure]
173
+
174
+ 1. [action]
175
+ 2. [action]
176
+
177
+ ### Preventive Improvements
178
+
179
+ #### For Documentation/Skills
180
+
181
+ ```markdown
182
+ [Specific text to add or change in the skill/documentation]
183
+ ```
184
+ ````
185
+
186
+ #### For Tooling
187
+
188
+ [Changes to CLI, MCP, or other tools that would prevent this]
189
+
190
+ #### For Workflow
191
+
192
+ [Process changes that would catch this earlier]
193
+
194
+ ### Verification
195
+
196
+ After implementing fixes, verify by:
197
+
198
+ - [ ] [Test case or scenario to validate]
199
+ - [ ] [Another verification step]
200
+
201
+ ---
202
+
203
+ ## Summary
204
+
205
+ | Question | Answer |
206
+ | ------------------- | ------ |
207
+ | What failed? | |
208
+ | Impact severity? | /10 |
209
+ | Root cause? | |
210
+ | RPN score? | /1000 |
211
+ | Top recommendation? | |
212
+
213
+ ```
214
+
215
+ ## Report Guidelines
216
+
217
+ ### Be Specific
218
+
219
+ - Quote actual commands and outputs
220
+ - Reference specific line numbers in documentation
221
+ - Include timestamps if relevant
222
+
223
+ ### Be Constructive
224
+
225
+ - Focus on systemic improvements, not blame
226
+ - Propose concrete changes with examples
227
+ - Consider multiple contributing factors
228
+
229
+ ### Be Actionable
230
+
231
+ - Recommendations should be implementable
232
+ - Include verification steps
233
+ - Prioritize by RPN score
234
+
235
+ ## After Creating Report
236
+
237
+ 1. Write the report to `.tmp/fmea.md`
238
+ 2. Summarize key findings for the user:
239
+
240
+ ```
241
+
242
+ FMEA Report created at .tmp/fmea.md
243
+
244
+ Summary:
245
+
246
+ - Failure: [brief description]
247
+ - RPN Score: [X]/1000 ([priority level])
248
+ - Top recommendation: [most impactful fix]
249
+
250
+ Would you like me to implement any of the recommended improvements?
251
+
252
+ ```
253
+
254
+ ## Common Failure Patterns
255
+
256
+ ### Workflow Deviation
257
+ - Agent skipped required CLI commands
258
+ - Used manual approach instead of automated tool
259
+ - Didn't verify state before proceeding
260
+
261
+ ### Tool Failure
262
+ - CLI command returned error
263
+ - MCP server not responding
264
+ - Permission denied
265
+
266
+ ### Context Loss
267
+ - Agent forgot earlier instructions
268
+ - Didn't read relevant documentation
269
+ - Missed skill instructions
270
+
271
+ ### Ambiguous Instructions
272
+ - Multiple valid interpretations
273
+ - Missing negative instructions (what NOT to do)
274
+ - Unclear gate requirements
275
+ ```
@@ -0,0 +1,312 @@
1
+ ---
2
+ description: Review FMEA report and implement continuous improvements
3
+ argument-hint: [--apply | --plan]
4
+ allowed-tools:
5
+ - Bash
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Glob
10
+ - Grep
11
+ - AskUserQuestion
12
+ - Skill
13
+ plan-mode: false
14
+ ---
15
+
16
+ # Kaizen: Continuous Improvement from FMEA
17
+
18
+ Review the FMEA report at `.tmp/fmea.md` and implement improvements through incremental fixes or structured planning.
19
+
20
+ ## Prerequisites
21
+
22
+ This command requires an FMEA report at `.tmp/fmea.md`. If missing:
23
+
24
+ ```
25
+ No FMEA report found at .tmp/fmea.md
26
+
27
+ Run /fmea first to document the failure, then return here to implement fixes.
28
+ ```
29
+
30
+ ## Phase 1: Review FMEA Report
31
+
32
+ ### 1.1 Load Report
33
+
34
+ ```bash
35
+ cat .tmp/fmea.md
36
+ ```
37
+
38
+ Parse the YAML frontmatter and extract:
39
+
40
+ - `title`: What failed
41
+ - `context`: Tool/workflow affected
42
+ - `repository` and `branch`: Where to apply fixes
43
+
44
+ ### 1.2 Extract Recommendations
45
+
46
+ From section "5. Recommended Actions", identify:
47
+
48
+ | Priority | Action | Complexity |
49
+ | -------- | ------------- | ------------------ |
50
+ | HIGH | [from report] | Small/Medium/Large |
51
+ | MEDIUM | [from report] | Small/Medium/Large |
52
+ | LOW | [from report] | Small/Medium/Large |
53
+
54
+ ### 1.3 Assess RPN Score
55
+
56
+ From section "4. Risk Priority Number":
57
+
58
+ - **RPN < 100**: Low priority - improvements optional
59
+ - **RPN 100-300**: Medium priority - address when convenient
60
+ - **RPN 300-500**: High priority - address soon
61
+ - **RPN > 500**: Critical - address immediately
62
+
63
+ ## Phase 2: Propose Technical Solutions
64
+
65
+ For each recommended action, propose a concrete technical solution:
66
+
67
+ ````markdown
68
+ ## Proposed Fixes
69
+
70
+ ### Fix 1: [Action from FMEA]
71
+
72
+ **Priority:** HIGH | **Complexity:** Small
73
+
74
+ **Files to modify:**
75
+
76
+ - `path/to/file.md` - Add gate requirements
77
+
78
+ **Changes:**
79
+
80
+ ```diff
81
+ + ### CRITICAL: Do Not Proceed Without These Steps
82
+ +
83
+ + **STOP** - You MUST run these commands...
84
+ ```
85
+ ````
86
+
87
+ **Estimated scope:** 1 file, ~20 lines
88
+
89
+ ```
90
+
91
+ ### Complexity Assessment
92
+
93
+ | Complexity | Criteria | Approach |
94
+ |------------|----------|----------|
95
+ | **Small** | Single file, <50 lines, no tests needed | Direct edit |
96
+ | **Medium** | 2-3 files, <200 lines, may need tests | Direct edit with verification |
97
+ | **Large** | 4+ files, >200 lines, requires tests | Use `/planner` workflow |
98
+
99
+ ## Phase 3: User Review
100
+
101
+ Present the proposed fixes and ask the user:
102
+
103
+ ```
104
+
105
+ Based on the FMEA report (RPN: [score]/1000), I've identified [N] improvements:
106
+
107
+ 1. [HIGH] Add gate requirements to /planner skill
108
+ Complexity: Small (1 file, ~30 lines)
109
+
110
+ 2. [HIGH] Add negative instructions section
111
+ Complexity: Small (1 file, ~15 lines)
112
+
113
+ 3. [MEDIUM] Add state verification steps
114
+ Complexity: Medium (1 file, ~25 lines)
115
+
116
+ How would you like to proceed?
117
+
118
+ ```
119
+
120
+ Use AskUserQuestion:
121
+
122
+ ```
123
+
124
+ question: "Which improvements should I implement?"
125
+ options:
126
+
127
+ - "All fixes now" - Implement all in order of priority
128
+ - "HIGH priority only" - Only critical fixes
129
+ - "Review each fix" - Step through one at a time
130
+ - "Create plan first" - Use /planner for structured approach
131
+
132
+ ````
133
+
134
+ ## Phase 4: Implementation
135
+
136
+ ### 4.1 Small/Medium Fixes (Direct Edit)
137
+
138
+ For each approved fix:
139
+
140
+ 1. Read the target file
141
+ 2. Apply the change using Edit tool
142
+ 3. Verify the change
143
+ 4. Report completion
144
+
145
+ ```markdown
146
+ ### Fix Applied: [Title]
147
+
148
+ **File:** `path/to/file.md`
149
+ **Lines changed:** 25-47
150
+ **Status:** Complete
151
+
152
+ Next fix: [Title] or "All fixes complete"
153
+ ````
154
+
155
+ ### 4.2 Large Fixes (Use Planner)
156
+
157
+ If any fix is Large complexity OR total changes exceed 200 lines:
158
+
159
+ ```
160
+ This improvement requires significant changes across multiple files.
161
+ Switching to /planner workflow for structured implementation.
162
+ ```
163
+
164
+ Invoke the planner skill:
165
+
166
+ ```
167
+ /planner .tmp/kaizen-prd.md
168
+ ```
169
+
170
+ Before invoking, create `.tmp/kaizen-prd.md`:
171
+
172
+ ```markdown
173
+ ---
174
+ version: 0.1.0
175
+ status: draft
176
+ created: [ISO timestamp]
177
+ ticket: KAIZEN-[date]
178
+ source: FMEA report
179
+ ---
180
+
181
+ # Kaizen Improvement: [Title from FMEA]
182
+
183
+ ## Problem Statement
184
+
185
+ [From FMEA section 1: Failure Description]
186
+
187
+ ## Root Cause
188
+
189
+ [From FMEA section 3: Root Cause Analysis]
190
+
191
+ ## Proposed Solution
192
+
193
+ [From Phase 2 technical solutions]
194
+
195
+ ## Acceptance Criteria
196
+
197
+ - [ ] [Verification item from FMEA]
198
+ - [ ] [Another verification item]
199
+ - [ ] RPN score reduced after implementation
200
+
201
+ ## Test Strategy
202
+
203
+ Verify by:
204
+
205
+ 1. [Test case from FMEA recommendations]
206
+ 2. Manual testing of affected workflow
207
+ ```
208
+
209
+ ## Phase 5: Verification
210
+
211
+ After all fixes are applied:
212
+
213
+ ### 5.1 Run Verification Steps
214
+
215
+ Execute any verification commands from the FMEA report:
216
+
217
+ ```bash
218
+ # Example: Test the fixed workflow
219
+ secureai plan status --json
220
+ ```
221
+
222
+ ### 5.2 Update FMEA Report
223
+
224
+ Add a resolution section to `.tmp/fmea.md`:
225
+
226
+ ```markdown
227
+ ---
228
+
229
+ ## 6. Resolution
230
+
231
+ **Date:** [ISO date]
232
+ **Applied by:** /kaizen command
233
+
234
+ ### Fixes Implemented
235
+
236
+ | Fix | Status | Commit |
237
+ | ------------------------- | -------- | ------ |
238
+ | Add gate requirements | Complete | [sha] |
239
+ | Add negative instructions | Complete | [sha] |
240
+
241
+ ### Post-Fix RPN Assessment
242
+
243
+ | Metric | Before | After | Rationale |
244
+ | ---------- | ------- | ------ | -------------------------------------------- |
245
+ | Severity | 6/10 | 6/10 | Unchanged - failure impact same if it occurs |
246
+ | Occurrence | 8/10 | 3/10 | Reduced - explicit gates prevent deviation |
247
+ | Detection | 6/10 | 2/10 | Reduced - state verification catches early |
248
+ | **RPN** | **288** | **36** | 87% reduction |
249
+
250
+ ### Verification Results
251
+
252
+ - [x] Ran /planner on test branch - followed correct workflow
253
+ - [x] TodoWrite not used during planning phase
254
+ - [x] secureai plan status shows correct state
255
+ ```
256
+
257
+ ### 5.3 Summary
258
+
259
+ ```
260
+ Kaizen Complete
261
+
262
+ FMEA: [Title]
263
+ Fixes applied: [N]
264
+ RPN reduction: [before] → [after] ([%] improvement)
265
+
266
+ Files modified:
267
+ - path/to/file1.md
268
+ - path/to/file2.md
269
+
270
+ Commit ready. Run `git status` to review changes.
271
+ ```
272
+
273
+ ## Error Handling
274
+
275
+ ### No FMEA Report
276
+
277
+ ```
278
+ No FMEA report found at .tmp/fmea.md
279
+
280
+ To create one:
281
+ 1. Run /fmea to document the failure
282
+ 2. Return here with /kaizen to implement fixes
283
+ ```
284
+
285
+ ### User Declines All Fixes
286
+
287
+ ```
288
+ No fixes selected. The FMEA report remains at .tmp/fmea.md for future reference.
289
+
290
+ You can return later with /kaizen to implement improvements.
291
+ ```
292
+
293
+ ### Fix Fails to Apply
294
+
295
+ ```
296
+ Failed to apply fix: [Title]
297
+
298
+ Error: [details]
299
+
300
+ Options:
301
+ 1. Skip this fix and continue
302
+ 2. Manually review and fix
303
+ 3. Abort kaizen process
304
+ ```
305
+
306
+ ## Quick Reference
307
+
308
+ | Argument | Effect |
309
+ | --------- | ----------------------------------------------- |
310
+ | (none) | Interactive mode - review and select fixes |
311
+ | `--apply` | Apply all HIGH priority fixes without prompting |
312
+ | `--plan` | Create PRD and use /planner for all fixes |