CLI Tour
The CLI is independent of the web viewer. Use lnk start, lnk query, lnk brief, lnk session-end, lnk health, and maintenance commands even when lnk serve is not running. Agents that support lazy-loaded instructions can also use the official Link skills instead of MCP setup.
Use lnk try when you want the shortest proof loop: demo creation, readiness, query proof, brief proof, viewer command, and first agent prompts in one command.
Use lnk proof when you want to prove the cross-agent memory loop directly: one clean local workspace, one reviewed memory, and one bounded recall packet shared by CLI, skills, and MCP.
Use lnk setup for install day and every upgrade after it: it detects every agent installed on your machine and wires them all — workspace, MCP provisioning, session hooks, and a refresh of any stale Link-owned agent instruction files (a steering file from an older Link can name MCP tools the configured server no longer exposes, sending the agent back to file greps) — in one idempotent command. Use lnk onboard when you want the guided single-agent flow: safe repair, health check, optional first memory, optional project seed, first prompts, and optional agent MCP wiring. If the local viewer is running, /onboard mirrors that flow with copy buttons.
Use lnk seed . ~/link from a project directory when you want Link to create a source-backed project page from existing repo context before the first real recall. It scans allowlisted docs/rule files, blocks secret-looking values, and does not create durable memories silently.
Daily Loop
lnk serve
lnk setup # every detected agent, wired in one command
lnk onboard
lnk onboard --seed-project .
lnk seed . ~/link
lnk proof
lnk welcome
lnk next
lnk start ~/link --task "working on Link release"
lnk session-end session-notes.md ~/link --limit 3
lnk health
lnk ingest-status
lnk remember "User prefers feature branches for Link work." --type preference --scope project --project link --visibility project --review-after 2026-08-01
lnk remember "Temporary launch branch is release/one-off." --type project --project link --expires-at 2026-09-01
lnk remember "1. Bump version 2. Run tests 3. Tag and publish" --type procedure --trigger "cutting a release"
lnk remember "Deploy acme only via blue-green" --applies-when "project:acme, task:deploying"
lnk remember "Releases ship daily from main" --supersedes weekly-releases
lnk recall "how often do releases ship" --as-of 2026-03-01
lnk share "Prefer local memory"
lnk snapshot ~/link --output link-snapshot
lnk brief "working on Link release" --project link
lnk query "what should I know before changing the MCP tools?" --budget small --project link
lnk validate
Memory Commands
One rule for the memory knobs. Finding it → --trigger (a phrase that helps task-shaped recall find a recipe). Fencing it → --applies-when (conditions that demote or hide a memory outside its context). Owning it → --scope/--project/--visibility (whose memory it is and who may see it). Replacing it → --supersedes (archive the old claim with lineage; accepts the memory name or its title). Aging it → --review-after/--expires-at. When in doubt, save with none of them — every knob can be added later through review.
lnk remember
Save a local agent memory. Strong duplicates and likely conflicts are refused unless explicitly allowed.
lnk recall
Search local memories with recall readiness, project-aware filtering, type filters, and --as-of temporal recall.
lnk recipes
List saved procedure memories with their triggers and first steps.
lnk explain-memory
Show provenance, lifecycle, graph links, review issues, and recall readiness.
lnk update-memory
Merge new text into an existing memory and reset review state.
lnk archive-memory
Reversibly hide a stale or wrong memory from default recall.
lnk forget-memory
Permanently delete a memory after explicit confirmation.
Capture Workflow
Use lnk session-end at the end of a work session when an agent has notes or a transcript and should propose memory without saving it silently. Use lower-level captures for saved review inbox workflows.
lnk session-end session-notes.md ~/link --project link --limit 3
cat transcript.md | lnk session-end - ~/link --project link
lnk capture-session session-notes.md --project link
lnk capture-inbox --project link
lnk accept-capture raw/memory-captures/<capture>.md --index 1
lnk redact-capture raw/memory-captures/<capture>.md
lnk delete-capture raw/memory-captures/<capture>.md --confirm
lnk dedup-captures # collapse inbox captures that offer nothing new (--confirm applies)
Import Your Scattered Memory
Your memory already exists — in ~/.claude/CLAUDE.md and Claude Code's auto-memory, Cursor rules, a hand-tended AGENTS.md, or memories copied out of ChatGPT. lnk import reads those surfaces and turns each deliberate line into a reviewable proposal in the capture inbox — through the same dedup, secret-scanning, and injection-labeling gates as any capture. Nothing is ever auto-accepted, Link's own instruction sections are excluded, and re-running an import is a no-op for anything already pending, dismissed, or saved.
lnk import claude-code # CLAUDE.md + auto-memory
lnk import cursor # rules files
lnk import codex # AGENTS.md (minus Link's own section)
lnk import file --file chatgpt-memories.txt # anything pasted to a file
Weekly Digest
lnk digest is the reflection ritual: what you taught Link this week, what is aging out of its trust window, which memories are drifting into saying the same thing, and what is still waiting for review. Read-only and deterministic — it reuses the lifecycle, consolidation, and inbox engines rather than computing new truth. A quiet week says so.
lnk digest # the last 7 days
lnk digest --days 30 # a monthly look back
lnk digest --json # for dashboards and agents
Temporal Recall
Ask what you believed then, in plain language. Link resolves everyday time phrases ("last quarter", "in March", "2 months ago", "back then") to an exact date and reconstructs what was active on it from the dated files themselves — archived memories, supersede lineage, and expiry all participate. No model, no clock magic. --as-of YYYY-MM-DD still pins the moment explicitly.
lnk recall "where does local data live" # today's truth
lnk recall "where does local data live in March" # what was true then
lnk recall "what did we decide last quarter"
lnk recall "deploy process" --as-of 2026-03-31
Sync Between Machines
lnk sync moves reviewed memory between your machines through a git remote you control (a private repo, a homelab bare repo) — no server, no service. Secrets are scanned before anything is pushed; conflicting memory edits are kept as both versions and surfaced by lnk consolidate for review (git conflict markers never touch wiki files); the tamper-evident log merges with a declared re-anchor. raw/ captures and the runtime never sync.
lnk sync --init --remote git@github.com:you/link-memory.git
lnk sync # daily: commit, pull, resolve, gate secrets, push
lnk sync --status
Maintenance
lnk backup
lnk doctor --fix
lnk health
lnk status --validate
lnk memory-audit
lnk compliance-export --output link-audit.json
lnk team-sync ~/link
lnk snapshot ~/link --output link-snapshot
lnk operations
lnk benchmark "agent memory"
lnk rebuild-index
lnk rebuild-backlinks
lnk validate
lnk verify-mcp
Use lnk backup before broad repair work. Use lnk benchmark when a wiki starts to feel slow or when you want to see how much broad wiki context the bounded packet avoided sending to an agent. lnk status --validate and lnk benchmark both show persistent-cache reuse so you can tell whether Link is rereading every page or reusing unchanged records.
Use lnk operations when health reports an interrupted write. If a marker has a rollback snapshot, run lnk operations ~/link --recover <marker> to preview the recovery and add --confirm only after reviewing the plan.
Use lnk team-sync before sharing Link through Git. It is read-only: it checks Git state, verifies that raw/ is protected, checks whether review or visibility: private memories would make sharing unsafe, keeps wiki/log.md local to preserve each machine's audit hash chain, and prints paste-safe setup/sync commands without pushing private source material for you.
Use lnk snapshot when you need a static, read-only HTML export for a teammate, maintainer, security reviewer, or demo. It excludes raw/, captures, local operation state, and memory pages by default. With --include-memories, it still excludes visibility: private memories unless --include-private-memories is explicitly passed.
Use lnk connect <agent> when an agent already has Link instructions but still needs MCP wiring. It previews the config before writing.
lnk connect codex ~/link
lnk connect codex ~/link --write
lnk connect kiro ~/link --write
lnk connect claude-code ~/link --hooks --write
lnk verify-mcp ~/link
Add --hooks (Claude Code, Codex, Cursor) to also install session hooks: every new session then starts with a bounded Link memory brief injected automatically, and session end stores proposal-only notes with memory candidates for later review — no durable memory is written without approval. Codex has no session-end event, so it gets the session-start brief only. Sessions without memory-worthy content are skipped and duplicate end events are deduplicated, so the capture inbox does not fill with noise. The hooks run lnk hook session-start and lnk hook session-end, which you can also invoke directly to inspect what they inject or capture. Codex and Cursor hook support is new and follows those vendors' documented hook schemas — if a hook misbehaves there, please open an issue. If the workspace runtime predates session hooks, --write refreshes it automatically.
Use lnk recipes to list saved procedure memories with their triggers, and lnk recall "<task>" --type procedure to recall only recipes. Consolidation plans also surface recurring themes across session captures — the review-gated way an agent learns your patterns: detection is automatic and deterministic, but turning a pattern into one durable memory is always proposed to you first. A scheduled idle-time agent session can run the plan as a "dream pass" and bring proposals to your next session.
Use lnk consolidate when the capture or review backlog builds up. It is read-only: it counts pending captures and memories needing review, groups duplicate captures, and prints paste-safe accept/discard/review commands to run with the user. When the backlog crosses a threshold, the injected session-start brief nudges the agent to offer a consolidation pass, and MCP agents can request the same plan through review(action="consolidate").
Use lnk semantic to inspect or enable optional hybrid recall. Lexical recall is always the default and the fallback; running lnk semantic --setup once (or python3 -m link_mcp --semantic-setup for MCP-only installs) adds a small local embedding model so paraphrased queries also find memories phrased differently — on Homebrew installs, where the runtime Python refuses direct pip installs, setup provisions the extras into ~/.link-mcp-venv automatically. Recall itself never touches the network — the model loads offline-only, embeddings live in plain JSON under .link-cache/, and semantic-only matches are labeled with capped confidence so agents verify before trusting them. Measured results and methodology live in benchmarks/RESULTS.md.
From a source checkout, use the synthetic large-wiki smoke when you want local scale evidence without touching your real wiki. The script prints the exact lnk serve command and graph URL for the generated fixture.
python3 scripts/smoke_large_wiki.py --pages 10000
All Commands
lnk --version
lnk version
lnk init [dir]
lnk serve [dir] [--port 3000]
lnk onboard [dir] [--agent codex] [--write] [--hooks] [--first-memory "..."] [--seed-project .]
lnk seed [project-dir] [dir] [--project-name name] [--overwrite] [--dry-run]
lnk try [dir] [--force] [--serve] [--port 3000]
lnk proof [dir] [--force] [--serve] [--port 3000]
lnk welcome [dir] [--project slug]
lnk prompts [dir] [--project slug]
lnk next [dir] [--project slug]
lnk health [dir] [--json]
lnk status [--validate]
lnk operations [--limit 20] [--recover marker.json] [--confirm]
lnk backup [--label name] [--include-raw]
lnk compliance-export [dir] [--output audit.json] [--project slug]
lnk team-sync [dir] [--remote git-url]
lnk share <page-or-memory> [dir] [--port 3000]
lnk snapshot [dir] [--output link-snapshot] [--include-memories] [--include-private-memories] [--force]
lnk ingest-status
lnk import-obsidian <vault> [dir] [--dry-run] [--overwrite]
lnk remember "text" [--type note|preference|decision|project|fact|procedure] [--project slug] [--visibility private|project|team] [--review-after YYYY-MM-DD] [--expires-at YYYY-MM-DD] [--trigger "..."] [--applies-when "..."] [--supersedes name-or-title]
lnk propose-memories <file-or-text> [--project slug]
lnk session-end <file-or-text-or-> [dir] [--project slug] [--limit 3]
lnk capture-session <file-or-text> [--project slug]
lnk capture-inbox [--project slug]
lnk accept-capture <capture> [--index N] [--visibility private|project|team]
lnk redact-capture <capture>
lnk delete-capture <capture> --confirm
lnk query "task" [--budget micro|small|medium|large] [--project slug]
lnk graph-summary ["topic"] [--limit 40] [--depth 1]
lnk benchmark ["query"] [--budget micro|small|medium|large] [--project slug]
lnk start [dir] [--task "task"] [--project slug]
lnk brief "task" [--project slug]
lnk memory-audit [--project slug]
lnk consolidate [dir] [--project slug] [--limit N]
lnk semantic [dir] [--setup] [--rebuild]
lnk recall "query" [--project slug] [--type TYPE] [--as-of YYYY-MM-DD] [--include-archived]
lnk recipes [dir] [--project slug]
lnk profile [--project slug]
lnk wins [--project slug]
lnk memory-inbox [--project slug]
lnk memory-log [--limit N]
lnk review-memory <name>
lnk explain-memory <name>
lnk update-memory <name> "text" [--project slug]
lnk set-memory-visibility <name> private|project|team
lnk archive-memory <name>
lnk restore-memory <name>
lnk forget-memory <name> --confirm
lnk doctor
lnk doctor --fix
lnk migrate
lnk validate [--strict]
lnk rebuild-index
lnk rebuild-backlinks
lnk verify-mcp [--json]
lnk connect <agent> [dir] [--write] [--config path] [--python python] [--hooks]
lnk hook session-start|session-end [dir] [--limit N] [--project slug]
lnk backup [--list] [--include-raw]
lnk restore-backup <backup.tar.gz> [--include-raw] --confirm
python3 link.py demo
python3 link.py query-link "task" [dir]
query-link is kept as an internal/backward-compatible alias. Prefer lnk query in user-facing docs.