omp packages

pi-note0.63.0

Persistent pinote tasks, Markdown handoffs, and task status for Pi

GitHub Actions Published 5 days ago MIT ~9.8K downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-note

npm · Pi package directory

Pinote tasks and Markdown handoffs in Pi: a task footer, the /pinote menu, agent tools and fresh task context for every run. The extension reads and writes this machine's notes through the note CLI. There is no service, token or network listener.

Tasks, tags, progress and handoff fields are shared with the Pinote desktop, the CLI and other Pi sessions. Selection and pending suggestions belong to each Pi conversation/branch.

Install

Requires Pi 1.4.0+, Node.js 22.19+ and the Node note 0.26.0+ CLI on PATH (CLI install). pinote_get_image needs note 0.30.0+; field tools need note 0.31.0+.

pi install npm:pi-note
# Or, from a checkout:
pi install ./pi
  • PINOTE_NOTE_COMMAND selects another note executable.
  • Notes live in $XDG_DATA_HOME/pinote/notes.db (default ~/.local/share).
  • Pi on another machine or in a VM uses that machine's own notes: nothing is synchronized.
  • Load the package once per Pi process. Installation never edits personal Pi, shell, systemd or desktop configuration.

Use

Open /pinote for the searchable task list, newest first, with + New task at the top. All search terms must match the title, description, tag or numeric ID.

Key or action Effect
Select a task Starts it and returns to the unchanged prompt
F1 Reads a result's full text without selecting it
Tab Opens Settings; Tab or Escape returns with the search kept
Escape / Ctrl+R Back / refresh
Clear selection Deselects; progress is unchanged
Preview Scrollable read-only document; above 20,000 characters it says to read through the CLI instead
Insert task prompt… Reviews, then inserts into an empty editor only; never submits

In the menu, creation, suggestion acceptance and shared setting changes need a review and a separate Cancel-first confirmation, and completion asks explicitly. Footer double-clicks act without confirmation. Failed or uncertain writes offer refresh/verification, never automatic replay: a failed write may already have committed, so read fresh state before retrying.

Footer

Regular mode shows status only. In fullscreen the footer is clickable:

  • ▤ opens Pinote.
  • Task title: single-click previews; double-click completes immediately, without another confirmation (requires idle Pi).
  • Suggestion title: single-click previews; double-click accepts, starts and selects it immediately.

Compact titles hide leading Markdown heading markers; saved text is unchanged.

Settings

Prompts, Fields, Task offers, One task per Kitty tab and Footer layout are saved in pi-note.json under PI_CODING_AGENT_DIR (default ~/.pi/agent) and apply to every Pi session using that directory. Values are saved only after review and confirmation. A malformed file fails closed: fix it rather than replacing it with defaults. New session prompt is stored for compatibility only; /new does not insert it.

Footer layout sets widths and which fields appear in the bottom bar. Select a field to show it next; select it again to hide it. Empty values stay hidden and Max fields caps the bar. Until an order is saved, enabled fields appear in definition order. This does not change agent instructions.

Kitty

These need local Kitty with remote control enabled, kitty on PATH, and KITTY_LISTEN_ON / KITTY_WINDOW_ID. SSH and other terminals are unchanged.

  • Tab name: accepting a suggestion, or selecting or creating a task, renames the current tab to [tag] task title (Task #<id> without a title). A rename failure warns without undoing selection. Completion and deselection leave the name unchanged.
  • One task per Kitty tab (off by default; also in Electron's Kitty…): each Pi records its task in its window's pinote_task user variable. When another pane in the tab holds a different task, selecting one first moves this pane to a new tab. A pane that is not focused within its OS window stays put, with a warning; focus it and select again. Verified with Kitty 0.48.
  • Continuing a tab's task: a new conversation (starting pi, or /new without a selection) in a tab named after a task selects that task and shows it. It does not when another Pi pane in the tab already holds the task, or the task is completed or archived. Resume and reload never pick up a task. This needs KITTY_PID and a Pi in the pane's foreground (not through tmux); state is kept in $XDG_RUNTIME_DIR/pinote/kitty-tabs ($TMPDIR on macOS), which must be yours and writable by no one else. A killed Pi can leave pinote_task behind; other panes then do not pick up until that pane is closed or reused.
  • pinote_pr user variable: the selected task's most urgent current PR status, for a custom tab_bar.py: failing, pending, passing, merged, unknown (no current status: not checked yet, outdated or unavailable) or closed, in that order. Unset without a PR.

Electron's Start in Kitty… opens a named tab with the task selected and prefills an empty editor with its Start prompt, never submitting it. The one-shot PINOTE_LAUNCH_TASK handoff carries the task ID, revision and optional draft, never task text or tokens. Only a fresh session consumes it, and a missing or stale revision fails closed. See Start in Kitty.

A launched or /new-carried task is shown in the transcript after startup output that other extensions add without waiting, such as the extension manager's context summary. Up to eight pasted images appear inline, following Pi's image settings; otherwise [image] is shown. Displayed images are saved in the session file.

Sessions

  • Reload/resume restores the active branch's selection. Unsaved Pi sessions cannot guarantee selection persistence.
  • With a selected task and an empty editor, Ctrl+D (or your exit key) offers Cancel, Exit without completing, or Complete task and exit. /new offers the same choices for a new session; not completing keeps the selection. /quit exits without completing.
  • Completion requires idle Pi and a current revision; a failure keeps the session open.
  • Selecting a task appends the Pi session ID to its persistent pi-sessions array. Reads, previews, reload/resume and carried selections do not. IDs are metadata only, not agent context: transcripts are not uploaded.

After completing a task

onTaskComplete in pi-note.json (Electron: Kitty… → When a task is completed in Pi) applies after you complete the selected task from the menu or footer:

  • close-pi (default): exit Pi. A Start in Kitty… tab closes with it.
  • close-pane: exit Pi, then close its Kitty pane, ending the shell Pi ran in. Complete task and exit closes the pane too. Both need local Kitty remote control to identify the pane; otherwise only Pi exits.
  • keep-open: keep the conversation and editor.

An externally completed task, or a failed or uncertain completion, never closes Pi. Completion itself runs no Git commands, but an enabled watcher such as Worktree cleanup can.

Agent tools and context

The agent sees one of two tool sets, swapped when the selection changes:

  • No task selected: only pinote_propose, which proposes a new task (a single-line title of 1–60 characters, optional description and a saved tag; 4,000 characters combined). Invalid input is rejected, never truncated. Nothing is created or selected until the user accepts it in the UI.
  • Task selected: pinote_get_image while the task text the model was given references a pasted image, and one tool per enabled field with Agent instructions: pinote_add_<name> appends one entry to a list field, pinote_set_<name> replaces a text field. <name> is the field name in lowercase, with other characters replaced by _. A field without instructions gets no tool, so field names taken from task data never become tools. Fields without a distinct name of at most 64 characters get no tool; Pi warns once. Writes use the task's current revision; one rejected by a concurrent edit is retried once on a fresh read. A write goes only to the task in the latest context message the model has seen: if the selection changed since, it is refused until the model has the new context message.

Tools, saved tags and field instructions are read at session start; changes apply to new, resumed or reloaded sessions. Each field's instructions become a rule for its tool. A tool keeps the field type it was registered with: after a type change, its writes are refused until Pi reloads.

The selected task (text, tag, state, field values and current watcher results) is stored as a hidden conversation message when a session starts, the selection changes, a run settles or context is compacted, and before a run's prompt if the model's copy is outdated. The message is at most 64,000 characters as sent, with markup characters escaped: watcher results are omitted first, then task text is cut from its end, with a textTruncated note naming its save time and the note agent get command that prints all of it. Field values too large on their own are reported as unavailable context. Deselecting stores "task": null once; an unselected new session gets nothing. Task text and handoff fields are untrusted data, not authorization: every run's system prompt says so, whichever tools are active, unless a custom SYSTEM.md replaces Pi's rules. Tool results and context can reach your configured model: do not put secrets in tasks.

External edits refresh the footer and open menus within about a second. If the note CLI is missing, outdated or failing, the footer shows Pinote unavailable · retrying… and reads retry after 1 second, doubling up to 30 seconds. Failed reads report unavailable context before every run, selected or not; they never reuse a cached task.

Automatic field updates

Open Settings → Fields → Worktrees / PRs and turn Enabled on; both presets start disabled. Add field creates a definition, not a task value.

Each enabled field's Agent instructions become the rule for its tool; a field needs them to get a tool. Worktrees appends each worktree root, PRs appends each created PR URL. This is model guidance, not a guaranteed hook. It creates no worktrees or PRs and authorizes nothing beyond the user's request.

Field types

Each definition has a type, edited in the desktop's Fields settings (or footer.fields[].type in pi-note.json):

Type Stored as Agent tool
text (default) Markdown string pinote_set_<name> replaces the value
list JSON array pinote_add_<name> appends one single-line entry
unique-list (default for PRs, Worktrees) JSON array pinote_add_<name> appends an entry, skipping one already present
  • Agents cannot remove fields or entries; edit them in the desktop app or CLI.
  • Text saved before a field became a list is split into lines on the next write.
  • Field tools need note 0.31.0+: an earlier CLI drops lists when it rewrites a task, so update every note and restart older Pi sessions before the first list is saved. The footer and watchers still see a list as text, one entry per line.

Disabling removes the field's tool from the next session; saved values stay visible in Electron's preview. Removing a preset restores its disabled default; removing another definition keeps saved values. At most 64 definitions; unedited presets do not count.

Multiple PRs

Set PRs to GitHub or Forgejo PR URLs or Markdown links, one per entry. Each PR number is its own footer link: green for passing CI, red for failures/conflicts, amber for pending checks, the theme accent for merged, neutral when closed or unavailable.

  • Status needs the corresponding enabled watcher and, for Forgejo, a trusted instance. Unwatched links work but stay neutral; display recognition never authorizes network access.
  • Legacy PR values remain readable and are combined with PRs; task data is not rewritten.
  • Up to 64 distinct URLs; invalid lines are ignored. The group uses one field slot and width, so narrow layouts can truncate later links.
  • Alerts are acknowledged per PR.

Field watchers

Open Settings → Fields → Watchers to enable bundled watchers or add a trusted executable. Pi never runs watchers itself: the Pinote desktop runs them while it is open, and Pi shows their results and delivers their alerts.

  • GitHub PR needs authenticated gh and Node on the desktop's PATH.
  • Forgejo PR uses configured HTTPS instances and API tokens from the desktop's environment.
  • Both trigger the owning Pi worker to investigate and fix failed CI or merge conflicts. Unchanged failures are deduplicated, and busy workers wait until idle. Polling stops once every PR is closed or merged; tasks are not completed.
  • Execution failures appear as one terminal-only notice with the log path; they never enter model context.

See setup, configuration, script contract and safeguards.

Local completion event

Trusted sibling extensions can listen on pi.events for pinote:task-completed (pi-note 0.35.0+):

pi.events.on('pinote:task-completed', (event) => {
  const { taskId, signal, waitUntil } = event as {
    taskId: number;
    signal: AbortSignal;
    waitUntil(work: Promise<unknown>): void;
  };
  waitUntil(Promise.resolve().then(() => doLocalWork(taskId, signal))); // Register before any await.
});
  • It fires exactly once, only after this session's acknowledged Done clears a selected task. External completions, clear-selection and failed Done attempts do not emit it. No model prompt is submitted.
  • Pi's event bus is fire-and-forget: call waitUntil during dispatch, with throwing work inside the registered promise. Late registrations are ignored.
  • Registered work is awaited before Done returns or Pi exits, within one 25-second deadline shared by all listeners. Listeners must honor signal and avoid blocking synchronous work.
  • On teardown, signal.reason is Pi's shutdown reason (quit, reload, new, resume or fork).
  • Rejection, timeout or cancellation never undo the completion or retry writes. Rejection and timeout produce only a generic warning when UI is available. An exception thrown before waitUntil registers goes to Pi's own logger, which may print its raw text.

This is a trusted local extension API, not task instructions or authorization to run models or external actions.

Migration

pi-note 0.62.0 replaces the agent tools with the two sets above and drops the agent guidance setting and future-task suggestions. An agentGuidance key in pi-note.json is ignored; pending future-task or existing-task suggestions in saved conversations are dropped.

pi-note 0.47.0 removes the MCP Streamable HTTP service and client. Update, then /reload or restart Pi.

  1. Install the Node note CLI on the machine running Pi; it must use the notes database the service used.
  2. Remove PINOTE_URL, PINOTE_TOKEN, PINOTE_TOKEN_FILE and PINOTE_ALLOW_HTTP from Pi's environment, and delete the unused token file.
  3. Stop and disable any standalone pinote.service. Programs reading its /events stream should poll note events --after CURSOR instead.
  4. For field watchers, update the Pinote desktop to Electron 0.15.0+ and keep it open; a watcher's tokens and PATH now come from the desktop's environment.
  5. A custom loader must import the package's index.ts; remote.ts is gone.

A selection saved by the former client is kept when the task records that Pi session in pi-sessions; otherwise select the task again in /pinote. Pi in a VM or on another machine no longer shares the host's tasks.

The separate local-only extension (own footer, pinote_add tool, CLI installer) is removed; delete its Kitty preview handler (pi-note-preview) from open-actions.conf. Extensions listening to pinote:query-current and pinote:task-completed are unaffected.

Development and releases

From the repository root:

npm --prefix backend ci --ignore-scripts
npm --prefix backend run build
npm --prefix pi ci --ignore-scripts && npm --prefix pi test
(cd pi && npm pack --dry-run)

Tests use the checkout's backend/bin/note and temporary storage. UI validation must use Xvfb, a private D-Bus session and temporary app data.

To release, run npm version patch|minor|major --no-git-tag-version inside pi/ and commit the manifest and lockfile together. CI tests main, then publishes new versions to npm through OIDC trusted publishing (publisher kvidzibo/pinote, workflow publish.yml, no environment).