name: route
description: Analyze an enriched note and route to the best vault destination. Stage 3 of the processing pipeline.
allowed-tools:
- Read(/.claude/vaults/**/CLAUDE.md)
- Read(/.claude/vaults//*.md)
- Read(~/.claude/vaults//.routing-memory.md)
- Write(/.claude/vaults/**/.routing-memory.md)
- Edit(/.claude/vaults/**/.routing-memory.md)
- Bash(npx @techpickles/sb:*)
Route Stage
Analyze an enriched note against routing memory, vault rules, and generic signals. Move to destination or mark for review.
See references/pipeline.md for stage definitions and status flow.
See references/routing.md for the scoring algorithm.
See references/para.md and references/johnny-decimal.md for the two folder systems a vault may use (often both, mid-migration).
See references/routing-memory.md for the correction and learning loop.
Input
An enriched note in the inbox with status: enriched.
Process
Load routing context:
- Read
.routing-memory.mdfrom vault root (create with defaults if missing) - Read vault CLAUDE.md for disambiguation rules
- Run
sb vault structurefor available destinations - Run
sb note context --note "{note-path}"for keywords and signals
- Read
Score destinations (priority order): a. Check
.routing-memory.mdcorrections for matching topics/keywords b. Check.routing-memory.mdlearned patterns c. Apply vault CLAUDE.md disambiguation rules d. Apply generic signal scoring (perreferences/routing.md)Each destination from
sb vault structurecarries atype. For Johnny Decimal destinations (type: 'jd') also useareaandcodewhen scoring: match the note's topic to thearea, and prefer an IDcode(e.g.67.01) for a specific note or its parent categorycode(e.g.67) for a loose note. Seereferences/johnny-decimal.md.Apply threshold:
- Score >=
auto-route-threshold: auto-route, move file, setstatus: routed - Score < threshold: set
status: pending-review, return without moving
- Score >=
If auto-routing, move the file:
npx @techpickles/sb note move --from "{note-path}" --to "{destination}/"Update frontmatter:
status: routedIf pending-review, present suggestions to human (when called by orchestrator):
- Show top 2-3 destinations with scores and reasoning
- Include "Leave in inbox" option
- If user overrides suggestion, capture correction to
.routing-memory.md
Capturing Corrections
When the user picks a destination different from the top suggestion:
- Ask: "Quick note on why {chosen} over {suggested}?"
- Append to
## Correctionsin.routing-memory.md:
For Johnny Decimal destinations, key the correction on the JD- {YYYY-MM-DD}: "{note title}" routed to "{suggested}", corrected to "{chosen}" Reason: {user's reason}code(e.g. "corrected to 67.01") so the learning loop can match by number, not just folder name.
Output
- Note moved to destination with
status: routed, OR - Note marked
status: pending-reviewfor human input
Constraints
- Only suggest destinations from
sb vault structureoutput - Always include "Leave in inbox" for pending-review notes
- Show reasoning for all suggestions
- Capture corrections on every override (this is how routing improves)