SuperAPI AI Directory

research

Writing & research

View repository

Updated 10-16 01:16

About this skill

Multi-Agent Research v3.2.0

CT mode detection → Multi-perspective parallel research → Cross-validation → CT compliance check → Intelligent aggregation → Memory archive (auto commit)

Automation Mechanisms

⚡ This skill has integrated Claude Code Hooks

  • Action logging, state tracking, and git commit are all handled automatically by hooks
  • Only CP1 initialization needs to be executed; the remaining checkpoints run automatically

Usage

/multi-research [研究主題]
/multi-research AI Agent 架構設計模式 --deep
/multi-research --ct experiment "Multi-CT Pipeline 是否能降低 agent drift?"
/multi-research --no-ct "只要快速草稿"

Flags: --perspectives N | --quick | --deep | --ct off|lite|strict|experiment | --no-ct | --no-memory

CT Mode (Built-in)

/multi-research will execute the CT Escalation Router before starting, autonomously selecting the CT mode.

Mode Trigger Scenarios Additional Artifacts
off User explicitly --no-ct or --ct off None
lite Default; general research, comparison, direction organization evidence / uncertainty / drift guard
strict Architecture, risk, product, technical decisions, agent/memory/tool policy ct-stack.yaml、ct-compliance.md、risk-policy.yaml
experiment Papers, experiments, benchmark, evaluation, hypothesis, reproducible verification strict artifacts + hypotheses.yaml、experiment-plan.md、eval-rubric.yaml、failure-modes.md

Automatic Rules:

  • Defaults to lite。
  • --deep will raise the minimum mode to strict。
  • When requirements such as papers, experiments, benchmark, evaluation, hypothesis, variables, control groups, etc. are detected, escalate to experiment。
  • Detecting "quick", "rough first", "doesn't need too much detail" will downgrade, unless the user explicitly requests experiment.
  • User override always takes precedence.

→ Router:shared/ct/escalation-router.md → Rules:shared/ct/escalation-rules.yaml

Default 4 Perspectives

ID Name Model Focus
architecture Architecture Analyst sonnet System structure, design patterns
cognitive Cognitive Researcher sonnet Methodology, thinking frameworks
workflow Workflow Design haiku Execution flow, integration strategy
industry Industry Practice haiku Existing frameworks, best practices

→ Model routing configuration:shared/config/model-routing.yaml

Execution Flow

CP1: 工作流初始化 ⚡ 手動執行
    python scripts/hooks/init_workflow.py --topic "{topic}" --stage RESEARCH
    ↓
Phase 0: CT Escalation Router → 偵測 ct_mode、理由、信心度
    ├── 檢查 user override: --ct / --no-ct
    ├── 依規則計分: lite / strict / experiment
    ├── 套用 downgrade guard: 快速 / 粗略 / 不用太詳細
    └── 寫入 meta.yaml: ct_detection
    ↓
Phase 1: 北極星錨定 → 定義研究目標、成功標準
    ↓
Phase 2: Memory 搜尋 → 避免重複研究
    ↓
Phase 3: 視角分解 → 為每視角生成專屬 prompt + CT envelope
    ↓
Phase 4: MAP(並行研究)✅ 自動追蹤
    ┌──────────┬──────────┬──────────┬──────────┐
    │架構分析師│認知研究員│工作流設計│業界實踐  │
    └──────────┴──────────┴──────────┴──────────┘
    [CP2/CP3 由 hooks 自動處理 Agent 狀態追蹤]

    ⚠️ **並行執行關鍵**:
       在單一訊息中發送 4 個 Task 工具呼叫:
       - Task({description: "架構視角", ...})
       - Task({description: "認知視角", ...})
       - Task({description: "工作流視角", ...})
       - Task({description: "業界視角", ...})
       這樣才能真正並行執行!

    ⚠️ **強制**:每個 Agent 必須在完成前執行:
       1. mkdir -p .claude/memory/research/{topic-id}/perspectives/
       2. Write → .claude/memory/research/{topic-id}/perspectives/{perspective_id}.md
       未執行 Write = 任務失敗,工作流中止
    ↓
Phase 5: REDUCE(交叉驗證 + CT compliance + 匯總)
    ↓
Phase 6: Memory 存檔 → 品質閘門檢查 → 存儲報告
    ↓
CP4: Task Commit ✅ 自動執行
    [寫入 .claude/memory/ 時自動 git commit]

CP4: Task Commit ✅ Automatic

Handled automatically by the post_write.py hook

When the Write tool writes to the .claude/memory/ directory, the hook will automatically:

  1. git add .claude/memory/research/{topic-id}/
  2. git commit -m "docs(research): complete {topic} research"
  3. Log action to actions.jsonl

→ Hook configuration:.claude/settings.local.json.template → Protocol:shared/checkpoints/mandatory-checkpoints.md

Quality Gates

Pass conditions (RESEARCH phase):

  • ✅ At least 2 perspectives reach consensus
  • ✅ No unresolved critical contradictions
  • ✅ Quality score ≥ 70
  • ✅ CT-lite and above require evidence / uncertainty / drift guard to be marked
  • ✅ CT-strict and above must not have HIGH CT violations
  • ✅ CT-experiment requires producing testable hypotheses and experimental design

→ Gate configuration:shared/quality/gates.yaml

Early Termination

When consensus_rate >= 0.9 , conflict resolution can be skipped.

→ Configuration:shared/config/early-termination.yaml

Context7 Integration

When tech stack keywords (react, vue, fastapi, etc.) are automatically detected, query the latest documentation.

→ Configuration:shared/integration/context7.yaml

Output Structure

.claude/memory/research/[topic-id]/
├── meta.yaml           # 元數據,包含 ct_detection
├── ct-stack.yaml       # CT-strict / experiment 產出
├── ct-compliance.md    # CT-strict / experiment 產出
├── risk-policy.yaml    # CT-strict / experiment 產出
├── hypotheses.yaml     # CT-experiment 產出
├── experiment-plan.md  # CT-experiment 產出
├── eval-rubric.yaml    # CT-experiment 產出
├── failure-modes.md    # CT-experiment 產出
├── perspectives/       # 完整視角報告(MAP 產出,保留)
│   ├── architecture.md
│   ├── cognitive.md
│   ├── workflow.md
│   └── industry.md
├── summaries/          # 結構化摘要(REDUCE 產出,供快速查閱)
│   ├── architecture.yaml
│   ├── cognitive.yaml
│   ├── workflow.yaml
│   └── industry.yaml
├── synthesis.md        # 匯總報告(主輸出)
└── metrics.yaml        # 階段指標

⚠️ perspectives/ stores the complete report, summaries/ stores the structured summary; both must be retained.

Agent Capability Limitations

Perspective Agents should not open Task:

Allowed Operations Description
✅ Read Read files
✅ Glob/Grep Search files and content
✅ Explore agent Lightweight exploration
✅ Bash Execute commands
✅ WebFetch Fetch web pages
✅ Write Write reports
❌ Task Spawn sub-Agents

Web Fetch Strategy

When web pages need to be fetched, use the following order:

  1. Prefer WebFetch - Fast, lightweight
  2. If WebFetch fails, use Chrome:
    a. mcp__claude-in-chrome__tabs_create_mcp → 建立新分頁
    b. mcp__claude-in-chrome__navigate → 導航到 URL
    c. mcp__claude-in-chrome__get_page_text → 讀取內容
    
  3. If it still fails, log the URL for manual handling

Action Log ✅ Automatic

Handled automatically by Claude Code Hooks

Tool calls are automatically logged to .claude/workflow/{workflow-id}/logs/actions.jsonl。

Automatically logged tools:

Tool Triggered Hook Logged content
Task pre_task.py / post_task.py Agent start/completion status
Write post_write.py File paths, Memory commit

Troubleshoot issues:

# 查看 RESEARCH 階段所有失敗行動
jq 'select(.stage == "RESEARCH" and .status == "failed")' \
  .claude/workflow/{workflow-id}/logs/actions.jsonl

# 查看特定視角 Agent 的行動
jq 'select(.agent_id == "architecture")' \
  .claude/workflow/{workflow-id}/logs/actions.jsonl

# 查看即時狀態
cat .claude/workflow/{workflow-id}/current.json | jq .

→ Hook script:scripts/hooks/ → Logging spec:shared/communication/execution-logs.md

Shared modules

Module Purpose
ct/escalation-router.md CT mode auto-detection
ct/escalation-rules.yaml CT upgrade/downgrade rules
02-ct-mode/lite.md CT-lite envelope
02-ct-mode/strict.md CT-strict envelope
02-ct-mode/experiment.md CT-experiment envelope
02-ct-mode/compliance.md CT compliance rules
coordination/map-phase.md Parallel coordination
coordination/reduce-phase.md Aggregation and integration, large file handling
synthesis/cross-validation.md Cross-validation
quality/gates.yaml Quality gate
config/model-routing.yaml Model routing

Workflow position

RESEARCH → PLAN → TASKS → IMPLEMENT → REVIEW → VERIFY
   ↑
  你在這裡

Research results can be referenced by the plan skill as input for planning.