Obsidian CLI Turns Notes into Agent-Accessible Knowledge Base
Obsidian CLI exposes markdown vaults for scripting, letting agents create, append, search, and manage notes with semantic awareness. Instead of dumb text scans yielding 200 irrelevant lines for "Kubernetes," CLI search ranks by note titles, tags, frontmatter, paths, and links—delivering structured results like relevant note names. Use obsidian new --title "Daily Note" to generate daily journals with tasks, or obsidian search "meeting notes" for ranked matches. Append content via obsidian notes "path/to/note" --append "- [ ] Task", which auto-formats as markdown checklists. Fetch tasks with obsidian tasks --status todo --file daily, filter unresolved items, or query links/backlinks to build graph-like context: obsidian links "project-note" reveals connected resources, projects, and areas per PARA method. Screenshot active UI via CLI for visual debugging—obsidian screenshot—giving agents full context on tabs/menus. Pipe results to TUIs like tv for fuzzy terminal search with previews, Neovim opens, or tagging. This grounds agents in your existing vault, avoiding chat history bloat or manual MD dumps.
Pi Agent Extension Enables On-Demand Vault Queries
Install Pi's Obsidian package (pi install pi-obsidian) to grant the agent CLI access, letting it query/search/create notes inline. Pi self-adapts: it taught itself CLI usage, compared it to direct file access (favoring CLI for structure), and handles 20-second queries on high-reasoning models by opening notes directly. Script morning routines: open daily note, add inbox-check todo, fetch random old note for recall. Agents now treat Obsidian as an IDE for editing/reviewing LLM outputs, storing "lessons learned" alongside handwritten notes. Links provide smarter context—agents traverse connections for richer responses, turning flat files into a queryable graph without rebuilding from scratch.
Graphifi Adds Knowledge Graph for Token-Efficient Retrieval
Run Graphifi (pipx install graphifi) on your vault to generate a knowledge graph via Tree-sitter parsing, indexing nodes, edges, tags, and semantics—originally for code repos, it adapts to notes. It identifies "god nodes" (highly connected), surprising links (e.g., course launch semantically near DevOps notes), and cohesion scores. Outputs: JSON wiki index, HTML viz, report. Pi's Graphifi package (pi install graphifi-pi) instructs agents to traverse the graph pre-query: graphifi build on full vault takes 5+ minutes but caps at safe sizes; benchmark shows token reduction per query (less than promised 70x on large note bases, but measurable vs. raw scans). Query explain kubernetes for connected nodes; everything I know about Kubernetes compiles structured responses with references. This maximizes Q&A on Karpathy's three-layer stack (notes → storage → query), cutting confusion from weak retrieval.
Markdown Portability Beats AI-Native Note Apps
Skip subscription-locked AI tools promising auto-summaries—they impose proprietary graphs/memories. Obsidian's plain markdown stays portable, git-diffable, editable in Neovim, and future-proof. Agents enhance your system without replacing thinking: manually review/compile notes to cement knowledge, or graphs waste tokens on unprocessed data. Trade-off: CLI syntax feels like curl (verbose params), no fuzzy UI for results, but scripting efficiency trumps it for automation.