/memex:session-endfrom memex
Closes a Memex session by updating status.md, session-log.md, hub files, and verifying wikilinks. Use at session end or before a long break.
Ships in memex. 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.
Read when SKILL.md points to them; scripts run unread.
Wikilink rule: When referencing files in any markdown you write, use [[filename]] format. Plain-text filenames break Obsidian graph connectivity.
Leave the workspace clean for the next session. Work each step in order — no skipping, no asking permission between steps; execute everything, report at the end.
Session-end's work is proportional to the session (touched files, modified hubs, new decisions). Workspace-wide maintenance — graph rebuild, dedup, contradiction sweep, decisions compression — lives in /memex:reindex//memex:consolidate on their own cadence.
Run WORKSPACE_ROOT=$(pwd) && echo "$WORKSPACE_ROOT" via Bash.
No _MANIFEST.md: skip silently, stop. Otherwise resolve paths (first match wins): manifest config table → convention (memory/status.md, session-log.md, decisions.md, scratch/ideas.md or ideas.md) → search by name. No session lock — unconditional and idempotent.
Before touching files, write a brief internal summary: files created/modified/moved, domains touched, decisions made, done vs. left open.
Idempotency check: strip the "Last updated" line from old and new content, hash both. Matching hashes (unchanged substance): skip the write entirely, including the date — prevents "ran twice" from compounding drift via timestamp churn.
Prepend to session-log.md (after the header, before existing entries):
## YYYY-MM-DD - [one-line title]
- [what changed - name files specifically]
- [decisions made or insights locked]
- [what's next / what was left open]
---
3-5 bullets. Past tense. Specific.
If the log now has more than 10 entries, archive the oldest — see references/log-rotation.md.
_CLOSETS.mdOnly update hubs for domains touched this session. Read the Hub Map for each hub; scan touched folders for *-index.md files too (catches hubs created informally, without /memex:add-domain).
5a. Hub-table entries (legacy hubs only). Touched hub with a prose [domain]-index.md file/table: update per references/legacy-hubs.md. Closets-only hubs (v2.1+ default) skip this; new files land in _CLOSETS.md via 5c. Always update _MANIFEST.md's one-line summaries when Tier 1/Tier 2 content changes meaningfully, per the 8 rules in references/summary-rules.md (benchmark-validated 90.1% R@5 — don't paraphrase).
5b. Status sections in touched domain files. Scan files read/edited this session for status-like sections (## Status, ## Current State, ## Progress); update any made stale (e.g. still "planned" when done, counts/dates that no longer hold). Touched files only.
5c. Refresh _CLOSETS.md for touched hubs. Refresh each touched hub's _CLOSETS.md (sibling of the hub index, e.g. programs/_CLOSETS.md) — the typed-field index future sessions scan. Format/semantics/pagination/fallback: references/closets-format.md (read once per session). Quick rules: one ## [[stem]] heading per file; subjects/people/claims/decisions/dates/status lines (omit empty); cap ~1500 chars/entry; only touched-this-session files; create if missing. Over 30 entries: paginate per the reference (includes Recently Archived).
5d. Refresh memory/_CLOSETS.md. Touched Tier 1 file (status.md, session-log.md, decisions.md, glossary.md, or user-added like contacts.md): refresh its entry — same format, no pagination. Missing on 2.1.x+: create from memory-closets.md.tmpl, seed every Tier 1 file.
Self-check. Re-read each summary written/updated this session — would it surface every named subject in the top 5 manifest hits? Missing subject: add it.
Scan for files/folders not in any hub or the manifest (skim content). Flag folders with 3+ untracked markdown files (likely domains — note name, count, apparent topic from content) and loose untracked project files (note which domain fits, or if it's a new one). Build a list for the close-report; keep it fast — session-end surfaces this, dedup/contradiction sweeps are /memex:consolidate's job.
Meaningful decisions this session: append to decisions.md:
**YYYY-MM-DD** - [decision stated as a fact, one sentence]
Append-only — session-end doesn't compress. At/above 95 lines after appending: nudge the close report (decisions.md at <N> lines; run /memex:consolidate --fix to compress); don't block close. No decisions: skip this step.
8a. Wikilink integrity. Run against the workspace (--skip .claude .obsidian .git + any scratch path):
python3 "${CLAUDE_SKILL_DIR}/scripts/verify-wikilinks.py" "$WORKSPACE_ROOT" --skip .claude .obsidian .git
Not found: report "Wikilink script not found - skipping" — don't silently pass. Broken links: fix them; target is zero.
8b. Wikilink suggest (scoped to this session). Files created/modified this session (Step 2's summary): run a scoped suggest pass for new plain-text refs that should be wikilinks:
python3 "${CLAUDE_SKILL_DIR}/scripts/verify-wikilinks.py" "$WORKSPACE_ROOT" --suggest --files <file1> <file2> ... --skip .claude .obsidian .git
Hits: surface in the close report; auto-apply only unambiguous matches (exact case-fold match to an existing file), list ambiguous ones (short stems, multiple candidates) for the user to route. No files touched: skip 8b. Proportional version of /memex:wikilinks --suggest — run that for full sweeps.
8c. Typed-edge graph (deferred). No longer rebuilt at session-end — refreshes lazily via /memex:reindex//memex:consolidate (both run extract-graph.py). Frontmatter-bearing file touched this session: mention it in the close report:
frontmatter touched this session — run /memex:consolidate or /memex:reindex to refresh memory/.graph.md
Informational; don't block close.
8d. Self-test. Verify each prior step's output landed:
status.md — "Last updated" today (or unchanged if Step 3 idempotent-skipped)session-log.md — new entry at top, today's date_CLOSETS.md/memory/_CLOSETS.md — entry for every touched file_MANIFEST.md — summary-format-version marker still :2Any failure: surface in Step 9 as [INCOMPLETE] next to the step. Drift is louder than silence.
Output:
Session closed.
status.md - updated [date]
session-log.md - entry added: "[session title]"
Hub updates: [list or "none needed"]
Decisions logged: [count or "none"]
Wikilinks: CLEAN
Next session: [top priority from status.md]
Append if triggered — untracked content (Step 6) or an ideas inbox with routes:
Untracked content:
[folder]/ ([count] files about [topic]) - /memex:add-domain [name]
[file.md] (fits in [domain]/) - say "organize files" to move it
Ideas inbox: [count] items
"[title]" -> [domain]. Say "route ideas" to move ready items.
Consolidate cadence nag. Skip if workspace < 14 days old (_MANIFEST.md mtime) — nothing to sweep yet. Otherwise check memory/.consolidate-runs.log's last line: missing or > 14 days old, append Last /memex:consolidate: [N days ago | never]. Consider running it for a deeper drift sweep.; else omit. One-line nudge — informational, doesn't block close.
$CLAUDE_PLUGIN_DATA set and exists: append to $CLAUDE_PLUGIN_DATA/session-closes.log:
YYYY-MM-DDTHH:MM:SS workspace-root-basename clean
Best-effort, never blocks close — no lock to clear; session-start/session-end are stateless.
[[filename]] format; every new hub file gets one.[[old-name]] across all .md files, update to [[new-name]]./memex:lint if drift is suspected..session.lock) — unconditional, idempotent (Step 3 hashes to skip no-op writes); bulk-write skills keep their own locks for real concurrency._CLOSETS-archive.md per references/closets-format.md.*-index.md in touched folders only — untouched domains wait for a future session./memex:consolidate; the 100-line cap just nudges the close report.references/summary-rules.md literally.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub skyfox-io/memex --plugin memex17 skills in this plugin
/add-domainAdds a new domain folder with a hub index and wires it into `_MANIFEST.md` -- for a new topic area, or splitting an existing domain into its own folder.
/archiveMoves a file from active (Tier 2) to archived (Tier 3) so Memex stops loading it automatically -- for a wrapped project, a stale reference, or a superseded file. The file stays on disk; only its manifest tier and hub status change.
/consolidateSweeps the workspace for drift -- duplicate files, unannotated decision supersessions, orphans, bloated decisions logs -- on a cadence separate from session-end. Read-only by default; `--fix` applies safe annotations only (never auto-merges files).
/cross-searchTrigger when the user's question spans multiple Memex workspaces and they don't know which one holds the answer, or they ask "have I written about X anywhere?". Not for questions the current workspace can answer -- use `/memex:search` instead. Reads only manifests and closets, never inside individual files.
/ideaQuick-capture an idea to the scratch inbox. Use when the user explicitly asks to capture: "capture this", "add to ideas", "don't let me forget", "log this idea", `/memex:idea`. Not for every "we should eventually..." aside -- most asides aren't capture-intent. Not for decisions (decisions.md) or state claims (closets `claims:` field).
/initSets up Memex in the current workspace. Detects state -- fresh repo, existing repo with loose markdown, a foreign manifest, or an outdated version marker -- and runs the right combination of scaffold, scan-and-organize, migrate, or health-check.
Other plugins' skills for the same job