Autosearch autosearch:experience-compact
Promote recurring patterns from `experience/patterns.jsonl` into the compact `experience.md` digest (≤120 lines, read by runtime AI before calling the skill). Triggers on N-events / file-size / user-feedback / session-end. Guards against single-success noise and pollution via promotion thresholds.
git clone https://github.com/0xmariowu/Autosearch
T=$(mktemp -d) && git clone --depth=1 https://github.com/0xmariowu/Autosearch "$T" && mkdir -p ~/.claude/skills && cp -r "$T/autosearch/skills/meta/experience-compact" ~/.claude/skills/0xmariowu-autosearch-autosearch-experience-compact && rm -rf "$T"
autosearch/skills/meta/experience-compact/SKILL.mdexperience-compact — Per-Skill Digest Updater
Reads a skill's
experience/patterns.jsonl + existing experience.md, promotes recurring patterns to the digest, prunes stale rules, and rotates raw events if the file is getting large.
Trigger Conditions
Run compact when ANY of:
- ≥10 new events added to
since last compact.patterns.jsonl
> 64 KB.patterns.jsonl- Last event carried explicit user feedback (
oruser_feedback: accepted
).rejected - Session ending and this skill was used at least once during the session.
Runtime AI (or a cron on long-running instances) calls this skill per trigger.
Promotion Rules
A candidate rule is extracted from
patterns.jsonl when the same winning_pattern string or good_query template recurs. To promote it into the Active Rules section of experience.md:
(appeared in at least 3 distinct events)seen >= 3
(at least 2 of those events havesuccess >= 2
)outcome: success
(most recent appearance within the last 30 days)last_verified <= 30 days
Each promoted rule carries a metadata footer:
seen=5, success=4, last_verified=2026-04-21
Anti-Pollution Rules
- Single success never promotes. Even if an event looks great, one instance is noise — requires 3 occurrences.
- User-rejected / rubric-failed / low-relevance events go only into Failure Modes, never Active Rules.
- User corrections (explicit "no, that's wrong") always promote to Failure Modes with high weight.
- Cold rules expire. Any Active Rule with
moves to a "pending revalidation" bucket; if not re-verified in another 30 days, removed entirely.last_verified > 30 days
experience.md Template
# <skill-name> experience ## Active Rules # ≤ 20 entries - <rule> — seen=5, success=4, last_verified=2026-04-21 - <rule> — seen=3, success=3, last_verified=2026-04-19 ## Failure Modes # ≤ 15 entries - <failure pattern> — seen=4, last_verified=2026-04-20 - <user correction> — seen=1, last_verified=2026-04-18 ## Good Query Patterns # ≤ 20 templates - `{brand} {feature} 翻车 {year}` — seen=7 - `{category} 避雷 小红书 最近` — seen=5 ## Last Compacted - 2026-04-22, from 37 events, promoted 3 rules, archived raw events before 2026-03-22.
Hard ceiling: 120 lines total across all sections. If exceeded after promotion, drop oldest Failure Modes first, then lowest-seen Active Rules, then lowest-seen Good Query Patterns.
Rotation
When
patterns.jsonl > 1 MB:
- Rename current file to
(month of first event in the file).experience/archive/YYYY-MM.jsonl - Create fresh empty
.patterns.jsonl - Update
experience.md
line with rotation note.## Last Compacted
Archives are permanent — never delete. They serve as the lineage trail for AVO self-evolution audits.
AVO Safety Boundaries
This skill writes
experience.md. That's the promotion layer. It does not:
- Modify the skill's
body (that'sSKILL.md
's domain, which must commit viaauto-evolve
and be reversible viascripts/committer
).git revert - Modify
orjudge.py
(project-level fixed contracts; AVO must not change its own evaluation function).PROTOCOL.md - Delete or rewrite
(append-only; only rotation is allowed).patterns.jsonl
Invocation Pattern
Runtime AI calls compact via a sync tool:
compact_experience("search-xiaohongshu")
Implementation (Standard tier LLM call):
- Read
.autosearch/skills/channels/search-xiaohongshu/experience/patterns.jsonl - Read existing
(if exists).autosearch/skills/channels/search-xiaohongshu/experience.md - Group events by
/winning_pattern
template; countgood_query
andseen
.success - Apply promotion thresholds; drop events older than 30 days for rule evaluation.
- Build new
body: keep old Active Rules that still pass threshold; add new ones that newly qualify; move expired ones to Failure Modes or drop; refreshexperience.md
line.## Last Compacted - Write the new
.experience.md - If
> 1 MB, rotate.patterns.jsonl
Latency target: < 10 seconds, one LLM call for rule grouping if the patterns.jsonl is large.
What This Skill Is NOT
- Not a summarizer of the skill's purpose (that's the SKILL.md body).
- Not a decision-maker for which skills to call (that's the router + group-index layer).
- Not a replacement for AVO's
(which can editauto-evolve
with human / automated review).SKILL.md
It is a safe, bounded, reversible digest writer that turns append-only event logs into a short, runtime-visible rule list.
Relationship to Other Skills
- Reads ←
(from<leaf>/experience/patterns.jsonl
).experience-capture - Writes →
.<leaf>/experience.md - Feeds → runtime AI (which reads
before calling the skill).experience.md - Feeds →
(which uses the rule history as input when proposing SKILL.md edits).auto-evolve
Quality Bar
- Evidence items have non-empty title and url.
- No crash on empty or malformed API response.
- Source channel field matches the channel name.