encapsulation
This skill should be used when the user asks to \"audit plugin encapsulation\", \"check self-containment semantics\", \"find…
The user meets the deficit their context shows as the protocol that resolves it and sees why, without recalling which exist — /route invokes what plain fits compose into, else points or stays silent.
$ npx -y skills add jongwony/epistemic-protocols --skill route --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/routeContext preview
The summary Claude sees to decide when to auto-load this skill.
The user meets the deficit their context shows as the protocol that resolves it and sees why, without recalling which exist — /route invokes what plain fits compose into, else points or stays silent.
name: route description: "The user meets the deficit their context shows as the protocol that resolves it and sees why, without recalling which exist — /route invokes what plain fits compose into, else points or stays silent."
Route the accumulated session context to the core epistemic protocol whose deficit it shows, and bring that protocol in. Type: `(DeficitUnrouted, AI, ROUTE, AccumulatedContext) → ProtocolInvocation`.
**Route**: An act of bringing a present deficit to the protocol that resolves it, so that the person meets that protocol without recalling which protocols exist or which one fits. At a recognition point — the prompt, or a moment in the turn where preparing a response or action shows a deficit — Route reads the loaded core protocols' own descriptions against the context as it stands and yields the one outcome `route` gives: an invocation with Route's reading shown, pointer lines, or silence. How the fits raised now compose — with each other and with the work underway, another protocol's checkpoint that still holds the person's judgment included — is Route's judgment, shown in its reading before the call: one protocol comes in, the fits beside it are shown with how they follow or stand beside it, the checkpoint stays the person's, and the run it belongs to goes on with what the invoked protocol leaves. Route closes nothing: each protocol's own gates hold the person's judgment, and a pointer is taken up, if at all, in the person's next turn.
/-!
How to read this block. It is core Lean 4 and elaborates as written, and you are the model it is
written for: you read it, and by inference over the context you settle each element it leaves
open. Every `axiom` is one of those judgments — a black box to the contract, yours to make from
the material in front of you; its doc comment says what you judge there, and nothing in this
block decides it for you. Every `def`, `inductive`, and `structure` is fixed by the contract.
-/
/-! ── FLOW ──
Route(C) → routeAt(C) = route(catalog C, C), one pass at the recognition point C:
[`lead` brings a protocol in, it has fits raised now and each is plain, and nothing the
person has said withholds invoking it] Route's reading shown, the fits beside it
included → invoke that protocol
[otherwise, where a pointer to a fit raised now gives the person something]
one pointer line per such fit
[otherwise] silence
One pass; no loop and no state. A checkpoint that still holds the person's judgment, and fits
for other protocols raised beside the one brought in, are no branches of their own: they are
read inside `lead`.
-/
/-! ── MORPHISM ──
AccumulatedContext
→ read(catalog) -- the loaded core protocols, each with its own declared description; this skill absent
→ match(fits) -- every surviving fit, one line per deficit and protocol, each resting on turns it cites
→ read(occasion) -- Raise and Fresh for each fit, Plain, lead, Allowed, each read from the context
→ emit(ProtocolInvocation) -- invoke one protocol with Route's reading shown, point, or silence
→ ProtocolInvocation
requires: a recognition point — the prompt, or a deficit recognized mid-turn
deficit: DeficitUnrouted -- the context shows a present deficit instance that no protocol in it serves
preserves: the context -- read, never rewritten
invariant: Routing over Doing
-/
namespace Route
/-! ── GROUND ──
The session primitive this contract reads.
-/
inductive Origin | person | assistant | external | peer | injected | unknown
deriving DecidableEq
/-- A turn is who sent it and what it says. What the turn does — a statement, a request, an
instruction, a report of what was observed — is read from its content, never stored here. -/
structure Turn (P : Type) where
origin : Origin
content : P
abbrev Context (P : Type) := List (Turn P)
/-- An origin that may ground: the harness says who sent a turn, and that is all this admits on.
The assistant's own turns, injected text, and turns of unknown origin ground nothing. -/
def Grounding := {o : Origin // o ≠ .assistant ∧ o ≠ .injected ∧ o ≠ .unknown}
/-- Any turn a person sent, whatever it does. -/
def Utterance (P : Type) := {e : Turn P // e.origin = .person}
def Response (P : Type) := {e : Turn P // e.origin = .assistant}
/-- A turn from outside the conversation: what a tool or the environment returned, or a peer's
report. A person's account of what they observed is an utterance, read as such. -/
def Evidence (P : Type) := {e : Turn P // e.origin = .external ∨ e.origin = .peer}
def fuse {P : Type} (c : Context P) (u : Utterance P) : Context P := c ++ [u.val]
/-- One turn of the context, with the origin it grounds on. -/
structure Cite {P : Type} (c : Context P) where
idx : Nat
lt : idx < c.length
src : Grounding
ok : (c[idx]'lt).origin = src.val
/-- `admits` reads only who sent the cited turn; `supports` is the model's reading of what that
turn says, including what it does — a statement, a request, a report of an observation. -/
structure Coord (P A : Type) where
admits : Grounding → Prop
supports : Context P → Turn P → A → Prop
/-- `open_` may carry a candidate citation whose support is still short. -/
inductive Occ {P A : Type} (q : Coord P A) (c : Context P)
| open_ (candidate : Option (Cite c))
| filled (a : A) (src : Cite c) (allowed : q.admits src.src)
(supported : q.supports c (c[src.idx]'src.lt) a)
/-- The same turn, cited from a longer context; what it supports is judged again against the
context that now stands. -/
def Cite.lift {P : Type} {c : Context P} (s : Cite c) (t : Context P) : Cite (c ++ t) :=
{ idx := s.idx
lt := by have := s.lt; simp; omega
src := s.src
ok := by rw [List.getElem_append_left s.lt]; e한국어 When AI collaboration goes off-track, you redo everything. These protocols bring the decisions that set the direction to you early — often at the plan level, before a wrong one hardens into code or other downstream work — and leave each one yours to
This skill should be used when the user asks to \"audit plugin encapsulation\", \"check self-containment semantics\", \"find…
This skill should be used when the user asks to \"formal review\", \"formal lens review\", or invokes /formal-review. A…
This skill should be used when the user asks to "run the outcome eval", "paired bare vs protocol", "which decisions did the…
This skill should be used when the user asks to "run the eval", "test whether the protocol actually works at runtime", "check…
This skill should be used when a contributor names a skill whose Lean contract is to be re-derived — a core protocol, or a…