Skip to main content
Auto-Skill’s pattern detection is highly configurable. You can customize detection thresholds, sequence lengths, lookback periods, and ignored tools to match your workflow.

Detection Configuration

Pattern detection behavior is controlled by the DetectionConfig interface:
DetectionConfig Interface
export interface DetectionConfig {
  minOccurrences: number;        // Minimum times a pattern must repeat
  minSequenceLength: number;     // Minimum number of tools in a sequence
  maxSequenceLength: number;     // Maximum number of tools in a sequence
  lookbackDays: number;          // How far back to analyze sessions
  minConfidence: number;         // Minimum confidence score (0.0-1.0)
  ignoredTools: string[];        // Tools to exclude from pattern detection
}

Default Values

minOccurrences

Default: 3A tool sequence must appear at least 3 times across different sessions to be considered a pattern.

minSequenceLength

Default: 2Sequences must contain at least 2 tools. Single-tool patterns are too generic.

maxSequenceLength

Default: 10Sequences longer than 10 tools are truncated. Very long patterns are often noise.

lookbackDays

Default: 7Analyzes the last 7 days of sessions. Older patterns may be stale.

minConfidence

Default: 0.7Only patterns with 70%+ confidence are suggested for skill generation.

ignoredTools

Default: ["AskUserQuestion"]These tools are excluded from pattern detection (too interactive).

Configuration File

You can override defaults using a project-local configuration file:
.claude/auto-skill.local.md
---
detection:
  min_occurrences: 5
  min_sequence_length: 3
  max_sequence_length: 8
  lookback_days: 14
  min_confidence: 0.8
  ignored_tools:
    - AskUserQuestion
    - WebFetch
    - Task
---

# Auto-Skill Local Configuration

This file customizes pattern detection for this project.
The configuration file uses YAML frontmatter, similar to SKILL.md files. The body content is optional and ignored.

Loading Configuration

Configuration is loaded with project-specific overrides:
Loading Config
import { loadConfig } from '@matrixy/auto-skill';

// Load default config
const defaultConfig = loadConfig();

// Load config with project overrides
const projectConfig = loadConfig('/path/to/project');
The loader:
  1. Starts with default values
  2. Looks for .claude/auto-skill.local.md in the project directory
  3. Parses YAML frontmatter
  4. Merges overrides into the default config
  5. Returns the merged Config object

Confidence Scoring

Auto-Skill calculates confidence using a weighted formula:
1

Occurrence Score (40%)

Logarithmic scaling rewards frequent patterns:
const occurrenceScore = Math.min(
  1.0,
  Math.log(occurrenceCount + 1) / Math.log(10)
);
  • 3 occurrences → ~0.60
  • 5 occurrences → ~0.78
  • 10 occurrences → ~1.00
2

Length Score (20%)

Optimal sequence length is 3-5 tools:
if (sequenceLength >= 3 && sequenceLength <= 5) {
  lengthScore = 1.0;
} else if (sequenceLength === 2) {
  lengthScore = 0.7;
} else if (sequenceLength > 5) {
  lengthScore = Math.max(0.5, 1.0 - (sequenceLength - 5) * 0.1);
}
3

Success Score (25%)

Ratio of successful executions:
const successScore = successCount / totalCount;
  • 100% success → 1.0
  • 80% success → 0.8
  • 50% success → 0.5
4

Recency Score (15%)

Recent patterns score higher:
const daysSinceLast = (nowMs - lastSeenMs) / 86_400_000;
const recencyScore = Math.max(0.5, 1.0 - daysSinceLast * 0.05);
  • Used today → 1.0
  • 5 days ago → 0.75
  • 10 days ago → 0.5 (floor)
Final confidence:
const confidence =
  occurrenceScore * 0.4 +
  lengthScore * 0.2 +
  successScore * 0.25 +
  recencyScore * 0.15;

Ignoring Tools

Some tools should be excluded from pattern detection because they:
  • Are too interactive (AskUserQuestion)
  • Fetch external content (WebFetch)
  • Delegate to other agents (Task)
  • Are Auto-Skill commands themselves
detection:
  ignored_tools:
    - AskUserQuestion
    - WebFetch
    - Task
    - TodoWrite

Tuning for Your Workflow

Lower the occurrence threshold and minimum confidence:
detection:
  min_occurrences: 2
  min_confidence: 0.6
Tradeoff: You may see more false positives and noise.
Raise the confidence threshold and occurrence requirement:
detection:
  min_occurrences: 5
  min_confidence: 0.85
Tradeoff: You may miss useful patterns that haven’t repeated enough yet.
Increase the lookback period:
detection:
  lookback_days: 30
Tradeoff: Older patterns may no longer be relevant.
Increase the max sequence length:
detection:
  max_sequence_length: 15
Tradeoff: Very long sequences are harder to match and may be too specific.

Pattern Detection Pipeline

Advanced: Per-Tool Weights

Coming in v6.0: Per-tool weighting will allow you to assign importance scores to specific tools, influencing confidence calculations.
detection:
  tool_weights:
    Bash: 1.2      # Shell commands are high-signal
    Edit: 1.1      # Code edits are important
    Read: 0.8      # Reading files is common
    Grep: 0.9      # Searching is exploratory

Example Patterns by Confidence

{
  "toolSequence": ["Read", "Edit", "Bash"],
  "occurrenceCount": 8,
  "successRate": 1.0,
  "confidence": 0.92,
  "suggestedName": "read-and-run",
  "description": "Read code, edit it, then run tests"
}

Next Steps

Configuration Reference

Complete reference for all config options

Integration Guide

Learn how patterns are detected in real-time

Build docs developers (and LLMs) love