pi-maestro-flow 0.2.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 (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,511 @@
1
+ ---
2
+ name: scholar-rebuttal-pro
3
+ description: "Enhanced academic paper review response workflow with Agy/CLI collaborative analysis and multi-perspective discussion. Produces structured rebuttal documents with evidence-based strategies. Triggers on \"rebuttal\", \"respond to reviewers\", \"review response\", \"审稿回复\"."
4
+ allowed-tools: Task AskUserQuestion TodoWrite Read Write Edit Bash Glob Grep Skill mcp__ace-tool__search_context mcp__ccw-tools__read_file mcp__ccw-tools__edit_file
5
+ ---
6
+
7
+ # Scholar Rebuttal Pro
8
+
9
+ Enhanced academic paper review response workflow combining Agy/CLI collaborative analysis with multi-perspective discussion. Produces structured, evidence-based rebuttal documents optimized for conference-specific requirements.
10
+
11
+ ## Pre-load (before execution)
12
+
13
+ 1. **Codebase docs**: If `.workflow/codebase/ARCHITECTURE.md` exists, read for project context
14
+ 2. **Specs**: `maestro load --type spec --category coding` — load coding conventions
15
+ 3. **Wiki knowledge**: `maestro search "academic writing research paper" --json` — top 5 entries as prior context
16
+ 4. All optional — proceed without if unavailable
17
+
18
+ ## Architecture Overview
19
+
20
+ ```
21
+ ┌─────────────────────────────────────────────────────────────────┐
22
+ │ Scholar Rebuttal Pro Orchestrator (SKILL.md) │
23
+ │ → Pure coordinator: Execute phases, parse outputs, pass context │
24
+ │ → Optional: --session <session-id> for WFS session integration │
25
+ └───────────────────────┬─────────────────────────────────────────┘
26
+
27
+ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐
28
+ │ Phase 1 │ │ Phase 2 │ │ Phase 3 │ │ Phase 4 │ │ Phase 5 │ │ Step 6 │
29
+ │ Review │ │ Multi- │ │Strategy │ │Rebuttal │ │ Quality │ │Session │
30
+ │ Parsing │ │Perspect │ │Formula │ │ Writing │ │Validat │ │Finalize │
31
+ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘ └─────────┘
32
+ reviewA discussion strategy rebuttal quality git commit
33
+ nalysis Consensus Matrix Draft Score + register
34
+ ```
35
+
36
+ ## Key Design Principles
37
+
38
+ 1. **CLI-Assisted Analysis**: Leverage Agy CLI for semantic analysis, evidence gathering, and quality validation
39
+ 2. **Multi-Perspective Discussion**: Simulate author/reviewer/expert viewpoints to develop robust strategies
40
+ 3. **Evidence-Based Responses**: Link every response to paper content or experimental evidence
41
+ 4. **Conference-Agnostic Templates**: Support extensible template system for different venues
42
+ 5. **Progressive Disclosure**: Load phase documents on-demand to manage context window
43
+
44
+ ## Interactive Preference Collection
45
+
46
+ Collect workflow preferences via AskUserQuestion before dispatching to phases:
47
+
48
+ ```javascript
49
+ const prefResponse = AskUserQuestion({
50
+ questions: [
51
+ {
52
+ question: "是否跳过所有确认步骤(自动模式)?",
53
+ header: "Auto Mode",
54
+ multiSelect: false,
55
+ options: [
56
+ { label: "Interactive (Recommended)", description: "交互模式,每阶段后确认" },
57
+ { label: "Auto", description: "跳过所有确认,自动执行" }
58
+ ]
59
+ },
60
+ {
61
+ question: "论文内容来源?(用于策略制定时查找支撑证据)",
62
+ header: "Paper Source",
63
+ multiSelect: false,
64
+ options: [
65
+ { label: "Provide Path", description: "指定论文 PDF/LaTeX 路径" },
66
+ { label: "Current Directory", description: "自动搜索当前目录" },
67
+ { label: "Review Only", description: "仅基于审稿意见回复" }
68
+ ]
69
+ },
70
+ {
71
+ question: "目标会议类型?(影响模板和策略选择)",
72
+ header: "Conference",
73
+ multiSelect: false,
74
+ options: [
75
+ { label: "ML Conferences", description: "NeurIPS/ICML/ICLR" },
76
+ { label: "CV Conferences", description: "CVPR/ECCV/ICCV" },
77
+ { label: "NLP Conferences", description: "ACL/EMNLP" },
78
+ { label: "Generic", description: "通用模板" }
79
+ ]
80
+ }
81
+ ]
82
+ })
83
+
84
+ // Derive workflowPreferences from user selection
85
+ workflowPreferences = {
86
+ autoYes: prefResponse["Auto Mode"] === "Auto",
87
+ paperSource: prefResponse["Paper Source"],
88
+ conferenceType: prefResponse["Conference"]
89
+ }
90
+ ```
91
+
92
+ **workflowPreferences** is passed to phase execution as context variable.
93
+ Phases reference as `workflowPreferences.autoYes`, `workflowPreferences.paperSource`, etc.
94
+
95
+ ## Auto Mode Defaults
96
+
97
+ When `workflowPreferences.autoYes === true`:
98
+ - Skip confirmation after each phase
99
+ - Use recommended strategies from multi-perspective discussion
100
+ - Apply default conference template (Generic)
101
+ - Auto-proceed to quality validation
102
+
103
+ ## Execution Flow
104
+
105
+ > **⚠️ COMPACT DIRECTIVE**: Context compression MUST check TodoWrite phase status.
106
+ > The phase currently marked `in_progress` is the active execution phase — preserve its FULL content.
107
+ > Only compress phases marked `completed` or `pending`.
108
+
109
+ ```
110
+ Input Parsing:
111
+ └─ Convert user input to structured format (reviewCommentsPath + paperPath + conferenceType)
112
+ └─ Parse --session flag → resolve output_base (session: {sessionDir}/rebuttal/ | default: .)
113
+
114
+ Phase 1: Review Parsing & Classification
115
+ └─ Ref: phases/01-review-parsing.md
116
+ ├─ Tasks attached: Parse reviewer comments structure → Classify comments using Agy CLI → Extract sentiment and key concerns → Generate review-analysis.json
117
+ └─ Output: reviewAnalysis, commentCategories, ${output_base}/review-analysis.json, ${output_base}/comment-classification.md
118
+
119
+ Phase 2: Multi-Perspective Discussion
120
+ └─ Ref: phases/02-multi-perspective-discussion.md
121
+ ├─ Tasks attached: Author perspective: effective response strategies → Reviewer perspective: persuasive arguments → Expert perspective: technical accuracy and academic norms → Synthesize consensus strategies
122
+ └─ Output: discussionConsensus, strategicRecommendations, ${output_base}/discussion-log.md, ${output_base}/consensus-strategies.json
123
+
124
+ Phase 3: Strategy Formulation
125
+ └─ Ref: phases/03-strategy-formulation.md
126
+ ├─ Tasks attached: Map comments to response strategies → Search paper content for evidence using CLI → Identify gaps requiring new experiments → Generate strategy matrix
127
+ └─ Output: strategyMatrix, evidenceMap, ${output_base}/strategy-matrix.md, ${output_base}/evidence-references.json
128
+
129
+ Phase 4: Rebuttal Writing
130
+ └─ Ref: phases/04-rebuttal-writing.md
131
+ ├─ Tasks attached: Apply conference-specific template → Write point-by-point responses → Integrate evidence and citations → Optimize professional tone
132
+ └─ Output: rebuttalDraft, rebuttal.md, ${output_base}/rebuttal-draft-v1.md
133
+
134
+ Phase 5: Quality Validation
135
+ └─ Ref: phases/05-quality-validation.md
136
+ ├─ Tasks attached: Check completeness (all comments addressed) → Assess professionalism and tone → Evaluate persuasiveness and evidence strength → Generate improvement recommendations
137
+ └─ Output: qualityScore, improvements, ${output_base}/quality-report.md, ${output_base}/improvement-suggestions.json
138
+
139
+ Step 6: Session Finalization (only when --session provided)
140
+ └─ Git commit artifacts → Register in context/index.json
141
+ ├─ Tasks: git add rebuttal/ → git commit → register artifacts in index.json
142
+ └─ Output: commit hash, updated index.json
143
+
144
+ Return:
145
+ └─ Summary with recommended next steps
146
+ ```
147
+
148
+ **Phase Reference Documents** (read on-demand when phase executes):
149
+
150
+ | Phase | Document | Purpose | Compact |
151
+ |-------|----------|---------|---------|
152
+ | 1 | [phases/01-review-parsing.md](phases/01-review-parsing.md) | Parse reviewer comments, classify by type (Major/Minor/Typo/Misunderstanding), extract key concerns using Agy CLI semantic analysis | TodoWrite 驱动 |
153
+ | 2 | [phases/02-multi-perspective-discussion.md](phases/02-multi-perspective-discussion.md) | Simulate discussion from author, reviewer, and domain expert perspectives to develop consensus strategies | TodoWrite 驱动 + 🔄 sentinel |
154
+ | 3 | [phases/03-strategy-formulation.md](phases/03-strategy-formulation.md) | Select response strategies (Accept/Defend/Clarify/Experiment) based on discussion, analyze paper content for supporting evidence using CLI | TodoWrite 驱动 + 🔄 sentinel |
155
+ | 4 | [phases/04-rebuttal-writing.md](phases/04-rebuttal-writing.md) | Generate structured rebuttal document using rebuttal-writer agent, apply conference-specific templates, optimize tone | TodoWrite 驱动 + 🔄 sentinel |
156
+ | 5 | [phases/05-quality-validation.md](phases/05-quality-validation.md) | Validate rebuttal quality using Agy CLI: completeness, professionalism, persuasiveness, generate improvement suggestions | TodoWrite 驱动 |
157
+
158
+ **Compact Rules**:
159
+ 1. **TodoWrite `in_progress`** → 保留完整内容,禁止压缩
160
+ 2. **TodoWrite `completed`** → 可压缩为摘要
161
+ 3. **🔄 sentinel fallback** → 带此标记的 phase 包含 compact sentinel;若 compact 后仅存 sentinel 而无完整 Step 协议,必须立即 `Read()` 恢复
162
+
163
+ ## Core Rules
164
+
165
+ 1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 execution
166
+ 2. **No Preliminary Analysis**: Do not read files or gather context before Phase 1
167
+ 3. **Parse Every Output**: Extract required data from each phase for next phase
168
+ 4. **Auto-Continue**: Check TodoList status to execute next pending phase automatically
169
+ 5. **Track Progress**: Update TodoWrite dynamically with task attachment/collapse pattern
170
+ 6. **Progressive Phase Loading**: Read phase docs ONLY when that phase is about to execute
171
+ 7. **DO NOT STOP**: Continuous multi-phase workflow until all phases complete
172
+ 8. **CLI Integration**: Use `ccw cli --tool agy --mode analysis` for semantic analysis tasks
173
+ 9. **Evidence Linking**: Every response strategy must link to paper content or experimental evidence
174
+
175
+ ## Input Processing
176
+
177
+ User provides review comments in one of these formats:
178
+
179
+ 1. **File path**: `reviews.txt`, `reviewer-comments.md`, `reviews.pdf`
180
+ 2. **Inline text**: Paste reviewer comments directly
181
+ 3. **Structured JSON**: Pre-parsed review structure
182
+
183
+ **Optional flag**: `--session <session-id>` to integrate with WFS session.
184
+
185
+ ### Session Resolution
186
+
187
+ ```javascript
188
+ // Parse --session flag from $ARGUMENTS
189
+ const sessionMatch = $ARGUMENTS.match(/--session\s+(\S+)/);
190
+
191
+ if (sessionMatch) {
192
+ const sessionId = sessionMatch[1];
193
+ // Resolve session directory (follows paper:assemble pattern)
194
+ const sessionDir = `.workflow/${sessionId}`;
195
+
196
+ // Validate session exists
197
+ if (!fs.existsSync(`${sessionDir}/session.json`)) {
198
+ error(`Session not found: ${sessionDir}. Run /session:start first.`);
199
+ }
200
+
201
+ // Create rebuttal subdirectory if it doesn't exist
202
+ // mkdir -p ${sessionDir}/rebuttal/
203
+ const output_base = `${sessionDir}/rebuttal`;
204
+
205
+ // Remove --session flag from arguments before further parsing
206
+ const cleanArgs = $ARGUMENTS.replace(/--session\s+\S+/, '').trim();
207
+ } else {
208
+ // No session: use current working directory (backward-compatible default)
209
+ const output_base = '.';
210
+ const sessionDir = null;
211
+ const cleanArgs = $ARGUMENTS;
212
+ }
213
+ ```
214
+
215
+ ### Structured Input
216
+
217
+ Convert to structured format:
218
+
219
+ ```javascript
220
+ const structuredInput = {
221
+ reviewCommentsPath: <path or inline text>,
222
+ paperPath: workflowPreferences.paperSource === "Provide Path" ? <user-provided> : <auto-discovered>,
223
+ conferenceType: workflowPreferences.conferenceType,
224
+ autoMode: workflowPreferences.autoYes,
225
+ sessionId: sessionMatch ? sessionMatch[1] : null,
226
+ sessionDir: sessionDir,
227
+ output_base: output_base // All phase outputs use this base path
228
+ }
229
+ ```
230
+
231
+ ## Data Flow
232
+
233
+ ```
234
+ User Input (review comments + paper path + conference type [+ --session <session-id>])
235
+ |
236
+ [Session Resolution]
237
+ | sessionDir = --session provided ? .workflow/{session-id}/ : null
238
+ | output_base = sessionDir ? {sessionDir}/rebuttal/ : .
239
+ | mkdir -p ${output_base}
240
+ |
241
+ [Convert to Structured Format]
242
+ |
243
+ Phase 1: Review Parsing & Classification
244
+ | Input: reviewCommentsPath + conferenceType
245
+ | Output: reviewAnalysis + commentCategories
246
+ | Files: ${output_base}/review-analysis.json, ${output_base}/comment-classification.md
247
+ |
248
+ Phase 2: Multi-Perspective Discussion
249
+ | Input: reviewAnalysis + commentCategories
250
+ | Output: discussionConsensus + strategicRecommendations
251
+ | Files: ${output_base}/discussion-log.md, ${output_base}/consensus-strategies.json
252
+ |
253
+ Phase 3: Strategy Formulation
254
+ | Input: discussionConsensus + strategicRecommendations + paperPath
255
+ | Output: strategyMatrix + evidenceMap
256
+ | Files: ${output_base}/strategy-matrix.md, ${output_base}/evidence-references.json
257
+ |
258
+ Phase 4: Rebuttal Writing
259
+ | Input: strategyMatrix + evidenceMap + conferenceType
260
+ | Output: rebuttalDraft
261
+ | Files: ${output_base}/rebuttal-draft-v1.md
262
+ |
263
+ Phase 5: Quality Validation
264
+ | Input: rebuttalDraft
265
+ | Output: qualityScore + improvements
266
+ | Files: ${output_base}/quality-report.md, ${output_base}/improvement-suggestions.json
267
+ |
268
+ Step 6: Session Finalization (only when --session provided)
269
+ | Git commit all artifacts in session repo
270
+ | Register artifacts in {sessionDir}/context/index.json
271
+ |
272
+ Return summary to user
273
+ ```
274
+
275
+ ## TodoWrite Pattern
276
+
277
+ **Core Concept**: Dynamic task attachment and collapse for real-time visibility.
278
+
279
+ ### Key Principles
280
+
281
+ 1. **Task Attachment** (when phase executed):
282
+ - Sub-tasks are **attached** to orchestrator's TodoWrite
283
+ - **Phase 1, 2, 3, 4, 5**: Multiple sub-tasks attached
284
+
285
+ 2. **Task Collapse** (after sub-tasks complete):
286
+ - **Applies to Phase 1, 2, 3, 4, 5**: Remove sub-tasks, collapse to summary
287
+ - Maintains clean orchestrator-level view
288
+
289
+ 3. **Continuous Execution**: After completion, automatically proceed to next phase
290
+
291
+ ### Phase 1 (Tasks Attached):
292
+ ```json
293
+ [
294
+ {"content": "Phase 1: Review Parsing & Classification", "status": "in_progress"},
295
+ {"content": " → Parse reviewer comments structure", "status": "in_progress"},
296
+ {"content": " → Classify comments using Agy CLI", "status": "pending"},
297
+ {"content": " → Extract sentiment and key concerns", "status": "pending"},
298
+ {"content": " → Generate review-analysis.json", "status": "pending"},
299
+ {"content": "Phase 2: Multi-Perspective Discussion", "status": "pending"},
300
+ {"content": "Phase 3: Strategy Formulation", "status": "pending"},
301
+ {"content": "Phase 4: Rebuttal Writing", "status": "pending"},
302
+ {"content": "Phase 5: Quality Validation", "status": "pending"},
303
+ {"content": "Step 6: Session Finalization (if --session)", "status": "pending"}
304
+ ]
305
+ ```
306
+
307
+ ### Phase 1 (Collapsed):
308
+ ```json
309
+ [
310
+ {"content": "Phase 1: Review Parsing & Classification", "status": "completed"},
311
+ {"content": "Phase 2: Multi-Perspective Discussion", "status": "pending"},
312
+ {"content": "Phase 3: Strategy Formulation", "status": "pending"},
313
+ {"content": "Phase 4: Rebuttal Writing", "status": "pending"},
314
+ {"content": "Phase 5: Quality Validation", "status": "pending"},
315
+ {"content": "Step 6: Session Finalization (if --session)", "status": "pending"}
316
+ ]
317
+ ```
318
+
319
+ ## Post-Phase Updates
320
+
321
+ After each phase completes:
322
+
323
+ 1. **Phase 1 → Phase 2**: Pass `reviewAnalysis` and `commentCategories` to discussion phase
324
+ 2. **Phase 2 → Phase 3**: Pass `discussionConsensus` and `strategicRecommendations` to strategy formulation
325
+ 3. **Phase 3 → Phase 4**: Pass `strategyMatrix` and `evidenceMap` to rebuttal writing
326
+ 4. **Phase 4 → Phase 5**: Pass `rebuttalDraft` to quality validation
327
+ 5. **Phase 5 → Return**: Present quality report and improvement suggestions to user
328
+
329
+ ## Error Handling
330
+
331
+ - **Parsing Failure**: If output parsing fails, retry once, then report error
332
+ - **Validation Failure**: Report which file/data is missing
333
+ - **Command Failure**: Keep phase `in_progress`, report error, do not proceed
334
+ - **CLI Failure**: If Agy CLI fails, fall back to direct analysis or report error
335
+ - **Paper Not Found**: If paper path invalid, proceed with review-only mode
336
+
337
+ ## Coordinator Checklist
338
+
339
+ **Before Phase 1**:
340
+ - [ ] TodoWrite initialized with all 5 phases
341
+ - [ ] User preferences collected (autoMode, paperSource, conferenceType)
342
+ - [ ] Review comments path validated
343
+ - [ ] Paper path validated (if provided)
344
+
345
+ **Between Phases**:
346
+ - [ ] Previous phase marked `completed`
347
+ - [ ] Current phase marked `in_progress`
348
+ - [ ] Output variables extracted and passed to next phase
349
+ - [ ] Sub-tasks collapsed to summary
350
+
351
+ **After Phase 5**:
352
+ - [ ] All phases marked `completed`
353
+ - [ ] Quality report generated
354
+ - [ ] Improvement suggestions presented
355
+ - [ ] Final rebuttal.md file written
356
+
357
+ **Step 6 - Session Finalization** (only when `--session` was provided):
358
+ - [ ] All artifacts committed to git within session repo
359
+ - [ ] Artifacts registered in `{sessionDir}/context/index.json` with type `notes` and tag `rebuttal`
360
+ - [ ] Session `session.json` updated with rebuttal progress
361
+
362
+ ## Step 6: Session Finalization
363
+
364
+ > **Condition**: Only executes when `--session <session-id>` was provided. Skip entirely otherwise.
365
+
366
+ After Phase 5 completes, finalize the session integration:
367
+
368
+ ### 6.1 Git Commit Artifacts
369
+
370
+ ```bash
371
+ # Commit all rebuttal artifacts within the session
372
+ cd "${sessionDir}"
373
+ git add rebuttal/
374
+ git commit -m "feat(rebuttal): add rebuttal artifacts (review analysis, strategy, draft, quality report)"
375
+ ```
376
+
377
+ ### 6.2 Register Artifacts in Context Index
378
+
379
+ Register key rebuttal artifacts in `{sessionDir}/context/index.json` so other session commands can discover them.
380
+
381
+ ```javascript
382
+ // Read existing index
383
+ const indexPath = `${sessionDir}/context/index.json`;
384
+ const index = JSON.parse(Read(indexPath));
385
+
386
+ // Artifacts to register
387
+ const rebuttalArtifacts = [
388
+ {
389
+ id: `rebuttal_analysis_${Date.now()}`,
390
+ type: "notes",
391
+ description: "Review analysis and comment classification",
392
+ path: "rebuttal/review-analysis.json",
393
+ tags: ["rebuttal", "review-analysis"],
394
+ added_at: new Date().toISOString()
395
+ },
396
+ {
397
+ id: `rebuttal_strategy_${Date.now()}`,
398
+ type: "notes",
399
+ description: "Response strategy matrix with evidence mapping",
400
+ path: "rebuttal/strategy-matrix.md",
401
+ tags: ["rebuttal", "strategy"],
402
+ added_at: new Date().toISOString()
403
+ },
404
+ {
405
+ id: `rebuttal_draft_${Date.now()}`,
406
+ type: "notes",
407
+ description: "Rebuttal draft document",
408
+ path: "rebuttal/rebuttal-draft-v1.md",
409
+ tags: ["rebuttal", "draft"],
410
+ added_at: new Date().toISOString()
411
+ },
412
+ {
413
+ id: `rebuttal_quality_${Date.now()}`,
414
+ type: "notes",
415
+ description: "Rebuttal quality validation report",
416
+ path: "rebuttal/quality-report.md",
417
+ tags: ["rebuttal", "quality"],
418
+ added_at: new Date().toISOString()
419
+ }
420
+ ];
421
+
422
+ // Append to materials array and update statistics
423
+ index.materials.push(...rebuttalArtifacts);
424
+ index.statistics.total_materials = index.materials.length;
425
+ index.updated_at = new Date().toISOString();
426
+
427
+ // Update tag_index
428
+ for (const artifact of rebuttalArtifacts) {
429
+ for (const tag of artifact.tags) {
430
+ if (!index.tag_index[tag]) index.tag_index[tag] = [];
431
+ index.tag_index[tag].push(artifact.id);
432
+ }
433
+ }
434
+
435
+ Write(indexPath, JSON.stringify(index, null, 2));
436
+ ```
437
+
438
+ ### 6.3 Update Session Status
439
+
440
+ ```bash
441
+ jq --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" '
442
+ .progress.rebuttal = {
443
+ "status": "completed",
444
+ "artifacts_path": "rebuttal/",
445
+ "completed_at": $ts
446
+ }
447
+ ' "${sessionDir}/session.json" > temp.json
448
+ mv temp.json "${sessionDir}/session.json"
449
+
450
+ # Final commit with session metadata update
451
+ cd "${sessionDir}"
452
+ git add context/index.json session.json
453
+ git commit -m "chore(rebuttal): register artifacts in session index"
454
+ ```
455
+
456
+ ## Related Commands
457
+
458
+ **Prerequisites**:
459
+ - `/research-init` - Initialize research project structure
460
+ - `/zotero-review` - Import and review literature
461
+
462
+ **Follow-ups**:
463
+ - `/commit` - Commit rebuttal document to version control
464
+ - `/presentation` - Prepare conference presentation after acceptance
465
+ - `/poster` - Generate academic poster
466
+
467
+ ## CLI Integration Details
468
+
469
+ This skill uses `ccw cli` for enhanced analysis:
470
+
471
+ **Phase 1 - Review Parsing**:
472
+ ```bash
473
+ ccw cli -p "PURPOSE: Parse and classify reviewer comments by type (Major/Minor/Typo/Misunderstanding)
474
+ TASK: • Extract comment structure • Classify by severity • Identify sentiment
475
+ MODE: analysis
476
+ CONTEXT: @<review-file>
477
+ EXPECTED: JSON with classification results" --tool agy --mode analysis
478
+ ```
479
+
480
+ **Phase 2 - Multi-Perspective Discussion**:
481
+ Uses `team-ultra-analyze` skill or custom discussion agent to simulate multiple perspectives.
482
+
483
+ **Phase 3 - Strategy Formulation**:
484
+ ```bash
485
+ ccw cli -p "PURPOSE: Search paper content for evidence supporting response strategies
486
+ TASK: • Locate relevant sections • Extract supporting data • Identify evidence gaps
487
+ MODE: analysis
488
+ CONTEXT: @<paper-file>
489
+ EXPECTED: Evidence map with file:line references" --tool agy --mode analysis
490
+ ```
491
+
492
+ **Phase 5 - Quality Validation**:
493
+ ```bash
494
+ ccw cli -p "PURPOSE: Validate rebuttal quality (completeness, professionalism, persuasiveness)
495
+ TASK: • Check all comments addressed • Assess tone • Evaluate evidence strength
496
+ MODE: analysis
497
+ CONTEXT: @<rebuttal-file>
498
+ EXPECTED: Quality report with improvement suggestions" --tool agy --mode analysis
499
+ ```
500
+
501
+ ## Conference Template System
502
+
503
+ Templates are loaded from:
504
+ - **Built-in**: `G:\github_lib\claude-scholar\skills\review-response\references\`
505
+ - **Custom**: `d:\ccws\.workflow\参考文档1\` (user-provided)
506
+
507
+ Template selection based on `workflowPreferences.conferenceType`:
508
+ - **ML Conferences**: NeurIPS/ICML/ICLR strategies (novelty, theory, experiments)
509
+ - **CV Conferences**: CVPR/ECCV/ICCV strategies (visual results, one-page limit)
510
+ - **NLP Conferences**: ACL/EMNLP strategies (linguistic appropriateness, ethics)
511
+ - **Generic**: Universal template for all venues