tribunal-kit 1.0.0 → 2.4.2

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 (127) 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/github-operations/SKILL.md +354 -0
  55. package/.agent/skills/i18n-localization/SKILL.md +158 -96
  56. package/.agent/skills/intelligent-routing/SKILL.md +89 -285
  57. package/.agent/skills/intelligent-routing/router-manifest.md +65 -0
  58. package/.agent/skills/lint-and-validate/SKILL.md +229 -27
  59. package/.agent/skills/llm-engineering/SKILL.md +258 -0
  60. package/.agent/skills/local-first/SKILL.md +203 -0
  61. package/.agent/skills/mcp-builder/SKILL.md +159 -111
  62. package/.agent/skills/mobile-design/SKILL.md +102 -282
  63. package/.agent/skills/nextjs-react-expert/SKILL.md +143 -227
  64. package/.agent/skills/nodejs-best-practices/SKILL.md +201 -254
  65. package/.agent/skills/observability/SKILL.md +285 -0
  66. package/.agent/skills/parallel-agents/SKILL.md +124 -118
  67. package/.agent/skills/performance-profiling/SKILL.md +143 -89
  68. package/.agent/skills/plan-writing/SKILL.md +133 -97
  69. package/.agent/skills/platform-engineer/SKILL.md +135 -0
  70. package/.agent/skills/powershell-windows/SKILL.md +167 -104
  71. package/.agent/skills/python-patterns/SKILL.md +149 -361
  72. package/.agent/skills/python-pro/SKILL.md +114 -0
  73. package/.agent/skills/react-specialist/SKILL.md +107 -0
  74. package/.agent/skills/readme-builder/SKILL.md +270 -0
  75. package/.agent/skills/realtime-patterns/SKILL.md +296 -0
  76. package/.agent/skills/red-team-tactics/SKILL.md +136 -134
  77. package/.agent/skills/rust-pro/SKILL.md +237 -173
  78. package/.agent/skills/seo-fundamentals/SKILL.md +134 -82
  79. package/.agent/skills/server-management/SKILL.md +155 -104
  80. package/.agent/skills/sql-pro/SKILL.md +104 -0
  81. package/.agent/skills/systematic-debugging/SKILL.md +156 -79
  82. package/.agent/skills/tailwind-patterns/SKILL.md +163 -205
  83. package/.agent/skills/tdd-workflow/SKILL.md +148 -88
  84. package/.agent/skills/test-result-analyzer/SKILL.md +299 -0
  85. package/.agent/skills/testing-patterns/SKILL.md +141 -114
  86. package/.agent/skills/trend-researcher/SKILL.md +228 -0
  87. package/.agent/skills/ui-ux-pro-max/SKILL.md +107 -0
  88. package/.agent/skills/ui-ux-researcher/SKILL.md +234 -0
  89. package/.agent/skills/vue-expert/SKILL.md +118 -0
  90. package/.agent/skills/vulnerability-scanner/SKILL.md +228 -188
  91. package/.agent/skills/web-design-guidelines/SKILL.md +148 -33
  92. package/.agent/skills/webapp-testing/SKILL.md +171 -122
  93. package/.agent/skills/whimsy-injector/SKILL.md +349 -0
  94. package/.agent/skills/workflow-optimizer/SKILL.md +219 -0
  95. package/.agent/workflows/api-tester.md +279 -0
  96. package/.agent/workflows/audit.md +168 -0
  97. package/.agent/workflows/brainstorm.md +65 -19
  98. package/.agent/workflows/changelog.md +144 -0
  99. package/.agent/workflows/create.md +67 -14
  100. package/.agent/workflows/debug.md +122 -30
  101. package/.agent/workflows/deploy.md +82 -31
  102. package/.agent/workflows/enhance.md +59 -27
  103. package/.agent/workflows/fix.md +143 -0
  104. package/.agent/workflows/generate.md +84 -20
  105. package/.agent/workflows/migrate.md +163 -0
  106. package/.agent/workflows/orchestrate.md +66 -17
  107. package/.agent/workflows/performance-benchmarker.md +305 -0
  108. package/.agent/workflows/plan.md +76 -33
  109. package/.agent/workflows/preview.md +73 -17
  110. package/.agent/workflows/refactor.md +153 -0
  111. package/.agent/workflows/review-ai.md +140 -0
  112. package/.agent/workflows/review.md +83 -16
  113. package/.agent/workflows/session.md +154 -0
  114. package/.agent/workflows/status.md +74 -18
  115. package/.agent/workflows/strengthen-skills.md +99 -0
  116. package/.agent/workflows/swarm.md +194 -0
  117. package/.agent/workflows/test.md +80 -31
  118. package/.agent/workflows/tribunal-backend.md +55 -13
  119. package/.agent/workflows/tribunal-database.md +62 -18
  120. package/.agent/workflows/tribunal-frontend.md +58 -12
  121. package/.agent/workflows/tribunal-full.md +70 -11
  122. package/.agent/workflows/tribunal-mobile.md +123 -0
  123. package/.agent/workflows/tribunal-performance.md +152 -0
  124. package/.agent/workflows/ui-ux-pro-max.md +100 -82
  125. package/README.md +117 -62
  126. package/bin/tribunal-kit.js +542 -288
  127. package/package.json +10 -6
@@ -0,0 +1,154 @@
1
+ ---
2
+ description: Interactive session state tracking for multi-conversation context continuity.
3
+ ---
4
+
5
+ # /session — Interactive Session State Tracker
6
+
7
+ Use this workflow to maintain context and track overarching goals across multiple single-chat sessions. It acts as a logbook that survives conversation resets.
8
+
9
+ ---
10
+
11
+ ## When to Use This
12
+
13
+ - Starting a long multi-session task (spanning multiple conversations)
14
+ - Resuming work after a break — load the last checkpoint instantly
15
+ - Tracking parallel workstreams (tag different sessions)
16
+ - Exporting a summary of work for documentation or handoff
17
+
18
+ ---
19
+
20
+ ## Commands
21
+
22
+ ```bash
23
+ # ── Core commands ──────────────────────────────────────────────────
24
+
25
+ # Save a checkpoint of the current session
26
+ // turbo
27
+ python .agent/scripts/session_manager.py save "working on auth middleware"
28
+
29
+ # Load the current active session (note + tags)
30
+ // turbo
31
+ python .agent/scripts/session_manager.py load
32
+
33
+ # Compact status overview: active session + last 3 checkpoints
34
+ // turbo
35
+ python .agent/scripts/session_manager.py status
36
+
37
+ # View the last 10 session checkpoints
38
+ // turbo
39
+ python .agent/scripts/session_manager.py show
40
+
41
+ # ── Tagging and filtering ─────────────────────────────────────────
42
+
43
+ # Add a label/tag to the current session
44
+ python .agent/scripts/session_manager.py tag <label>
45
+ python .agent/scripts/session_manager.py tag v2-feature
46
+
47
+ # ── History and export ────────────────────────────────────────────
48
+
49
+ # Paginated list of ALL sessions (most recent first)
50
+ python .agent/scripts/session_manager.py list
51
+ python .agent/scripts/session_manager.py list --all # show entire history
52
+
53
+ # Export all sessions to session_export.md (or stdout)
54
+ python .agent/scripts/session_manager.py export
55
+ python .agent/scripts/session_manager.py export --stdout
56
+
57
+ # Clear the session data entirely to start fresh
58
+ python .agent/scripts/session_manager.py clear
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Command Reference
64
+
65
+ | Command | Description |
66
+ |---|---|
67
+ | `save <note>` | Save a new session checkpoint with a note |
68
+ | `load` | Display the current active session |
69
+ | `status` | Compact 3-session status summary + active session |
70
+ | `show` | Show the last 10 sessions |
71
+ | `tag <label>` | Add a tag to the current session (e.g., `v2-feature`, `auth-sprint`) |
72
+ | `list [--all]` | Paginated full session history |
73
+ | `export [--stdout]` | Export all history to `session_export.md` |
74
+ | `clear` | Delete the session state file entirely |
75
+
76
+ ---
77
+
78
+ ## How It Works
79
+
80
+ Session state is stored in `.agent_session.json` in the project root.
81
+
82
+ **Start of a new conversation:** run `status` immediately to re-establish situational awareness:
83
+
84
+ ```
85
+ python .agent/scripts/session_manager.py status
86
+ ```
87
+
88
+ **When reaching a natural waypoint** (completed a task, switching context): run `save` with a descriptive note so the next session starts with full context.
89
+
90
+ **Tags** group related sessions for filtering and export. Use them for features, sprints, or bugfix tracks.
91
+
92
+ ---
93
+
94
+ ## Workflow Patterns
95
+
96
+ **Starting a session:**
97
+ ```
98
+ User: /session save "Finished implementing JWT strategy. Next: user endpoints."
99
+ Agent: ✅ Session saved: Finished implementing JWT strategy...
100
+ Session: #5, tagged: auth-sprint
101
+ ```
102
+
103
+ **Resuming after a break:**
104
+ ```
105
+ User: /session status
106
+ Agent: ━━━ Session Status ━━━━━━━━━━━━━━━━━━━━━━━━
107
+ Total sessions: 5
108
+ Active: #5 — Finished implementing JWT strategy...
109
+
110
+ Last 3 sessions:
111
+ #5 2026-03-03T23:15 [auth-sprint] Finished JWT strategy...
112
+ #4 2026-03-03T21:00 [auth-sprint] Completed DB schema for auth...
113
+ #3 2026-03-03T18:30 [auth-sprint] Set up project structure...
114
+ ```
115
+
116
+ **Exporting for handoff or documentation:**
117
+ ```
118
+ User: /session export
119
+ Agent: ✅ Exported 5 sessions to session_export.md
120
+ ```
121
+
122
+ ---
123
+
124
+ ## Best Practices
125
+
126
+ | Practice | Why |
127
+ |---|---|
128
+ | Save at every natural stopping point | Next session starts with accurate context |
129
+ | Use descriptive notes with "Next:" | Gives future sessions a clear direction |
130
+ | Tag sessions by feature or sprint | Makes export and filtering useful |
131
+ | Run `status` at every session start | Reestablishes context without reading the full history |
132
+
133
+ ---
134
+
135
+ ## Cross-Workflow Navigation
136
+
137
+ | Use /session when... | Then go to... |
138
+ |---|---|
139
+ | Starting a multi-session task | `/plan` to write the formal plan for the work |
140
+ | Resuming work on a feature | Load session, then continue with relevant workflow |
141
+ | Work is complete, documenting it | `/changelog` to record what was built |
142
+
143
+ ---
144
+
145
+ ## Usage
146
+
147
+ ```
148
+ /session save "Finished JWT middleware. Next: protect API routes."
149
+ /session status
150
+ /session tag auth-sprint
151
+ /session list
152
+ /session export
153
+ /session load
154
+ ```
@@ -12,33 +12,64 @@ This command shows the current state of the active Tribunal session — what has
12
12
 
13
13
  ---
14
14
 
15
+ ## When to Use This
16
+
17
+ - After starting a multi-agent task to see which reviewers finished
18
+ - When a reviewer rejected code and you want details on the finding
19
+ - To check whether anything is currently at the Human Gate awaiting your decision
20
+ - To get a snapshot of the session before resuming after a break
21
+
22
+ ---
23
+
24
+ ## Sub-commands
25
+
26
+ ```
27
+ /status → Full session view (default)
28
+ /status issues → Show only REJECTED and WARNING verdicts
29
+ /status gate → Show what's currently at the Human Gate
30
+ /status agents → Show only the agent activity table
31
+ /status history → Show the last 5 completed tribunal sessions
32
+ ```
33
+
34
+ ---
35
+
15
36
  ## Session Dashboard
16
37
 
17
38
  ```
18
39
  ━━━ Tribunal Session ━━━━━━━━━━━━━━━━━━━━
19
40
 
20
- Mode: [Generate | Review | Plan | Audit]
41
+ Mode: [Generate | Review | Plan | Audit | Swarm]
21
42
  Request: [original prompt or task name]
43
+ Started: [timestamp]
22
44
 
23
45
  ━━━ Agent Activity ━━━━━━━━━━━━━━━━━━━━━
24
46
 
25
47
  logic-reviewer ✅ APPROVED
26
- security-auditor ❌ REJECTED — 1 issue
48
+ security-auditor ❌ REJECTED — 1 CRITICAL issue
27
49
  dependency-reviewer ✅ APPROVED
28
- type-safety-reviewer 🔄 Running
29
- performance-reviewer ⏸️ Queued
50
+ type-safety-reviewer ⚠️ WARNING — 1 MEDIUM issue
51
+ performance-reviewer 🔄 Running...
52
+ sql-reviewer ⏸️ Queued
30
53
 
31
54
  ━━━ Blocked Issues ━━━━━━━━━━━━━━━━━━━━━
32
55
 
33
- ❌ security-auditor flagged:
34
- File: src/routes/user.ts Line 34
35
- Type: SQL injection
36
- Fix: Replace string interpolation with parameterized query
56
+ ❌ security-auditor [CRITICAL] — src/routes/user.ts line 34
57
+ Type: SQL injection via string interpolation
58
+ Code: db.query(`WHERE id = ${id}`)
59
+ Fix: db.query('WHERE id = $1', [id])
60
+
61
+ ⚠️ type-safety-reviewer [MEDIUM] — src/auth/jwt.ts line 12
62
+ Type: Implicit any in parameter
63
+ Code: function decodeToken(payload) { ... }
64
+ Fix: function decodeToken(payload: JWTPayload) { ... }
37
65
 
38
66
  ━━━ Human Gate ━━━━━━━━━━━━━━━━━━━━━━━━
39
67
 
40
68
  Status: ⏸️ Awaiting your decision before any file is written.
41
69
 
70
+ Blocked on: security-auditor rejection (CRITICAL)
71
+ Action required: Fix the issue and resubmit, or discard.
72
+
42
73
  Options:
43
74
  ✅ Approve — write the approved changes to disk
44
75
  🔄 Revise — send back to the Maker with feedback
@@ -51,19 +82,44 @@ Request: [original prompt or task name]
51
82
 
52
83
  | Symbol | Meaning |
53
84
  |---|---|
54
- | | Agent complete — verdict returned |
55
- | 🔄 | Agent currently running |
56
- | ⏸️ | Queued waiting for a prior stage |
57
- | | Rejectedissue found, cannot proceed |
58
- | ⚠️ | Warningnon-blocking, review before approving |
85
+ | `✅ APPROVED` | Agent complete — no blocking issues |
86
+ | `🔄 Running` | Agent currently executing |
87
+ | `⏸️ Queued` | Waiting for a prior stage to complete |
88
+ | `❌ REJECTED` | Blocking finding code cannot proceed |
89
+ | `⚠️ WARNING` | Non-blocking finding — review before approving |
90
+ | `N/A` | Reviewer ran but this domain not present in code |
59
91
 
60
92
  ---
61
93
 
62
- ## Sub-commands
94
+ ## Retry Counter
95
+
96
+ The status view also shows how many revision attempts have been made:
63
97
 
64
98
  ```
65
- /status → Full session view
66
- /status issues → Show only REJECTED and WARNING verdicts
67
- /status gate → Show what's currently at the Human Gate awaiting approval
68
- /status agents → Show only the agent activity table
99
+ Maker revision: 2 of 3 (1 remaining before escalation)
100
+ ```
101
+
102
+ After 3 revisions without resolving a CRITICAL rejection, the session halts and reports to the user.
103
+
104
+ ---
105
+
106
+ ## Cross-Workflow Navigation
107
+
108
+ | If /status shows... | Go to |
109
+ |---|---|
110
+ | CRITICAL security rejection | `/review [file]` for focused audit |
111
+ | Multiple rejections across domains | `/tribunal-full` if it hasn't run yet |
112
+ | Session stalled at Human Gate | Review findings and decide: approve/revise/discard |
113
+ | Everything approved, ready to write | Confirm the Human Gate to write to disk |
114
+
115
+ ---
116
+
117
+ ## Usage
118
+
119
+ ```
120
+ /status
121
+ /status issues
122
+ /status gate
123
+ /status agents
124
+ /status history
69
125
  ```
@@ -0,0 +1,99 @@
1
+ ---
2
+ description: Strengthen skills by appending Tribunal guardrails (LLM Traps, Pre-Flight checklist, VBC Protocol) to any SKILL.md missing them.
3
+ ---
4
+
5
+ # /strengthen-skills Workflow
6
+
7
+ Use this command to audit and harden all skills in `.agent/skills/` that are missing
8
+ the standard Tribunal guardrails block.
9
+
10
+ ---
11
+
12
+ ## What It Does
13
+
14
+ Runs `strengthen_skills.py` against all skill files.
15
+ For each skill it checks:
16
+
17
+ 1. **Tribunal Integration section** — does it have `🏛️ Tribunal Integration`?
18
+ 2. **VBC Protocol** — does it have `Verification-Before-Completion`?
19
+
20
+ Skills missing either are strengthened by appending the full canonical block:
21
+ - `## 🤖 LLM-Specific Traps`
22
+ - `## 🏛️ Tribunal Integration (Anti-Hallucination)`
23
+ - Forbidden AI Tropes
24
+ - Pre-Flight Self-Audit checklist
25
+ - VBC Protocol
26
+
27
+ Skills that already have both sections are skipped automatically.
28
+
29
+ ---
30
+
31
+ ## Steps
32
+
33
+ ### Step 1 — Dry Run (Always First)
34
+
35
+ ```powershell
36
+ python .agent/scripts/strengthen_skills.py . --dry-run
37
+ ```
38
+
39
+ Review the output. All lines prefixed with `⚠️ [DRY RUN]` are skills that would be strengthened.
40
+
41
+ > **Human Gate:** If the dry-run output looks correct, continue to Step 2.
42
+ > If unexpected skills are listed, investigate before proceeding.
43
+
44
+ ---
45
+
46
+ ### Step 2 — Strengthen All Skills
47
+
48
+ ```powershell
49
+ python .agent/scripts/strengthen_skills.py .
50
+ ```
51
+
52
+ ---
53
+
54
+ ### Step 3 — Verify Summary
55
+
56
+ The script prints a final summary:
57
+ ```
58
+ ✅ Strengthened: N
59
+ ⏭️ Skipped: N
60
+ ❌ Errors: 0
61
+ ```
62
+
63
+ Errors must be zero before proceeding. If any errors appear, fix them and re-run.
64
+
65
+ ---
66
+
67
+ ### Step 4 — Strengthen a Single Skill (Optional)
68
+
69
+ To strengthen one specific skill only:
70
+
71
+ ```powershell
72
+ python .agent/scripts/strengthen_skills.py . --skill <skill-name>
73
+ ```
74
+
75
+ Example:
76
+ ```powershell
77
+ python .agent/scripts/strengthen_skills.py . --skill brainstorming
78
+ ```
79
+
80
+ ---
81
+
82
+ ### Step 5 — Custom Skills Directory (Optional)
83
+
84
+ If skills live in a non-standard location:
85
+
86
+ ```powershell
87
+ python .agent/scripts/strengthen_skills.py . --skills-path /path/to/skills
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Related Commands
93
+
94
+ | Command | Purpose |
95
+ |---|---|
96
+ | `/audit` | Full project health audit (includes skills review) |
97
+ | `python .agent/scripts/patch_skills_meta.py .` | Inject version/freshness metadata into frontmatter |
98
+ | `python .agent/scripts/patch_skills_output.py .` | Add Output Format sections to skills missing them |
99
+ | `python .agent/scripts/config_validator.py .` | Validate all agent config consistency |
@@ -0,0 +1,194 @@
1
+ ---
2
+ description: Multi-Agent Swarm Orchestration — Supervisor decomposes a goal into sub-tasks, dispatches to specialist Workers, collects results, and synthesizes a unified response.
3
+ ---
4
+
5
+ # /swarm — Multi-Agent Swarm Orchestration
6
+
7
+ $ARGUMENTS
8
+
9
+ ---
10
+
11
+ ## What This Does
12
+
13
+ `/swarm` is for goals that are **too large or multi-domain for a single agent**.
14
+
15
+ Instead of one agent trying to do everything (and hallucinating outside its expertise), the Supervisor:
16
+
17
+ 1. **Decomposes** your goal into independent sub-tasks
18
+ 2. **Dispatches** each sub-task to the best specialist Worker
19
+ 3. **Collects** all results
20
+ 4. **Synthesizes** a unified, coherent response
21
+
22
+ Use `/swarm` when your request spans **2+ domains** (e.g., backend API + database schema + docs) or when you want specialist-quality output for each component.
23
+
24
+ ---
25
+
26
+ ## When to Use /swarm vs Other Commands
27
+
28
+ | Use `/swarm` when... | Use something else when... |
29
+ |---|---|
30
+ | Goal spans 2+ specialist domains | Single-domain task → `/generate` |
31
+ | You want parallel specialist output | Simple question → just ask |
32
+ | Task needs backend + DB + docs together | Need a plan only → `/plan` |
33
+ | Complex refactor across multiple files | Debugging one bug → `/debug` |
34
+ | Maximum specialist coverage on large feature | Step-by-step incremental work → `/orchestrate` |
35
+
36
+ ---
37
+
38
+ ## Pipeline Flow
39
+
40
+ ```
41
+ /swarm [your goal]
42
+
43
+
44
+ supervisor-agent (triage)
45
+ → Reads: swarm-worker-registry.md
46
+ → Validates: swarm-worker-contracts.md
47
+ → Emits: WorkerRequest JSON (validated) for each sub-task
48
+
49
+ ├─── Worker 1: [agent-name] ──── WorkerResult 1
50
+ ├─── Worker 2: [agent-name] ──── WorkerResult 2
51
+ └─── Worker N: [agent-name] ──── WorkerResult N
52
+
53
+
54
+ supervisor-agent (synthesize)
55
+
56
+
57
+ ━━━ Swarm Complete ━━━
58
+ Human Gate → Y / N / R
59
+ ```
60
+
61
+ **Constraints:**
62
+ - Maximum **5 Workers** per swarm invocation
63
+ - Workers are **independent** — no Worker depends on another's pending result
64
+ - Workers that fail are **retried up to 3 times** with targeted feedback
65
+ - Workers that still fail after 3 retries are **escalated** (not silently dropped)
66
+ - Tribunal rules apply **inside each Worker** — no invented libraries, guessed columns, or uncited calls
67
+
68
+ ---
69
+
70
+ ## Step 1 — Supervisor Triage
71
+
72
+ The `supervisor-agent` reads the goal and produces a dispatch plan.
73
+
74
+ **Format:**
75
+
76
+ ```
77
+ ━━━ Swarm Triage ━━━━━━━━━━━━━━━━━━━━━━━━
78
+
79
+ Goal: [restate the user's goal in one sentence]
80
+
81
+ Workers to dispatch: [N of max 5]
82
+
83
+ Worker 1
84
+ task_id: [uuid]
85
+ type: [generate_code | research | review_code | write_docs | analyze]
86
+ agent: [agent-name from swarm-worker-registry.md]
87
+ goal: [single-sentence sub-task]
88
+ context: [minimal context — only what this worker needs]
89
+
90
+ Worker 2
91
+ ...
92
+
93
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
94
+ ```
95
+
96
+ > ⚠️ Workers that share no dependency can run in parallel. Workers that share output must be serialized.
97
+
98
+ ---
99
+
100
+ ## Step 2 — Worker Dispatch
101
+
102
+ Each Worker receives its `WorkerRequest` in **isolation** — no Worker sees another Worker's prompt.
103
+
104
+ Workers generate their output against the constraints of their specialist agent file (`.agent/agents/{agent}.md`).
105
+
106
+ **All Tribunal anti-hallucination rules apply inside each Worker:**
107
+ - No invented libraries or non-existent methods
108
+ - No guessed database column names
109
+ - `// VERIFY:` tags on any uncertain call
110
+ - Retry limit: 3 per Worker
111
+
112
+ Validate WorkerRequest JSON before dispatch:
113
+
114
+ ```bash
115
+ // turbo
116
+ python .agent/scripts/swarm_dispatcher.py --mode swarm --file worker_request.json
117
+ ```
118
+
119
+ A schema validation failure **halts the swarm** — it is not silently ignored.
120
+
121
+ ---
122
+
123
+ ## Step 3 — Collect and Validate
124
+
125
+ After all Workers return a `WorkerResult`:
126
+
127
+ | Status | Meaning | Action |
128
+ |---|---|---|
129
+ | `status: "success"` | Worker completed | Output included in synthesis |
130
+ | `status: "failure"` | Worker errored | Re-dispatch with failure context (up to 3 retries) |
131
+ | `status: "escalate"` | Worker hit retry limit | Noted as ⚠️ in report, not retried |
132
+
133
+ ---
134
+
135
+ ## Step 4 — Synthesis and Human Gate
136
+
137
+ ```
138
+ ━━━ Swarm Complete ━━━━━━━━━━━━━━━━━━━━━━━━
139
+
140
+ Workers dispatched: [N]
141
+ Workers succeeded: [N]
142
+ Workers escalated: [N]
143
+
144
+ ━━━ [Worker 1 goal] ━━━━━━━━━━━━━━━━━━━━━━
145
+
146
+ [Worker 1 output — reviewed by Tribunal]
147
+
148
+ ━━━ [Worker 2 goal] ━━━━━━━━━━━━━━━━━━━━━━
149
+
150
+ [Worker 2 output — reviewed by Tribunal]
151
+
152
+ ━━━ Escalations ━━━━━━━━━━━━━━━━━━━━━━━━━━
153
+
154
+ ⚠️ [task_id] — [agent] — [reason for escalation after 3 retries]
155
+
156
+ ━━━ Human Gate ━━━━━━━━━━━━━━━━━━━━━━━━━━━
157
+
158
+ Write to disk? Y = approve | N = discard | R = revise with feedback
159
+ ```
160
+
161
+ **Human Gate is never skipped.** No files are written without explicit approval.
162
+
163
+ ---
164
+
165
+ ## Hallucination Guard
166
+
167
+ - Supervisor only routes to agents listed in `swarm-worker-registry.md`
168
+ - Each Worker only uses tools, packages, and methods it has seen documented
169
+ - Every `WorkerRequest` is validated against `swarm-worker-contracts.md` before dispatch
170
+ - `swarm_dispatcher.py` exits `1` on any schema violation — swarm halted, not silently degraded
171
+ - Synthesis only combines verified Worker outputs — the Supervisor does not add new logic during synthesis
172
+
173
+ ---
174
+
175
+ ## Cross-Workflow Navigation
176
+
177
+ | After /swarm reveals... | Go to |
178
+ |---|---|
179
+ | Security issues in Worker output | `/tribunal-full` to re-audit the flagged code |
180
+ | Worker escalated after 3 retries | `/debug` to investigate what the worker failed on |
181
+ | Need a more sequential approach | `/orchestrate` for wave-based multi-agent execution |
182
+ | Want to verify final synthesized code | `/tribunal-full` before writing to disk |
183
+
184
+ ---
185
+
186
+ ## Usage Examples
187
+
188
+ ```
189
+ /swarm build a REST API with user auth, a PostgreSQL schema, and API documentation
190
+ /swarm analyze this repo, identify security vulnerabilities, and create a remediation plan
191
+ /swarm create a React dashboard component with a backend data endpoint and unit tests
192
+ /swarm refactor the payment module: review the code, optimize the SQL queries, and update the docs
193
+ /swarm generate a full feature: file upload API + storage service + frontend uploader + tests
194
+ ```