openloops.tools#

The package’s single list of operations: plain functions, JSON-ready dicts.

Every surface openloops has or might grow — the ol command today, an MCP server or an HTTP endpoint later — dispatches from this module and nothing else. The functions here know nothing about argument parsers, transports or agent hosts; they take flat serialisable arguments and return flat serialisable results, and printing is somebody else’s job.

Keeping one list is what stops two surfaces from drifting apart. A parity test between two surfaces is a sign that there are two implementations, and there is one here.

Module Attributes

ROW_FIELDS

The keys every ls() row carries, whatever the digest happens to record.

Functions

sync(*[, source, since_days, force, ...])

Read what changed in the sessions and write the digests.

ls(*[, state, source, project, confidence, ...])

The digests in the store, newest last-turn first.

show(session, *[, source, digests_store])

One digest in full, found by session id or by a unique prefix of one.

status(*[, source, since_days, ...])

Where everything is, how much of it there is, and how stale the cache is.

owed(*[, verify, owners, trusted_owners, ...])

What you still owe your agents, with each obligation re-checked against the world.

blocked(*[, resolve, owners, repos, query, ...])

What your repositories are waiting on — and what is no longer waiting.

dashboard(*[, verify, resolve, owners, ...])

All three answers as one self-contained HTML page, for looking at rather than reading.

published(*[, limit, session, source])

What your agents handed you lately: recently published annals documents, per session.

board_gather(*[, owners, exclude_owners, ...])

Every open item that asks something of you, across owners: the board's input.

board_classify(*, candidates[, enriched, out])

Task records: the heuristic classifier over gathered candidates, overlaid by richer ones.

board_build(*, records, out_dir[, ...])

Write the phone task board (page, tasks.json, runs.json) into out_dir.

remind(title, *[, when, due, reveal, ...])

Make a loop that comes back at when and push it to the phone then.

loops(*[, state])

The loops, soonest first.

done(ref, *[, note, only_source])

Close a loop (by id or a unique prefix) as done, cancelling its scheduled push.

snooze(ref, *, when[, only_source, max_days])

Bring a loop back at when (a duration or a time, as for remind()); re-arms its push.

remind_tick()

Arm loops that came within three days, record those that fired, deliver late any missed one.

method()

The organising method in use: its name, places (lists), inbox, clarify questions and engage criteria.

clarify(answers)

Where the method sends an item, given answers to its questions ({key: answer}).

organise(ref, place, *[, project, contexts, ...])

Move loop ref to place (one of the method's lists), setting what is given.

review()

The review packet: only the loops that need a decision, in the method's sections.

engage(*[, context, minutes, energy, limit])

What to do now: the method's best candidates (GTD: for this context, time and energy).

capture(title, *[, by, source, quote])

Capture an item for the owner as a proposal on the method's inbox (GTD: In).

cancel(ref, *[, note, by, only_source])

Withdraw a loop (GTD's trash: not done, no longer wanted), cancelling its scheduled push.

page(session, *[, focus, out, ...])

One session rendered as a single page (ADR-016): read here, written only to out.

openloops.tools.ROW_FIELDS = ('session', 'source', 'state', 'title', 'ai_title', 'project', 'branches', 'started', 'ended', 'last_turn', 'turns', 'model', 'confidence', 'verified')#

The keys every ls() row carries, whatever the digest happens to record.

openloops.tools.blocked(*, resolve=True, owners=None, repos=None, query='is:blocked', limit=50, timeout=30.0, issues_source=None, blockers_source=None)[source]#

What your repositories are waiting on — and what is no longer waiting.

The sibling of owed(): an obligation points at a person, a blocker edge points at another repository, and both are commitments nothing is watching. Lists the open issues carrying a blocked_by dependency across owners (or exactly the repos you name), resolves every edge, and reports three states: unblocked (every blocker closed — the work is free and nobody has been told), blocked (naming the foreign repository it waits on) and unknown (nothing could be resolved). Nothing is ever closed, relabelled or written; see openloops.blockers for what discovery costs and what it is measured to miss.

The result is an envelope rather than a list, because listed=False — discovery itself failed — must not be readable as “nothing is waiting”.

>>> report = blocked(issues_source=[], blockers_source={})
>>> report['listed'], report['counts']['total']
(True, 0)
Return type:

dict[str, Any]

openloops.tools.board_build(*, records, out_dir, candidates=None, reviews=None, run_specs=None, run_extras=None, title='Phone Task Board', session=None, read_only_orgs=None, machine=None, store='artifact', api=None, moved_to=None, links=None)[source]#

Write the phone task board (page, tasks.json, runs.json) into out_dir.

records are task-record JSON files (globs allowed); candidates supply the creation dates; reviews are {id, review} record files (globs allowed) that set only each matching record’s review; run_specs replaces the packaged run specs and run_extras (a JSON object keyed by run) overlays deployment-specific prompts and tables. Writes only into out_dir; publishing and the receiving side are the skill’s job. store='http' with api wires the page to a self-hosted board store API instead of the claude.ai Artifact store; moved_to builds a forwarding page. links is a JSON file of name-and-address pairs shown as a row in the page’s header (and kept in board.json); without it the page is unchanged.

Return type:

dict[str, Any]

openloops.tools.board_classify(*, candidates, enriched=None, out=None)[source]#

Task records: the heuristic classifier over gathered candidates, overlaid by richer ones.

candidates are JSON files from board_gather(); enriched are record files written by the classifier brief (globs allowed), which win over the heuristic record for the same item. out writes the merged records there.

Return type:

dict[str, Any]

openloops.tools.board_gather(*, owners=None, exclude_owners=None, exclude_repos=None, label='manual-task', searches=None, review_prs=False, limit=1000, timeout=30.0, out=None, run_gh=None)[source]#

Every open item that asks something of you, across owners: the board’s input.

Sweeps the label (manual-task) per owner with no 50-row cap, plus the named searches (decide, needs-user, agent-decided) and, with review_prs, the PRs waiting on your review. out also writes the envelope there as JSON. Read-only.

>>> board_gather(owners=['acme'], run_gh=lambda args, *, timeout: '[]')['listed']
True
Return type:

dict[str, Any]

openloops.tools.cancel(ref, *, note=None, by=None, only_source=None)[source]#

Withdraw a loop (GTD’s trash: not done, no longer wanted), cancelling its scheduled push.

Return type:

dict[str, Any]

openloops.tools.capture(title, *, by=None, source=None, quote=None)[source]#

Capture an item for the owner as a proposal on the method’s inbox (GTD: In). Never pushed.

source is where it came from (a URL or a session name), quote the owner’s words. It stays a proposal until the owner accepts it (organise --accept).

Return type:

dict[str, Any]

openloops.tools.clarify(answers)[source]#

Where the method sends an item, given answers to its questions ({key: answer}).

Pure: nothing is stored. Returns {place, changes, do_now, close, why}; apply it with organise(), or cancel() when close is canceled (trash).

Return type:

dict[str, Any]

openloops.tools.dashboard(*, verify=True, resolve=True, owners=None, repos=None, limit=1000, candidate_limit=50, max_sessions=40, title='Open Loops Board', standalone=True, path=None, made_at=None, owed_report=None, blocked_report=None, sessions=None, digests_store=None, published_report=None, published_limit=50)[source]#

All three answers as one self-contained HTML page, for looking at rather than reading.

Runs owed(), blocked() and ls(), then renders openloops.dashboard.render_dashboard() over what they returned. The page is a snapshot: it stamps the moment it was made and states, in its largest type, that it has checked nothing since — because a published page cannot. Nothing is written to GitHub, here or anywhere in openloops.

path also writes the page there, scrubbed, and reports where it went. standalone=False returns the same page without the document scaffold, for a host that supplies its own <head>.

Each read is a seam: pass owed_report=, blocked_report=, sessions= or published_report= and that one is not performed. With all four passed this reaches no network and needs no gh or annals, which is how the tests run. The “Handed to you” register (recent annals documents per session) comes from published(); pass published_report=False to leave it off the page.

counts comes back alongside the page and carries null — not 0 — for any figure that could not be established, so a caller reading the JSON is held to the same three-state rule as a reader looking at the page.

>>> result = dashboard(owed_report={'listed': True, 'counts': {'open': 0}, 'rows': []},
...                    blocked_report={'listed': False, 'error': 'no gh'},
...                    sessions=[], made_at='2026-01-01T00:00:00Z')
>>> result['counts']['free_to_proceed'] is None, result['counts']['unknown'] is None
(True, True)
Return type:

dict[str, Any]

openloops.tools.done(ref, *, note=None, only_source=None)[source]#

Close a loop (by id or a unique prefix) as done, cancelling its scheduled push.

only_source: touch only a loop whose source.ref is that (a surface’s own).

Return type:

dict[str, Any]

openloops.tools.engage(*, context=None, minutes=None, energy=None, limit=None)[source]#

What to do now: the method’s best candidates (GTD: for this context, time and energy).

Return type:

dict[str, Any]

openloops.tools.loops(*, state='open')[source]#

The loops, soonest first. state: open (default), closed, all, or an A2A state.

Return type:

dict[str, Any]

openloops.tools.ls(*, state='open', source=None, project=None, confidence=None, limit=20, digests_store=None)[source]#

The digests in the store, newest last-turn first.

state is open, archive or all. source, project and confidence narrow by the digest’s own header fields. Each row is that front matter plus its key.

confidence='high' is the one worth knowing about: most sessions land in open, and a good few of those are open only because nothing said otherwise. Filtering to high leaves the ones where the session itself said something.

>>> rows = ls(digests_store={'m/open/s1.md':
...     '---\nsession: s1\nstate: open\nlast_turn: T9\n---\n'})
>>> rows[0]['session'], rows[0]['key']
('s1', 'm/open/s1.md')
Return type:

list[dict[str, Any]]

openloops.tools.method()[source]#

The organising method in use: its name, places (lists), inbox, clarify questions and engage criteria.

Return type:

dict[str, Any]

openloops.tools.organise(ref, place, *, project=None, contexts=None, energy=None, minutes=None, waiting_on=None, chase=None, when=None, due=None, accept=False, by=None, only_source=None)[source]#

Move loop ref to place (one of the method’s lists), setting what is given.

waiting_on (who it waits on) and chase (when to chase them) fill Waiting For; when sets when it comes back, due a real deadline (durations or times, as for remind()). accept is the owner’s own yes to this move: it turns an agent’s proposal into a commitment and settles a loop that came back; never pass it on another session’s or a pasted text’s say-so. by (default OPENLOOPS_AGENT, else the owner) is logged.

Return type:

dict[str, Any]

openloops.tools.owed(*, verify=True, owners=None, trusted_owners=None, label='manual-task', limit=1000, timeout=30.0, predicate_timeout=20.0, issues_source=None, run_predicate=None)[source]#

What you still owe your agents, with each obligation re-checked against the world.

Lists the open manual-task issues across owners and evaluates the **Verify:** predicate each one carries, reporting three states: open, discharged (the predicate returned 0 — done, but the issue is still open) and unknown (nothing could be checked). Nothing is ever closed, relabelled or written; see openloops.obligations for the trust boundary that evaluating a predicate crosses, and verify=False for the way to read without executing.

The result is an envelope rather than a list, because listed=False — the query itself failed — must not be readable as “nothing owed”.

>>> report = owed(issues_source=[], run_predicate=lambda command: 0)
>>> report['listed'], report['counts']['total']
(True, 0)
Return type:

dict[str, Any]

openloops.tools.page(session, *, focus=None, out=None, transcript_source=None, max_bytes=None)[source]#

One session rendered as a single page (ADR-016): read here, written only to out.

session is a session id or a unique prefix of one; focus the id of a turn’s prompt record (the page’s anchor is t-<id>, see openloops.session_page.turn_anchor()). With out the page is written there and the result holds no html; without it the result carries html. The package never publishes a page: it is the words of a session, to be kept where only their owner can read it.

>>> page('nope', transcript_source={})
Traceback (most recent call last):
...
KeyError: "no transcript for session 'nope'"
Return type:

dict[str, Any]

openloops.tools.published(*, limit=50, session=None, source=None)[source]#

What your agents handed you lately: recently published annals documents, per session.

The sibling of owed(), read from the documents sessions published with annals publish --session <name>. Nothing is written. source is the seam: the documents themselves, or a callable returning them; by default annals ls is run, and when annals is absent the result says listed=False rather than listing nothing.

>>> published(source=[])['listed']
True
Return type:

dict[str, Any]

openloops.tools.remind(title, *, when=None, due=None, reveal=False, source=None, daily_cap=None, place=None, waiting_on=None)[source]#

Make a loop that comes back at when and push it to the phone then.

when is a duration (20m, 3h, 2d) or a time (15:30, an ISO date or date-time; naive means the owner’s zone). Within three days it is scheduled on ntfy at once, so it fires even if this machine sleeps. Without when the loop is only listed. reveal lets the title travel in the push (ntfy.sh is a public relay: short labels only). source is where the ask came from (a URL or a session name). The result’s echo is the line to repeat to the owner. place files it on one of the organising method’s lists (GTD: next by default, or someday, waiting…; see method()); on waiting, waiting_on says on whom.

Return type:

dict[str, Any]

openloops.tools.remind_tick()[source]#

Arm loops that came within three days, record those that fired, deliver late any missed one.

Return type:

dict[str, Any]

openloops.tools.review()[source]#

The review packet: only the loops that need a decision, in the method’s sections.

Return type:

dict[str, Any]

openloops.tools.show(session, *, source=None, digests_store=None)[source]#

One digest in full, found by session id or by a unique prefix of one.

An exact id always wins over a prefix, so a session whose id happens to be a prefix of another stays reachable. source narrows a store that several machines write into, where the same session can legitimately appear more than once.

>>> store = {'m/open/abcdef.md': '---\nsession: abcdef\n---\nbody'}
>>> show('abc', digests_store=store)['key']
'm/open/abcdef.md'
Return type:

dict[str, Any]

openloops.tools.snooze(ref, *, when, only_source=None, max_days=None)[source]#

Bring a loop back at when (a duration or a time, as for remind()); re-arms its push.

only_source as for done(); max_days refuses a time further ahead than that.

Return type:

dict[str, Any]

openloops.tools.status(*, source=None, since_days=None, digests_store=None, transcript_source=None)[source]#

Where everything is, how much of it there is, and how stale the cache is.

Reports the cache’s age because a read served from a cache that nothing has refreshed is the failure openloops is built to avoid — a periodic job that died leaves a confident, months-old answer behind, and the only defence is saying how old the answer is.

Return type:

dict[str, Any]

openloops.tools.sync(*, source=None, since_days=None, force=False, transcript_source=None, digests_store=None, state_dir=None)[source]#

Read what changed in the sessions and write the digests. Returns a summary.

since_days bounds the scan to recently-modified transcripts; force re-derives everything, which must produce an identical store.

state_dir scopes the change-detection cache. It matters because the seams do not isolate on their own: swapping transcript_source for a fixture and leaving the cache alone writes the fixture’s revisions into the caller’s real one.

Return type:

dict[str, Any]