@abhishek944/pi-tasks0.17.0
Session-scoped work and todo tracking for Pi.
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.
Reports 0
No reports yet.
Readme
pi-tasks
A Pi extension for session-scoped work and todo tracking.
It adds:
WorkCreate,WorkList,WorkUpdate, andWorkDeleteTodoCreate,TodoList,TodoUpdate, andTodoDeleteTaskTimeExportandTaskTimeImportfor measured delegated effort/works, a detailed floating dashboard modeled afterpi-loop-monitor's/monitors- a compact floating top-right panel with work and todo names, completion percentages, and measured active time
- main-conversation guidance that keeps normal requested work current across every Pi skill and requires each delegated agent to establish its own Work and Todo IDs before assigned work
Works and todos belong only to the Pi session ID. Their authoritative JSON file is <agent-directory>/tasks/<sessionId>.json (normally ~/.pi/agent/tasks/). Navigating the conversation tree never rolls tasks back. Resume/reload retains the same records; a fork with a new session ID starts empty. Existing sessions import their selected legacy task view once when no JSON store exists; original history is left untouched. /ask and /btw conversations do not update works, todos, loops, or monitors.
The coordination model is intentionally small: a work is a collection of tasks with shared context and no status, a todo is one concrete step with its own status, a monitor runs one long-lived background command, and a loop schedules a future or repeated wake. Loops and monitors remain owned by pi-loop-monitor.
Tracking guidance requires the globally installed implement skill as the coordination workflow for every tracked Work, including worker-local Works, while preserving specialized skill permissions. Pi-tasks owns records/progress, implement owns task ownership decisions and artifact paths, and herdr owns delegated-agent lifecycle. Root artifacts use repository-relative var/<sessionId>/<workId>/<taskId>/; children nest their own session/Work/Task path below the parent task directory. Each task records self or delegate with a reason in the hidden taskInfo; the only visible task text is finalThoughts. These are instructions, not runtime enforcement, shared cross-session records, or an automatic skill installer. Missing required skills, tools, or IDs blocks execution; plain conversation and /ask//btw remain outside this workflow. See the usage guide for setup and the full contract.
Install
pi install npm:@abhishek944/pi-tasks
Restart Pi or run /reload.
Use
The extension guides Pi to manage work automatically for normal requests that start or continue work. You can also call the tools directly:
WorkCreate workName="Add task tracking" workInfo="Detailed goal, scope, constraints, and expected outcome"
TodoCreate workId="W1" taskName="Implement state" taskInfo="owner: self — records and state changes." goal={ goal: "State schema and storage are implemented", criteria: ["Schema and storage are implemented", "Typecheck and build pass"] }
TodoUpdate taskId="T1" completionPercent=40 finalThoughts="State changes are implemented; rendering and verification remain."
TodoUpdate taskId="T1" status="completed" finalThoughts="State, rendering, typecheck, and build passed. Live native behavior is unverified."
TodoUpdate taskId="T1" status="closed"
TodoUpdate taskId="T2" status="blocked" dependentOn="another-agent" blockedReason="Waiting for review. Resume when it returns."
WorkUpdate workId="W1" workInfo="Task tracking is implemented; state and UI checks passed."
taskInfo is hidden coordination metadata: keep the owner: declaration, canonical artifact paths, parent IDs, and necessary execution constraints there. It is never shown in the task panel. finalThoughts is the only user-visible task text. A blocked task also stores dependentOn="user-decision" or dependentOn="another-agent", which task details show beside Final thoughts together with the blocked age when the record stores one. A user-decision blocker can store the pi-decisions decisionQuestionId that it waits on. Use final thoughts for a short significant active update, a completed result with verification and remaining limits, or rely on blockedReason for the authoritative blocked dependency. Do not repeat the goal, ownership rationale, or history there; see Final thoughts.
Run /works to inspect full workInfo and each task's Final thoughts in an interactive overlay. Hidden task metadata stays available to tools for resumption but is not rendered. Display controls now live under this one command; /works-panel has been removed.
| Command | Display |
|---|---|
/works |
Open the on-demand overlay dashboard |
/works compact-on / /works compact-off |
Show/hide the compact Pi display |
/works herdr-on / /works herdr-off |
Open/focus or close only this session’s native Tasks pane |
These displays are independent. Hiding either display never stops tracking. Auxiliary actions such as /works open, /works open-session, and /works delegate T<number> remain available.
Works are collections with no status. Every task starts active with its own visible goal and acceptance criteria; no separate goal approval is required to work, delegate, complete, or close it. TaskGoalUpdate records a material goal change. Verified work is completed at 100% and can be closed without a closeout approval step; closing is an agent action after verified completion, and a delegated worker's /close is requested and verified with TaskWorkerClose or TaskCloseoutFinalize. Tasks use active, blocked, completed, closed, and cancelled. Cancelling a task or reopening a closed or cancelled task requires an explicit human decision through TaskLifecycleDecision; closed and cancelled records stay stored. A cancellation requested from an active task is recorded as blocked on user-decision with its decisionQuestionId while the page is pending; rejection restores it to active. The tool accepts an optional cancellation reason, shown on the page and recorded with the decision. Use blocked only when the next step waits for a user decision (a response, approval, or permission) or for another agent's output or review. Supply both blockedReason and dependentOn when entering blocked status: dependentOn is exactly "user-decision" or "another-agent". Explain the dependency and what will unblock it; retain progress. The blocked reason is that task's visible Final thoughts, so do not duplicate it. Both fields are preserved during other blocked edits and cleared when leaving blocked; a new blocked state records blockedAt, while a legacy record without it omits the age entirely. Older blocked records without either field remain readable without an invented dependency. When several tasks link the same decisionQuestionId, one answer must reconcile all of them, and a superseded page is retired with pi-decisions WithdrawQuestion while its tasks are updated in the same turn. If a conversation concludes that a blocker no longer exists, the task record must change in that same turn; saying no input is needed without updating it is a lifecycle defect. Do not mark a task blocked for an external service, tool failure, or other obstacle that fits neither category; keep it active, preserve safety, and report the unavailable dependency truthfully. A status change clears an unsupplied thought, so an old active note cannot hide a new blocker. Completed tasks should state the short verified result and remaining limits in finalThoughts; historical completed records without one remain honestly empty rather than showing old narrative. Parent delegated tasks stay blocked while awaiting worker output; the worker's own local tasks may be active. AgentCreate automatically blocks the parent task after successful creation, retaining its progress. For manual delegation, mark the parent task blocked explicitly. Return blocked tasks to active when the dependency resolves and work resumes. Status does not itself schedule a wake. Legacy saved task statuses planned and pending restore as active; old Work statuses are ignored. Work tools no longer accept status or a status filter. To cancel an entire Work, cancel its remaining tasks through the human decision path; WorkDelete removes only tasks with no recorded work, so a Work containing retained tasks cannot be deleted.
Pi reports approximate task progress through the existing TodoCreate/TodoUpdate tools using optional completionPercent (an integer from 0 to 100, or null for unknown). Work progress is the equal average of non-cancelled tasks, rounded down—not the fraction of finished tasks. For example, task values 100, 40, 0, 0 give work progress 35%. A missing estimate makes work progress unknown (—); blocked tasks retain their estimate. Completed tasks are 100%; reporting 100 without completed status is rejected. For longer tasks, the guidance asks Pi to include interim estimates after roughly 5–10 meaningful working steps or a milestone, rather than waiting until completion. Estimates remain optional and must be supported by evidence; this is guidance, not an enforced schedule. These percentages are estimates, not time predictions. The floating panel keeps percentages in a reserved right-hand column so long names cannot hide them. Existing keyboard controls are unchanged.
Native Herdr view
Run /works herdr-on from the intended local Pi session to open its compact native Work → Task tree. Task names toggle inline Final thoughts; taskInfo is never shown. A blocked task shows its authoritative blocked reason and, when stored, Dependent on: User decision or Dependent on: Another agent beside the Final thoughts label; a task with no thought shows an honest empty label. Legacy blocked records without a dependency show no invented label. Linked task-only Agent ↗ buttons open existing delegates: a pane owner gets normal focus, while a pane-less Core child opens its own screen overlay over the current tab without navigating to its parent. The pane header carries a compact status dropdown (All statuses, Active, Blocked (all), Blocked on you, Waiting on agents, Completed, Cancelled) that narrows the tree to matching tasks; Completed lists every finished task, including records closed after verified completion, so finished work does not disappear from the view used to find it, while All statuses stays the live view; the split entries use dependency counts, labels show how many tasks each entry lists, and blocked rows show their blocked age when the record stores one while Work progress and effort stay totals for every task; its selection is per-pane view state and is never written to records or settings. A Work with nothing to list is not drawn, and no Work or task record is deleted. Numeric progress/time stay on the right; the native header × closes only the view. No extra session/status bar or Read-only footer.
Set pi-tasks.herdrPanel.enabled to true to open or focus the pane automatically at each session start in a local Herdr Core TUI session. The package fallback is off when the key is omitted; a malformed value reports a diagnostic and stays off. Automatic startup also replaces this terminal’s Tasks pane from an earlier session and keeps setup failures silent. /works herdr-off still closes the running session’s pane, and commands never rewrite settings.
First setup installs missing content assets and refreshes a differing mods/pi-tasks asset from this package version, keeping the replaced file as a timestamped backup, then creates/selects personal copies of the current pane header/layout for the persistent native-header close; header and layout originals stay untouched. See native setup, compatibility and rollback. /works compact-off hides only the compact TUI, not tracking or the native view.
Active task time
The panel and /works reserve Done and Time columns. An active task whose details declare owner: self starts timing automatically when a run begins, or when it becomes the only eligible task during a run; routine work needs no extra call. Use TodoUpdate taskId="T1" working=true only to switch between tasks when more than one is eligible; switching pauses the previous task. Use working=false to pause without changing status for the rest of that run. Blocked, delegated, completed and closed tasks are never timed automatically, and explicit choices always win.
The extension uses Date.now() to add working intervals, including thinking and foreground tools. Idle time, native retry delays between agent loops, and blocking user prompts do not count. Completion, blocking, cancellation, ownership changes, abort, and shutdown stop the timer automatically. Saved totals survive reload and branch navigation; restored tasks are paused and offline time never counts. A running time has a ▶ marker. Totals are saved on interval boundaries, not every display tick. A forced process kill can lose the current unsaved interval. Blocking prompt exclusion needs a Pi host that emits ui_prompt_start/ui_prompt_end; older hosts still pause at agent-loop boundaries.
New tasks start at 0s; historical tasks without timing show — until measured, with no attempt to reconstruct earlier time. Work time sums every task's measured effort, including cancelled tasks; any unknown task makes the total unknown. It is not wall-clock duration or an estimate of remaining time. Every delegated agent times its own local tasks. AgentCreate supplies a timing report path; the worker calls TaskTimeExport with its assignment task IDs after pausing or completing them. The parent then calls TaskTimeImport with its delegated task ID. The parent task and Work include that measured effort, without counting waiting or changing status. Until exported and imported, delegated effort shows —. Repeated imports replace the cumulative snapshot rather than adding it again. See delegated timing. Listings and copied Markdown include the same totals.
The panel and /works prefix work names with IDs and task names with IDs plus ownership, such as [W1] Locate subagent restrictions and [T1] [self] Inspect the implement skill. Task ownership comes from an explicit owner: self or owner: delegate declaration at the start of a line in the hidden taskInfo; preserve it on updates. Missing or conflicting decisions show [unassigned], without rewriting stored names or old records. Final thoughts never carry ownership, links, or paths. Inside Herdr, AgentCreate automatically links its task to an underlined, clickable [delegate] badge; Open actions are also underlined. See delegate terminal links for linking and keyboard access.
The compact TUI panel is off by default. Enable it with /works compact-on or pi-tasks.panel.enabled:true; its default visible layout is floating at the top-right. The compact header no longer displays the session ID. An underlined Open session action beside Copy opens this agent's artifact folder using the configured command, including existing nested delegated paths; if none exists, it creates var/<sessionId>/. The existing Open still opens the repository. Use /works open-session without mouse input. Narrow headers shorten Minimize/Maximize to [-]/[+]. The /works dashboard title stays unchanged. Its top border centers the current repository's Git branch and staged/unstaged/untracked file counts, refreshed asynchronously with a one-second cache. Clean repositories show clean. In fullscreen TUI mode, its title bar has clickable Copy, Open, and Minimize/Maximize actions, and you can scroll overflowing rows directly with the mouse wheel. Open defaults to cursor .; configure pi-tasks.openCommand to use another tool (see configuration). Open /works to inspect every row or copy from the keyboard. Use /works minimize, /works maximize, or /works open when mouse input is unavailable. In /works, press o to run the configured command. Switch layouts with /works floating or /works widget; /works compact-off hides the compact TUI and /works compact-on restores the last visible layout. Set pi-tasks.panel.enabled to false for a hidden default; panel.mode selects floating (default) or widget. The separate native Herdr pane follows pi-tasks.herdrPanel.enabled (default false). Commands override only the running instance, not settings. /works remains available on demand. See visibility and Herdr pane setup.
Agents through pi-herdr
The separate pi-herdr package owns AgentCreate, AgentResume, AgentList, AgentStatus, AgentOutput, AgentSend, AgentInterrupt, AgentClose, and AgentFocus. This package does not register Agent tools. They wrap hc/Core operations using returned terminalId addresses. Creation derives and creates the canonical delegated-task directory, verifies the real Core parent and native Pi readiness, then registers pi-loop-monitor. A post-launch failure returns structured partial handles; AgentResume finishes that same worker after validating the timing descriptor and Core ownership. Workers are Core-only by default; present: true also adopts the worker into a dedicated visible task-named Herdr app tab and verifies that mapping. Confirm its subscription ready receipt before AgentSend. Focus uses herdr-app and reports when no app is available; a pane-less child is presented through the existing terminal.peek overlay instead of an agent.focus no-op. Process lifecycle uses hc. No HERDR_ENV prerequisite, legacy TUI fallback, registry or recovery runtime. Creation/resume/closure require modern Pi nested calls and updated pi-loop-monitor. Completing a delegate task whose worker record is still linked returns a one-shot cleanup advisory after pi-herdr verifies session/task ownership; it never closes or interrupts the worker. See agent tools.
pi-herdr 0.1.0 requires this working source's version-1 delegation bridge; published pi-tasks 0.15.0 does not provide it. Install the compatible local pi-tasks source alongside pi-herdr and reload/restart Pi. Do not load the legacy npm source in parallel. pi-tasks retains records, timing, delegate metadata and display helpers; pi-herdr discovers those operations through Pi's event bus without importing pi-tasks internals.
Optional auto-continuation
On Pi 1.2.0 or newer, enable unfinished-work continuation in your global or trusted project settings.json:
{
"pi-tasks": {
"autoContinue": { "enabled": true }
}
}
It defaults off. Auto-continuation defaults to 10 extra runs per fresh accepted main user run when maxContinuations is omitted. Set a positive integer such as "maxContinuations": 20 to change the limit; values above 50 are clamped to 50 with one visible warning. After a normal user-requested run succeeds or fails, Pi continues while any task across all Works in the current Pi session is active. Empty Works and blocked, completed, or cancelled tasks do not trigger continuation; legacy planned/pending task statuses restore as active. Record correctness is not budgeted progress: a pending completed/blocked transition still produces one record-only review when auto-continuation is disabled or its limit is reached; it names active tasks as unresolved, says not to continue unrelated active work, and does not count against the progress budget. If active tasks remain when progress is disabled or its limit is reached, one explicit unresolved warning names them and states the actionable continuation (enable the setting, reload, then send a new main prompt; reload alone does not arm continuation, or drive the work in a new prompt); it changes no record and never claims completion. An active task that launched a command MonitorCreate with an onDone wake is excluded from continuation until that wake is delivered or dismissed, including while its notification is queued for idle. The exact task is captured at launch. Core hcTerminalId subscriptions and unrelated tasks still continue. No task status is changed for that wait. The final requested continuation is labeled final, and the next unfinished boundary warns with the count and hands control back without changing records. Escape/abort stops the flow; only a fresh accepted main interactive or RPC run rearms it and resets the count. Extension wakes, session-tree changes, and queued steering/follow-up input do not reset it. The limit counts requested continuations per fresh main user run, not dollars or tool calls. Reload after editing settings.
Auto-continuation uses Pi's native pre-settlement boundary, after queued work, retries, and compaction. Failed runs do not disarm it: after Pi's native retries finish, unfinished records request another continuation. It does not run with unavailable tracking tools or start work just because a session was restored. It never changes task statuses itself, and cannot independently prove completion. Older hosts retain ordinary tracking without this feature.
Independently of auto-continuation, a TodoUpdate that marks a task completed or blocked, or changes a blocked task's dependency class, emits one reflective prompt at Pi's turn boundary. Every delivered review also includes a read-only blocked-task audit with dependency class, blocked age, linked question, and reason, and the same audit is delivered once for a restored start (startup, /reload, or resume) so a stale blocker cannot survive a restart or reload silently; a fresh fork stays isolated. The audit asks the agent to confirm the dependency, return the task to active, retire an obsolete task through the human cancellation decision, or keep the block with its exact unblock condition and a live question or monitor; it never changes a record itself. Completion prompts ask the agent to re-sweep authorized in-scope work and verification without expanding into optional work. A user-decision blocker must first be challenged; if a human choice is genuinely needed, use pi-decisions SubmitQuestion and WaitForAnswer in the browser rather than asking again in chat, and keep an honest blocked reason when those tools or browser access are unavailable. An another-agent blocker stays distinct with one continuous monitor. Prompts are deduplicated per task and transition kind for each fresh main user run and never change task records themselves.
See the usage guide and reference.
Native Durable entrypoint
For hosts running on @earendil-works/pi-durable 1.1.0, this package also ships a
settings-only native extension with no desktop dependency:
import { createTasksDurableExtension } from "@abhishek944/pi-tasks/durable";
import { createRegistry } from "@earendil-works/pi-durable";
const registry = createRegistry();
registry.install(createTasksDurableExtension({ maxWorks: 100, maxTodos: 500 }));
// The host opens its own Harness with models/storage/env and selects `tasks`.
Settings are plain JSON copied and frozen at factory creation. Records live in one
conversation-scoped document (pi-tasks.state, latest history, initial fork), so each
conversation has isolated tracking and a fork starts empty. The eight tools are real
document transactions with the same validation as the desktop extension: WorkCreate,
WorkList, WorkUpdate, WorkDelete, TodoCreate, TodoList, TodoUpdate, and
TodoDelete, including completion rules, hidden taskInfo metadata, visible finalThoughts, blockedReason, and dependentOn handling. Effort timing is
unsupported natively: the native schema has no working field and reports no times,
rather than fabricated zeros. Desktop timing is unchanged. Desktop-only surfaces have no
native equivalent and are documented in src/durable.ts rather than stubbed: Herdr agent
tools, TaskTimeExport/Import file handoffs, auto-continuation, the /works command,
and the TUI panel.
Development
npm run lint
npm run typecheck
npm run build
npm run audit:production