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