Files
Claude-Code-Workflow/.ccw/workflows/cli-templates/protocols/analysis-protocol.md
catlog22 3b92bfae8c feat: add Discuss and Explore subagents for dynamic critique and code exploration
- Implement Discuss Subagent for multi-perspective critique with dynamic perspectives.
- Create Explore Subagent for shared codebase exploration with centralized caching.
- Add tests for CcwToolsMcpCard component to ensure enabled tools are preserved on config save.
- Introduce SessionPreviewPanel component for previewing and selecting sessions for Memory V2 extraction.
- Develop CommandCreateDialog component for creating/importing commands with import and CLI generate modes.
2026-02-27 17:25:52 +08:00

3.6 KiB

Analysis Mode Protocol

Mode Definition

Mode: analysis (READ-ONLY)

Prompt Structure

PURPOSE: [development goal]
TASK: [specific implementation task]
MODE: [auto|write]
CONTEXT: [file patterns]
EXPECTED: [deliverables]
RULES: [templates | additional constraints]

Operation Boundaries

ALLOWED Operations

  • READ: All CONTEXT files and analyze content
  • ANALYZE: Code patterns, architecture, dependencies
  • GENERATE: Text output, insights, recommendations
  • DOCUMENT: Analysis results in output response only

FORBIDDEN Operations

  • NO FILE CREATION: Cannot create any files on disk
  • NO FILE MODIFICATION: Cannot modify existing files
  • NO FILE DELETION: Cannot delete any files
  • NO DIRECTORY OPERATIONS: Cannot create/modify directories

CRITICAL: Absolutely NO file system operations - OUTPUT ONLY

Execution Flow

  1. Load Project Specs - MANDATORY first step: run ccw spec load to retrieve project specifications and constraints before any analysis. Adapt analysis scope and standards based on loaded specs
  2. Parse all 6 fields (PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES)
  3. Read and analyze CONTEXT files thoroughly
  4. Identify patterns, issues, and dependencies
  5. Generate insights and recommendations
  6. Validate EXPECTED deliverables met
  7. Output structured analysis (text response only)

Core Requirements

ALWAYS:

  • Run ccw spec load FIRST to obtain project specifications before starting any work
  • Analyze ALL CONTEXT files completely
  • Apply RULES (templates + constraints) exactly
  • Provide code evidence with file:line references
  • List all related/analyzed files at output beginning
  • Match EXPECTED deliverables precisely

NEVER:

  • Assume behavior without code verification
  • Ignore CONTEXT file patterns
  • Skip RULES or templates
  • Make unsubstantiated claims
  • Create/modify/delete any files

RULES Processing

  • Parse RULES field to extract template content and constraints
  • Recognize | as separator: template content | additional constraints
  • Apply ALL template guidelines as mandatory
  • Treat rule violations as task failures

Error Handling

File Not Found: Report missing files, continue with available, note in output Invalid CONTEXT Pattern: Report invalid pattern, request correction, do not guess

Quality Standards

  • Thoroughness: Analyze ALL files, check cross-file patterns, quantify metrics
  • Evidence-Based: Quote code with file:line, link patterns, support claims with examples
  • Actionable: Clear recommendations, prioritized by impact, incremental changes

Output Format

Format Priority

If template defines output format → Follow template format EXACTLY

If template has no format → Use default format below

Default Analysis Output

# Analysis: [TASK Title]

## Related Files
- `path/to/file1.ext` - [Brief description of relevance]
- `path/to/file2.ext` - [Brief description of relevance]

## Summary
[2-3 sentence overview]

## Key Findings
1. [Finding] - path/to/file:123
2. [Finding] - path/to/file:456

## Detailed Analysis
[Evidence-based analysis with code quotes]

## Recommendations
1. [Actionable recommendation]
2. [Actionable recommendation]

Code References

Format: path/to/file:line_number Example: src/auth/jwt.ts:45 - Authentication uses deprecated algorithm

Quality Checklist

  • All CONTEXT files analyzed
  • Code evidence with file:line references
  • Specific, actionable recommendations
  • No unsubstantiated claims
  • EXPECTED deliverables met