Skip to content

Obsidian Tasks Plugin Integration

Runtime integration with Tasks plugin (v7.23.1) -- cache API, ownership split, mutation pipeline, tag behavior

Details

Runtime integration with Obsidian Tasks plugin (v7.23.1) via eval_js bridge.

Architecture

Python wrappers in env.py execute JS snippets from _js/ via bridge.eval_js(). All data comes from plugin cache (plugin.cache.tasks), not disk parsing.

Plugin API (apiV1)

executeToggleTaskDoneCommand(line, path) -> programmatic toggle, returns new line text. Handles recurring tasks, done dates, and status transitions. createTaskLineModal() and editTaskLineModal() open UI modals (not programmatic).

Plugin-Native Mutation Pipeline

  1. Find Task in cache by ID/description
  2. Call task.handleNewStatus(newStatus) -> returns new Task[] (handles recurrence, dates, pure function)
  3. Call result[0].toFileLineString() -> correctly formatted line string
  4. Write string to file via bridge.write_file() or vault.process()
  5. Cache auto-reindexes from file change via vault subscription

Ownership Split

Tasks plugin owns: checkbox state, done/cancelled dates, recurrence, priority emojis, due/scheduled/start dates. work-buddy owns: state (inbox/mit/focused/snoozed/done), urgency, complexity, contract link, snooze-until, state change history, task ID (t-). Shared: #projects/* tags.

Rule: Never fight the plugin's output. Let it compute its part, then add/update ours.

Tag Behavior

New tasks: clean lines with only #todo and #projects/ inline. State/urgency/complexity in SQLite store. Legacy tasks: may still have #tasker/state/ and #tasker/urgency/* inline. Manager reads store first, falls back to inline tags.

Priority Mapping

1=high (mapped from emoji), 2=medium (mapped from emoji), 3=none/default (no emoji).

Task Object Key Properties

description, originalMarkdown, statusCharacter, status.type (TODO/DONE), priority (1-3), tags, _dueDate/_doneDate/_createdDate (Moment objects), recurrence, children, parent, taskLocation._tasksFile._path, taskLocation._lineNumber.

Limitations

  • Tasks plugin cache is read-only for programmatic use. Creation uses raw markdown approach.
  • Cache includes all vault files -- filter by file_path for canonical list.
  • Moment.js dates must be formatted before serialization.
  • Task objects have circular parent/children refs preventing naive JSON.stringify.