org-workspace
Python library that makes org-mode files first-class citizens for AI agent workflows.
If you need to read and write org-mode task lists from Python — create tasks, transition states, query deadlines, or coordinate multiple agents over a shared org file — org-workspace is the library for it.
Built on a vendored fork of orgparse with write support (PR #77), it adds:
- Multi-file workspace management — load a directory, track dirty files, save only what changed
- Safe serialization — round-trip invariant: unmodified nodes are byte-identical on save
- GTD query layer —
agenda(),deadlines(),overdue(),next_action(),ai_tasks() - Concurrency primitives —
TaskClaim(atomic claiming),OptimisticLock,FileLock - Dependency DAG — parse
DEPENDS_ONproperties, topological sort,ready_tasks()
Install
pip install org-workspace
Quick start
from pathlib import Path
from org_workspace import OrgWorkspace, Query
# Load workspace
ws = OrgWorkspace(roots=[Path.home() / "org"])
# Query tasks
q = Query(ws)
next_up = q.next_action()
ai_tasks = q.ai_tasks(states=["TODO"])
deadlines = q.deadlines(days=14)
# Create a task
task = ws.create_node(
file=Path.home() / "org" / "inbox.org",
heading="Research org-mode parsing",
state="TODO",
tags=["AI", "research"],
body="Investigate approaches for org-mode mutation",
)
# Transition state
ws.transition(task, "DONE", agent="my-agent")
# Save changes (only modified files are written)
ws.save()
Documentation
- Quick start guide — from install to first AI-readable task list in five minutes
- Comparison: org-workspace vs orgparse vs organice — factual feature comparison for developers choosing a library
Features
Workspace management
- Multi-file loading with dirty-file tracking
- Content-addressed ID generation with dedup
- Round-trip safe serialization (zero byte-diff on unchanged files)
NodeView pattern
- Stateless, non-caching read-only views over org nodes
- Generation-counter staleness detection
- Safe for concurrent access patterns
Mutations (via OrgWorkspace)
create_node()— create headings with state, tags, properties, bodyrefile()— move nodes between files preserving subtreeremove_node()— delete nodes from filestransition()— state changes with LOGBOOK entriesset_property(),set_heading(),set_tags()
Query system
agenda(),deadlines(),overdue(),stale()by_state(),by_tag(),by_property()ai_tasks()— find:AI:tagged tasks for agent executionnext_action()— GTD next action selection
Dependency DAG (Plan)
- Parse
DEPENDS_ONproperties into dependency graphs - Topological sort for execution ordering
ready_tasks(),blocked_tasks(), cycle detection
Concurrency
FileLock— file-level lockingOptimisticLock— hash-based conflict detectionTaskClaim— agent-level task claiming with staleness timeoutmulti_lock()— deadlock-free multi-file locking (lexicographic order)
LOGBOOK and session logging
add_logbook_entry(),add_state_change_entry(),add_clock_entry()SessionLogfor buffered per-session logging
Archive
archive_node()— archive with hierarchy preservationarchive_done()— bulk archive completed tasksarchive_plan()— archive entire dependency plans
Context extraction (for AI agents)
build_execution_context()— structured context from task propertiesget_prompt()— PROMPT property with body fallbackget_role()— agent persona from ROLE property
GTD state configuration
from org_workspace import StateConfig
# Default: the DIP-0009 v2.0 vocabulary
config = StateConfig.default()
# #+SEQ_TODO: TODO NEXT WAITING REVIEW | DONE DEFERRED CANCELLED
# terminal: DONE, CANCELLED. DEFERRED is done-class but not terminal (it can wake to TODO).
# StateConfig.nightshift() is a deprecated alias for default(). The v1.1
# execution overlay (QUEUED, WORKING, FAILED) is retired; a reader of a legacy
# file passes its own StateConfig, or relies on that file's #+SEQ_TODO header.
License
BSD 2-Clause. See LICENSE.
This library includes a vendored copy of orgparse (BSD 2-Clause, Copyright 2012 Takafumi Arakaki) with modifications from datacore-one/orgparse PR #77 adding write support.
Metadata
Release files for org-workspace 0.7.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| org_workspace-0.7.1.tar.gz | 87.6 kB | Without provenance | Details for org_workspace-0.7.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| org_workspace-0.7.1-py3-none-any.whl | Python 3 | none | any | Details for org_workspace-0.7.1-py3-none-any.whl |
Total release size: 156.7 kB
Release files / org_workspace-0.7.1.tar.gz
| Download URL | org_workspace-0.7.1.tar.gz |
|---|---|
| Size | 87.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d35dccd0d8dbfb5884e684e98e0bc46850b54b69d890e0f5d0ceeccc36ffec66
|
|
BLAKE2b-256 checksum How to use checksums |
ccc5322dfd07ff1d22c0925a0acc1aa70e7d4f02da8b07e1546da7606529ced4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / org_workspace-0.7.1-py3-none-any.whl
| Download URL | org_workspace-0.7.1-py3-none-any.whl |
|---|---|
| Size | 69.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4461b16741c9f87dbc4b05dddb813b3ea7a3ee32d5c70051281b800030de9535
|
|
BLAKE2b-256 checksum How to use checksums |
656c6ad89e9f7037b4b624076028b66b33598a87635006f2eaa0a98ac2e72447
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for org-workspace 0.7.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.