Add Multi-CLI Plan feature and corresponding JSON schema

- Introduced a new navigation item for "Multi-CLI Plan" in the dashboard template.
- Created a new JSON schema for "Multi-CLI Discussion Artifact" to facilitate structured discussions and decision-making processes.
This commit is contained in:
catlog22
2026-01-13 23:46:15 +08:00
parent c3da637849
commit 6922ca27de
12 changed files with 2535 additions and 274 deletions

View File

@@ -45,220 +45,19 @@ You are a multi-CLI collaborative discussion agent. You orchestrate multiple CLI
Write to: `{session.folder}/rounds/{round_number}/synthesis.json`
### Core Types
```typescript
/** Multi-language label for UI display */
interface I18nLabel {
en: string;
zh: string;
}
/** Discussion status */
type Status = 'exploring' | 'analyzing' | 'debating' | 'decided' | 'blocked';
/** Priority/Impact levels */
type Level = 'critical' | 'high' | 'medium' | 'low';
/** Decision reversibility */
type Reversibility = 'easily_reversible' | 'requires_refactoring' | 'irreversible';
/** Agent identifier */
interface AgentIdentifier {
name: 'Gemini' | 'Codex' | 'Qwen' | 'Human';
id: string;
}
**Schema Reference**: Load schema before generating output:
```bash
cat ~/.claude/workflows/cli-templates/schemas/multi-cli-discussion-schema.json
```
### Main Artifact Structure
```typescript
interface DiscussionArtifact {
metadata: ArtifactMetadata;
discussionTopic: DiscussionTopicSection;
relatedFiles: RelatedFilesSection;
planning: PlanningRequirementsSection;
decision: DecisionSection;
decisionRecords: DecisionRecordsSection;
// Internal analysis data (for debugging/auditing)
_internal: {
cli_analyses: CLIAnalysis[];
cross_verification: CrossVerification;
convergence: ConvergenceMetrics;
};
}
```
### Section 1: Metadata
```typescript
interface ArtifactMetadata {
artifactId: string; // e.g., "MCP-auth-refactor-2026-01-13-round-1"
roundId: number;
timestamp: string; // ISO 8601
contributingAgents: AgentIdentifier[];
durationSeconds: number;
exportFormats: ('markdown' | 'html')[];
}
```
### Section 2: Discussion Topic (讨论主题)
```typescript
interface DiscussionTopicSection {
title: I18nLabel;
description: I18nLabel;
scope: {
included: I18nLabel[]; // What's in scope
excluded: I18nLabel[]; // What's explicitly out of scope
};
keyQuestions: I18nLabel[]; // Questions being explored
status: Status;
tags: string[]; // For filtering: ["auth", "security", "api"]
}
```
### Section 3: Related Files (关联文件)
```typescript
interface RelatedFilesSection {
fileTree: FileNode[];
dependencyGraph: DependencyEdge[];
impactSummary: FileImpact[];
}
interface FileNode {
path: string;
type: 'file' | 'directory';
modificationStatus: 'added' | 'modified' | 'deleted' | 'unchanged';
impactScore?: Level;
children?: FileNode[];
codeSnippet?: CodeSnippet;
}
interface DependencyEdge {
source: string; // File path
target: string; // File path
relationship: string; // 'imports' | 'calls' | 'inherits' | 'uses'
}
interface FileImpact {
filePath: string;
line?: number;
score: Level;
reasoning: I18nLabel;
}
interface CodeSnippet {
startLine: number;
endLine: number;
code: string;
language: string;
comment?: I18nLabel;
}
```
### Section 4: Planning Requirements (规划要求)
```typescript
interface PlanningRequirementsSection {
functional: Requirement[];
nonFunctional: Requirement[];
acceptanceCriteria: AcceptanceCriterion[];
}
interface Requirement {
id: string; // e.g., "FR-01", "NFR-01"
description: I18nLabel;
priority: Level;
source: string; // "User Request", "Technical Debt", etc.
}
interface AcceptanceCriterion {
id: string; // e.g., "AC-01"
description: I18nLabel;
isMet: boolean;
}
```
### Section 5: Decision (决策)
```typescript
interface DecisionSection {
status: 'pending' | 'decided' | 'conflict';
summary: I18nLabel;
selectedSolution?: Solution;
rejectedAlternatives: RejectedSolution[];
confidenceScore: number; // 0.0 to 1.0
}
interface Solution {
id: string; // e.g., "sol-jwt-01"
title: I18nLabel;
description: I18nLabel;
pros: I18nLabel[];
cons: I18nLabel[];
estimatedEffort: I18nLabel; // e.g., "3 developer-days"
risk: Level;
affectedFiles: FileImpact[];
sourceCLIs: string[]; // Which CLIs proposed this
}
interface RejectedSolution extends Solution {
rejectionReason: I18nLabel;
}
```
### Section 6: Decision Records (决策记录)
```typescript
interface DecisionRecordsSection {
timeline: DecisionEvent[];
}
interface DecisionEvent {
eventId: string; // e.g., "evt-proposal-001"
timestamp: string; // ISO 8601
type: 'proposal' | 'argument' | 'agreement' | 'disagreement' | 'decision' | 'reversal';
contributor: AgentIdentifier;
summary: I18nLabel;
evidence: Evidence[];
reversibility?: Reversibility;
}
interface Evidence {
type: 'link' | 'code_snippet' | 'log_output' | 'benchmark' | 'reference';
content: string | CodeSnippet;
description: I18nLabel;
}
```
### Internal Analysis Data
```typescript
interface CLIAnalysis {
tool: 'gemini' | 'codex' | 'qwen';
perspective: string;
feasibility_score: number;
findings: string[];
implementation_approaches: ImplementationApproach[];
technical_concerns: string[];
code_locations: FileImpact[];
}
interface CrossVerification {
agreements: string[];
disagreements: string[];
resolution: string;
}
interface ConvergenceMetrics {
score: number;
new_insights: boolean;
recommendation: 'continue' | 'converged' | 'user_input_needed';
}
```
**Main Sections**:
- `metadata`: Artifact ID, round, timestamp, contributing agents
- `discussionTopic`: Title, description, scope (included/excluded), key questions, status, tags
- `relatedFiles`: File tree, dependency graph, impact summary
- `planning`: Functional requirements, non-functional requirements, acceptance criteria
- `decision`: Status, summary, selected solution, rejected alternatives, confidence score
- `decisionRecords`: Timeline of decision events (proposals, agreements, disagreements)
- `_internal`: CLI analyses, cross-verification results, convergence metrics
## Execution Flow
@@ -1118,46 +917,3 @@ function validateAnalysis(analysis) {
- Generate more than 4 clarification questions
- Ignore previous round context
## UI Component Mapping
For dashboard visualization, map artifact sections to UI components:
| Section | Component | Library Example | Notes |
|---------|-----------|-----------------|-------|
| **metadata** | | | |
| `roundId`, `timestamp` | `Tag`, `Badge` | Ant Design `Tag` | Header indicators |
| `contributingAgents` | `Avatar.Group` | Ant Design `Avatar.Group` | Agent icons with tooltips |
| `exportFormats` | `Dropdown` + `Button` | Material-UI `Menu` | Export actions |
| **discussionTopic** | `Card` | Bootstrap `Card` | Main section container |
| `title`, `description` | `Typography` | Any UI library | Standard text |
| `scope` | `List` with icons | Heroicons | Included/Excluded lists |
| `keyQuestions` | `Collapse` | Ant Design `Collapse` | Expandable Q&A |
| `status` | `Steps`, `Timeline` | Ant Design `Steps` | Progress indicator |
| **relatedFiles** | | | |
| `fileTree` | `Tree` | Ant Design `Tree` | Hierarchical file view |
| `dependencyGraph` | `Graph` | `vis-network`, `react-flow` | Interactive graph |
| `impactSummary` | `Table` | Ant Design `Table` | Sortable impact list |
| `codeSnippet` | `SyntaxHighlighter` | `react-syntax-highlighter` | Code with line numbers |
| **planning** | `Tabs` | Bootstrap `Navs` | FR/NFR/AC tabs |
| `functional/nonFunctional` | `Table` | Material-UI `Table` | Priority-sortable |
| `acceptanceCriteria` | `List` + `Checkbox` | Ant Design `List` | Checkable items |
| `priority` | `Tag` (color-coded) | Ant Design `Tag` | critical=red, high=orange |
| **decision** | | | |
| `summary` | `Alert`, `Callout` | Ant Design `Alert` | Prominent decision box |
| `selectedSolution` | `Card` (highlighted) | Bootstrap `Card` | Winner card |
| `rejectedAlternatives` | `Collapse` of `Card`s | Ant Design `Collapse` | Collapsed alternatives |
| `pros/cons` | `List` with icons | ThumbUp/ThumbDown | Visual indicators |
| `confidenceScore` | `Progress`, `Gauge` | Ant Design `Progress` | 0-100% visual |
| **decisionRecords** | | | |
| `timeline` | `Timeline` | Ant Design `Timeline`, `react-chrono` | Chronological events |
| `contributor` | `Avatar` + `Tooltip` | Ant Design `Avatar` | Who contributed |
| `evidence` | `Popover`, `Modal` | Ant Design `Popover` | Click to expand |
| `reversibility` | `Tag` with icon | SyncOutlined | Reversibility indicator |
### Visualization Recommendations
1. **Real-time Updates**: Use WebSocket or SSE for live synthesis.json updates
2. **Responsive Layout**: Card grid → stacked on mobile
3. **Dark/Light Theme**: CSS variables for theme switching
4. **Export**: Generate Markdown via template, HTML via React-to-static
5. **i18n Toggle**: Language switch button in header, read `en`/`zh` from I18nLabel

View File

@@ -0,0 +1,421 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Multi-CLI Discussion Artifact Schema",
"description": "Visualization-friendly output for multi-CLI collaborative discussion agent",
"type": "object",
"required": ["metadata", "discussionTopic", "relatedFiles", "planning", "decision", "decisionRecords"],
"properties": {
"metadata": {
"type": "object",
"required": ["artifactId", "roundId", "timestamp", "contributingAgents"],
"properties": {
"artifactId": {
"type": "string",
"description": "Unique ID for this artifact (e.g., 'MCP-auth-refactor-2026-01-13-round-1')"
},
"roundId": {
"type": "integer",
"minimum": 1,
"description": "Discussion round number"
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "ISO 8601 timestamp"
},
"contributingAgents": {
"type": "array",
"items": {
"$ref": "#/definitions/AgentIdentifier"
},
"description": "Agents that contributed to this artifact"
},
"durationSeconds": {
"type": "integer",
"description": "Total duration in seconds"
},
"exportFormats": {
"type": "array",
"items": {
"type": "string",
"enum": ["markdown", "html"]
},
"description": "Supported export formats"
}
}
},
"discussionTopic": {
"type": "object",
"required": ["title", "description", "status"],
"properties": {
"title": {
"$ref": "#/definitions/I18nLabel"
},
"description": {
"$ref": "#/definitions/I18nLabel"
},
"scope": {
"type": "object",
"properties": {
"included": {
"type": "array",
"items": { "$ref": "#/definitions/I18nLabel" },
"description": "What's in scope"
},
"excluded": {
"type": "array",
"items": { "$ref": "#/definitions/I18nLabel" },
"description": "What's explicitly out of scope"
}
}
},
"keyQuestions": {
"type": "array",
"items": { "$ref": "#/definitions/I18nLabel" },
"description": "Questions being explored"
},
"status": {
"type": "string",
"enum": ["exploring", "analyzing", "debating", "decided", "blocked"],
"description": "Discussion status"
},
"tags": {
"type": "array",
"items": { "type": "string" },
"description": "Tags for filtering (e.g., ['auth', 'security', 'api'])"
}
}
},
"relatedFiles": {
"type": "object",
"properties": {
"fileTree": {
"type": "array",
"items": { "$ref": "#/definitions/FileNode" },
"description": "File tree structure"
},
"dependencyGraph": {
"type": "array",
"items": { "$ref": "#/definitions/DependencyEdge" },
"description": "Dependency relationships"
},
"impactSummary": {
"type": "array",
"items": { "$ref": "#/definitions/FileImpact" },
"description": "File impact summary"
}
}
},
"planning": {
"type": "object",
"properties": {
"functional": {
"type": "array",
"items": { "$ref": "#/definitions/Requirement" },
"description": "Functional requirements"
},
"nonFunctional": {
"type": "array",
"items": { "$ref": "#/definitions/Requirement" },
"description": "Non-functional requirements"
},
"acceptanceCriteria": {
"type": "array",
"items": { "$ref": "#/definitions/AcceptanceCriterion" },
"description": "Acceptance criteria"
}
}
},
"decision": {
"type": "object",
"required": ["status", "confidenceScore"],
"properties": {
"status": {
"type": "string",
"enum": ["pending", "decided", "conflict"],
"description": "Decision status"
},
"summary": {
"$ref": "#/definitions/I18nLabel"
},
"selectedSolution": {
"$ref": "#/definitions/Solution"
},
"rejectedAlternatives": {
"type": "array",
"items": { "$ref": "#/definitions/RejectedSolution" }
},
"confidenceScore": {
"type": "number",
"minimum": 0,
"maximum": 1,
"description": "Confidence score (0.0 to 1.0)"
}
}
},
"decisionRecords": {
"type": "object",
"properties": {
"timeline": {
"type": "array",
"items": { "$ref": "#/definitions/DecisionEvent" },
"description": "Timeline of decision events"
}
}
},
"_internal": {
"type": "object",
"description": "Internal analysis data (for debugging)",
"properties": {
"cli_analyses": {
"type": "array",
"items": { "$ref": "#/definitions/CLIAnalysis" }
},
"cross_verification": {
"$ref": "#/definitions/CrossVerification"
},
"convergence": {
"$ref": "#/definitions/ConvergenceMetrics"
}
}
}
},
"definitions": {
"I18nLabel": {
"type": "object",
"required": ["en", "zh"],
"properties": {
"en": { "type": "string" },
"zh": { "type": "string" }
},
"description": "Multi-language label for UI display"
},
"AgentIdentifier": {
"type": "object",
"required": ["name", "id"],
"properties": {
"name": {
"type": "string",
"enum": ["Gemini", "Codex", "Qwen", "Human", "System"]
},
"id": { "type": "string" }
}
},
"FileNode": {
"type": "object",
"required": ["path", "type"],
"properties": {
"path": { "type": "string" },
"type": {
"type": "string",
"enum": ["file", "directory"]
},
"modificationStatus": {
"type": "string",
"enum": ["added", "modified", "deleted", "unchanged"]
},
"impactScore": {
"type": "string",
"enum": ["critical", "high", "medium", "low"]
},
"children": {
"type": "array",
"items": { "$ref": "#/definitions/FileNode" }
},
"codeSnippet": { "$ref": "#/definitions/CodeSnippet" }
}
},
"DependencyEdge": {
"type": "object",
"required": ["source", "target", "relationship"],
"properties": {
"source": { "type": "string" },
"target": { "type": "string" },
"relationship": { "type": "string" }
}
},
"FileImpact": {
"type": "object",
"required": ["filePath", "score", "reasoning"],
"properties": {
"filePath": { "type": "string" },
"line": { "type": "integer" },
"score": {
"type": "string",
"enum": ["critical", "high", "medium", "low"]
},
"reasoning": { "$ref": "#/definitions/I18nLabel" }
}
},
"CodeSnippet": {
"type": "object",
"required": ["startLine", "endLine", "code"],
"properties": {
"startLine": { "type": "integer" },
"endLine": { "type": "integer" },
"code": { "type": "string" },
"language": { "type": "string" },
"comment": { "$ref": "#/definitions/I18nLabel" }
}
},
"Requirement": {
"type": "object",
"required": ["id", "description", "priority"],
"properties": {
"id": { "type": "string" },
"description": { "$ref": "#/definitions/I18nLabel" },
"priority": {
"type": "string",
"enum": ["critical", "high", "medium", "low"]
},
"source": { "type": "string" }
}
},
"AcceptanceCriterion": {
"type": "object",
"required": ["id", "description", "isMet"],
"properties": {
"id": { "type": "string" },
"description": { "$ref": "#/definitions/I18nLabel" },
"isMet": { "type": "boolean" }
}
},
"Solution": {
"type": "object",
"required": ["id", "title", "description"],
"properties": {
"id": { "type": "string" },
"title": { "$ref": "#/definitions/I18nLabel" },
"description": { "$ref": "#/definitions/I18nLabel" },
"pros": {
"type": "array",
"items": { "$ref": "#/definitions/I18nLabel" }
},
"cons": {
"type": "array",
"items": { "$ref": "#/definitions/I18nLabel" }
},
"estimatedEffort": { "$ref": "#/definitions/I18nLabel" },
"risk": {
"type": "string",
"enum": ["critical", "high", "medium", "low"]
},
"affectedFiles": {
"type": "array",
"items": { "$ref": "#/definitions/FileImpact" }
},
"sourceCLIs": {
"type": "array",
"items": { "type": "string" }
}
}
},
"RejectedSolution": {
"allOf": [
{ "$ref": "#/definitions/Solution" },
{
"type": "object",
"required": ["rejectionReason"],
"properties": {
"rejectionReason": { "$ref": "#/definitions/I18nLabel" }
}
}
]
},
"DecisionEvent": {
"type": "object",
"required": ["eventId", "timestamp", "type", "contributor", "summary"],
"properties": {
"eventId": { "type": "string" },
"timestamp": {
"type": "string",
"format": "date-time"
},
"type": {
"type": "string",
"enum": ["proposal", "argument", "agreement", "disagreement", "decision", "reversal"]
},
"contributor": { "$ref": "#/definitions/AgentIdentifier" },
"summary": { "$ref": "#/definitions/I18nLabel" },
"evidence": {
"type": "array",
"items": { "$ref": "#/definitions/Evidence" }
},
"reversibility": {
"type": "string",
"enum": ["easily_reversible", "requires_refactoring", "irreversible"]
}
}
},
"Evidence": {
"type": "object",
"required": ["type", "content", "description"],
"properties": {
"type": {
"type": "string",
"enum": ["link", "code_snippet", "log_output", "benchmark", "reference"]
},
"content": {},
"description": { "$ref": "#/definitions/I18nLabel" }
}
},
"CLIAnalysis": {
"type": "object",
"required": ["tool", "perspective", "feasibility_score"],
"properties": {
"tool": {
"type": "string",
"enum": ["gemini", "codex", "qwen"]
},
"perspective": { "type": "string" },
"feasibility_score": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"findings": {
"type": "array",
"items": { "type": "string" }
},
"implementation_approaches": { "type": "array" },
"technical_concerns": {
"type": "array",
"items": { "type": "string" }
},
"code_locations": {
"type": "array",
"items": { "$ref": "#/definitions/FileImpact" }
}
}
},
"CrossVerification": {
"type": "object",
"properties": {
"agreements": {
"type": "array",
"items": { "type": "string" }
},
"disagreements": {
"type": "array",
"items": { "type": "string" }
},
"resolution": { "type": "string" }
}
},
"ConvergenceMetrics": {
"type": "object",
"properties": {
"score": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"new_insights": { "type": "boolean" },
"recommendation": {
"type": "string",
"enum": ["continue", "converged", "user_input_needed"]
}
}
}
}
}