Obsidian Cli Memory Bank
Overview
Use this skill to maintain a per-project "memory bank" inside Obsidian with consistent note structure, dense wikilinking, and CLI-first retrieval. Persist the vault path once, then bootstrap/update project notes on every relevant run.
Communication Style
- •Be friendly and conversational 🙂.
- •Use light emojis to keep updates engaging (
✅,🧠,🔎,🛠️). - •Avoid noisy failure narration when a safe fallback exists (for example missing optional env vars).
Workflow
Resolve the skill path first. Do not assume any one agent runtime path:
if [ -f "./scripts/obsidian_memory.py" ]; then
SKILL_DIR="$(pwd)"
elif [ -n "${CODEX_HOME:-}" ] && [ -d "$CODEX_HOME/skills/obsidian-cli-memory-bank" ]; then
SKILL_DIR="$CODEX_HOME/skills/obsidian-cli-memory-bank"
elif [ -d "$HOME/.codex/skills/obsidian-cli-memory-bank" ]; then
SKILL_DIR="$HOME/.codex/skills/obsidian-cli-memory-bank"
else
echo "Need absolute path to obsidian-cli-memory-bank skill directory."
exit 1
fi
Run all helper commands as:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" <command> ...
1) Resolve vault first
Run:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" show-vault
If no vault is set for the current workspace:
- •Ask exactly one question:
Which absolute vault path should I use for this project? - •Save it:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" set-vault --vault-path "/absolute/path/to/vault"
Use --workspace "/path/to/project" when setting or resolving a different workspace than the current directory.
2) Bootstrap project memory structure
Create core notes once per project:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" bootstrap --project "Sequency"
Or run the one-command initializer:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" init-project --project "Sequency" --with-stub
This creates:
- •
Project Memory/<project-slug>/<Project Home>.md - •
Project Memory/<project-slug>/MOC.md - •
Project Memory/<project-slug>/Run Log.md - •
Project Memory/<project-slug>/Decisions.md - •
Project Memory/<project-slug>/Open Questions.md
All seed notes include wikilinks to each other so backlinks are available immediately.
3) Record each meaningful run
After a task, add a run note:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" record-run \ --project "Sequency" \ --title "Fix MXF progress regression" \ --summary "Updated progress to use true frame counts." \ --prompt "User asked for accurate progress on MXF exports." \ --actions "Adjusted estimateFrameCount routing in exporter and view model." \ --decisions "Prefer measured frame counts over duration heuristics." \ --questions "Confirm behavior for variable-frame-rate MXF corpus." \ --tags "swift,mxf,bugfix"
This creates a timestamped note in Runs/, appends it to Run Log.md, and links back to project anchor notes.
4) Retrieve context before answering
Use CLI retrieval first:
# search by topic python3 "$SKILL_DIR/scripts/obsidian_memory.py" search --project "Sequency" --query "MXF fallback routing" # inspect a key note python3 "$SKILL_DIR/scripts/obsidian_memory.py" read-note \ --path "Project Memory/sequency/Decisions.md"
5) Keep graph hygiene high
Run periodic audits:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" audit --project "Sequency"
This runs:
- •
obsidian unresolved counts verbose - •
obsidian orphans - •
obsidian deadends - •
obsidian backlinks path="<project-home-note>" counts
Automatic behavior: record-run triggers auto-audit every N runs (default 5).
Change cadence:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" set-audit-frequency --runs 5
Set --runs 0 to disable auto-audit.
6) Health-check setup
Run:
python3 "$SKILL_DIR/scripts/obsidian_memory.py" doctor
This validates Obsidian CLI availability, app reachability, workspace-to-vault mapping, and vault write access.
Persistence Mode
Use this pattern to behave as “always-on” memory:
- •At first action in a session, run
show-vault; ask user only if missing. - •At task start, run
searchfor key topic terms before proposing changes. - •At task end, run
record-runwith summary + rationale. - •Run
auditperiodically (or after major refactors).
Hook Integration (Optional)
For runtimes that support hook events, use the matching adapter script.
Codex supports a native notify hook for agent-turn-complete. To enable it:
chmod +x scripts/install_codex_notify_hook.sh scripts/codex_notify_hook.py "$SKILL_DIR/scripts/install_codex_notify_hook.sh"
The hook auto-runs record-run for mapped workspaces and no-ops when a mapping is missing.
Rules
- •Prefer wikilinks (
[[Note]]) over plain text references. - •Link every run note to at least:
[[<Project Home>]],[[MOC]], and one topic/decision note. - •Keep properties at the top of notes (
tags,created,updated,project,type). - •Use short, stable note titles; avoid duplicate names in the same vault.
- •Capture both outcome and rationale so later retrieval answers "what changed" and "why".
Resources
- •Script entrypoint:
scripts/obsidian_memory.py - •Reference patterns:
references/obsidian-cli-patterns.md