Skip to content
Arpit Jalan
Go back

Pipal, a minimal, durable AI harness

The front page of the Pipal site reads “A minimal, durable AI harness.” beside a drawing of a young fig tree. Its leaves are labeled the Svelte workspace, its trunk one Node.js process, and its roots Pi Durable and one SQLite file.

In October I ended Tinkering with Pi with an idea for a small browser workspace built on Pi Durable. I wanted to stop the server after one model had reviewed a diff, while the second review was still pending, and see if I could pick up where I left off by restarting it with the same database.

I built that workspace, and this week I published it as Pipal, a minimal, durable AI harness. The code is on GitHub and there’s an illustrated Pipal Book to go with it. I am happy to say the answer to my October question is yes.

Why I named it Pipal

I named it after the peepal (पीपल), the Hindi name for the sacred fig tree. I think of Pipal’s core as the sturdy trunk of that tree and its extensions as the branches. Each branch grows from the same base and adds something of its own, like web search for the assistant or a prompt button in the chat. I also chose the name for the wordplay in “Pi pal,” because Pi is the agent harness I built Pipal on.

One process and one SQLite file

Pipal is a self-hosted chat workspace where I choose which AI model answers my messages. The harness is the part underneath that connects the model to my tools and keeps track of the conversation. In the drawing at the top of this post, the leaves are the Svelte workspace and the trunk is one Node.js process running Hono, which serves both the API and the chat UI. The roots are Pi Durable and the SQLite file that holds my conversations, durable.sqlite.

When I press Send, Pi Durable records the message and runs the conversation. Pi AI calls the model I picked, and Hono streams the reply back to the tab as server-sent events. The book follows one message from the Send button, and the repo’s architecture guide shows where that code lives.

A new chat starts with the Chat profile. The composer gives me a place to drop a diff or a screenshot, and Search chats finds a conversation by words I remember from a message even when I’ve forgotten what I called the chat. Typing /session shows me how many tokens each model used in that chat and an estimate of what they would cost at API prices.

Pipal’s New conversation screen in the light theme, with Search chats in the sidebar and a composer that has tabs for Chat, Developer, Code reviewer, and Sysadmin.

A reply that outlives the tab

Pipal writes my message to disk before it replies. The message, the task that will answer it, and a deadline for that work all go into SQLite in one commit. If I close the tab while the reply is streaming, the run belongs to the server and it keeps going. The part I love is what happens if the process dies mid-reply. The message and its task are still in SQLite, so when I restart the server with the same database, Pi Durable finds the unfinished task and sends the model request again if the run has time and retries left.

The restart timeline follows seven steps across the browser, the Pipal process, and SQLite, from Send and Commit through Stream, Close the tab, Kill the process, Restart, and Come back.

When I open the chat again, a fresh snapshot shows me the finished answer. The recovery suite runs a harsher version of the test I had in mind in October. It waits for the reply to start streaming, sends the host a SIGKILL, and starts a fresh process on the same store, and it does the same in the middle of a tool call. pnpm spike runs just those cases, and the runtime decision record describes each one. I never thought I’d be so happy about a server getting killed.

The trunk stays small

I like being able to leave the core alone and choose what the assistant can do through the profiles, tools, and extensions I turn on. The site draws them as six branches on one stem.

The Branches section of the Pipal site shows one stem with six leaves, for Profiles, Delegation, Project access, Routines, Web artifacts, and Extensions.

A profile is a Markdown file in agents/. The frontmatter can set a model with provider and model and grant tools through optional_extensions when the host enables them. The body tells the assistant how to do the job. My favorite part is that the four profiles I see when I press ⌘K are the four files in agents/, so when I switch to Sysadmin I know where to look for its instructions.

Pipal’s quick switcher lists the Chat, Developer, Code reviewer, and Sysadmin profiles above actions such as New chat, Choose model, and Show session info.

Here’s the top of agents/sysadmin.md, where the grant sits right above the instructions.

---
id: sysadmin
name: Sysadmin
optional_extensions: [pipal.system-diagnostics, codemode]
---

Diagnose the machine running the Pipal server.
…agents/sysadmin.md

If I start in Chat and ask “How’s my system looking now?” it can hand the job to Sysadmin and use the result in its reply. When I give Developer access to a project, it reads and edits files and runs commands on the machine that runs Pipal, on another machine over SSH, or in an offline Docker container. By default the edits and commands wait for my approval, and Settings has a YOLO mode that approves them automatically in new chats.

With Routines, I schedule a prompt and the server runs it while the browser is closed, so the reply is in the same chat when I come back. When I ask for a web artifact, like a demo, a calculator, or a widget, the chat lets me preview it in a sandboxed frame or download the HTML.

I can register a host tool and grant it to a profile, and I can add a Svelte 5 component or install a theme when I want the workspace itself to change. The HTTP and streaming API is there if I want to build a different client.

Running it yourself

Pipal needs Node.js 26 and pnpm. From a terminal, run these commands.

git clone https://github.com/PipalAI/pipal.git
cd pipal
pnpm install --frozen-lockfile
pnpm dev

Open http://127.0.0.1:8080 and sign in with the token in data/access-token. To try it with no model account, choose Local echo in Runtime and it’ll repeat the text you send. To use your ChatGPT plan, choose Connect ChatGPT in Settings.

Pipal is built for one user, listens only on loopback, and supports sign-in with a token or a passkey. The book covers running it on Linux with Caddy and systemd. On Android, open the workspace over HTTPS and install it from the browser menu. The bundled theme comes in light and dark.

Pipal’s New conversation screen on a phone, in the light theme on the left and the dark theme on the right.

The Pipal Book

The Pipal Book is a guided, illustrated tour of the architecture, and its first page says to start with the pictures. Its contents run through Seed, Roots, Trunk, Leaves, Branches, Ground, and Tending. I’d start with Meet Pipal and Follow one message, then read Decisions and trade-offs for why every stream starts with a fresh view.

The first page of The Pipal Book shows the title beside a drawing of a young fig tree labeled Leaves, Branches, Trunk, Ground, and Roots.

Many of the figures have Previous and Next buttons, so I can step through them one stage at a time. This is the first figure in Meet Pipal, and it follows a first chat from pnpm dev in the terminal to the reply in the browser.

Figure 1.1 of The Pipal Book, “From a checkout to a reply,” draws arrows between Terminal, Pipal, and Browser for pnpm dev, Open page, Create chat, Chat ID, Watch chat, Send message, and Reply.

Standing on Pi

Pipal is a Pi pal. Its base is Pi Durable, the durable agent harness from the Pi project. As the site puts it, “Pi runs the conversation. Pipal makes it a workspace.” The book goes into what Pi gives Pipal and what Pipal adds.

Area Pi gives Pipal adds
Conversations Transcripts, tasks, checkpoints, and recovery Admission, retry checks, and run deadlines
Models One interface for model providers, with streaming Markdown profiles, a model picker, and ChatGPT sign-in
Tools Tool calls, extensions, and hooks Grants checked at every call, and routing to the project’s location
Waiting Parking, wake-ups, and signals Approvals, delegation, routines, and workers
Access A watch on each conversation The HTTP API, the event stream, sign-in, and the Svelte workspace

I am grateful to Pi for the harness and to term-llm for the design inspiration. I enjoy reading a diff alongside the conversation in term-llm’s web UI, and that’s the tab I made the Hacker theme for.

Pipal is version 0.1.0 under the MIT license, so for now it’s three leaves above the ground. I love how much is going on underneath them.


Share this post on:

Next Post
A terminal theme for term-llm’s web UI