# openloops.method

The organising method: the seam between the loop record and the system that organises it.

A loop ([`openloops.loops.Loop`](openloops.loops.html.md#openloops.loops.Loop)) records one of the owner’s commitments and stays
neutral about how commitments are organised: its `list` field is a *place* whose
vocabulary belongs to a method. A **method** supplies that vocabulary and the five
operations that personal organising methods share (Getting Things Done, Personal
Kanban, PARA, the Bullet Journal, the Eisenhower matrix and the apps that implement
them; the comparison is in `docs/research/organising-methods-seam.md`):

- **capture**: where an unclarified item lands (`inbox`);
- **clarify**: which questions an item is asked, and where the answers send it
  (`questions`, `clarify`);
- **organise**: the places, and the rules for moving a loop to one (`places`,
  `default_place`, `organise`);
- **review**: what is surfaced for a decision, as exceptions (`review`);
- **engage**: how the next thing to do is chosen (`criteria`, `engage`).

The method only decides. The rules that hold whatever the method, and so live here
rather than in each method, are applied by [`organise()`](#openloops.method.organise): a move is logged; only an
explicit acceptance turns an agent’s proposal into a commitment; a loop the owner has
attended to, or given a new time, is scheduled again rather than left as fired.

Every function in openloops that needs a method takes it as one keyword argument,
`method=`, defaulting to [`default_method()`](#openloops.method.default_method) (Getting Things Done,
[`openloops.gtd.GTD`](openloops.gtd.html.md#openloops.gtd.GTD)), the only method implemented. A second one is a class with
the same attributes, passed in; nothing else changes.

```pycon
>>> m = default_method()
>>> m.name, m.inbox, m.default_place
('gtd', 'in', 'next')
>>> isinstance(m, Method)
True
>>> sorted(describe(m))
['criteria', 'default_place', 'inbox', 'name', 'places', 'questions']
```

### Functions

| [`default_method`](#openloops.method.default_method)()                                  | The method used wherever `method=` is not given: Getting Things Done.             |
|----------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------|
| [`describe`](#openloops.method.describe)([method])                                | A method's vocabulary as flat JSON: what an agent reads before clarifying for it. |
| [`check_place`](#openloops.method.check_place)(method, place)                        | `place` if the method has it, else a `ValueError` naming its places.              |
| [`organise`](#openloops.method.organise)(loop, place, now, \*[, method, by, ...]) | `loop` moved to `place`, with what the method's rules make of `fields`.           |
| [`capture`](#openloops.method.capture)(title, \*, by[, source, method, now, id]) | A capture made by `by`, on the method's inbox; an agent's is a proposal.          |

### Classes

| [`Question`](#openloops.method.Question)(key, ask[, kind, choices, when])   | One question a method's clarify step asks of an item.   |
|----------------------------------------------------------------------------------------------|---------------------------------------------------------|
| [`Method`](#openloops.method.Method)(\*args, \*\*kwargs)                  | What an organising method supplies.                     |

### *class* openloops.method.Method(\*args, \*\*kwargs)

Bases: [`Protocol`](https://docs.python.org/3/library/typing.html#typing.Protocol)

What an organising method supplies. Pure: no clock, file or network.

- `name`: a short id (`gtd`).
- `places`: the values a loop’s `list` may take under this method.
- `inbox`: where an unclarified capture lands; `default_place`: where an
  item the owner asked for directly lands (both among `places`).
- `questions`: what `clarify` asks, in order. `criteria`: the keyword
  filters `engage` understands.
- `clarify(answers)`: where the answers send the item, as data:
  `{place, changes, do_now, close, why}`. `place` is `None` when the item
  leaves the system (`close` then names the lifecycle state, e.g. `canceled`).
- `organise(loop, place, now, *, others, **fields)`: the field changes a move to
  `place` makes, as a dict, after checking them; `ValueError` when the method
  refuses the move. `others` are the other loops, for a rule that counts
  (a work-in-progress limit). The move itself is applied by [`organise()`](#openloops.method.organise).
- `review(loops, now)`: `{method, at, sections: [{name, group, rows}], counts}`;
  only rows that need a decision, each `{id, title, list, why}`.
- `engage(loops, now, *, limit, **criteria)`: the candidates to do now, best
  first, each a row with `why`.

### *class* openloops.method.Question(key, ask, kind='bool', choices=(), when=None)

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

One question a method’s clarify step asks of an item.

`key` is the answer’s name in the mapping given to `clarify`; `kind` is one of
`bool`, `choice` (then `choices` lists them), `text`, `minutes`, `time`,
`words` (a list, or a comma/space separated string). `when` names the answer
this question depends on (`"actionable=false"`), so an agent or a form can skip
what does not apply.

#### read(value)

`value` as this question’s kind, or `ValueError` saying what was expected.

```pycon
>>> Question("a", "?").read("No"), Question("m", "?", kind="minutes").read("15")
(False, 15)
```

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

### openloops.method.capture(title, , by, source=None, method=None, now=None, id=None)

A capture made by `by`, on the method’s inbox; an agent’s is a proposal.

It never pushes and never reaches `engage` until the owner accepts it. `source`
(`{kind, ref, quote, said_by}`) is what makes it traceable; keep the owner’s words.

```pycon
>>> loop = capture("Call the notary", by="bosun", source={"kind": "voice", "quote": "call the notary"},
...                now=datetime(2026, 11, 28, tzinfo=timezone.utc), id="loop-c")
>>> loop.list, loop.proposed_by, loop.remind_at
('in', 'bosun', None)
```

* **Return type:**
  [`Loop`](openloops.loops.html.md#openloops.loops.Loop)

### openloops.method.check_place(method, place)

`place` if the method has it, else a `ValueError` naming its places.

```pycon
>>> check_place(default_method(), "later")
Traceback (most recent call last):
...
ValueError: gtd has no list 'later'; its lists are in, next, waiting, someday, reference
```

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

### openloops.method.default_method()

The method used wherever `method=` is not given: Getting Things Done.

* **Return type:**
  [`Method`](#openloops.method.Method)

### openloops.method.describe(method=None)

A method’s vocabulary as flat JSON: what an agent reads before clarifying for it.

* **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.method.organise(loop, place, now, , method=None, by='owner', accepted=False, others=(), \*\*fields)

`loop` moved to `place`, with what the method’s rules make of `fields`.

The rules that hold whatever the method:

- the loop must be open, and the place one of the method’s;
- `accepted=True` means the owner said yes to this move, in their own words. It
  turns a proposal into a commitment, and settles a loop that came back
  (`input-required`): it is open again (`submitted`), with no second push for a
  time already past. Anyone’s move otherwise leaves both as they were, so an agent
  never reschedules the owner’s commitments;
- a loop given a new time in the future is scheduled again, whoever moved it;
- one `organised` entry is logged, by `by`.

```pycon
>>> now = datetime(2026, 11, 28, 12, tzinfo=timezone.utc)
>>> from openloops.loops import new_loop
>>> loop = capture("Ask the bank", by="bosun", now=now, id="loop-b")
>>> moved = organise(loop, "waiting", now, by="bosun", waiting={"on": "the bank"})
>>> moved.list, moved.proposed_by, moved.waiting["since"]
('waiting', 'bosun', '2026-11-28T12:00:00Z')
>>> organise(moved, "waiting", now, accepted=True).proposed_by is None
True
```

* **Return type:**
  [`Loop`](openloops.loops.html.md#openloops.loops.Loop)
