Skip to content

detect: add .obsidian/ (and .trash/, .smart-env/) to _SKIP_DIRS — Obsidian vault config is ingested as source code #2493

Closed

Description

@ientzsch2011-sketch

Summary

_SKIP_DIRS in graphify/detect.py covers venvs, caches and build output, but not .obsidian/ — the config directory Obsidian creates at the root of every vault. As a result, running graphify on an Obsidian vault ingests the app's own UI state as source code.

Obsidian is a natural corpus for graphify (a folder of Markdown notes is the ideal input), so this hits essentially every vault out of the box.

Files picked up

Every Obsidian vault has these, all detected as code:

.obsidian/graph.json         # graph-VIEW settings (node colours, forces, filters)
.obsidian/workspace.json     # open panes, window layout, cursor positions
.obsidian/app.json
.obsidian/appearance.json
.obsidian/core-plugins.json

.obsidian/graph.json is worth calling out: it's Obsidian's graph view configuration, not graphify output. The name makes it easy to misread as something graphify itself produced — I did exactly that before checking the path.

On a real vault of ~180 files, 5 of the 7 detected code files were these — i.e. 71% of the "code" corpus was UI state.

Reproduce

mkdir -p /tmp/vault/.obsidian /tmp/vault/notes
printf '{"a":1}' > /tmp/vault/.obsidian/graph.json
printf '{"b":2}' > /tmp/vault/.obsidian/workspace.json
printf '{"c":3}' > /tmp/vault/real-data.json
printf '# Note\nbody\n'  > /tmp/vault/notes/note.md

python -c "
from graphify.detect import detect
from pathlib import Path
f = detect(Path('/tmp/vault'))['files']
print({k: len(v) for k, v in f.items() if v})
print('code:', [p.split('/')[-1] for p in f['code']])
"

Actual

{'code': 3, 'document': 1}
code: ['graph.json', 'workspace.json', 'real-data.json']

Expected

{'code': 1, 'document': 1}
code: ['real-data.json']

Proposed fix

Add to _SKIP_DIRS in graphify/detect.py:

".obsidian",    # Obsidian vault config/UI state — .obsidian/graph.json is the
                # graph-VIEW settings file, not graphify output
".trash",       # Obsidian's soft-delete folder — deleted notes, still on disk
".smart-env",   # Smart Connections plugin embeddings cache

.trash/ matters beyond noise: notes the user deleted keep showing up as live nodes in the graph.

Workaround

A root .graphifyignore with .obsidian/, .trash/, .smart-env/ works today and needs no code change — the gitignore support in detect handles it. Verified on the repro above: code drops 3 → 1, real files untouched.

Note for anyone writing that workaround

Do not put graphify-out/ in .graphifyignore. It looks like a sensible belt-and-braces line, but detect already skips that directory via _SKIP_DIRS and deliberately re-includes the sidecars under graphify-out/converted/ — the Markdown extracted from PDFs, i.e. the only path by which a PDF enters the corpus. Adding the line silently drops every PDF-derived document (I lost one this way; document count fell by 1 with no warning, and it only surfaced because I diffed the two file lists).

Possibly worth a line in the docs, or a warning when a user-supplied ignore pattern would match graphify-out/converted/.

Environment

  • graphifyy 0.9.6 (installed via uv tool), Python 3.14, macOS
  • Also verified against main at v0.9.33: .obsidian is still absent from _SKIP_DIRS

Activity

  1. rohit-jsfreaky commented on Aug 9, 2026

    @rohit-jsfreaky
    Contributor

    I reproduced this on the current v8 branch. I plan to add the listed Obsidian metadata directories to _SKIP_DIRS and add a regression test that verifies they are excluded while real project JSON remains detected. I will open a focused PR for this.

  2. added a commit that references this issue on Aug 11, 2026
  3. safishamsi commented on Aug 11, 2026

    @safishamsi
    Member

    Fixed in v0.9.40 (graphifyy==0.9.40 on PyPI). .obsidian and .smart-env (Obsidian vault metadata / plugin caches) are now in the skip-dirs. .trash was intentionally left out as a generic name with over-skip risk. Thanks @rohit-jsfreaky (PR #2572).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions