codingbuddy-rules 4.5.0 → 5.0.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.
- package/.ai-rules/adapters/antigravity.md +6 -6
- package/.ai-rules/adapters/claude-code.md +68 -4
- package/.ai-rules/adapters/codex.md +5 -5
- package/.ai-rules/adapters/cursor.md +2 -2
- package/.ai-rules/adapters/kiro.md +8 -8
- package/.ai-rules/adapters/opencode.md +7 -7
- package/.ai-rules/adapters/q.md +2 -2
- package/.ai-rules/agents/README.md +66 -16
- package/.ai-rules/agents/accessibility-specialist.json +2 -1
- package/.ai-rules/agents/act-mode.json +2 -1
- package/.ai-rules/agents/agent-architect.json +8 -7
- package/.ai-rules/agents/ai-ml-engineer.json +1 -0
- package/.ai-rules/agents/architecture-specialist.json +1 -0
- package/.ai-rules/agents/auto-mode.json +4 -2
- package/.ai-rules/agents/backend-developer.json +1 -0
- package/.ai-rules/agents/code-quality-specialist.json +1 -0
- package/.ai-rules/agents/code-reviewer.json +65 -64
- package/.ai-rules/agents/data-engineer.json +8 -7
- package/.ai-rules/agents/data-scientist.json +10 -9
- package/.ai-rules/agents/devops-engineer.json +1 -0
- package/.ai-rules/agents/documentation-specialist.json +1 -0
- package/.ai-rules/agents/eval-mode.json +20 -19
- package/.ai-rules/agents/event-architecture-specialist.json +1 -0
- package/.ai-rules/agents/frontend-developer.json +1 -0
- package/.ai-rules/agents/i18n-specialist.json +2 -1
- package/.ai-rules/agents/integration-specialist.json +1 -0
- package/.ai-rules/agents/migration-specialist.json +1 -0
- package/.ai-rules/agents/mobile-developer.json +8 -7
- package/.ai-rules/agents/observability-specialist.json +1 -0
- package/.ai-rules/agents/parallel-orchestrator.json +346 -0
- package/.ai-rules/agents/performance-specialist.json +1 -0
- package/.ai-rules/agents/plan-mode.json +3 -1
- package/.ai-rules/agents/plan-reviewer.json +208 -0
- package/.ai-rules/agents/platform-engineer.json +1 -0
- package/.ai-rules/agents/security-engineer.json +9 -8
- package/.ai-rules/agents/security-specialist.json +2 -1
- package/.ai-rules/agents/seo-specialist.json +1 -0
- package/.ai-rules/agents/software-engineer.json +1 -0
- package/.ai-rules/agents/solution-architect.json +11 -10
- package/.ai-rules/agents/systems-developer.json +9 -8
- package/.ai-rules/agents/technical-planner.json +11 -10
- package/.ai-rules/agents/test-engineer.json +7 -6
- package/.ai-rules/agents/test-strategy-specialist.json +1 -0
- package/.ai-rules/agents/tooling-engineer.json +4 -3
- package/.ai-rules/agents/ui-ux-designer.json +1 -0
- package/.ai-rules/keyword-modes.json +4 -4
- package/.ai-rules/rules/clarification-guide.md +14 -14
- package/.ai-rules/rules/core.md +73 -0
- package/.ai-rules/rules/parallel-execution.md +217 -0
- package/.ai-rules/skills/README.md +23 -1
- package/.ai-rules/skills/agent-design/SKILL.md +5 -0
- package/.ai-rules/skills/agent-design/examples/agent-template.json +58 -0
- package/.ai-rules/skills/agent-design/references/expertise-guidelines.md +112 -0
- package/.ai-rules/skills/agent-discussion/SKILL.md +199 -0
- package/.ai-rules/skills/agent-discussion-panel/SKILL.md +448 -0
- package/.ai-rules/skills/api-design/SKILL.md +5 -0
- package/.ai-rules/skills/api-design/examples/error-response.json +159 -0
- package/.ai-rules/skills/api-design/examples/openapi-template.yaml +393 -0
- package/.ai-rules/skills/build-fix/SKILL.md +234 -0
- package/.ai-rules/skills/code-explanation/SKILL.md +4 -0
- package/.ai-rules/skills/context-management/SKILL.md +1 -0
- package/.ai-rules/skills/cost-budget/SKILL.md +348 -0
- package/.ai-rules/skills/cross-repo-issues/SKILL.md +257 -0
- package/.ai-rules/skills/database-migration/SKILL.md +1 -0
- package/.ai-rules/skills/deepsearch/SKILL.md +214 -0
- package/.ai-rules/skills/deployment-checklist/SKILL.md +1 -0
- package/.ai-rules/skills/error-analysis/SKILL.md +1 -0
- package/.ai-rules/skills/finishing-a-development-branch/SKILL.md +281 -0
- package/.ai-rules/skills/frontend-design/SKILL.md +5 -0
- package/.ai-rules/skills/frontend-design/examples/component-template.tsx +203 -0
- package/.ai-rules/skills/frontend-design/references/css-patterns.md +243 -0
- package/.ai-rules/skills/git-master/SKILL.md +358 -0
- package/.ai-rules/skills/incident-response/SKILL.md +1 -0
- package/.ai-rules/skills/legacy-modernization/SKILL.md +1 -0
- package/.ai-rules/skills/mcp-builder/SKILL.md +7 -0
- package/.ai-rules/skills/mcp-builder/examples/resource-example.ts +233 -0
- package/.ai-rules/skills/mcp-builder/examples/tool-example.ts +203 -0
- package/.ai-rules/skills/mcp-builder/references/protocol-spec.md +215 -0
- package/.ai-rules/skills/performance-optimization/SKILL.md +3 -0
- package/.ai-rules/skills/plan-and-review/SKILL.md +115 -0
- package/.ai-rules/skills/pr-all-in-one/SKILL.md +15 -13
- package/.ai-rules/skills/pr-all-in-one/configuration-guide.md +7 -7
- package/.ai-rules/skills/pr-all-in-one/pr-templates.md +10 -10
- package/.ai-rules/skills/pr-review/SKILL.md +4 -0
- package/.ai-rules/skills/receiving-code-review/SKILL.md +347 -0
- package/.ai-rules/skills/refactoring/SKILL.md +1 -0
- package/.ai-rules/skills/requesting-code-review/SKILL.md +348 -0
- package/.ai-rules/skills/rule-authoring/SKILL.md +5 -0
- package/.ai-rules/skills/rule-authoring/examples/rule-template.md +142 -0
- package/.ai-rules/skills/rule-authoring/examples/trigger-patterns.md +126 -0
- package/.ai-rules/skills/security-audit/SKILL.md +4 -0
- package/.ai-rules/skills/skill-creator/SKILL.md +461 -0
- package/.ai-rules/skills/skill-creator/agents/analyzer.md +206 -0
- package/.ai-rules/skills/skill-creator/agents/comparator.md +167 -0
- package/.ai-rules/skills/skill-creator/agents/grader.md +152 -0
- package/.ai-rules/skills/skill-creator/assets/eval_review.html +289 -0
- package/.ai-rules/skills/skill-creator/assets/skill-template.md +43 -0
- package/.ai-rules/skills/skill-creator/eval-viewer/generate_review.py +496 -0
- package/.ai-rules/skills/skill-creator/references/frontmatter-guide.md +632 -0
- package/.ai-rules/skills/skill-creator/references/multi-tool-compat.md +480 -0
- package/.ai-rules/skills/skill-creator/references/schemas.md +784 -0
- package/.ai-rules/skills/skill-creator/scripts/aggregate_benchmark.py +302 -0
- package/.ai-rules/skills/skill-creator/scripts/init_skill.sh +196 -0
- package/.ai-rules/skills/skill-creator/scripts/run_loop.py +327 -0
- package/.ai-rules/skills/systematic-debugging/SKILL.md +1 -0
- package/.ai-rules/skills/tech-debt/SKILL.md +1 -0
- package/.ai-rules/skills/test-coverage-gate/SKILL.md +303 -0
- package/.ai-rules/skills/tmux-master/SKILL.md +491 -0
- package/.ai-rules/skills/using-git-worktrees/SKILL.md +368 -0
- package/.ai-rules/skills/verification-before-completion/SKILL.md +234 -0
- package/.ai-rules/skills/widget-slot-architecture/SKILL.md +6 -0
- package/.ai-rules/skills/widget-slot-architecture/examples/parallel-route-setup.tsx +206 -0
- package/.ai-rules/skills/widget-slot-architecture/examples/widget-component.tsx +250 -0
- package/.ai-rules/skills/writing-plans/SKILL.md +78 -0
- package/bin/cli.js +178 -0
- package/lib/init/detect-stack.js +148 -0
- package/lib/init/generate-config.js +31 -0
- package/lib/init/index.js +86 -0
- package/lib/init/prompt.js +60 -0
- package/lib/init/scaffold.js +67 -0
- package/lib/init/suggest-agent.js +46 -0
- package/package.json +10 -2
|
@@ -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
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Standard API error response examples. Use these as templates for consistent error formatting.",
|
|
3
|
+
|
|
4
|
+
"validation_error": {
|
|
5
|
+
"status": 400,
|
|
6
|
+
"body": {
|
|
7
|
+
"error": {
|
|
8
|
+
"code": "VALIDATION_ERROR",
|
|
9
|
+
"message": "Invalid input data",
|
|
10
|
+
"details": [
|
|
11
|
+
{
|
|
12
|
+
"field": "email",
|
|
13
|
+
"message": "Must be a valid email address",
|
|
14
|
+
"code": "INVALID_FORMAT"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"field": "name",
|
|
18
|
+
"message": "Name is required",
|
|
19
|
+
"code": "REQUIRED"
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
"field": "age",
|
|
23
|
+
"message": "Must be between 1 and 150",
|
|
24
|
+
"code": "OUT_OF_RANGE"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
28
|
+
"meta": {
|
|
29
|
+
"requestId": "req_abc123",
|
|
30
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
"unauthorized": {
|
|
36
|
+
"status": 401,
|
|
37
|
+
"body": {
|
|
38
|
+
"error": {
|
|
39
|
+
"code": "UNAUTHORIZED",
|
|
40
|
+
"message": "Authentication is required to access this resource"
|
|
41
|
+
},
|
|
42
|
+
"meta": {
|
|
43
|
+
"requestId": "req_def456",
|
|
44
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
|
|
49
|
+
"forbidden": {
|
|
50
|
+
"status": 403,
|
|
51
|
+
"body": {
|
|
52
|
+
"error": {
|
|
53
|
+
"code": "FORBIDDEN",
|
|
54
|
+
"message": "You do not have permission to perform this action",
|
|
55
|
+
"details": [
|
|
56
|
+
{
|
|
57
|
+
"field": "role",
|
|
58
|
+
"message": "Requires 'admin' role",
|
|
59
|
+
"code": "INSUFFICIENT_PERMISSIONS"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
},
|
|
63
|
+
"meta": {
|
|
64
|
+
"requestId": "req_ghi789",
|
|
65
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
"not_found": {
|
|
71
|
+
"status": 404,
|
|
72
|
+
"body": {
|
|
73
|
+
"error": {
|
|
74
|
+
"code": "NOT_FOUND",
|
|
75
|
+
"message": "The requested resource was not found"
|
|
76
|
+
},
|
|
77
|
+
"meta": {
|
|
78
|
+
"requestId": "req_jkl012",
|
|
79
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
|
|
84
|
+
"conflict": {
|
|
85
|
+
"status": 409,
|
|
86
|
+
"body": {
|
|
87
|
+
"error": {
|
|
88
|
+
"code": "CONFLICT",
|
|
89
|
+
"message": "A resource with this identifier already exists",
|
|
90
|
+
"details": [
|
|
91
|
+
{
|
|
92
|
+
"field": "email",
|
|
93
|
+
"message": "An account with this email already exists",
|
|
94
|
+
"code": "DUPLICATE"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
"meta": {
|
|
99
|
+
"requestId": "req_mno345",
|
|
100
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
|
|
105
|
+
"rate_limited": {
|
|
106
|
+
"status": 429,
|
|
107
|
+
"headers": {
|
|
108
|
+
"Retry-After": "60",
|
|
109
|
+
"X-RateLimit-Limit": "100",
|
|
110
|
+
"X-RateLimit-Remaining": "0",
|
|
111
|
+
"X-RateLimit-Reset": "1705312260"
|
|
112
|
+
},
|
|
113
|
+
"body": {
|
|
114
|
+
"error": {
|
|
115
|
+
"code": "RATE_LIMITED",
|
|
116
|
+
"message": "Too many requests. Please retry after 60 seconds."
|
|
117
|
+
},
|
|
118
|
+
"meta": {
|
|
119
|
+
"requestId": "req_pqr678",
|
|
120
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
"internal_error": {
|
|
126
|
+
"status": 500,
|
|
127
|
+
"body": {
|
|
128
|
+
"error": {
|
|
129
|
+
"code": "INTERNAL_ERROR",
|
|
130
|
+
"message": "An unexpected error occurred. Please try again later."
|
|
131
|
+
},
|
|
132
|
+
"meta": {
|
|
133
|
+
"requestId": "req_stu901",
|
|
134
|
+
"timestamp": "2024-01-15T10:30:00Z"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
"_error_code_registry": {
|
|
140
|
+
"_comment": "Machine-readable error codes used across the API. Keep this list updated.",
|
|
141
|
+
"codes": {
|
|
142
|
+
"VALIDATION_ERROR": "Request body or parameters failed validation",
|
|
143
|
+
"UNAUTHORIZED": "Missing or invalid authentication credentials",
|
|
144
|
+
"FORBIDDEN": "Valid credentials but insufficient permissions",
|
|
145
|
+
"NOT_FOUND": "Requested resource does not exist",
|
|
146
|
+
"CONFLICT": "Request conflicts with current server state",
|
|
147
|
+
"RATE_LIMITED": "Client exceeded rate limit quota",
|
|
148
|
+
"INTERNAL_ERROR": "Unexpected server-side failure",
|
|
149
|
+
"SERVICE_UNAVAILABLE": "Upstream dependency is unavailable",
|
|
150
|
+
"REQUIRED": "A required field is missing",
|
|
151
|
+
"INVALID_FORMAT": "Field value does not match expected format",
|
|
152
|
+
"OUT_OF_RANGE": "Numeric value outside allowed range",
|
|
153
|
+
"DUPLICATE": "Value must be unique but already exists",
|
|
154
|
+
"INSUFFICIENT_PERMISSIONS": "Specific permission check failed",
|
|
155
|
+
"EXPIRED": "Token or resource has expired",
|
|
156
|
+
"IMMUTABLE": "Attempted to modify a read-only field"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|