prxy.monster API-key BYOK is live. Start free

patterns

Category: injection · Cloud + Local · Status: v1 — production

The model gets measurably smarter per user over time. patterns watches for fixes (“the issue was X, the solution is Y”) in successful conversations and saves them. On future requests, it injects relevant patterns into the system prompt.

What it does

Two halves:

Repeated problem types get solved faster each time. After a few weeks, the model has effectively learned your codebase’s quirks, your team’s conventions, and your common gotchas.

When to use it

✅ Coding assistants (huge wins per-codebase) ✅ Customer support (recurring ticket types) ✅ Any workflow where similar problems recur

❌ One-shot creative tasks ❌ Workflows with no learning signal (no “this was the fix” feedback)

Configuration

patterns:
  maxInjected: 5            # max patterns per request
  minSuccessRate: 0.6       # only inject patterns with this success rate
  forgeOnSuccess: true      # forge new patterns from response detection
  decayAfterDays: 90        # don't inject patterns older than N days
  similarity: 0.6           # min relevance for injection

Metrics emitted

Examples

Conservative injection — only highly-trusted patterns:

patterns:
  maxInjected: 3
  minSuccessRate: 0.85

Aggressive learning — forge eagerly, inject many:

patterns:
  maxInjected: 8
  minSuccessRate: 0.5
  forgeOnSuccess: true

Read-only mode — use existing patterns, don’t forge new ones:

patterns:
  forgeOnSuccess: false

How it works

Pre hook (injection)

  1. Extract last user message text.
  2. Embed it.
  3. Vector search the patterns table for the user, scoped by minSuccessRate and decayAfterDays.
  4. Take top maxInjected matches.
  5. Format as a <learned-patterns> block, prepend to the system prompt.

Post hook (forging)

  1. Extract response text.
  2. Run regex detection for fix-pattern shape:
    • the (issue|bug|problem) was X, (the fix|solution) is Y
    • to (fix|solve|resolve) X, do Y
    • And similar variants.
  3. If detected, store as a new pattern with the request embedding as the lookup vector.

Current forging uses regex-based detection. A small LLM-driven detector with outcome tracking is planned — patterns whose injection led to user “yes that worked” responses get reinforced; patterns that didn’t get retired.

Pattern lifecycle

created  ──▶  injected  ──▶  outcome (success/failure)  ──▶  reinforced or retired

Privacy

Cloud vs Local

Cloud patterns are scoped to your account or workspace. Local patterns stay on your machine and survive container restarts in the configured data volume.

Source

src/modules/patterns.ts