codingbuddy-rules 4.5.0 → 5.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 (129) hide show
  1. package/.ai-rules/adapters/aider.md +374 -0
  2. package/.ai-rules/adapters/antigravity.md +6 -6
  3. package/.ai-rules/adapters/claude-code.md +68 -4
  4. package/.ai-rules/adapters/codex.md +5 -5
  5. package/.ai-rules/adapters/cursor.md +2 -2
  6. package/.ai-rules/adapters/kiro.md +8 -8
  7. package/.ai-rules/adapters/opencode.md +7 -7
  8. package/.ai-rules/adapters/q.md +2 -2
  9. package/.ai-rules/adapters/windsurf.md +395 -0
  10. package/.ai-rules/agents/README.md +66 -16
  11. package/.ai-rules/agents/accessibility-specialist.json +8 -1
  12. package/.ai-rules/agents/act-mode.json +8 -1
  13. package/.ai-rules/agents/agent-architect.json +14 -7
  14. package/.ai-rules/agents/ai-ml-engineer.json +7 -0
  15. package/.ai-rules/agents/architecture-specialist.json +7 -0
  16. package/.ai-rules/agents/auto-mode.json +10 -2
  17. package/.ai-rules/agents/backend-developer.json +7 -0
  18. package/.ai-rules/agents/code-quality-specialist.json +7 -0
  19. package/.ai-rules/agents/code-reviewer.json +86 -64
  20. package/.ai-rules/agents/data-engineer.json +14 -7
  21. package/.ai-rules/agents/data-scientist.json +16 -9
  22. package/.ai-rules/agents/devops-engineer.json +7 -0
  23. package/.ai-rules/agents/documentation-specialist.json +7 -0
  24. package/.ai-rules/agents/eval-mode.json +30 -19
  25. package/.ai-rules/agents/event-architecture-specialist.json +7 -0
  26. package/.ai-rules/agents/frontend-developer.json +7 -0
  27. package/.ai-rules/agents/i18n-specialist.json +8 -1
  28. package/.ai-rules/agents/integration-specialist.json +7 -0
  29. package/.ai-rules/agents/migration-specialist.json +7 -0
  30. package/.ai-rules/agents/mobile-developer.json +8 -10
  31. package/.ai-rules/agents/observability-specialist.json +7 -0
  32. package/.ai-rules/agents/parallel-orchestrator.json +352 -0
  33. package/.ai-rules/agents/performance-specialist.json +7 -0
  34. package/.ai-rules/agents/plan-mode.json +9 -1
  35. package/.ai-rules/agents/plan-reviewer.json +211 -0
  36. package/.ai-rules/agents/platform-engineer.json +7 -0
  37. package/.ai-rules/agents/security-engineer.json +15 -8
  38. package/.ai-rules/agents/security-specialist.json +8 -1
  39. package/.ai-rules/agents/seo-specialist.json +7 -0
  40. package/.ai-rules/agents/software-engineer.json +7 -0
  41. package/.ai-rules/agents/solution-architect.json +17 -10
  42. package/.ai-rules/agents/systems-developer.json +15 -8
  43. package/.ai-rules/agents/technical-planner.json +17 -10
  44. package/.ai-rules/agents/test-engineer.json +13 -6
  45. package/.ai-rules/agents/test-strategy-specialist.json +7 -0
  46. package/.ai-rules/agents/tooling-engineer.json +10 -3
  47. package/.ai-rules/agents/ui-ux-designer.json +7 -0
  48. package/.ai-rules/keyword-modes.json +4 -4
  49. package/.ai-rules/rules/clarification-guide.md +14 -14
  50. package/.ai-rules/rules/core.md +73 -0
  51. package/.ai-rules/rules/parallel-execution.md +217 -0
  52. package/.ai-rules/schemas/agent.schema.json +38 -0
  53. package/.ai-rules/skills/README.md +29 -1
  54. package/.ai-rules/skills/agent-design/SKILL.md +5 -0
  55. package/.ai-rules/skills/agent-design/examples/agent-template.json +55 -0
  56. package/.ai-rules/skills/agent-design/references/expertise-guidelines.md +112 -0
  57. package/.ai-rules/skills/agent-discussion/SKILL.md +199 -0
  58. package/.ai-rules/skills/agent-discussion-panel/SKILL.md +448 -0
  59. package/.ai-rules/skills/api-design/SKILL.md +5 -0
  60. package/.ai-rules/skills/api-design/examples/error-response.json +159 -0
  61. package/.ai-rules/skills/api-design/examples/openapi-template.yaml +393 -0
  62. package/.ai-rules/skills/build-fix/SKILL.md +234 -0
  63. package/.ai-rules/skills/code-explanation/SKILL.md +4 -0
  64. package/.ai-rules/skills/context-management/SKILL.md +1 -0
  65. package/.ai-rules/skills/cost-budget/SKILL.md +348 -0
  66. package/.ai-rules/skills/cross-repo-issues/SKILL.md +257 -0
  67. package/.ai-rules/skills/database-migration/SKILL.md +1 -0
  68. package/.ai-rules/skills/deepsearch/SKILL.md +214 -0
  69. package/.ai-rules/skills/deployment-checklist/SKILL.md +1 -0
  70. package/.ai-rules/skills/error-analysis/SKILL.md +1 -0
  71. package/.ai-rules/skills/finishing-a-development-branch/SKILL.md +281 -0
  72. package/.ai-rules/skills/frontend-design/SKILL.md +5 -0
  73. package/.ai-rules/skills/frontend-design/examples/component-template.tsx +203 -0
  74. package/.ai-rules/skills/frontend-design/references/css-patterns.md +243 -0
  75. package/.ai-rules/skills/git-master/SKILL.md +358 -0
  76. package/.ai-rules/skills/incident-response/SKILL.md +1 -0
  77. package/.ai-rules/skills/legacy-modernization/SKILL.md +1 -0
  78. package/.ai-rules/skills/mcp-builder/SKILL.md +7 -0
  79. package/.ai-rules/skills/mcp-builder/examples/resource-example.ts +233 -0
  80. package/.ai-rules/skills/mcp-builder/examples/tool-example.ts +198 -0
  81. package/.ai-rules/skills/mcp-builder/references/protocol-spec.md +215 -0
  82. package/.ai-rules/skills/onboard/SKILL.md +150 -0
  83. package/.ai-rules/skills/performance-optimization/SKILL.md +3 -0
  84. package/.ai-rules/skills/plan-and-review/SKILL.md +115 -0
  85. package/.ai-rules/skills/plan-to-issues/SKILL.md +318 -0
  86. package/.ai-rules/skills/pr-all-in-one/SKILL.md +15 -13
  87. package/.ai-rules/skills/pr-all-in-one/configuration-guide.md +7 -7
  88. package/.ai-rules/skills/pr-all-in-one/pr-templates.md +10 -10
  89. package/.ai-rules/skills/pr-review/SKILL.md +4 -0
  90. package/.ai-rules/skills/receiving-code-review/SKILL.md +347 -0
  91. package/.ai-rules/skills/refactoring/SKILL.md +1 -0
  92. package/.ai-rules/skills/requesting-code-review/SKILL.md +348 -0
  93. package/.ai-rules/skills/retrospective/SKILL.md +192 -0
  94. package/.ai-rules/skills/rule-authoring/SKILL.md +5 -0
  95. package/.ai-rules/skills/rule-authoring/examples/rule-template.md +142 -0
  96. package/.ai-rules/skills/rule-authoring/examples/trigger-patterns.md +126 -0
  97. package/.ai-rules/skills/security-audit/SKILL.md +4 -0
  98. package/.ai-rules/skills/ship/SKILL.md +242 -0
  99. package/.ai-rules/skills/skill-creator/SKILL.md +461 -0
  100. package/.ai-rules/skills/skill-creator/agents/analyzer.md +206 -0
  101. package/.ai-rules/skills/skill-creator/agents/comparator.md +167 -0
  102. package/.ai-rules/skills/skill-creator/agents/grader.md +152 -0
  103. package/.ai-rules/skills/skill-creator/assets/eval_review.html +568 -0
  104. package/.ai-rules/skills/skill-creator/assets/skill-template.md +43 -0
  105. package/.ai-rules/skills/skill-creator/eval-viewer/generate_review.py +496 -0
  106. package/.ai-rules/skills/skill-creator/references/frontmatter-guide.md +632 -0
  107. package/.ai-rules/skills/skill-creator/references/multi-tool-compat.md +480 -0
  108. package/.ai-rules/skills/skill-creator/references/schemas.md +784 -0
  109. package/.ai-rules/skills/skill-creator/scripts/aggregate_benchmark.py +302 -0
  110. package/.ai-rules/skills/skill-creator/scripts/init_skill.sh +196 -0
  111. package/.ai-rules/skills/skill-creator/scripts/run_loop.py +327 -0
  112. package/.ai-rules/skills/systematic-debugging/SKILL.md +1 -0
  113. package/.ai-rules/skills/tech-debt/SKILL.md +1 -0
  114. package/.ai-rules/skills/test-coverage-gate/SKILL.md +303 -0
  115. package/.ai-rules/skills/tmux-master/SKILL.md +491 -0
  116. package/.ai-rules/skills/using-git-worktrees/SKILL.md +368 -0
  117. package/.ai-rules/skills/verification-before-completion/SKILL.md +234 -0
  118. package/.ai-rules/skills/widget-slot-architecture/SKILL.md +6 -0
  119. package/.ai-rules/skills/widget-slot-architecture/examples/parallel-route-setup.tsx +206 -0
  120. package/.ai-rules/skills/widget-slot-architecture/examples/widget-component.tsx +250 -0
  121. package/.ai-rules/skills/writing-plans/SKILL.md +78 -0
  122. package/bin/cli.js +170 -0
  123. package/lib/init/detect-stack.js +162 -0
  124. package/lib/init/generate-config.js +31 -0
  125. package/lib/init/index.js +86 -0
  126. package/lib/init/prompt.js +60 -0
  127. package/lib/init/scaffold.js +67 -0
  128. package/lib/init/suggest-agent.js +57 -0
  129. package/package.json +10 -2
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: agent-discussion
3
+ description: Use when rendering multi-agent debate, discussion, or review output in the terminal. Formats agent opinions with severity badges, colored identifiers, evidence blocks, and consensus indicators using box drawing characters.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Agent Discussion Formatter
8
+
9
+ ## Overview
10
+
11
+ When multiple specialist agents contribute opinions, findings, or recommendations, raw text output becomes unreadable. This skill defines a structured terminal format that makes agent debates scannable, severity-aware, and action-oriented.
12
+
13
+ **Core principle:** Every agent contribution must be visually distinct, severity-tagged, and traceable to evidence.
14
+
15
+ **Iron Law:**
16
+ ```
17
+ NEVER MIX AGENT OUTPUTS INTO UNSTRUCTURED PROSE — ALWAYS USE THE BOX FORMAT
18
+ ```
19
+
20
+ ## When to Use
21
+
22
+ - Rendering output from parallel specialist agents (security, accessibility, performance, etc.)
23
+ - Displaying code review findings from multiple reviewers
24
+ - Presenting debate/discussion between agents with differing opinions
25
+ - Summarizing consensus or disagreement across agent recommendations
26
+ - EVAL mode consolidated output
27
+
28
+ **Use this ESPECIALLY when:**
29
+ - 3+ agents contribute findings on the same topic
30
+ - Agents disagree and the user needs to see both sides
31
+ - Severity levels vary across findings
32
+
33
+ ## When NOT to Use
34
+
35
+ - Single agent output (no debate to format)
36
+ - Non-terminal output (HTML, JSON API responses)
37
+ - Log-style sequential output where ordering matters more than structure
38
+
39
+ ## Format Specification
40
+
41
+ ### Agent Contribution Block
42
+
43
+ Each agent's finding is rendered in a box with metadata:
44
+
45
+ ```
46
+ ┌─ {emoji} {agent-name} ─────────────────────────┐
47
+ │ {SEVERITY} [{LEVEL}]: {title} │
48
+ │ {description spanning multiple lines with │
49
+ │ proper indentation and wrapping} │
50
+ │ │
51
+ │ Evidence: {file:line — code or observation} │
52
+ │ Recommendation: {actionable next step} │
53
+ └──────────────────────────────────────────────────┘
54
+ ```
55
+
56
+ ### Agent Identifiers
57
+
58
+ Each agent type has a fixed emoji prefix for visual scanning:
59
+
60
+ | Agent | Emoji | Color Hint |
61
+ |-------|-------|------------|
62
+ | security-specialist | `🔒` | Red |
63
+ | accessibility-specialist | `♿` | Blue |
64
+ | performance-specialist | `⚡` | Yellow |
65
+ | code-quality-specialist | `📏` | Green |
66
+ | architecture-specialist | `🏛️` | Purple |
67
+ | test-strategy-specialist | `🧪` | Cyan |
68
+ | event-architecture-specialist | `📨` | Orange |
69
+ | integration-specialist | `🔗` | Teal |
70
+ | observability-specialist | `📊` | Gray |
71
+ | migration-specialist | `🔄` | Magenta |
72
+ | seo-specialist | `🔍` | Lime |
73
+ | ui-ux-design-specialist | `🎨` | Pink |
74
+ | documentation-specialist | `📝` | White |
75
+ | code-reviewer | `👀` | Indigo |
76
+
77
+ ### Severity Badges
78
+
79
+ Severity levels with visual indicators:
80
+
81
+ | Level | Badge | Meaning |
82
+ |-------|-------|---------|
83
+ | CRITICAL | `🔴 CRITICAL` | Must fix before merge — security vulnerability, data loss risk |
84
+ | HIGH | `🟠 HIGH` | Should fix before merge — significant quality or correctness issue |
85
+ | MEDIUM | `🟡 MEDIUM` | Should fix soon — maintainability, performance, or minor risk |
86
+ | LOW | `🟢 LOW` | Nice to have — style, optimization, minor improvement |
87
+ | INFO | `ℹ️ INFO` | Observation — no action required, context for the team |
88
+
89
+ ### Example: Single Finding
90
+
91
+ ```
92
+ ┌─ 🔒 security-specialist ──────────────────────────┐
93
+ │ 🟠 HIGH: SQL injection risk in user input handling │
94
+ │ │
95
+ │ Raw string concatenation used to build SQL query │
96
+ │ without parameterization. User-controlled input │
97
+ │ flows directly into the query string. │
98
+ │ │
99
+ │ Evidence: api/users.ts:42 │
100
+ │ const q = `SELECT * FROM users WHERE id=${input}` │
101
+ │ Recommendation: Use parameterized queries │
102
+ │ const q = `SELECT * FROM users WHERE id=$1` │
103
+ └─────────────────────────────────────────────────────┘
104
+ ```
105
+
106
+ ### Example: Multiple Agents on Same Topic
107
+
108
+ ```
109
+ ┌─ 🔒 security-specialist ──────────────────────────┐
110
+ │ 🔴 CRITICAL: Unauthenticated endpoint exposed │
111
+ │ │
112
+ │ The /api/admin/users endpoint has no auth guard. │
113
+ │ Any client can list all user records including PII. │
114
+ │ │
115
+ │ Evidence: api/admin/users.ts:12 — no @UseGuards() │
116
+ │ Recommendation: Add AuthGuard and RolesGuard │
117
+ └─────────────────────────────────────────────────────┘
118
+
119
+ ┌─ 📏 code-quality-specialist ───────────────────────┐
120
+ │ 🟡 MEDIUM: Missing input validation │
121
+ │ │
122
+ │ Query parameters parsed without validation. │
123
+ │ Unexpected types could cause runtime errors. │
124
+ │ │
125
+ │ Evidence: api/admin/users.ts:18 — raw req.query │
126
+ │ Recommendation: Add Zod/class-validator schema │
127
+ └─────────────────────────────────────────────────────┘
128
+ ```
129
+
130
+ ## Consensus & Disagreement
131
+
132
+ ### Consensus Indicator
133
+
134
+ When agents agree, show a consensus block:
135
+
136
+ ```
137
+ ╔══════════════════════════════════════════════════════╗
138
+ ║ ✅ CONSENSUS (3/3 agents agree) ║
139
+ ║ ║
140
+ ║ Auth guard must be added to /api/admin/* endpoints. ║
141
+ ║ Agents: 🔒 security, 📏 code-quality, 🏛️ architecture ║
142
+ ╠══════════════════════════════════════════════════════╣
143
+ ║ Priority: CRITICAL — unanimously recommended ║
144
+ ╚══════════════════════════════════════════════════════╝
145
+ ```
146
+
147
+ ### Disagreement Indicator
148
+
149
+ When agents disagree, show the split:
150
+
151
+ ```
152
+ ╔══════════════════════════════════════════════════════╗
153
+ ║ ⚖️ SPLIT OPINION (2 vs 1) ║
154
+ ║ ║
155
+ ║ Topic: Should we add request-level caching? ║
156
+ ║ ║
157
+ ║ FOR (2): ║
158
+ ║ ⚡ performance — reduces DB load by ~40% ║
159
+ ║ 🏛️ architecture — fits existing cache layer ║
160
+ ║ ║
161
+ ║ AGAINST (1): ║
162
+ ║ 🔒 security — cache invalidation risks stale ║
163
+ ║ auth state for permission changes ║
164
+ ║ ║
165
+ ║ Recommendation: Proceed with cache, add TTL < 60s ║
166
+ ╚══════════════════════════════════════════════════════╝
167
+ ```
168
+
169
+ ## Summary Block
170
+
171
+ At the end of a multi-agent discussion, render a summary:
172
+
173
+ ```
174
+ ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
175
+ ┃ 📋 DISCUSSION SUMMARY ┃
176
+ ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫
177
+ ┃ Agents: 4 participated ┃
178
+ ┃ Findings: 7 total ┃
179
+ ┃ 🔴 CRITICAL: 1 ┃
180
+ ┃ 🟠 HIGH: 2 ┃
181
+ ┃ 🟡 MEDIUM: 3 ┃
182
+ ┃ 🟢 LOW: 1 ┃
183
+ ┃ Consensus: 2 items agreed ┃
184
+ ┃ Disputes: 1 split opinion ┃
185
+ ┃ ┃
186
+ ┃ Action required: Fix 1 CRITICAL + 2 HIGH before ┃
187
+ ┃ merge. Review 1 split opinion with team. ┃
188
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
189
+ ```
190
+
191
+ ## Rendering Rules
192
+
193
+ 1. **Box width** — Adapt to terminal width, minimum 50 characters
194
+ 2. **Text wrapping** — Wrap long lines inside box boundaries with proper indentation
195
+ 3. **Ordering** — Sort findings by severity: CRITICAL > HIGH > MEDIUM > LOW > INFO
196
+ 4. **Grouping** — Group by topic when multiple agents comment on the same code location
197
+ 5. **Deduplication** — If two agents report the same issue, merge into one block with both agent names
198
+ 6. **Evidence format** — Always include `file:line` reference when available
199
+ 7. **Spacing** — One blank line between agent blocks, two blank lines before consensus/summary blocks
@@ -0,0 +1,448 @@
1
+ ---
2
+ name: agent-discussion-panel
3
+ description: Use when rendering a multi-agent discussion as a TUI panel. Defines terminal panel layout, component architecture, real-time streaming behavior, and integration points for displaying AgentOpinion data with bordered boxes, severity badges, and consensus indicators.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Agent Discussion Panel (TUI)
8
+
9
+ ## Overview
10
+
11
+ The Agent Discussion Panel is a terminal UI component that renders multi-agent debates as a structured, scrollable panel. It consumes `DiscussionResult` data (from the AgentOpinion protocol) and renders it using the box-drawing format defined by the `agent-discussion` formatter skill.
12
+
13
+ **Core principle:** The panel is a _layout container_, not a formatter. It delegates all opinion rendering to the `agent-discussion` formatter and focuses on panel chrome, streaming lifecycle, and spatial arrangement.
14
+
15
+ **Iron Law:**
16
+ ```
17
+ THE PANEL NEVER FORMATS OPINIONS — IT ARRANGES THEM
18
+ Formatting = agent-discussion skill. Layout = this skill.
19
+ ```
20
+
21
+ ## Relationship to Other Components
22
+
23
+ ```
24
+ ┌─────────────────────────────────────────────────┐
25
+ │ AgentOpinion Protocol (discussion.types.ts) │
26
+ │ Defines: AgentOpinion, DiscussionResult │
27
+ └──────────────────┬──────────────────────────────┘
28
+ │ data
29
+
30
+ ┌─────────────────────────────────────────────────┐
31
+ │ agent-discussion (formatter skill) │
32
+ │ Renders: box chars, severity badges, consensus │
33
+ └──────────────────┬──────────────────────────────┘
34
+ │ formatted blocks
35
+
36
+ ┌─────────────────────────────────────────────────┐
37
+ │ agent-discussion-panel (THIS skill — TUI layout) │
38
+ │ Arranges: header, stream, consensus, summary │
39
+ └─────────────────────────────────────────────────┘
40
+ ```
41
+
42
+ ## When to Use
43
+
44
+ - Building a TUI that displays multi-agent discussion output
45
+ - Implementing a codingbuddy terminal dashboard with agent debate panels
46
+ - Rendering streaming agent opinions in real time within a bounded panel region
47
+ - Displaying EVAL mode consolidated output in a structured panel
48
+
49
+ ## When NOT to Use
50
+
51
+ - Formatting individual agent opinions (use `agent-discussion` formatter)
52
+ - Building web/HTML UIs (this is terminal-only)
53
+ - Rendering a single agent's output (no panel needed)
54
+ - Logging or piping output to files (panel chrome adds noise)
55
+
56
+ ## Data Model Binding
57
+
58
+ The panel binds directly to the AgentOpinion protocol types:
59
+
60
+ ```typescript
61
+ // Input: DiscussionResult from discussion.types.ts
62
+ interface DiscussionResult {
63
+ topic: string; // → Panel header title
64
+ specialists: string[]; // → Header participant count
65
+ opinions: AgentOpinion[]; // → Opinion stream (main content)
66
+ consensus: ConsensusStatus; // → Consensus bar
67
+ summary: string; // → Summary footer
68
+ maxSeverity: OpinionSeverity; // → Header severity indicator
69
+ }
70
+
71
+ // Each opinion maps to a formatter block
72
+ interface AgentOpinion {
73
+ agent: string; // → Box title (with emoji prefix)
74
+ opinion: string; // → Box body text
75
+ severity: OpinionSeverity; // → Severity badge
76
+ evidence: string[]; // → Evidence lines in box
77
+ recommendation: string; // → Recommendation line in box
78
+ }
79
+ ```
80
+
81
+ ## Panel Architecture
82
+
83
+ ### Full Panel Layout
84
+
85
+ ```
86
+ ╔══════════════════════════════════════════════════════╗
87
+ ║ 🗣️ AGENT DISCUSSION: {topic} ║
88
+ ║ {specialist_count} agents | Max severity: {badge} ║
89
+ ╠══════════════════════════════════════════════════════╣
90
+ ║ ║
91
+ ║ ┌─ 🔒 security-specialist ────────────────────────┐ ║
92
+ ║ │ 🔴 CRITICAL: {title} │ ║
93
+ ║ │ {description} │ ║
94
+ ║ │ Evidence: {file:line} │ ║
95
+ ║ │ Recommendation: {action} │ ║
96
+ ║ └──────────────────────────────────────────────────┘ ║
97
+ ║ ║
98
+ ║ ┌─ ⚡ performance-specialist ─────────────────────┐ ║
99
+ ║ │ 🟡 MEDIUM: {title} │ ║
100
+ ║ │ {description} │ ║
101
+ ║ │ Evidence: {file:line} │ ║
102
+ ║ │ Recommendation: {action} │ ║
103
+ ║ └──────────────────────────────────────────────────┘ ║
104
+ ║ ║
105
+ ║ ┌─ 📏 code-quality-specialist ────────────────────┐ ║
106
+ ║ │ 🟢 LOW: {title} │ ║
107
+ ║ │ {description} │ ║
108
+ ║ │ Evidence: {file:line} │ ║
109
+ ║ │ Recommendation: {action} │ ║
110
+ ║ └──────────────────────────────────────────────────┘ ║
111
+ ║ ║
112
+ ╠══════════════════════════════════════════════════════╣
113
+ ║ ✅ CONSENSUS (3/3 agents agree) ║
114
+ ║ Auth guard must be added to /api/admin/* endpoints. ║
115
+ ║ Priority: CRITICAL — unanimously recommended ║
116
+ ╠══════════════════════════════════════════════════════╣
117
+ ║ 📋 SUMMARY | Findings: 3 | 🔴1 🟡1 🟢1 ║
118
+ ║ Action: Fix 1 CRITICAL before merge ║
119
+ ╚══════════════════════════════════════════════════════╝
120
+ ```
121
+
122
+ ### Component Breakdown
123
+
124
+ The panel consists of four vertical sections:
125
+
126
+ | Section | Box Style | Source | Content |
127
+ |---------|-----------|--------|---------|
128
+ | **Header** | `╔═╗║╚═╝` (double-line) | `DiscussionResult.topic`, `.specialists`, `.maxSeverity` | Title, participant count, max severity badge |
129
+ | **Opinion Stream** | `┌─┐│└─┘` (single-line, per opinion) | `DiscussionResult.opinions[]` | Agent opinion blocks (delegated to formatter) |
130
+ | **Consensus Bar** | `╔═╗║╚═╝` (double-line) | `DiscussionResult.consensus`, inferred from opinions | Consensus/split/disagreement indicator |
131
+ | **Summary Footer** | `╠═╣` separator + `╚═╝` close | `DiscussionResult.summary`, severity counts | Compact stats and action items |
132
+
133
+ ## Component Specifications
134
+
135
+ ### 1. Panel Header
136
+
137
+ Renders the discussion topic and metadata in a double-line bordered header.
138
+
139
+ ```
140
+ ╔══════════════════════════════════════════════════════╗
141
+ ║ 🗣️ AGENT DISCUSSION: {topic} ║
142
+ ║ {n} agents | Max severity: {severity_badge} ║
143
+ ╠══════════════════════════════════════════════════════╣
144
+ ```
145
+
146
+ **Rules:**
147
+ - Topic text wraps within panel width, truncated with `...` if exceeding 2 lines
148
+ - Agent count derived from `specialists.length`
149
+ - Max severity badge uses the formatter's badge format: `🔴 CRITICAL`, `🟠 HIGH`, `🟡 MEDIUM`, `🟢 LOW`, `ℹ️ INFO`
150
+ - `╠══╣` separator divides header from opinion stream
151
+
152
+ ### 2. Opinion Stream
153
+
154
+ The scrollable main content area displaying individual agent opinion blocks.
155
+
156
+ **Rendering rules:**
157
+ - Each opinion is rendered by the `agent-discussion` formatter as a single-line bordered box
158
+ - Opinions are sorted by severity: CRITICAL > HIGH > MEDIUM > LOW > INFO
159
+ - One blank line separates consecutive opinion blocks
160
+ - The stream area has no outer border of its own — it lives inside the panel's `║` side borders
161
+ - If opinions exceed visible height, the panel supports vertical scrolling (implementation-dependent)
162
+
163
+ **Grouping:**
164
+ - When multiple agents comment on the same evidence location (`file:line`), group them visually with a shared topic label above the cluster:
165
+ ```
166
+ ║ 📍 api/admin/users.ts ║
167
+ ║ ║
168
+ ║ ┌─ 🔒 security-specialist ────────────────────────┐ ║
169
+ ║ │ ... │ ║
170
+ ║ └──────────────────────────────────────────────────┘ ║
171
+ ║ ║
172
+ ║ ┌─ 📏 code-quality-specialist ────────────────────┐ ║
173
+ ║ │ ... │ ║
174
+ ║ └──────────────────────────────────────────────────┘ ║
175
+ ```
176
+
177
+ **Deduplication:**
178
+ - If two agents report the same issue (identical `recommendation`), merge into a single block listing both agent names in the title: `┌─ 🔒 security + 📏 code-quality ─────┐`
179
+
180
+ ### 3. Consensus Bar
181
+
182
+ Displays the discussion's consensus status using double-line borders.
183
+
184
+ **Rendering by `ConsensusStatus`:**
185
+
186
+ | Status | Display |
187
+ |--------|---------|
188
+ | `consensus` | `✅ CONSENSUS ({n}/{n} agents agree)` — green accent |
189
+ | `majority` | `📊 MAJORITY ({n}/{total} agents agree)` — yellow accent |
190
+ | `split` | `⚖️ SPLIT OPINION ({n} vs {m})` — orange accent, shows FOR/AGAINST lists |
191
+ | `disagreement` | `❌ NO CONSENSUS ({n} agents disagree)` — red accent, lists each position |
192
+
193
+ **Rules:**
194
+ - Always appears between opinion stream and summary, separated by `╠══╣` lines
195
+ - For `split` and `disagreement`, list each side with agent emoji + name + 1-line reason
196
+ - Consensus bar may be omitted if only 1 agent participated (no consensus to show)
197
+
198
+ ### 4. Summary Footer
199
+
200
+ Compact statistics and action items at the panel bottom.
201
+
202
+ ```
203
+ ╠══════════════════════════════════════════════════════╣
204
+ ║ 📋 SUMMARY | Agents: {n} | Findings: {total} ║
205
+ ║ 🔴 {c} 🟠 {h} 🟡 {m} 🟢 {l} ℹ️ {i} ║
206
+ ║ Action: {action_summary} ║
207
+ ╚══════════════════════════════════════════════════════╝
208
+ ```
209
+
210
+ **Rules:**
211
+ - Severity counts derived from `opinions[].severity`
212
+ - Action summary derived from `DiscussionResult.summary`
213
+ - If no CRITICAL or HIGH findings, action line reads: `Action: No blocking issues found`
214
+ - `╚══╝` closes the entire panel
215
+
216
+ ## Real-Time Streaming
217
+
218
+ The panel supports progressive rendering as agent opinions arrive one by one during parallel specialist execution.
219
+
220
+ ### Streaming Lifecycle
221
+
222
+ ```
223
+ Phase 1: INITIALIZING
224
+ ╔══════════════════════════════════════════════════════╗
225
+ ║ 🗣️ AGENT DISCUSSION: {topic} ║
226
+ ║ Waiting for agents... (0/{expected} responded) ║
227
+ ╠══════════════════════════════════════════════════════╣
228
+ ║ ║
229
+ ║ ⏳ Collecting opinions... ║
230
+ ║ ║
231
+ ╚══════════════════════════════════════════════════════╝
232
+
233
+ Phase 2: STREAMING (opinions arriving)
234
+ ╔══════════════════════════════════════════════════════╗
235
+ ║ 🗣️ AGENT DISCUSSION: {topic} ║
236
+ ║ 2/{expected} agents responded | Max: 🟠 HIGH ║
237
+ ╠══════════════════════════════════════════════════════╣
238
+ ║ ║
239
+ ║ ┌─ 🔒 security-specialist ────────────────────────┐ ║
240
+ ║ │ 🟠 HIGH: ... │ ║
241
+ ║ └──────────────────────────────────────────────────┘ ║
242
+ ║ ║
243
+ ║ ┌─ ⚡ performance-specialist ─────────────────────┐ ║
244
+ ║ │ 🟡 MEDIUM: ... │ ║
245
+ ║ └──────────────────────────────────────────────────┘ ║
246
+ ║ ║
247
+ ║ ⏳ Waiting: 📏 code-quality, 🏛️ architecture ║
248
+ ║ ║
249
+ ╚══════════════════════════════════════════════════════╝
250
+
251
+ Phase 3: COMPLETE (all opinions received)
252
+ [Full panel layout as shown in Panel Architecture]
253
+ ```
254
+
255
+ ### Streaming Rules
256
+
257
+ 1. **Header updates live** — agent count and max severity refresh as each opinion arrives
258
+ 2. **Opinions append** — new opinions are inserted in severity-sorted position, not appended at bottom
259
+ 3. **Waiting indicator** — lists pending agent names with their emoji prefixes
260
+ 4. **Consensus bar deferred** — only rendered when all opinions are received (cannot compute consensus from partial data)
261
+ 5. **Summary footer deferred** — only rendered at Phase 3 (COMPLETE)
262
+ 6. **No flicker** — use terminal cursor repositioning or buffered output to avoid visual tearing
263
+
264
+ ### Streaming Data Events
265
+
266
+ ```typescript
267
+ // Event types the panel listens for
268
+ type PanelEvent =
269
+ | { type: 'discussion_start'; topic: string; expectedAgents: string[] }
270
+ | { type: 'opinion_received'; opinion: AgentOpinion }
271
+ | { type: 'discussion_complete'; result: DiscussionResult };
272
+ ```
273
+
274
+ ## Layout Constraints
275
+
276
+ ### Terminal Width Adaptation
277
+
278
+ | Terminal Width | Behavior |
279
+ |---------------|----------|
280
+ | >= 80 cols | Full layout with evidence and recommendations inline |
281
+ | 60-79 cols | Compact: evidence truncated with `...`, recommendation on separate line |
282
+ | < 60 cols | Minimal: severity badge + title only, details collapsed; expand on focus |
283
+
284
+ ### Minimum Dimensions
285
+
286
+ - **Width:** 50 columns minimum (matches formatter spec)
287
+ - **Height:** 10 rows minimum (header + 1 opinion + footer)
288
+
289
+ ### Content Overflow
290
+
291
+ - **Horizontal:** Wrap text at panel inner width (panel width - 4 for border + padding)
292
+ - **Vertical:** Scroll within opinion stream area; header and footer remain pinned
293
+
294
+ ## Integration Points
295
+
296
+ ### codingbuddy TUI
297
+
298
+ If a codingbuddy TUI dashboard exists, the panel integrates as a widget:
299
+
300
+ ```
301
+ ┌─ codingbuddy dashboard ──────────────────────────────────────┐
302
+ │ ┌── Task Progress ──┐ ┌── Agent Discussion Panel ────────┐ │
303
+ │ │ [=====> ] 60% │ │ ╔═══════════════════════════════╗│ │
304
+ │ │ Step 3/5: Testing │ │ ║ 🗣️ Auth Endpoint Review ║│ │
305
+ │ │ │ │ ╠═══════════════════════════════╣│ │
306
+ │ │ ✅ Step 1 │ │ ║ ┌─ 🔒 security ──────────┐ ║│ │
307
+ │ │ ✅ Step 2 │ │ ║ │ 🔴 CRITICAL: ... │ ║│ │
308
+ │ │ 🔄 Step 3 │ │ ║ └────────────────────────┘ ║│ │
309
+ │ │ ⬜ Step 4 │ │ ║ ┌─ 📏 code-quality ─────┐ ║│ │
310
+ │ │ ⬜ Step 5 │ │ ║ │ 🟡 MEDIUM: ... │ ║│ │
311
+ │ └────────────────────┘ │ ║ └────────────────────────┘ ║│ │
312
+ │ │ ╚═══════════════════════════════╝│ │
313
+ │ └──────────────────────────────────┘ │
314
+ └──────────────────────────────────────────────────────────────┘
315
+ ```
316
+
317
+ **Widget API contract:**
318
+
319
+ ```typescript
320
+ interface DiscussionPanelWidget {
321
+ /** Render the panel into a bounded region */
322
+ render(region: { x: number; y: number; width: number; height: number }): void;
323
+
324
+ /** Feed a new opinion into the streaming panel */
325
+ pushOpinion(opinion: AgentOpinion): void;
326
+
327
+ /** Finalize the panel with complete discussion result */
328
+ complete(result: DiscussionResult): void;
329
+
330
+ /** Clear the panel content */
331
+ reset(): void;
332
+ }
333
+ ```
334
+
335
+ ### Standalone Mode
336
+
337
+ When not embedded in a dashboard, the panel renders full-width to `stdout`:
338
+
339
+ ```typescript
340
+ interface StandalonePanel {
341
+ /** Render a complete discussion result to stdout */
342
+ print(result: DiscussionResult): void;
343
+
344
+ /** Start streaming mode, returns controller */
345
+ startStreaming(topic: string, expectedAgents: string[]): StreamController;
346
+ }
347
+
348
+ interface StreamController {
349
+ /** Add an opinion (re-renders panel) */
350
+ addOpinion(opinion: AgentOpinion): void;
351
+
352
+ /** Mark streaming complete, render final panel */
353
+ finish(result: DiscussionResult): void;
354
+ }
355
+ ```
356
+
357
+ ## Rendering Examples
358
+
359
+ ### Empty State (No Opinions Yet)
360
+
361
+ ```
362
+ ╔══════════════════════════════════════════════════════╗
363
+ ║ 🗣️ AGENT DISCUSSION: API Security Review ║
364
+ ║ Waiting for agents... (0/4 responded) ║
365
+ ╠══════════════════════════════════════════════════════╣
366
+ ║ ║
367
+ ║ ⏳ Collecting opinions from: ║
368
+ ║ 🔒 security ⚡ performance ║
369
+ ║ 📏 code-quality 🏛️ architecture ║
370
+ ║ ║
371
+ ╚══════════════════════════════════════════════════════╝
372
+ ```
373
+
374
+ ### Single Agent Response
375
+
376
+ ```
377
+ ╔══════════════════════════════════════════════════════╗
378
+ ║ 🗣️ AGENT DISCUSSION: API Security Review ║
379
+ ║ 1/4 agents responded | Max: 🔴 CRITICAL ║
380
+ ╠══════════════════════════════════════════════════════╣
381
+ ║ ║
382
+ ║ ┌─ 🔒 security-specialist ────────────────────────┐ ║
383
+ ║ │ 🔴 CRITICAL: Unauthenticated admin endpoint │ ║
384
+ ║ │ │ ║
385
+ ║ │ The /api/admin/users endpoint lacks auth guard. │ ║
386
+ ║ │ Any client can access user PII. │ ║
387
+ ║ │ │ ║
388
+ ║ │ Evidence: api/admin/users.ts:12 │ ║
389
+ ║ │ Recommendation: Add AuthGuard + RolesGuard │ ║
390
+ ║ └──────────────────────────────────────────────────┘ ║
391
+ ║ ║
392
+ ║ ⏳ Waiting: ⚡ performance, 📏 code-quality, ║
393
+ ║ 🏛️ architecture ║
394
+ ║ ║
395
+ ╚══════════════════════════════════════════════════════╝
396
+ ```
397
+
398
+ ### Disagreement with Split Opinion
399
+
400
+ ```
401
+ ╔══════════════════════════════════════════════════════╗
402
+ ║ 🗣️ AGENT DISCUSSION: Caching Strategy ║
403
+ ║ 3 agents | Max severity: 🟠 HIGH ║
404
+ ╠══════════════════════════════════════════════════════╣
405
+ ║ ║
406
+ ║ ┌─ ⚡ performance-specialist ─────────────────────┐ ║
407
+ ║ │ 🟠 HIGH: Add request-level caching │ ║
408
+ ║ │ DB query latency at p99 is 800ms. Cache would │ ║
409
+ ║ │ reduce to <50ms for repeated reads. │ ║
410
+ ║ │ Evidence: monitoring/latency-report.md:23 │ ║
411
+ ║ │ Recommendation: Add Redis cache with 60s TTL │ ║
412
+ ║ └──────────────────────────────────────────────────┘ ║
413
+ ║ ║
414
+ ║ ┌─ 🏛️ architecture-specialist ────────────────────┐ ║
415
+ ║ │ 🟡 MEDIUM: Cache fits existing layer │ ║
416
+ ║ │ The CacheModule is already wired. Adding a new │ ║
417
+ ║ │ cache key requires no architectural changes. │ ║
418
+ ║ │ Evidence: src/cache/cache.module.ts:1 │ ║
419
+ ║ │ Recommendation: Use existing CacheModule.set() │ ║
420
+ ║ └──────────────────────────────────────────────────┘ ║
421
+ ║ ║
422
+ ║ ┌─ 🔒 security-specialist ────────────────────────┐ ║
423
+ ║ │ 🟠 HIGH: Cache invalidation risk │ ║
424
+ ║ │ Stale cache may serve outdated auth state after │ ║
425
+ ║ │ permission changes, creating privilege window. │ ║
426
+ ║ │ Evidence: src/auth/permissions.service.ts:45 │ ║
427
+ ║ │ Recommendation: TTL < 30s + invalidate on │ ║
428
+ ║ │ permission change events │ ║
429
+ ║ └──────────────────────────────────────────────────┘ ║
430
+ ║ ║
431
+ ╠══════════════════════════════════════════════════════╣
432
+ ║ ⚖️ SPLIT OPINION (2 vs 1) ║
433
+ ║ ║
434
+ ║ FOR caching (2): ║
435
+ ║ ⚡ performance — reduces p99 latency by 94% ║
436
+ ║ 🏛️ architecture — fits existing cache layer ║
437
+ ║ ║
438
+ ║ AGAINST as-is (1): ║
439
+ ║ 🔒 security — stale auth state risk ║
440
+ ║ ║
441
+ ║ Recommendation: Proceed with TTL < 30s + event ║
442
+ ║ invalidation ║
443
+ ╠══════════════════════════════════════════════════════╣
444
+ ║ 📋 SUMMARY | Agents: 3 | Findings: 3 ║
445
+ ║ 🔴 0 🟠 2 🟡 1 🟢 0 ℹ️ 0 ║
446
+ ║ Action: Resolve split opinion, then fix 2 HIGH ║
447
+ ╚══════════════════════════════════════════════════════╝
448
+ ```
@@ -457,3 +457,8 @@ node The actual object
457
457
  cursor Pagination cursor
458
458
  pageInfo hasNextPage, etc.
459
459
  ```
460
+
461
+ ## Additional resources
462
+
463
+ - [OpenAPI 3.1 template](examples/openapi-template.yaml) — Copy-and-adapt template with CRUD endpoints, pagination, error responses, and security schemes
464
+ - [Error response examples](examples/error-response.json) — Standard error format for all HTTP status codes with machine-readable error code registry