← Catalog

@jocax/purpose-tilldone

Workflow-discipline extensions: purpose declaration gate and tilldone task tracking for pi

Extension

Install

Install with PiG

pig install npm:@jocax/purpose-tilldone

Install with Pi

pi install npm:@jocax/purpose-tilldone
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./dist/index.js"
  ]
}

README

Written by the package's publisher, shown as published in version 0.2.1 (README.md). PiG does not review it.

@jocax/purpose-tilldone

Workflow-discipline extensions — enforce intent declaration and task tracking before your agent starts working.

What

Two complementary gates that keep agent sessions focused and intentional:

  • Purpose Gate — Blocks all input until you declare a session purpose. A persistent widget shows the purpose above the editor, and every agent turn gets the purpose injected as <user_purpose> in its system prompt.
  • TillDone — Task-driven development discipline. The agent MUST define tasks (tilldone add) before using any other tools. Three-state lifecycle (idle → inprogress → done) with single-inprogress enforcement, tool-call blocking, and an auto-nudge on agent_end, once per task-list state, again only after a task changes.

Both gates are independent — install the package and enable one, both, or neither.

Why

Agent sessions without guardrails go off-road. The agent starts running tools before you've finished describing what you want. It chains unrelated edits together without a clear plan. This package enforces two lightweight constraints:

  • Purpose gate — No agent turn fires until you've declared intent. The purpose sits in the system prompt, giving the agent persistent context about why it's working.
  • TillDone — No tool (other than tilldone) runs until a task list exists and a task is in progress. The agent learns to plan before executing, and you get a live progress dashboard.

Install

Install the package from npm:

{
  "source": "npm:@jocax/purpose-tilldone"
}

Both gates are enabled by default. Disable one or both via environment variables.

Usage

Purpose Gate

On session start, pi shows an input dialog:

What is the purpose of this agent?
> e.g., Fix the login redirect bug

All prompts are blocked until you enter a non-empty purpose. Once answered:

  • A persistent widget appears above the editor: PURPOSE: <your text>
  • Every before_agent_start injects the purpose into the system prompt:
    <user_purpose>
    Fix the login redirect bug
    </user_purpose>
    
  • State survives fork/switch/tree — reconstructed from session history on resume

TillDone

The agent uses the tilldone tool to manage tasks:

tilldone add "Set up test fixtures"
tilldone add "Implement login redirect"
tilldone toggle 1       # Start task #1 (idle → inprogress)
... agent works on task #1 ...
tilldone toggle 1       # Mark task #1 done (inprogress → done)
tilldone toggle 2       # Start task #2

Task lifecycle — Three states, only one in progress at a time:

idle ──[toggle]──► inprogress ──[toggle]──► done
  ▲                                              │
  └────────────────────[toggle]──────────────────┘

Tool-call gate — Blocks all non-tilldone tools until:

  1. A task list exists, AND
  2. Tasks are defined, AND
  3. At least one task is in progress, AND
  4. Not all tasks are done

Auto-nudge — On agent_end, if tasks remain incomplete, the agent receives a steer message prompting it to continue — once per task-list state; a further nudge fires only after a task changes.

Overlay command — /tilldone (or /td) opens an interactive task overlay showing all tasks with status icons. Use arrow keys to navigate, Enter to toggle a task, or select actions to add/remove tasks.

UI surfaces — Three complementary displays keep you informed:

  • Widget (above editor) — Top 3 tasks with status icons, sorted inprogress-first
  • Footer — Task counts as Tasks: N/M with progress bar and current task name
  • Status line — Current in-progress task or All done!

All UI follows THEME.md color conventions:

  • success (green) — done tasks, filled progress bar segments
  • accent (cyan) — in-progress tasks, current task name
  • muted — idle tasks
  • dim — labels (Tasks:, [id], Progress:)
  • warning (yellow) — progress bar brackets

Commands

CommandDescription
/tilldoneOpen interactive task management overlay
/tdAlias for /tilldone

TillDone Tool Reference

SubcommandParametersDescription
new-listname (string)Create a named task list (default: "default")
addtexts (string[]) or text (string)Add one or more tasks (status: idle)
toggleid (number)Cycle task status: idle → inprogress → done → idle
removeid (number)Remove a task by ID
updateid (number), newText (string)Change a task's description
list(none)Show all tasks across all lists
clearonlyDone (boolean, optional)Clear all tasks, or only done tasks

Configuration

Both gates are enabled by default. Disable via environment variables:

VariableDefaultPurpose
AE_PI_PURPOSE_TILLDONE_PURPOSE_GATEtrueSet to false to disable the purpose declaration gate
AE_PI_PURPOSE_TILLDONE_TILLDONEtrueSet to false to disable the tilldone task discipline gate
# TillDone only (no purpose gate)
AE_PI_PURPOSE_TILLDONE_PURPOSE_GATE=false pi -p "Create a task list for testing"

# Purpose gate only (no tilldone)
AE_PI_PURPOSE_TILLDONE_TILLDONE=false pi -p "What should I work on?"

# Both disabled — package loads as a no-op
AE_PI_PURPOSE_TILLDONE_PURPOSE_GATE=false AE_PI_PURPOSE_TILLDONE_TILLDONE=false pi -p "hello"

Examples

Run each example standalone — no install required:

# Purpose gate demo — input dialog on start, widget, prompt injection
pi -e software/packages/purpose-tilldone/examples/purpose-gate.ts -p "test"

# TillDone demo — task lifecycle, tool gate, auto-nudge
pi -e software/packages/purpose-tilldone/examples/tilldone.ts -p "create tasks for testing"

# Both gates stacked — full workflow discipline
pi -e software/packages/purpose-tilldone/examples/both.ts -p "set purpose and create tasks"

Run the demo

just demo-web purpose-tilldone   # browser
just demo purpose-tilldone       # herdr — shows the widgets and the footer

Each scenario switches one gate off, because the two would otherwise block each other's first visible step.

Scenario "Declare a purpose first"

StepDo thisWatch
1Start the sessionAn input dialog asks What is the purpose of this agent? and stays open. In the browser its backdrop covers the Send button, so the prefilled prompt cannot be sent until you answer
2Answer the dialogPurpose set: …; prompts now run. In herdr the PURPOSE: … widget appears above the editor — not in the browser
3Send the promptIt goes through, and the purpose is now in the system prompt as <user_purpose>

In herdr the kit sends the scenario's first prompt automatically; if it arrives before the dialog is answered it is swallowed with no agent turn, then runs once you answer.

Scenario "Work till done"

StepDo thisWatch
1Send the first promptThe first non-tilldone call is blocked: No tasks defined. Use tilldone add to create tasks first.
2Keep watchingThe agent adds tasks; until one is inprogress the block reads No task in progress. Use tilldone toggle <id> to start a task.
3Once a task is startedThe status line reads 🎯 <task>, and the other calls pass
4Let the turn run to completionThe model usually finishes every task in the same turn; the status line ends at 🎯 All done!. A further non-tilldone call after that is blocked with All tasks are done. Use tilldone add or toggle to continue.
5Type /tilldone (or /td)A dialog titled TillDone lists 📋 Tasks (n in progress, x/y done), the task rows, ➕ Add Task, 🗑️ Clear Done Tasks, ❌ Close
6Send Add three more tasks for adding tests, then stop and wait for me before starting any of them.The agent adds 3 tasks and stops; exactly one nudge appears: You have 3 task(s) remaining. Use tilldone toggle to start the next task, or tilldone list to see all tasks.
7Watch what happens nextThe nudge's own turn ignores "wait for me" and keeps going: as each task starts and finishes, one more nudge follows — 2 task(s) remaining, then 1 task(s) remaining — and once every task is done, no further nudge fires

If a turn ends with tasks still open, the package steers a nudge (You have N task(s) remaining…) that starts another turn — but only once per task-list state. The nudge's own turn gets no second nudge unless the agent actually changes a task, so a nudge with nothing new to report never repeats.

In the browser the status line, the notifications, the dialogs and the blocked calls are all visible. The purpose widget, the tilldone widget and the tilldone footer are not: all three are custom TUI components, and pi's RPC mode has no terminal to draw them in. Run the demo in herdr to see them.

Needs herdr 0.9.3 or newer and one reachable model provider — see demo-kit.

Development

# Type-check
npx tsc --noEmit -p software/packages/purpose-tilldone/tsconfig.json

# Run tests
npx vitest run software/packages/purpose-tilldone/tests/