aep apply runs before you start any substantial task. It loads your saved packs, scores each one against the current task and repo context, selects the top 1–3, and reports which constraints, preferences, and success checks are now active. The task then runs under those alignment rules.
When to apply
Apply packs at the start of any task that involves non-trivial decisions — refactors, migrations, feature work, infra changes. Trivial one-liners generally don’t need it.Example user phrases
What the apply flow does
Resolve the install target
The agent detects the active agent directory for this repo and uses it as the AEP source root:The same detection order as
aep save applies: explicit reference → directory with existing aep/ files → currently running agent → ask.Load pack candidates
The agent loads candidates in two passes:
- Read
<agent-dir>/aep/index.jsonto get the list of known packs. - For each index entry, load the referenced pack file.
"version": "0.1" and "version": "1.0-exp" packs are loaded. The index may contain mixed versions; the agent handles both.Compute a base match score
For each pack, the agent computes a base match score by comparing the task description and repo context against three fields:
match.keywords— individual terms that signal relevancematch.patterns— natural-language phrases describing common task shapesmatch.tags— category labels like"frontend"or"migration"
[0, 1].Adjust with applies_to
For v1.0-exp packs, the base score is adjusted using the
applies_to block:- If languages, frameworks, paths, or domains clearly align with the current context, the score is boosted.
- If they clearly mismatch, the score is dampened.
applies_to alone — it just ranks lower.Combine with strength
The adjusted match score is blended with the pack’s If a pack has no
strength value to produce a final combined score:strength field (e.g. a v0.1 pack), strength is treated as neutral (0.5).Scoring weights
| Component | Weight | Source |
|---|---|---|
match_score | 60% | keyword/pattern/tag overlap + applies_to adjustment |
strength | 40% | Pack-level confidence scalar (0–1) |
Rank and select active packs
Packs are sorted by three criteria in priority order:
- Scope — task packs rank above project packs, which rank above user packs
- combined_score — higher is better
- Recency —
metrics.last_used_at(orindex.updated_atfor older packs) breaks ties
Update metrics
For each selected pack, the agent updates two fields:
metrics.times_applied— incremented by 1metrics.last_used_at— set to the current timestamp
Report active packs
The agent tells you:
- which packs are active (id, title, scope)
- their combined scores and
strengthvalues - key constraints and preferences now in force
- success checks you should verify at the end
Scoring at a glance
- v1.0-exp packs
- v0.1 packs
| Step | Input | Output |
|---|---|---|
| Base match | match.keywords, match.patterns, match.tags | match_score ∈ [0, 1] |
| applies_to adjustment | applies_to.languages, .frameworks, .paths, .domains | Boosted or dampened match_score |
| Strength blend | pack.strength | combined_score = 0.6 × match_score + 0.4 × strength |
| Scope sort | scope field | task > project > user |
| Recency tiebreak | metrics.last_used_at | Most recently used wins |
Related pages
aep save
Save a successful workflow as a pack
aep inspect
Surface active packs, scores, and metrics
Matching and scoring
Deep dive into the scoring algorithm
Schema reference
Full field definitions for v1.0-exp packs