/learning-loop:federationfrom learning-loop
Sets up or repairs learning-loop federation: enrolling a vault on a hub, linking a second machine, configuring visibility rules, and reading sync status. Safe to re-run.
Ships in learning-loop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Federation is three nouns. A key is a principal — a person or a machine.
The key is the identifier: there is no registry and no name to allocate. A
vault is a corpus with an owning key and a visibility policy; one key may
own several. A grant is a signed statement by one key about another —
follow (read a vault), link (these machines are the same person), assoc
(these identities are the same human, no authority), peer (two hubs bridge).
A hub decides who may connect. It never decides trust between keys: every grant is signed by the key that made it and verifies offline against nothing but the bytes and that key's public half.
This skill is invoked from /init Phase 4 when the user opts in, and is safe
to run standalone.
Resolve PLUGIN_DATA, VAULT, and the plugin root per ${CLAUDE_PLUGIN_ROOT}/skills-shared/paths-preamble.md (read it and apply).
ll-search writes everything federation owns under a config dir. For a
single-vault install that is PLUGIN_DATA itself, and --config-dir $PLUGIN_DATA is what every command below passes. For a multi-vault install
each vault has its own config dir under PLUGIN_DATA, listed by ll-search vault list.
ll-search sync also takes the search index as its first positional. That
is VAULT/.vault-search/vault-index.db — the file the watch daemon writes, not
anything under the config dir. Pass it in full; a path that does not exist ends
the command in a panic rather than a message.
Detect first, then walk the steps in order. Nothing writes config.json until
the hub has proved its identity and admitted this key, so a run that dies
part-way leaves a directory the next run enters cleanly.
PLUGIN_DATA/vaults.json exists, this is a multi-vault install. Run
ll-search vault list and ask which vault this run is about; use that
profile's config dir for everything below.PLUGIN_DATA/federation/config.json.If a config exists, federation is already set up for that vault. Run
ll-search status --config-dir <config_dir>
and report what it says. Do not re-enroll. ll-search join refuses a
config dir that already holds a config, and deleting the config to get past
that costs the vault its vault_id — the hub's copy of the old one is not
carried across.
ll-search status reads local files only. It opens no socket and reads no
clock, so nothing it prints can imply a check that did not run. It reports:
the vault and its vault_id, this machine's key, the hub and its pinned key,
when the last cycle ran and whether it succeeded,
what the hub held as of that cycle, and a BLOCKED line if ll-search sync
would refuse the config.
The last sync line describes the last cycle that finished, not the config
above it. The watch daemon re-reads config.json on each of its federation
ticks, so a config written since the last one has not been acted on yet — for
up to one sync interval, five minutes by default. A last sync error naming a
hub that is not the hub: line is that window and nothing else. Run the sync
in section C and re-read status rather than reporting the stale line.
Enrollment needs an invite code — twelve Crockford base32 characters grouped
XXXX-XXXX-XXXX. A code is single-use, expires seven days after it is minted,
and is spent only when a key successfully authenticates with it.
Where a code comes from: ask someone already on the hub. Any member may
mint one, capped at five outstanding unused invites each; there is no admin
role and no role column, so the person who invites a user does not have to be
whoever runs the box. What is still operator-side is the surface: minting is
sync-hub mint-invite <key_id>, run on the hub itself, so a member without a
shell there asks the operator to mint as them. A remote surface — a member
asking the hub for a code over the wire, and signing the request — does not
exist yet. Tell the user to ask a member they know; tell them the operator is
the fallback, not the rule.
What created_by does and does not mean. It records the member an invite
was minted as. It is not evidence that member asked for it: the command
proves the operator has a shell on the box, not that anyone consented. This
grants the operator no authority they lacked — with the database they could
write a members row by hand — but do not tell a user their invite was
authorised by the member it names.
So there are three doors onto a hub:
BOOTSTRAP_MEMBERS at boot;link grant from a machine already enrolled (section F) — which needs no
invite at all, because membership follows the link.Door 1 is not something a user can look up, and it does not excuse the
argument. BOOTSTRAP_MEMBERS is an environment variable on the hub; nothing
the client runs can read it. The hub admits a key it already knows before it
looks at the code, so a member's join succeeds whatever is in the invite
slot — but join takes the code as a required positional and there is no flag
to omit it. If the user believes they were admitted at boot and has no code,
have them pass any well-formed XXXX-XXXX-XXXX and read the outcome:
Authenticated means door 1 was real, hub rejected: invite redemption failed
means it was not and they need door 2. Say that is what the argument is doing,
so nobody records a code that was never spent.
If the user has none of the three, stop here rather than starting a join
that cannot complete.
Run, and show the user the output as it appears — the two confirmations are theirs to make, not yours:
ll-search join <hub-endpoint> <invite-code> <vault-path> --config-dir <config_dir>
The three are positional and in that order. The endpoint must be wss://.
The command, in order:
key_id and a
six-word fingerprint, then asks whether those are the six words the hub
operator gave the user. Anyone who can answer for that address can present
a key; the words are how the real hub is told from that. The invite code
has not left the machine at this point — the hub redeems it while
handling the hello, so a code offered to an impostor is a code already
burned. Answering anything but yes sends nothing and writes nothing.SyncReady names the new
vault_id. Declaring the vault in the hello is registering it — there is
no second round trip — but a hub that admits the key without creating the
row is refused here rather than at a first sync a repository away.config.json last.Never echo the recovery phrase back, never write it to a file, and never put it in your response. It is the user's to record.
join does not sync. It enrolls. The first upload is a separate step, and
it is not optional — a vault that enrolled and never synced is one the hub
holds no index for:
ll-search sync <VAULT>/.vault-search/vault-index.db <VAULT> --config-dir <config_dir>
Run it here rather than leaving it to the watch daemon. The daemon does pick
the new config up on its own — it re-reads config.json every federation tick,
and needs no restart — but that is up to five minutes away, and until then
ll-search status still describes the cycle before the join.
Report what it returns (notes uploaded, vaults fetched). If it names vaults it could not fetch, say which — the client was entitled to read them and could not, and that is the only place it surfaces.
If join fails, no config is written and the skill re-runs cleanly. The invite
is spent only on success.
A second vault on this machine needs ll-search vault add <vault-path> <id>
first. join creates the identity; vault add creates the registry entry.
A config dir under PLUGIN_DATA that no vault profile names is refused rather
than joined, because a vault the registry cannot see is one no later command
can find.
Three tiers: public (full content and its embedding), listed (title, tags,
vault-relative path and a 300-character summary, and no embedding: the vector is
computed over the whole body, so sending it would disclose what the summary
withheld)
only), private (not shared at all). A fresh config is private by default
with no rules.
Frontmatter is the only route to public. A note is published in full
only when it says so itself:
visibility: public
A glob rule naming public is clamped to listed: only frontmatter
publishes. A misspelled frontmatter value (visibility: pubic) falls through
to the glob rules and their clamp rather than to an uncapped tier, so a typo
cannot publish a note.
Frontmatter outranks a glob in both directions. A note carrying
visibility: public defeats a private rule written at that exact path, so a
glob cannot be used to claw back a note that has declared itself. This is the
opposite of what "rules may restrict" would suggest, and it is the one thing to
know before relying on a pattern to withhold something: check the frontmatter
of what it is meant to cover. ll-search visibility-backfill stamps
visibility: public into every note the globs published at the moment it runs,
so running it freezes one config's answer into thousands of notes that no later
rule can override.
Rules live in config.json under visibility.rules as { "pattern": "...", "tier": "..." }, last match wins. There is no CLI to edit them; write the file
directly. Suggested starting point, if the user wants one:
"visibility": {
"default": "private",
"rules": [{ "pattern": "1-fleeting/**", "tier": "listed" }]
}
If this vault federated before this rule existed, its published set was
derived from folder globs and is now capped to listed. To keep exactly the
notes that were public before, run once:
ll-search visibility-backfill <vault-path> --config-dir <config_dir> --dry-run
It reports what it would write. Re-run without --dry-run to stamp
visibility: public into the frontmatter of those notes. On a vault that has
never federated there is nothing to preserve — skip it.
After join and the first sync, report:
Federation configured.
Key: [key_id]
Vault id: [vault_id]
Hub: [endpoint] ([six-word fingerprint])
Uploaded: [N] notes
Visibility: [public/listed/private counts]
Then remind the user, once, that the 24 words are the only way back to this identity.
A person is a set of machines joined by link grants. Four doors, and the
six-word fingerprint is the security boundary in every one of them — the
transport is not. Both ends print six words over the joining machine's key;
the approver confirms they match before approving. If they do not match, stop:
something is relaying the pairing.
Both machines on a network, hub reachable — on the new machine:
ll-search link request <hub-endpoint> <vault-path> --config-dir <config_dir>
It prints a pairing code and a QR, plus the hub this identity will reach once admitted. On a machine already enrolled:
ll-search link approve <code> --config-dir <config_dir>
The approver lodges the grant with the hub; the new machine collects it on its next sync.
No hub, or no network path between the machines — on the new machine:
ll-search link code --config-dir <config_dir>
which needs no network at all. Then on the established machine:
ll-search link approve <code> --offline --config-dir <config_dir>
which signs the grant and prints it instead of lodging it. Carry that blob to the new machine:
ll-search link accept <grant> --config-dir <config_dir>
The grant verifies against nothing but its own bytes and the issuer's public key. The new machine can act as itself immediately.
If that machine has never had a hub, it still does not have one: the blob
carries the issuer's key, not an endpoint, and a hub key cannot be pinned
without reaching the hub. accept therefore writes no federation config, and a
sync before one exists fails on the missing vault_id. Once the machine can
reach the hub:
ll-search link request <hub-endpoint> <vault-path> --config-dir <config_dir>
That pins the hub and writes the config. The accepted link stands, so the
pairing code it prints needs no second approval. ll-search link accept prints
this guidance itself when the config is missing.
What the machines are linked to:
ll-search link list --config-dir <config_dir>
A link is two grants, not one signed twice: the approver signs A→B, and the
new machine signs B→A itself on finding it. Neither machine can speak for the
other before it has agreed to. link list shows which halves exist — a row
reading outbound was admitted by this machine and never answered, which is
what an approval nobody picked up looks like.
Cutting a machine off:
ll-search link revoke <key_id> --config-dir <config_dir>
It signs a revocation, lodges it with the hub, and then drops the local row — in that order, because this store is this key's only record of what it issued, and dropping the row first would leave nothing to sign a revocation for.
Two limits to state to the user rather than let them assume past:
link revoke says when one is still
standing, and so should you.link is unscoped — "every vault this
issuer owns" — so it names no directory under federation/data/peers/ to
remove. What stops the data being served is the hub dropping those vaults
from this key's listing on the next sync, not the revocation.There is no equivalent for a follow a peer holds on this vault. Nothing here
sends one; those lapse at their own expiry.
The 24 words from step C restore this machine's key:
ll-search recover "<24 words>" --config-dir <config_dir>
Recovering the identity already on this machine needs nothing extra — nothing
is replaced, so there is nothing to authorise. Recovering a different
identity over an existing one requires --force, and the guard is the loss,
not the write: every grant naming the old key stays signed, valid, and
unreachable, while the machine still looks enrolled.
recover writes the seed and deliberately leaves config.json alone — the
hub pin and vault_id in it describe an enrollment the new key was never part
of. ll-search status prints a RECOVERED line when the two disagree.
The identity is an Ed25519 seed held by the binary's seed store. Backends, in
priority order: the OS keyring (macOS Keychain, Linux Secret Service, Windows
Credential Manager), then a file encrypted at rest under
<config_dir>/federation/ for machines where no keyring daemon runs. A
plaintext .seed file is a pre-v1.18 format — still readable as a migration
source, never written by the binary. On a fresh install no .seed exists, and
that is normal.
ll-search identity --config-dir <config_dir>
reports pubkey_b64, backend (keyring, encrypted, or
plaintext-legacy), and created. It is idempotent: an existing seed is
reused, so re-runs return the same key.
If backend is plaintext-legacy, offer to move it into a secure backend:
ll-search migrate-seed --config-dir <config_dir>
Fail-closed: the plaintext file is deleted only after the new backend has been
written and verified, and re-running against a migrated seed is a no-op.
--rollback reverses it. Never move a seed between backends by copying files
by hand.
Very old installs may have a plaintext seed at
${CLAUDE_PLUGIN_ROOT}/federation/.seed — a location wiped on reinstall. Copy
it to <config_dir>/federation/.seed (mode 0600) so the legacy reader and
migrate-seed can find it, delete the marketplace-directory copy, then run
migrate-seed. This is the only manual file move in this skill.
config.json before join has succeeded. A failed run
must leave no state on disk.ll-search sync refuses the config and ll-search status says BLOCKED.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
24 skills in this plugin
/deepenStrengthen a single vault note with research. Usage: /learning-loop:deepen "note name" or /learning-loop:deepen (picks shallowest inbox note). Assesses maturity, researches gaps, rewrites in vault voice, promotes when ready./diagramGenerate an Excalidraw diagram for the vault. Usage: /learning-loop:diagram "concept or mechanism" or /learning-loop:diagram (infers from context). Produces .excalidraw.md in vault Excalidraw/ folder./discoveryExplore a topic interactively with web research and vault context. Usage: /learning-loop:discovery "topic" [--style guided|branch|checkpoint] [--tone academic|conversational|persona] [--surf]. --surf skips note creation./doctorDiagnose your learning-loop installation. Runs health checks, presents issues, offers per-fix remediation, re-runs each check after the fix to confirm. Safe to run anytime; only makes changes you approve. Pass --redact to scan plugin data files for leaked credentials instead./dreamConsolidate auto-memory between sessions. Usage: /learning-loop:dream (no args). Four-phase cycle: Orient, Gather Signal, Consolidate, Prune Index. Seven operators: MERGE, RESOLVE, ABSTRACT, COMPRESS, PRUNE, LINK, DATE NORMALIZE. Rebuilds MEMORY.md./dream-evalmeasure whether a /dream pass helps, hurts, or ties against no consolidation. usage: /learning-loop:dream-eval --mode={single|control|repeated} [--passes=N] [--mine]. single scores pre/post on the live corpus; control forks two clones and dreams one; repeated dreams a clone N times and plots the drift + content-survival curve.npx claudepluginhub robinslange/learning-loop --plugin learning-loopOther plugins' skills for the same job