Currently, all content imported via the Obsidian plugin is marked with EntrySource = "computer", which is also used for other types of imports (such as desktop client or manual ingestion). This lack of granularity in the source attribution means:
- It's impossible to specifically target only Obsidian-imported content for actions (e.g. bulk deletion) from the UI or API;
- All "computer" entries are lumped together, and deleting Obsidian content inadvertently affects unrelated entries.
For example, in src/khoj/routers/api_content.py, the EntrySource type only allows "computer", "github", or "notion", which are saved as DBEntry.file_source in the database. There is no way to distinguish between Obsidian-originated content and other sources with the current model.
Proposed Solution:
- Add a new
EntrySource value (e.g. "obsidian") in both frontend and backend to mark entries originating from the Obsidian plugin.
- Update validation, ingestion, and query logic to recognize and persist
"obsidian" as a valid source.
- Adapt deletion, filtering, and API/listing features to allow distinguishing content by its specific EntrySource.
Motivation/Use-case:
- Safely perform operations (delete, filter, query, list) that affect only Obsidian-imported content.
- Prevent accidental data loss when deleting or modifying content ingested by other pathways.
- Enable better tracking and debugging of content origins.
Currently, all content imported via the Obsidian plugin is marked with
EntrySource = "computer", which is also used for other types of imports (such as desktop client or manual ingestion). This lack of granularity in the source attribution means:For example, in
src/khoj/routers/api_content.py, theEntrySourcetype only allows"computer","github", or"notion", which are saved asDBEntry.file_sourcein the database. There is no way to distinguish between Obsidian-originated content and other sources with the current model.Proposed Solution:
EntrySourcevalue (e.g."obsidian") in both frontend and backend to mark entries originating from the Obsidian plugin."obsidian"as a valid source.Motivation/Use-case: