# openloops.gtd

Getting Things Done (David Allen) as an organising method: the default, and the only one.

It implements [`openloops.method.Method`](openloops.method.html.md#openloops.method.Method) with GTD’s own vocabulary, for the
owner’s commitments:

- **Capture** lands on `in`, GTD’s In list.
- **Clarify** is GTD’s workflow decision tree: is it actionable? If not: trash,
  incubate (`someday`, optionally with a date to come back) or `reference`. If it
  is: someone else should do it, delegate it (`waiting`, on whom); under two minutes,
  do it now; a specific day, defer it (`next` with a `remind_at`, the tickler);
  otherwise `next`. More than one step makes it part of a `project`.
- **Organise** moves a loop between `in`, `next`, `waiting`, `someday` and
  `reference`. Waiting For says on whom; reference is not actionable, so it carries
  no reminder.
- **Review** is the Weekly Review as an exceptions packet, in GTD’s three phases:
  *get clear* (In to zero, proposals to accept), *get current* (overdue, fired and
  unanswered, coming up, Waiting For to chase, projects with no next action), \*get
  creative\* (a sample of Someday/Maybe). Everything else is counted, not listed, so the
  owner’s attention goes only where a decision is needed.
- **Engage** is GTD’s four-criteria model: context, time available and energy filter
  the Next list; priority (a real deadline first, then what already fired, then the
  oldest) orders what is left.

Delegating to an agent is GTD’s delegate step: the loop goes on the owner’s Waiting
For, `waiting={"on": "<session>"}`, and the review lists it when it is due a chase.
That is how agents’ (cheaper) attention takes a loop off the owner’s mind.

```pycon
>>> gtd = GTD()
>>> gtd.clarify({"actionable": False, "keep": "someday"})["place"]
'someday'
>>> gtd.clarify({"actionable": "yes", "delegate_to": "openloops session"})["place"]
'waiting'
>>> gtd.clarify({"actionable": True, "minutes": 2})["do_now"]
True
```

### Module Attributes

| [`PLACES`](#openloops.gtd.PLACES)   | GTD's lists, as the places a loop can sit on.                                |
|-----------------------------------------------------------|------------------------------------------------------------------------------|
| [`ENERGY`](#openloops.gtd.ENERGY)   | Energy levels, lowest first (engage keeps what needs no more than you have). |

### Classes

| [`GTD`](#openloops.gtd.GTD)([two_minutes, coming_up, chase_after, ...])   | Getting Things Done.   |
|----------------------------------------------------------------------------------------------------|------------------------|

### openloops.gtd.ENERGY *= ('low', 'medium', 'high')*

Energy levels, lowest first (engage keeps what needs no more than you have).

### *class* openloops.gtd.GTD(two_minutes=2, coming_up=datetime.timedelta(days=7), chase_after=datetime.timedelta(days=7), someday_sample=5, engage_limit=5, name='gtd', places=('in', 'next', 'waiting', 'someday', 'reference'), inbox='in', default_place='next', questions=(Question(key='actionable', ask='Is it actionable: is there something to do about it?', kind='bool', choices=(), when=None), Question(key='keep', ask='Not actionable: throw it away, incubate it for later, or keep it as reference?', kind='choice', choices=('trash', 'someday', 'reference'), when='actionable=false'), Question(key='project', ask='Does the outcome take more than one action? Name the project.', kind='text', choices=(), when='actionable=true'), Question(key='minutes', ask='How many minutes does the next action take?', kind='minutes', choices=(), when='actionable=true'), Question(key='delegate_to', ask='Should someone else (a person or an agent session) do it? Who?', kind='text', choices=(), when='actionable=true'), Question(key='remind_at', ask='Must it happen on a specific day or time? When should it come back?', kind='time', choices=(), when=None), Question(key='contexts', ask='Where or with what can it be done (e.g. @mac, @phone, @errands)?', kind='words', choices=(), when='actionable=true')), criteria=('context', 'minutes', 'energy'))

Bases: [`object`](https://docs.python.org/3/builtins/functions.html#object)

Getting Things Done. The keyword fields are the method’s tunable rules.

`two_minutes`: the two-minute rule’s threshold. `coming_up`: how far ahead the
review looks for dates. `chase_after`: a Waiting For item with no `chase_at`
is due a chase once untouched this long. `someday_sample`: how many Someday/Maybe
items the review shows (oldest first). `engage_limit`: candidates `engage`
returns by default.

#### clarify(answers)

GTD’s decision tree over `answers` (keys: `questions`), as data.

```pycon
>>> GTD().clarify({"actionable": "no", "keep": "trash"})["close"]
'canceled'
>>> d = GTD().clarify({"actionable": True, "project": "Move flat", "remind_at": "2026-12-01T09:00Z"})
>>> d["place"], d["changes"]["project"], d["changes"]["remind_at"]
('next', 'Move flat', '2026-12-01T09:00Z')
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### engage(loops, now, , limit=None, context=None, minutes=None, energy=None)

What to do now: Next Actions available now, filtered by context, time and energy.

A loop deferred to a later `remind_at` is not available yet (the tickler), and
a proposal never shows. Priority orders what is left.

```pycon
>>> from datetime import timezone
>>> now = datetime(2026, 11, 28, 12, tzinfo=timezone.utc)
>>> a = _loops.new_loop("Call", now=now, id="loop-1", contexts=["@phone"], minutes=10)
>>> b = _loops.new_loop("Write", now=now, id="loop-2", contexts=["@mac"], minutes=90)
>>> [r["id"] for r in GTD().engage([a, b], now, minutes=30)]
['loop-1']
```

* **Return type:**
  [`list`](https://docs.python.org/3/builtins/stdtypes.html#list)[[`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]]

#### organise(loop, place, now, , others=(), \*\*fields)

The changes a move of `loop` to `place` makes, checked against GTD’s rules.

Waiting For merges what is given into what was there, and restarts its clock
only when it now waits on someone else. Reference is not actionable: it keeps
no reminder, and refuses one.

```pycon
>>> from datetime import timezone
>>> now = datetime(2026, 11, 28, 12, tzinfo=timezone.utc)
>>> loop = _loops.new_loop("Ask the bank", now=now, id="loop-b")
>>> GTD().organise(loop, "waiting", now, waiting={"on": "the bank"})["waiting"]
{'on': 'the bank', 'since': '2026-11-28T12:00:00Z'}
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

#### review(loops, now)

The Weekly Review as exceptions: only what needs a decision is listed.

```pycon
>>> from datetime import timezone
>>> now = datetime(2026, 11, 28, 12, tzinfo=timezone.utc)
>>> stuck = _loops.new_loop("Draft", now=now, id="loop-s", list="in", project="Book")
>>> packet = GTD().review([stuck], now)
>>> [(s["name"], [r["id"] for r in s["rows"]]) for s in packet["sections"] if s["rows"]]
[('in', ['loop-s']), ('stalled_projects', ['Book'])]
```

* **Return type:**
  [`dict`](https://docs.python.org/3/builtins/stdtypes.html#dict)[[`str`](https://docs.python.org/3/builtins/stdtypes.html#str), [`Any`](https://docs.python.org/3/library/typing.html#typing.Any)]

### openloops.gtd.PLACES *= ('in', 'next', 'waiting', 'someday', 'reference')*

GTD’s lists, as the places a loop can sit on. “Scheduled” (the tickler) is not a
list: it is a loop on Next with a future `remind_at`.
