The AI Pattern Analyzer now supports four analysis modes that let you balance speed and accuracy:
# Fast mode - Quick analysis of document start (default)
python analyze_ai_patterns.py document.md
# Adaptive mode - Intelligent sampling based on document size
python analyze_ai_patterns.py document.md --mode adaptive
# Sampling mode - Custom sampling strategy
python analyze_ai_patterns.py document.md --mode sampling --samples 10 --sample-size 3000
# Full mode - Complete document analysis (most accurate)
python analyze_ai_patterns.py document.md --mode full| Mode | Speed | Accuracy | Best For | Coverage |
|---|---|---|---|---|
| Fast | ⚡⚡⚡ Fastest | ⭐⭐ Basic | Quick checks, early drafts | ~2000 chars/dimension |
| Adaptive | ⚡⚡ Fast | ⭐⭐⭐ Good | Most documents, standard workflow | Adjusts to size |
| Sampling | ⚡ Medium | ⭐⭐⭐⭐ High | Large documents, custom needs | User-defined |
| Full | 🐌 Slowest | ⭐⭐⭐⭐⭐ Best | Final review, critical content | 100% |
When to Use:
- Quick sanity checks during writing
- Early draft reviews
- Rapid iteration on small changes
- CI/CD pipeline checks
How It Works:
- Analyzes first ~2000 characters per dimension
- Skips heavy computations
- Provides directional feedback
Example:
python analyze_ai_patterns.py draft.md
# or explicitly:
python analyze_ai_patterns.py draft.md --mode fastTypical Speed: 2-5 seconds for most documents
When to Use:
- Standard analysis workflow
- Medium to large documents (5k-100k words)
- When you want balanced speed and accuracy
- Most production use cases
How It Works:
- Documents < 5k chars: Full analysis
- Documents 5k-50k chars: 5 samples × 2000 chars
- Documents > 50k chars: 10 samples × 2000 chars
- Intelligently selects representative sections
Example:
python analyze_ai_patterns.py article.md --mode adaptiveTypical Speed: 5-15 seconds depending on document size
When to Use:
- Very large documents (100k+ words)
- Custom sampling requirements
- Performance tuning
- Specific section analysis
How It Works:
- You control the number of samples and sample size
- Choose sampling strategy (uniform, weighted, start, end)
- Optimizes for your specific needs
Example:
# Sample 8 sections of 5000 chars each
python analyze_ai_patterns.py large-doc.md --mode sampling --samples 8 --sample-size 5000
# Weighted sampling (favors start/end)
python analyze_ai_patterns.py book.md --mode sampling --samples 15 --strategy weightedSampling Strategies:
uniform: Even distribution across documentweighted: More samples from start/end (default)start: Focus on beginningend: Focus on conclusion
Typical Speed: 10-30 seconds depending on parameters
When to Use:
- Final manuscript review
- Critical content (academic, legal)
- Maximum accuracy requirements
- Benchmark/baseline analysis
How It Works:
- Analyzes entire document
- All dimensions at full depth
- Most comprehensive results
- No sampling or approximation
Example:
python analyze_ai_patterns.py final-manuscript.md --mode fullTypical Speed: 30-120+ seconds for large documents
Use this matrix to choose the right mode:
| Situation | Recommended Mode | Why |
|---|---|---|
| Writing first draft | Fast | Quick feedback loop |
| Reviewing edits | Adaptive | Balances speed and accuracy |
| Pre-submission check | Full | Maximum confidence |
| Large book chapter | Sampling | Efficient for large content |
| CI/CD pipeline | Fast or Adaptive | Speed matters |
| Academic paper | Full | Accuracy critical |
| Blog post | Fast or Adaptive | Sufficient for web content |
| Legal document | Full | Risk mitigation |
# Analyze multiple files with adaptive mode
python analyze_ai_patterns.py chapter-*.md --mode adaptive --batch
# Custom sampling for large batch
python analyze_ai_patterns.py *.md --mode sampling --samples 5 --batch --output results.tsv# Get detailed findings with full analysis
python analyze_ai_patterns.py manuscript.md --mode full --detailed
# Quick detailed check
python analyze_ai_patterns.py section.md --mode fast --detailed --output-format json# Optimization report with adaptive mode
python analyze_ai_patterns.py article.md --mode adaptive --scores
# Full accuracy dual score
python analyze_ai_patterns.py critical-doc.md --mode full --scoresHistory automatically tracks which mode was used:
# First iteration with full analysis
python analyze_ai_patterns.py draft.md --mode full --save-to-history
# Quick check with fast mode
python analyze_ai_patterns.py draft.md --mode fast --save-to-history
# View history with mode information
python analyze_ai_patterns.py draft.md --history-fullThe history report shows mode and analysis time for each iteration:
ITERATION 1: Initial baseline
Timestamp: 2025-01-15
Mode: FULL
Analysis Time: 45.3s
Quality: 72.0 / 100 (GOOD)
...
Preview what the analyzer will do without running analysis:
# See what fast mode will analyze
python analyze_ai_patterns.py large-doc.md --mode fast --dry-run
# Preview sampling strategy
python analyze_ai_patterns.py book.md --mode sampling --samples 10 --dry-runOutput shows:
- Mode selected
- Coverage statistics
- Dimensions that will be analyzed
- Estimated analysis time
Display detailed coverage information:
python analyze_ai_patterns.py document.md --mode adaptive --show-coverageOutput shows:
- Document size
- Characters analyzed
- Coverage percentage
- Mode-specific details
-
Use Fast Mode for iterations:
python analyze_ai_patterns.py draft.md --mode fast
-
Reduce sample count:
python analyze_ai_patterns.py large.md --mode sampling --samples 3
-
Use adaptive for automatic optimization:
python analyze_ai_patterns.py *.md --mode adaptive --batch
-
Use Full Mode for final checks:
python analyze_ai_patterns.py final.md --mode full
-
Increase sampling for large documents:
python analyze_ai_patterns.py book.md --mode sampling --samples 20 --sample-size 5000
-
Use weighted sampling strategy:
python analyze_ai_patterns.py manuscript.md --mode sampling --strategy weighted
-
Start with Sampling Mode:
python analyze_ai_patterns.py large-book.md --mode sampling --samples 15
-
Adjust sample size based on document:
- Documents < 50k words: 5-10 samples
- Documents 50k-100k words: 10-15 samples
- Documents > 100k words: 15-25 samples
-
Use adaptive if document size varies:
python analyze_ai_patterns.py *.md --mode adaptive --batch
Get detailed information about modes:
python analyze_ai_patterns.py --help-modesThis displays:
- All four modes with descriptions
- Sampling strategies
- Usage examples
- Performance characteristics
Solution: Switch to a faster mode
# Instead of:
python analyze_ai_patterns.py huge.md --mode full
# Try:
python analyze_ai_patterns.py huge.md --mode sampling --samples 10Solution: Use more thorough analysis
# Instead of:
python analyze_ai_patterns.py important.md --mode fast
# Try:
python analyze_ai_patterns.py important.md --mode fullSolution: Reduce sample size or use fast mode
# Instead of:
python analyze_ai_patterns.py massive.md --mode full
# Try:
python analyze_ai_patterns.py massive.md --mode sampling --samples 10 --sample-size 2000Error: Sample count must be between 1 and 50
Solution: Adjust --samples parameter
# Valid:
python analyze_ai_patterns.py doc.md --mode sampling --samples 10
# Invalid (too high):
python analyze_ai_patterns.py doc.md --mode sampling --samples 100Solution: Use --dry-run to verify configuration
python analyze_ai_patterns.py doc.md --mode sampling --samples 5 --dry-run-
During Writing: Use Fast mode for immediate feedback
python analyze_ai_patterns.py draft.md --mode fast
-
After Major Changes: Use Adaptive mode for balanced review
python analyze_ai_patterns.py draft.md --mode adaptive
-
Before Submission: Use Full mode for final validation
python analyze_ai_patterns.py final.md --mode full --scores
-
CI/CD Pipeline: Fast or Adaptive for speed
python analyze_ai_patterns.py *.md --mode adaptive --batch --output results.tsv -
Code Review: Adaptive mode with history
python analyze_ai_patterns.py changed-files.md --mode adaptive --save-to-history
-
Release Validation: Full mode for critical content
python analyze_ai_patterns.py release-notes.md --mode full --detailed
| Content Type | Recommended Mode | Frequency |
|---|---|---|
| Blog posts | Fast or Adaptive | Per save |
| Technical docs | Adaptive | Per major change |
| Marketing copy | Adaptive or Sampling | Daily |
| Academic papers | Full | Before submission |
| Books/ebooks | Sampling (10-15 samples) | Per chapter |
| Legal documents | Full | Before finalization |
| Social media | Fast | Per post |
| Email campaigns | Adaptive | Before send |
# Analyze start and end heavily
python analyze_ai_patterns.py novel.md --mode sampling --samples 20 --strategy weighted
# Uniform sampling across entire document
python analyze_ai_patterns.py article.md --mode sampling --samples 8 --strategy uniform
# Focus on beginning (intro analysis)
python analyze_ai_patterns.py report.md --mode sampling --samples 5 --strategy start
# Focus on end (conclusion analysis)
python analyze_ai_patterns.py thesis.md --mode sampling --samples 5 --strategy end# Full analysis with all reports
python analyze_ai_patterns.py manuscript.md --mode full --detailed --scores --save-to-history
# Fast batch with JSON output
python analyze_ai_patterns.py *.md --mode fast --batch --output-format json --output results.json
# Sampling with coverage display
python analyze_ai_patterns.py large.md --mode sampling --samples 10 --show-coverage
# Adaptive with dry-run first
python analyze_ai_patterns.py doc.md --mode adaptive --dry-run
python analyze_ai_patterns.py doc.md --mode adaptiveThe tool uses this logic when mode is not specified:
- Check --mode flag: If specified, use that mode
- Default to Fast: Most common use case
- Adaptive recommended: For production workflows
- Full for critical: When accuracy is paramount
If you've been using the analyzer without modes:
Old command:
python analyze_ai_patterns.py document.mdNew equivalent (same behavior):
python analyze_ai_patterns.py document.md --mode fastRecommended upgrade:
python analyze_ai_patterns.py document.md --mode adaptiveAll existing commands work without changes. Modes are purely additive.
Q: Which mode should I use most often? A: Adaptive mode for most work, Fast for quick checks, Full for final reviews.
Q: Do different modes give different scores? A: Scores may vary slightly due to sampling, but trends and insights are consistent.
Q: Can I change modes between iterations in history? A: Yes! History tracks which mode was used for each iteration.
Q: Does batch mode work with all analysis modes? A: Yes, all modes work with --batch flag.
Q: Will modes affect my existing scripts? A: No, existing commands work identically. Default is Fast mode (previous behavior).
Q: How do I know which mode was used? A: Check the output header, history report, or use --show-coverage.
Q: Can I use modes with --detailed flag? A: Yes, modes work with all existing flags (--detailed, --scores, --batch, etc.).
Q: What if I run out of memory with Full mode? A: Use Sampling mode with fewer samples or smaller sample size.
- Fast: Quick checks (default)
- Adaptive: Smart balance (recommended)
- Sampling: Large documents
- Full: Maximum accuracy
Start with Adaptive, adjust based on your needs. Use --dry-run to preview, --show-coverage to understand, and --help-modes for detailed reference.