Skip to content

feat: Phase 3, routines, Activity and approvals (2 of 3) - #2

Merged
bketelsen merged 23 commits into
mainfrom
phase3/routines
Oct 21, 2026
Merged

bketelsen merged 23 commits into
mainfrom
phase3/routines

Conversation

@bketelsen

Copy link
Copy Markdown
Contributor

Merge after #1. It targets main and holds #1's commits; once #1 merges, this shows only Phase 3.

Porter's Phase 3, kept local until Brian asked on 2026-10-21 to publish it: routines from prompts in the vault, Activity, approvals with approval cards in the web UI and the full app's Activity and Approvals pages, times in the owner's zone, a routine's model defaulting to routine_alias, and links Porter writes into the vault that work there.

Gates: make check.

bketelsen and others added 23 commits October 19, 2026 19:58
lodge/kit at bab1ed7 (untagged; it has lodgeapp's AgentClient and the
companion manifest flag), mise.toml and mise.lock with golangci-lint
2.13.1, lodge's .golangci.yml, and make verify, check and ci (frostyard/core
ADR-0043, ADR-0044), with lint, race, tidy-check and web-check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
thread.list, send, search, confirm, cancel and subscribe, with Turn, Card,
Context and Event (schema/rpc/thread.yaml, hand-written api/thread.go).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
SQLite (modernc): turns with their cards and context, an FTS5 index kept by
triggers, the rolling summary, card lookup, and recovery of a reply a
stopped porterd left unfinished.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
One MCP client per app, with that app's token, reconnecting once when a
session is gone. Each tool is marked Read, Draft, Write, Change, Capture or
Never (send and post tools, never offered); routines get only Read, Draft
and Write (ADR-0004). Porter's own tools join the registry.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each request carries the system prompt (draft 1), the owner's memory note,
the rolling summary, the recent turns and the context. Tools run through
the registry, and their results reach the model wrapped as data. Capture
becomes a card the owner confirms before anything is appended. remember,
search_thread and now are Porter's own tools. Replies stop at 40 tool
calls, and Compact folds old turns into the summary at background priority.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- internal/service implements thread.list, send, search, confirm, cancel
  and subscribe. There is one reply at a time, and events go to subscribed
  connections as the kit's envelope (event "turn" or "working").
- internal/config: /etc/porter/porter.json (owner, time zone, aliases,
  apps), and each app's token in the state directory, set with
  `porterd token set APP` (0600).
- porterd wires the store, one MCP client per app with a token over the
  agent socket, the inference socket, the agent and the service.
- The manifest sets companion: true, and the unit joins lodge-agents.
- Tests: config and tokens, plus a session's whole thread through
  kittest: events, a conflict while replying, list and search.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The thread (paged, kept at the bottom, a reply growing as events arrive),
markdown built as DOM from marked's lexer with no innerHTML and no image
ever loaded, links only to lodge addresses or https with their host shown,
tool and capture cards (confirm with edits, cancel), the input with the
current app's context chip and lodge-client's ask, search in the full app,
light and dark, phone-first. lodge-client is pinned at lodge bab1ed7;
marked 18.0.14; vitest and happy-dom for 50 tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
In the first live run, Porter guessed message ids for draft_reply: one
failed and one drafted a reply on the wrong thread. The prompt now says to
find an id with a search or list tool and use exactly what it returned, and
to link a draft when its tool returns a url.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Porter signed its first live draft "Porter". A draft goes out as the
owner's, so the prompt says to write it in their voice, signed with their
name or not at all.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
In its first live use the local model wrote "Draft ready" four times
without calling draft_reply, and the history then showed it those
replies as if they were done. porterd now checks a reply's claims
(drafts, captures, memory, tasks) against the reply's tool cards: an
unbacked claim sends the model back once, and if it is still unbacked
the reply says nothing was done. A past reply that called no tool is
marked so in the history. The prompt says the same, and draft_message
is classified as a draft for when mail adds it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e nudge

The claim check caught the next unbacked "Draft created", but the model
still called no tool: its history showed four earlier replies claiming
drafts, and a "[Done in this reply: …]" line it copied. History now
replays a reply's cards as the tool calls they were (a card keeps its
arguments, long strings shortened), with each call's outcome, and
leaves out the text of a past reply that claimed an action no tool
took. The nudge's retry sets tool_choice to required, and falls back
to asking without it if the provider refuses.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A placeholder standing in for a failed reply was copied word for word by
the model as its next answer. The history now leaves out a reply that
claimed an action no tool took, with the owner's turn it answered, and
search_thread leaves it out too; search_thread's hits show the tools a
reply called. A reply that repeats porterd's own words (its notes, or
markers older versions put in the history) counts as failed: it is sent
back once, and left out of the history.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
After the history fix, the model's first draft_reply guessed message 1
and drafted on another person's thread. A call of a tool that is not a
read now takes only ids a tool returned in this reply, the owner wrote,
the screen shows, or an earlier successful call used; any other id is
refused with a note to look it up first, and nothing is done.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Porter was pinned to lodge commit bab1ed7 for the agent socket client
and the companion's messages; both are now released as v0.2.0
(c31c333, the same kit code). The lockfile resolves client 0.2.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- internal/routine: routine notes in Porter/Routines/ parsed strictly
  (five cron fields, zone, output template, thinking, model, enabled), a
  scheduler that lists the folder each minute, runs what is due,
  never overlaps a routine, runs a recent miss at start and notes an
  older one, retries an unavailable model every 15 minutes for 2 hours,
  fails a run past 10 minutes or 40 tools, writes the output note
  (replacing only its own, else " (2)"), posts the run's line with its
  action cards, and records Activity. An invalid routine is posted once
  per version and never runs.
- The agent's loop serves chat and routines. A routine runs at
  background priority with the unattended tools; a call of any other
  offered tool becomes an approval card with its whole arguments, which
  thread.confirm runs and thread.cancel dismisses.
- Contract: CardKind approval, thread.pending, the activity domain
  (list, routines) and the activity event.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Approval cards with Approve and Dismiss; cards on notice turns, for
routine runs; in the full app, tabs for the thread, Activity (routines
with their next and last runs and any error, then entries, live) and
Approvals (every pending capture and approval, kept in step with turn
events).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…t carry it

A routine's check put a 09:30-04:00 standup at 5:30, and gave mail times
in UTC.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Porter linked mail and notes by lodge address (/mail/message/…,
/notes/2/…), which its thread opens through lodge. In a note a rooted path
is a vault path, so clicking a link in today's brief made notes named
mail/message/…. Text bound for the vault (routine outputs, created and
edited notes, captures, approvals' appends and memory) now links notes
as wikilinks by vault path and everything else by absolute URL under the
new lodge_url setting.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant