Check redundancy

From mderk/memento · View interactive version

Check redundancy is an AI agent skill from the GitHub repository mderk/memento. Analyze and report redundancy levels in markdown documentation files

How to use this skill

Skill file

Check Redundancy Skill

Analyzes markdown files for redundant content by detecting repeated phrases and calculating redundancy percentage.

When to Use This Skill

Use this skill when:

Invocation

From target project, run:

python ${CLAUDE_PLUGIN_ROOT}/skills/check-redundancy/scripts/check-redundancy.py <file>

What This Skill Does

  1. Analyzes repeated phrases (2-5 words) in markdown files
  2. Filters common phrases (articles, conjunctions, domain terms)
  3. Calculates redundancy percentage: (repeated occurrences - unique count) / total phrases × 100
  4. Reports top repeated phrases for manual review
  5. Exit codes:

Usage

Command Line

python ${CLAUDE_PLUGIN_ROOT}/skills/check-redundancy/scripts/check-redundancy.py <file>

Example Output

File: architecture.md
Lines: 89
Total phrases analyzed: 1247
Redundancy: 3.2%
✓ Redundancy optimal (3.2% ≤ 10%)

Or if redundancy is high:

File: verbose-file.md
Lines: 150
Total phrases analyzed: 2341
Redundancy: 15.8%

⚠️  High redundancy detected (15.8% > 10%)

Top repeated phrases:
  - 'memory bank documentation' (12 times)
  - 'project analysis json' (8 times)
  - 'generation plan md' (7 times)
  - 'static files to' (6 times)
  - 'prompt templates in' (5 times)

Integration Examples

In Generation Workflows

After generating a file:

# Generate file
python generate-doc.py > .memory_bank/file.md

# Check redundancy
python ${CLAUDE_PLUGIN_ROOT}/skills/check-redundancy/scripts/check-redundancy.py .memory_bank/file.md

# If exit code is 1, optimize the file
if [ $? -eq 1 ]; then
    echo "Optimizing file..."
    # Run optimization
fi

In Batch Processing

for file in .memory_bank/**/*.md; do
    python ${CLAUDE_PLUGIN_ROOT}/skills/check-redundancy/scripts/check-redundancy.py "$file"
done

How It Works

  1. Extract phrases: Tokenizes text into 2-5 word phrases
  2. Filter noise: Removes markdown syntax, code blocks, common English phrases
  3. Count frequencies: Tracks how often each unique phrase appears
  4. Calculate redundancy:
  1. Report results: Shows percentage and top repeated phrases

Threshold

Related

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.