tribunal-kit 1.0.0 → 2.4.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 (125) hide show
  1. package/.agent/.shared/ui-ux-pro-max/README.md +3 -3
  2. package/.agent/ARCHITECTURE.md +205 -10
  3. package/.agent/GEMINI.md +37 -7
  4. package/.agent/agents/accessibility-reviewer.md +134 -0
  5. package/.agent/agents/ai-code-reviewer.md +129 -0
  6. package/.agent/agents/frontend-specialist.md +3 -0
  7. package/.agent/agents/game-developer.md +21 -21
  8. package/.agent/agents/logic-reviewer.md +12 -0
  9. package/.agent/agents/mobile-reviewer.md +79 -0
  10. package/.agent/agents/orchestrator.md +56 -26
  11. package/.agent/agents/performance-reviewer.md +36 -0
  12. package/.agent/agents/supervisor-agent.md +156 -0
  13. package/.agent/agents/swarm-worker-contracts.md +166 -0
  14. package/.agent/agents/swarm-worker-registry.md +92 -0
  15. package/.agent/rules/GEMINI.md +134 -5
  16. package/.agent/scripts/bundle_analyzer.py +259 -0
  17. package/.agent/scripts/dependency_analyzer.py +247 -0
  18. package/.agent/scripts/lint_runner.py +188 -0
  19. package/.agent/scripts/patch_skills_meta.py +177 -0
  20. package/.agent/scripts/patch_skills_output.py +285 -0
  21. package/.agent/scripts/schema_validator.py +279 -0
  22. package/.agent/scripts/security_scan.py +224 -0
  23. package/.agent/scripts/session_manager.py +144 -3
  24. package/.agent/scripts/skill_integrator.py +234 -0
  25. package/.agent/scripts/strengthen_skills.py +220 -0
  26. package/.agent/scripts/swarm_dispatcher.py +317 -0
  27. package/.agent/scripts/test_runner.py +192 -0
  28. package/.agent/scripts/test_swarm_dispatcher.py +163 -0
  29. package/.agent/skills/agent-organizer/SKILL.md +132 -0
  30. package/.agent/skills/agentic-patterns/SKILL.md +335 -0
  31. package/.agent/skills/api-patterns/SKILL.md +226 -50
  32. package/.agent/skills/app-builder/SKILL.md +215 -52
  33. package/.agent/skills/architecture/SKILL.md +176 -31
  34. package/.agent/skills/bash-linux/SKILL.md +150 -134
  35. package/.agent/skills/behavioral-modes/SKILL.md +152 -160
  36. package/.agent/skills/brainstorming/SKILL.md +148 -101
  37. package/.agent/skills/brainstorming/dynamic-questioning.md +10 -0
  38. package/.agent/skills/clean-code/SKILL.md +139 -134
  39. package/.agent/skills/code-review-checklist/SKILL.md +177 -80
  40. package/.agent/skills/config-validator/SKILL.md +165 -0
  41. package/.agent/skills/csharp-developer/SKILL.md +107 -0
  42. package/.agent/skills/database-design/SKILL.md +252 -29
  43. package/.agent/skills/deployment-procedures/SKILL.md +122 -175
  44. package/.agent/skills/devops-engineer/SKILL.md +134 -0
  45. package/.agent/skills/devops-incident-responder/SKILL.md +98 -0
  46. package/.agent/skills/documentation-templates/SKILL.md +175 -121
  47. package/.agent/skills/dotnet-core-expert/SKILL.md +103 -0
  48. package/.agent/skills/edge-computing/SKILL.md +213 -0
  49. package/.agent/skills/frontend-design/SKILL.md +76 -0
  50. package/.agent/skills/frontend-design/color-system.md +18 -0
  51. package/.agent/skills/frontend-design/typography-system.md +18 -0
  52. package/.agent/skills/game-development/SKILL.md +69 -0
  53. package/.agent/skills/geo-fundamentals/SKILL.md +158 -99
  54. package/.agent/skills/i18n-localization/SKILL.md +158 -96
  55. package/.agent/skills/intelligent-routing/SKILL.md +89 -285
  56. package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
  57. package/.agent/skills/lint-and-validate/SKILL.md +229 -27
  58. package/.agent/skills/llm-engineering/SKILL.md +258 -0
  59. package/.agent/skills/local-first/SKILL.md +203 -0
  60. package/.agent/skills/mcp-builder/SKILL.md +159 -111
  61. package/.agent/skills/mobile-design/SKILL.md +102 -282
  62. package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
  63. package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
  64. package/.agent/skills/observability/SKILL.md +285 -0
  65. package/.agent/skills/parallel-agents/SKILL.md +124 -118
  66. package/.agent/skills/performance-profiling/SKILL.md +143 -89
  67. package/.agent/skills/plan-writing/SKILL.md +133 -97
  68. package/.agent/skills/platform-engineer/SKILL.md +135 -0
  69. package/.agent/skills/powershell-windows/SKILL.md +167 -104
  70. package/.agent/skills/python-patterns/SKILL.md +149 -361
  71. package/.agent/skills/python-pro/SKILL.md +114 -0
  72. package/.agent/skills/react-specialist/SKILL.md +107 -0
  73. package/.agent/skills/realtime-patterns/SKILL.md +296 -0
  74. package/.agent/skills/red-team-tactics/SKILL.md +136 -134
  75. package/.agent/skills/rust-pro/SKILL.md +237 -173
  76. package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
  77. package/.agent/skills/server-management/SKILL.md +155 -104
  78. package/.agent/skills/sql-pro/SKILL.md +104 -0
  79. package/.agent/skills/systematic-debugging/SKILL.md +156 -79
  80. package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
  81. package/.agent/skills/tdd-workflow/SKILL.md +148 -88
  82. package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
  83. package/.agent/skills/testing-patterns/SKILL.md +141 -114
  84. package/.agent/skills/trend-researcher/SKILL.md +228 -0
  85. package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
  86. package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
  87. package/.agent/skills/vue-expert/SKILL.md +118 -0
  88. package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
  89. package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
  90. package/.agent/skills/webapp-testing/SKILL.md +171 -122
  91. package/.agent/skills/whimsy-injector/SKILL.md +349 -0
  92. package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
  93. package/.agent/workflows/api-tester.md +279 -0
  94. package/.agent/workflows/audit.md +168 -0
  95. package/.agent/workflows/brainstorm.md +65 -19
  96. package/.agent/workflows/changelog.md +144 -0
  97. package/.agent/workflows/create.md +67 -14
  98. package/.agent/workflows/debug.md +122 -30
  99. package/.agent/workflows/deploy.md +82 -31
  100. package/.agent/workflows/enhance.md +59 -27
  101. package/.agent/workflows/fix.md +143 -0
  102. package/.agent/workflows/generate.md +84 -20
  103. package/.agent/workflows/migrate.md +163 -0
  104. package/.agent/workflows/orchestrate.md +66 -17
  105. package/.agent/workflows/performance-benchmarker.md +305 -0
  106. package/.agent/workflows/plan.md +76 -33
  107. package/.agent/workflows/preview.md +73 -17
  108. package/.agent/workflows/refactor.md +153 -0
  109. package/.agent/workflows/review-ai.md +140 -0
  110. package/.agent/workflows/review.md +83 -16
  111. package/.agent/workflows/session.md +154 -0
  112. package/.agent/workflows/status.md +74 -18
  113. package/.agent/workflows/strengthen-skills.md +99 -0
  114. package/.agent/workflows/swarm.md +194 -0
  115. package/.agent/workflows/test.md +80 -31
  116. package/.agent/workflows/tribunal-backend.md +55 -13
  117. package/.agent/workflows/tribunal-database.md +62 -18
  118. package/.agent/workflows/tribunal-frontend.md +58 -12
  119. package/.agent/workflows/tribunal-full.md +70 -11
  120. package/.agent/workflows/tribunal-mobile.md +123 -0
  121. package/.agent/workflows/tribunal-performance.md +152 -0
  122. package/.agent/workflows/ui-ux-pro-max.md +100 -82
  123. package/README.md +117 -62
  124. package/bin/tribunal-kit.js +329 -75
  125. package/package.json +10 -6
@@ -0,0 +1,144 @@
1
+ ---
2
+ description: Auto-generate changelogs from git history. Categorizes changes by type and follows Keep a Changelog format.
3
+ ---
4
+
5
+ # /changelog — Generate Change History
6
+
7
+ $ARGUMENTS
8
+
9
+ ---
10
+
11
+ This command generates a structured changelog from git history. It reads real commits and categorizes them — it never invents changes that don't exist.
12
+
13
+ ---
14
+
15
+ ## When to Use This
16
+
17
+ - Before a release to document what changed
18
+ - When preparing release notes for stakeholders
19
+ - To create or update `CHANGELOG.md`
20
+ - To summarize work completed in a sprint or between two tags
21
+
22
+ ---
23
+
24
+ ## What Happens
25
+
26
+ ### Stage 1 — Determine Range
27
+
28
+ Default range: commits since the last tag. Override with:
29
+
30
+ ```bash
31
+ # Default: since last tag
32
+ // turbo
33
+ git log $(git describe --tags --abbrev=0)..HEAD --oneline --format="%h %ad %s" --date=short
34
+
35
+ # Last N commits
36
+ git log -n 20 --oneline --format="%h %ad %s" --date=short
37
+
38
+ # Between specific tags
39
+ git log v1.0.0..v2.0.0 --oneline --format="%h %ad %s" --date=short
40
+
41
+ # Since a date
42
+ git log --since="2025-01-01" --oneline --format="%h %ad %s" --date=short
43
+ ```
44
+
45
+ If no tags exist: default to last 20 commits and flag no tags found.
46
+
47
+ ### Stage 2 — Collect and Categorize
48
+
49
+ Read the git log and categorize each commit by prefix:
50
+
51
+ | Commit Prefix | Category | Icon |
52
+ |---|---|---|
53
+ | `feat:`, `feature:`, `add:` | Features | ✨ |
54
+ | `fix:`, `bugfix:`, `hotfix:` | Fixes | 🐛 |
55
+ | `refactor:`, `cleanup:` | Refactors | ♻️ |
56
+ | `docs:`, `doc:` | Documentation | 📝 |
57
+ | `test:`, `tests:` | Tests | ✅ |
58
+ | `chore:`, `build:`, `ci:` | Maintenance | 🔧 |
59
+ | `perf:`, `performance:` | Performance | ⚡ |
60
+ | `security:`, `sec:` | Security | 🔒 |
61
+ | `BREAKING:`, `breaking:`, `!` after scope | Breaking Changes | 💥 |
62
+ | (no recognized prefix) | Other | 📦 |
63
+
64
+ ### Stage 3 — Generate Output
65
+
66
+ Output follows [Keep a Changelog](https://keepachangelog.com/) format:
67
+
68
+ ```markdown
69
+ # Changelog
70
+
71
+ ## [Unreleased] — YYYY-MM-DD
72
+
73
+ ### 💥 Breaking Changes
74
+ - `abc1234` — Description of breaking change
75
+
76
+ ### ✨ Features
77
+ - `def5678` — Description of new feature
78
+
79
+ ### 🐛 Fixes
80
+ - `ghi9012` — Description of bug fix
81
+
82
+ ### ⚡ Performance
83
+ - `jkl3456` — Description of performance improvement
84
+
85
+ ### 🔒 Security
86
+ - `mno7890` — Description of security fix
87
+
88
+ ### ♻️ Refactors
89
+ - `pqr1234` — Description of refactor
90
+
91
+ ### 📝 Documentation
92
+ - `stu5678` — Description of docs change
93
+
94
+ ### 🔧 Maintenance
95
+ - `vwx9012` — Description of chore/dependency bump
96
+ ```
97
+
98
+ ### Stage 4 — Review and Save
99
+
100
+ Present the generated summary before writing:
101
+
102
+ ```
103
+ 📋 Generated changelog from [range]:
104
+ 💥 1 breaking change
105
+ ✨ 3 features
106
+ 🐛 5 fixes
107
+ 📦 2 uncategorized commits
108
+
109
+ Save to CHANGELOG.md? [Y = append | N = cancel | S = stdout only]
110
+ ```
111
+
112
+ > ⏸️ **Human Gate** — CHANGELOG.md is not written without confirmation.
113
+
114
+ ---
115
+
116
+ ## Hallucination Guard
117
+
118
+ - **Only include commits that actually exist** in git history — read from `git log`, never invent
119
+ - **Never summarize or paraphrase** ambiguous commit messages — include verbatim if unclear
120
+ - **Always show the commit hash** for traceability beside each entry
121
+ - **Never infer intent** from a commit message — report what was written, not what it "probably meant"
122
+ - Breaking changes need to be explicitly labeled in the commit — never infer breakage from code
123
+
124
+ ---
125
+
126
+ ## Cross-Workflow Navigation
127
+
128
+ | After /changelog reveals... | Go to |
129
+ |---|---|
130
+ | Many uncategorized commits | Enforce commit conventions in the team |
131
+ | Breaking changes need documentation | Update API docs or migration guides |
132
+ | Ready for release | `/deploy` to complete the release pipeline |
133
+
134
+ ---
135
+
136
+ ## Usage
137
+
138
+ ```
139
+ /changelog since the last release
140
+ /changelog for the last 50 commits
141
+ /changelog between v1.0 and v2.0
142
+ /changelog generate and save to CHANGELOG.md
143
+ /changelog sprint summary since 2025-03-01
144
+ ```
@@ -8,7 +8,18 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command starts a structured creation process. Code only appears after requirements are clear and a plan is approved.
11
+ This command starts a structured creation process. **Code only appears after requirements are clear and a plan is approved.** Building before understanding is the number one source of wasted work.
12
+
13
+ ---
14
+
15
+ ## When to Use /create vs Other Commands
16
+
17
+ | Use `/create` when... | Use something else when... |
18
+ |---|---|
19
+ | Starting something from scratch | Extending existing code → `/enhance` |
20
+ | Building a complete feature (frontend + backend + DB) | Single function needed → `/generate` |
21
+ | You need a plan before code | Plan only, no code → `/plan` |
22
+ | Multi-domain coordination required | Single domain → `/generate` with right tribunal |
12
23
 
13
24
  ---
14
25
 
@@ -25,7 +36,18 @@ Before any planning begins, these four things must be established:
25
36
  4. What's the observable done state? (how do we know it's finished?)
26
37
  ```
27
38
 
28
- If anything is unclear → ask. Do not skip to Stage 2 on assumptions.
39
+ **If anything is unclear → ask. Do not skip to Stage 2 on assumptions.**
40
+
41
+ Minimum Socratic gate questions by project type:
42
+
43
+ | Project type | Questions to ask before planning |
44
+ |---|---|
45
+ | API / backend | Auth strategy? Database? Error format? Rate limiting? |
46
+ | Frontend / UI | Framework? Design system? State management? SSR? |
47
+ | Full-stack | All of the above + deployment target |
48
+ | CLI tool | Target OS? Binary or script? Package manager integration? |
49
+
50
+ ---
29
51
 
30
52
  ### Stage 2 — Plan
31
53
 
@@ -36,36 +58,52 @@ Location: docs/PLAN-{task-slug}.md
36
58
 
37
59
  Must contain:
38
60
  - Goal (one sentence)
39
- - OOS list (what we won't build)
40
- - Task table with: task / agent / dependency / done-condition
61
+ - Out-of-scope list (what we won't build in this version)
62
+ - Open questions with [VERIFY] tags
63
+ - Task table: task / agent / dependency / done-condition
41
64
  - Tribunal gate per task
65
+ - Time estimates: optimistic / realistic / pessimistic + confidence level
42
66
  ```
43
67
 
44
68
  **The plan is shown to the user before any code is written.**
45
69
 
46
70
  > ⏸️ "Here's the plan: `docs/PLAN-{slug}.md` — proceed?"
47
- > Do not advance until explicitly confirmed.
71
+ > Do not advance until explicitly confirmed with **Y**.
72
+
73
+ ---
48
74
 
49
75
  ### Stage 3 — Build (Parallel agents, after approval)
50
76
 
51
- | Layer | Agent | Review Gate |
77
+ | Layer | Primary Agent | Review Gate |
52
78
  |---|---|---|
53
- | Data schema | `database-architect` | `/tribunal-database` |
54
- | API & server | `backend-specialist` | `/tribunal-backend` |
79
+ | Data schema / migrations | `database-architect` | `/tribunal-database` |
80
+ | API & server logic | `backend-specialist` | `/tribunal-backend` |
55
81
  | UI & components | `frontend-specialist` | `/tribunal-frontend` |
56
- | Test coverage | `test-engineer` | `logic + test-coverage` |
82
+ | Test coverage | `test-engineer` | `logic + test-coverage-reviewer` |
83
+ | DevOps / deploy config | `devops-engineer` | `/tribunal-backend` |
57
84
 
58
85
  Each agent's code goes through Tribunal before being shown to the user.
59
86
 
87
+ **Wave execution (if multiple layers):**
88
+
89
+ ```
90
+ Wave 1: database-architect → reviewed → Human Gate
91
+ Wave 2: backend-specialist (uses Wave 1 schema) → reviewed → Human Gate
92
+ Wave 3: frontend-specialist + test-engineer (parallel) → reviewed → Human Gate
93
+ ```
94
+
95
+ ---
96
+
60
97
  ### Stage 4 — Verify
61
98
 
62
99
  ```
63
- Did the code satisfy every done-condition from Stage 1? Y / N
64
- Did all Tribunal reviewers return APPROVED? Y / N
65
- Are untested paths labeled // TODO with an explanation? Y / N
100
+ Did the code satisfy every done-condition from Stage 1?
101
+ Did all Tribunal reviewers return APPROVED?
102
+ Are untested paths labeled // TODO with an explanation?
103
+ □ Does the plan file match what was actually built?
66
104
  ```
67
105
 
68
- All three must be Y before the task is declared done.
106
+ All four must be checked before the task is declared done.
69
107
 
70
108
  ---
71
109
 
@@ -73,7 +111,20 @@ All three must be Y before the task is declared done.
73
111
 
74
112
  - Every import must exist in the project's `package.json` or carry `// VERIFY: add to deps`
75
113
  - No invented framework methods — `// VERIFY: check docs for this method` on any uncertain call
76
- - No agent touches code outside its domain
114
+ - No agent touches code outside its domain (frontend agent never writes DB migrations)
115
+ - No full-application generation in one shot — build in layers with Human Gates between waves
116
+
117
+ ---
118
+
119
+ ## Cross-Workflow Navigation
120
+
121
+ | If during /create you need to... | Go to |
122
+ |---|---|
123
+ | Understand the existing codebase first | Use `explorer-agent` before Stage 2 |
124
+ | Only write the plan (not build it) | `/plan` |
125
+ | Add to an already built feature | `/enhance` |
126
+ | Debug something during Stage 3 | `/debug` |
127
+ | Run a full safety check before shipping | `/audit` |
77
128
 
78
129
  ---
79
130
 
@@ -83,4 +134,6 @@ All three must be Y before the task is declared done.
83
134
  /create a REST API with JWT auth
84
135
  /create a React dashboard with real-time chart updates
85
136
  /create a complete user onboarding flow (frontend + backend + DB)
137
+ /create a CLI tool that validates JSON schemas against a spec
138
+ /create a scheduled background job for sending email digests
86
139
  ```
@@ -1,5 +1,5 @@
1
1
  ---
2
- description: Debugging command. Activates DEBUG mode for systematic problem investigation.
2
+ description: Debugging command. Activates DEBUG mode for systematic problem investigation. No fix is suggested until the root cause is confirmed.
3
3
  ---
4
4
 
5
5
  # /debug — Root Cause Investigation
@@ -8,7 +8,7 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command switches the AI into **investigation mode**. No fixes are suggested until the root cause is identified. No random changes. No guessing.
11
+ This command switches the AI into **investigation mode**. No fixes are suggested until the root cause is identified and confirmed. No random changes. No guessing.
12
12
 
13
13
  ---
14
14
 
@@ -16,49 +16,126 @@ This command switches the AI into **investigation mode**. No fixes are suggested
16
16
 
17
17
  > "A fix without a root cause is a patch on a symptom. It will fail again."
18
18
 
19
- The `debugger` agent follows this sequence without skipping steps:
19
+ The `debugger` agent follows this sequence **without skipping steps**:
20
+
21
+ 1. Collect evidence
22
+ 2. Generate hypotheses
23
+ 3. Test hypotheses one at a time
24
+ 4. Identify root cause
25
+ 5. Apply targeted fix
26
+ 6. Verify the fix and prevent recurrence
27
+
28
+ ---
29
+
30
+ ## When to Use /debug vs Other Commands
31
+
32
+ | Use `/debug` when... | Use something else when... |
33
+ |---|---|
34
+ | There's a specific error or unexpected behavior | Code needs to be written from scratch → `/generate` |
35
+ | You have a stack trace or error message | Code quality needs improvement → `/refactor` |
36
+ | Production is broken right now | You want to add tests → `/test` |
37
+ | A bug reappears after being "fixed" | You want a full project health check → `/audit` |
38
+
39
+ ---
40
+
41
+ ## Step 1 — Evidence Collection
42
+
43
+ **Collect these before forming any hypothesis:**
44
+
45
+ ```
46
+ □ Exact error text — full stack trace, not a summary
47
+ □ Minimum reproduction steps — fewest actions that trigger the bug
48
+ □ Last known-good state — commit hash, date, or config snapshot
49
+ □ Recent changes — code, dependency updates, env vars, infra
50
+ □ Environment — local / staging / production, OS, Node version, etc.
51
+ □ Frequency — always / sometimes / only under load / only in prod
52
+ ```
53
+
54
+ > ⚠️ If the error is intermittent, collect timing data before hypothesizing.
55
+
56
+ ---
57
+
58
+ ## Step 2 — Hypothesis Generation
59
+
60
+ Map possible causes — label each honestly:
61
+
62
+ ```
63
+ Cause A: [what it is] — Likelihood: High / Medium / Low — Evidence: [what points to it]
64
+ Cause B: [what it is] — Likelihood: High / Medium / Low — Evidence: [what points to it]
65
+ Cause C: [what it is] — Likelihood: High / Medium / Low — Evidence: [what points to it]
66
+ ```
67
+
68
+ Every entry is labeled as a **hypothesis**, never as a confirmed fact.
69
+
70
+ **Hypothesis ranking rules:**
71
+ - High likelihood: directly supported by evidence or error message
72
+ - Medium likelihood: consistent with the error but no direct evidence
73
+ - Low likelihood: possible but requires unusual conditions
20
74
 
21
75
  ---
22
76
 
23
- ## Investigation Sequence
77
+ ## Step 3 — Single-Hypothesis Testing
24
78
 
25
- **Collect evidence first:**
26
- - Exact error text (full stack trace, not a summary)
27
- - Minimum reproduction steps
28
- - Last known-good state (commit, date, config)
29
- - Recent changes (code, dependency updates, env vars, infrastructure)
79
+ Test causes **one at a time**. Never test two simultaneously — it makes the result ambiguous.
30
80
 
31
- **Map possible causes — label them honestly:**
81
+ ```
82
+ H1 tested: [what was examined + how]
83
+ Result: ✅ Confirmed root cause | ❌ Ruled out — [reason]
32
84
 
85
+ H2 tested: [what was examined + how]
86
+ Result: ✅ Confirmed root cause | ❌ Ruled out — [reason]
33
87
  ```
34
- Cause A: [what it is] — Likelihood: High / Medium / Low
35
- Cause B: [what it is] Likelihood: High / Medium / Low
36
- Cause C: [what it is] — Likelihood: High / Medium / Low
88
+
89
+ Stop when the first hypothesis is confirmed. Do not continue testing eliminated causes.
90
+
91
+ ---
92
+
93
+ ## Step 4 — Root Cause Statement
94
+
95
+ The root cause is the **single thing** that, if changed, prevents the entire failure chain.
96
+
97
+ Format:
98
+
37
99
  ```
100
+ Root Cause: [One sentence — WHY this happened, not WHAT happened]
38
101
 
39
- Every entry labeled as a **hypothesis**, not a diagnosis.
102
+ Example:
103
+ ✅ "JWT verification was skipped when the Authorization header used 'bearer' (lowercase),
104
+ because the header check was case-sensitive."
40
105
 
41
- **Test causes one at a time:**
42
- Check one. Mark resolved or eliminated. Move to next. Never test two simultaneously.
106
+ "The login returned 401." (This is the symptom, not the cause)
107
+ ```
43
108
 
44
- **Find the root cause:**
45
- The thing that, if changed, prevents the entire failure chain. Fixing a symptom doesn't count.
109
+ ---
46
110
 
47
- **Apply a targeted fix + prevent recurrence:**
48
- One change. Then verify. Then add a regression test.
111
+ ## Step 5 Fix + Regression Prevention
112
+
113
+ ```
114
+ Targeted fix: One change — the minimum required to resolve the root cause
115
+ Regression test: A specific test added to catch this exact failure if it ever returns
116
+ Similar patterns: Any other locations in the codebase where this pattern exists
117
+ ```
118
+
119
+ > ⚠️ All debug logging added during investigation must be removed before the fix is presented.
49
120
 
50
121
  ---
51
122
 
52
- ## Report Format
123
+ ## Debug Report Format
53
124
 
54
125
  ```
55
126
  ━━━ Debug Report ━━━━━━━━━━━━━━━━━━━━━━━
56
127
 
57
128
  Symptom: [what the user sees]
58
129
  Error: [exact message or trace]
59
- Reproduced: [Yes | No | Sometimes]
130
+ Reproduced: Yes | No | Sometimes — [conditions]
131
+ Environment: [runtime, version, OS]
60
132
  Last working: [commit / date / known-good state]
61
133
 
134
+ ━━━ Evidence Collected ━━━━━━━━━━━━━━━━
135
+
136
+ - [specific observation 1]
137
+ - [specific observation 2]
138
+
62
139
  ━━━ Hypotheses ━━━━━━━━━━━━━━━━━━━━━━━
63
140
 
64
141
  H1 [High] — [cause and why it's likely]
@@ -72,33 +149,48 @@ H2: ruled out — [evidence against it]
72
149
 
73
150
  ━━━ Root Cause ━━━━━━━━━━━━━━━━━━━━━
74
151
 
75
- [Single sentence explaining WHY this happened]
152
+ [Single sentence WHY this happened]
76
153
 
77
154
  ━━━ Fix ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
78
155
 
79
156
  Before: [original code]
80
157
  After: [corrected code]
81
158
 
82
- Regression test: [what test was added to prevent this]
83
- Similar patterns: [anywhere else in the codebase this might exist]
159
+ Regression test: [what test prevents this from recurring]
160
+ Similar patterns: [any other locations to check in the codebase]
84
161
  ```
85
162
 
86
163
  ---
87
164
 
88
165
  ## Hallucination Guard
89
166
 
90
- - Every hypothesis is explicitly labeled as a hypothesis — never as confirmed fact
91
- - Proposed fixes only use real, documented APIs — `// VERIFY: check method exists` on uncertainty
92
- - One change per fix — multi-file rewrites presented as "a debug session" are a red flag
93
- - Debug logging added during investigation must be removed before the fix is presented
167
+ - Every hypothesis is **explicitly labeled as a hypothesis** — never as confirmed fact until evidence backs it
168
+ - Proposed fixes only use **real, documented APIs** — `// VERIFY: check method exists` on any uncertain call
169
+ - **One change per fix** — multi-file rewrites presented as "a debug session" are a red flag
170
+ - Debug logging added during investigation must be **removed** before the fix is presented
171
+ - **Never assume the error message is accurate** — verify it matches actual behavior
172
+
173
+ ---
174
+
175
+ ## Cross-Workflow Navigation
176
+
177
+ | After /debug reveals... | Go to |
178
+ |---|---|
179
+ | Root cause confirmed, fix ready | `/generate` to write the fix safely through Tribunal |
180
+ | Multiple files need changing | `/enhance` for impact-zone analysis + callers update |
181
+ | Missing test allowed the bug in | `/test` to add regression coverage |
182
+ | Performance was the root cause | `/tribunal-performance` for full optimization review |
183
+ | Security vulnerability found | `/audit` to check if it exists elsewhere |
94
184
 
95
185
  ---
96
186
 
97
187
  ## Usage
98
188
 
99
189
  ```
100
- /debug TypeError: Cannot read properties of undefined
190
+ /debug TypeError: Cannot read properties of undefined reading 'id'
101
191
  /debug API returns 500 only in production
102
192
  /debug useEffect runs on every render instead of once
103
193
  /debug login works locally but fails in CI
194
+ /debug memory usage grows unbounded over 24h in the worker process
195
+ /debug race condition in the payment confirmation handler
104
196
  ```
@@ -8,7 +8,7 @@ $ARGUMENTS
8
8
 
9
9
  ---
10
10
 
11
- This command runs a structured, gate-enforced deployment sequence. Nothing reaches production without passing all three gates.
11
+ This command runs a structured, gate-enforced deployment sequence. **Nothing reaches production without passing all three gates.**
12
12
 
13
13
  ---
14
14
 
@@ -19,6 +19,21 @@ This command runs a structured, gate-enforced deployment sequence. Nothing reach
19
19
 
20
20
  ---
21
21
 
22
+ ## Before Running /deploy
23
+
24
+ Confirm the following checklist manually:
25
+
26
+ ```
27
+ □ /audit passed with no CRITICAL or HIGH issues
28
+ □ All tests pass on the current commit
29
+ □ CHANGELOG.md is updated
30
+ □ Environment variables are confirmed in the target environment
31
+ □ Database migrations (if any) have a rollback plan
32
+ □ Rollback target (tag or SHA) is documented
33
+ ```
34
+
35
+ ---
36
+
22
37
  ## Three-Gate Sequence
23
38
 
24
39
  ### Gate 1 — Security Sweep
@@ -28,23 +43,34 @@ This command runs a structured, gate-enforced deployment sequence. Nothing reach
28
43
  ```
29
44
  Expected clean state:
30
45
  ✅ No secrets or credentials in any changed file
31
- ✅ No unparameterized query added
32
- ✅ No new CVE-affected dependency introduced
46
+ ✅ No unparameterized query introduced
47
+ ✅ No new CVE-affected dependency
33
48
  ✅ No debug endpoints left active
49
+ ✅ No `console.log` with sensitive data
50
+ ```
51
+
52
+ ```bash
53
+ // turbo
54
+ python .agent/scripts/security_scan.py .
34
55
  ```
35
56
 
36
- **If any Critical or High issue is found → deployment is blocked.**
37
- The issue must be fixed and re-scanned before proceeding.
57
+ **If any CRITICAL or HIGH issue → deployment is blocked.** Fix and re-scan before proceeding.
38
58
 
39
59
  ### Gate 2 — Tribunal Verification
40
60
 
41
- `/tribunal-full` runs on all changed code:
61
+ Run `/tribunal-full` on all changed code:
62
+
63
+ ```bash
64
+ # Run full check suite
65
+ // turbo
66
+ python .agent/scripts/verify_all.py
67
+ ```
42
68
 
43
69
  ```
44
- ✅ logic-reviewer: APPROVED
45
- ✅ security-auditor: APPROVED
46
- ✅ dependency-reviewer: APPROVED
47
- ✅ type-safety-reviewer: APPROVED
70
+ ✅ logic-reviewer: APPROVED
71
+ ✅ security-auditor: APPROVED
72
+ ✅ dependency-reviewer: APPROVED
73
+ ✅ type-safety-reviewer: APPROVED
48
74
  ```
49
75
 
50
76
  **Any REJECTED verdict → deployment blocked.** Fix and re-review.
@@ -54,43 +80,67 @@ The issue must be fixed and re-scanned before proceeding.
54
80
  A deployment summary is shown before execution:
55
81
 
56
82
  ```
57
- ━━━ Release Summary ━━━━━━━━━
83
+ ━━━ Release Summary ━━━━━━━━━━━━━━━━━━━━━━━━
58
84
  Target: [staging | production]
59
- Files changed: [N]
60
- Security gate: Passed
61
- Tribunal gate: ✅ All APPROVED
62
- Tests: N passed
63
-
64
- Rollback to: [previous tag / commit SHA]
65
- Rollback time: [estimate]
66
- DB-safe: [Yes | No — explain]
67
-
68
- Proceed with deployment? (Y to execute | N to cancel)
69
- ━━━━━━━━━━━━━━━━━━━━━━━━━━━━
85
+ Commit: [SHA — first 8 chars]
86
+ Files changed: [N] — view diff?
87
+ Security gate: ✅ Passed (no CRITICAL/HIGH issues)
88
+ Tribunal gate: All reviewers APPROVED
89
+ Tests: ✅ [N] passed, [0] failed
90
+
91
+ Rollback to: [previous tag or commit SHA]
92
+ Rollback time: [estimate in minutes]
93
+ DB migration: [None | ⚠️ IRREVERSIBLE | ✅ Reversible]
94
+ DB backup: [Confirmed | Not confirmed deployment blocked]
95
+
96
+ Proceed with deployment? Y = execute | N = cancel
97
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
70
98
  ```
71
99
 
72
100
  ---
73
101
 
74
102
  ## Rollback is a Prerequisite
75
103
 
76
- Before any deployment executes, the rollback plan must be established:
104
+ Before any deployment executes, a rollback plan must exist:
77
105
 
78
106
  ```
79
- What does this roll back to? → [tag or SHA]
80
- How long will rollback take? → [estimate]
81
- Is the DB migration reversible? → Yes | No
82
- Who gets notified on rollback? → [name or channel]
107
+ What does this roll back to? → [tag or SHA]
108
+ How long will rollback take? → [estimate]
109
+ Is the DB migration reversible? → Yes | No — if No, is backup confirmed?
110
+ Who gets notified on rollback? → [name or Slack channel]
83
111
  ```
84
112
 
85
- No rollback plan = no deployment.
113
+ **No rollback plan = no deployment.** This is not optional.
114
+
115
+ ---
116
+
117
+ ## Environment-Specific Rules
118
+
119
+ | Target | Extra Requirements |
120
+ |---|---|
121
+ | Staging | Rollback optional, tests required, git tag optional |
122
+ | Production | All requirements above + git tag required |
123
+ | Hotfix | Security gate required, Human Gate required |
86
124
 
87
125
  ---
88
126
 
89
127
  ## Hallucination Guard
90
128
 
91
- - No invented CLI flags — `# VERIFY: check docs for this flag` on any uncertain command
92
- - All secrets via environment variables — never hardcoded in deploy configs
93
- - All images tagged with a specific version — `latest` is forbidden in production configs
129
+ - **No invented CLI flags** — `# VERIFY: check docs for this flag` on any uncertain command
130
+ - **All secrets via environment variables** — never hardcoded in deploy configs or scripts
131
+ - **All images tagged with a specific version** — `latest` is forbidden in production configs
132
+ - **Never generate deployment steps without reading the existing deploy scripts** — read before writing
133
+
134
+ ---
135
+
136
+ ## Cross-Workflow Navigation
137
+
138
+ | Before /deploy... | Go to |
139
+ |---|---|
140
+ | Security audit not run yet | `/audit` first |
141
+ | Tests broken | `/debug` to fix, then `/test` to verify |
142
+ | Changelog outdated | `/changelog` to update first |
143
+ | DB migration needed | `/migrate` with rollback plan documented |
94
144
 
95
145
  ---
96
146
 
@@ -99,4 +149,5 @@ No rollback plan = no deployment.
99
149
  ```
100
150
  /deploy to staging
101
151
  /deploy to production after staging validation
152
+ /deploy hotfix for the auth regression
102
153
  ```