The agentic IDE that gets better every time you use it, built around the pi coding agent. The app is
a thin host that runs pi and bridges it to a rich UI; pi owns models, skills, compaction, cost, and
session state.
- Use
goal-and-requirements.mdfor the product's goal, principles, capabilities, and non-goals. - Use
architecture.mdfor system topology, cross-module decisions, and repo-wide invariants. - For a pi upgrade or a host workaround around pi, read
pi-compatibility.md: verify every applicable removal gate against the installed SDK, update the registry, and report what was removed or retained. - Read the owning
SPEC.mdwhen work is governed by or may alter a module boundary, contract, invariant, documented behavior, or architecture decision. - Localized work does not require unrelated specs or a full repository map.
Clear, fractal module boundaries are a top-priority requirement:
- Every package and meaningful directory-level sub-module has a
SPEC.mdstating its responsibility, public surface, allowed dependencies, and forbidden reaches. - A sub-module exposes an
index.tsbarrel as its only public surface; siblings import through the barrel, never internals. Per-file imports remain only where a barrel would defeat code-splitting or a library convention, such asapps/web/src/panelsandpackages/ui. - Dependency edges between sibling sub-modules live in the parent module's
SPEC.md, not each leaf. - A change that moves or blurs a boundary updates the owning spec first. Cover public surfaces and boundary rules with tests where practical, but do not manufacture coverage for a localized change.
- Run
piin-process through@earendil-works/pi-coding-agent(createAgentSession), never as a subprocess and never through a second agent runtime. Fatal provider/agent faults can take down the host; that lack of crash isolation is accepted. - The three rings are engine host (
packages/server+packages/shared), typed wire (packages/contracts), and independently shippable UI (apps/web).apps/cliandapps/desktopare thin launchers over the same host. - Use only the
@earendil-works/*package scope.@mariozechner/*is deprecated.
apps/webdepends oncontracts,locales,ui,extension-api/web,resource-renderers, andthinkrail-extensions/*/webonly, neverserverorshared.- User-facing UI text is a key in
packages/locales/en.jsonrendered through@thinkrail/locales/react; the lint gate rejects hardcoded JSX text and text attributes. - Never value-import
piinto browser-bundled code. Import types only from thepi-ai/pi-agent-corepackage roots;@earendil-works/pi-coding-agentis server-only. - One id model: UI tab id versus
session.sessionId; there is no separate pi UUID. piowns state. The host exposes what pi reports rather than recomputing cost, stats, or state.- Streaming semantics:
text_delta/thinking_deltaappend;tool_execution_update.partialResultreplaces. prompt()throws while a session is streaming; usesteer()/followUp(). Forward errors through the event stream and thrown method result rather than treating them as a crash signal.- Automatic work ends at
agent_settled, neveragent_end; retries, compaction, recovery, or queued continuations may follow an attempt-levelagent_end. - UI panels are layout-agnostic; the shell arranges them.
- Errors are reported to PostHog Error Tracking unconditionally, but only as a classifier — type,
code, source/scope/request method and ThinkRail-only stack frames — nevermessagetext. Give a failure worth telling apart aCodedErrorcode rather than relying on its message. Host diagnostics that carry an error go throughlogger(scope), notconsole.*. The allow-list lives inpackages/server/src/analytics/SPEC.md. - The transport host endpoint is a parameter, defaulting to same-origin;
server.welcomecarries the protocol version.
For web UI work, read apps/web/SPEC.md and the owning sub-module spec. Styling uses Tailwind v4
utilities mapped to generated semantic CSS-var tokens: never inline style objects, raw hex, internal
palette names, or unknown token utilities. Read apps/web/src/styles/COLOR.md for color work and
apps/web/src/styles/SPACING.md for spacing work. Use @remixicon/react icons (Line by default, Fill
when active) and owned shadcn/Radix primitives from @thinkrail/ui/<primitive>; cn() lives in
@thinkrail/ui/utils. These rules also apply to packages/ui, packages/resource-renderers, and extension
web halves.
For conversation rendering or tool presentation, read apps/web/src/chat/SPEC.md. Presentational
renderers remain props-driven; only ChatView integrates store and transport. A server capability and
its UI renderer are joined by tool name through registerToolRenderer; unregistered tools use the
default renderer.
Specs are the durable home for intent, decisions, invariants, trade-offs, and post-mortems. Keep them concise and avoid restating code or another spec. Comments are near-zero: lint/type directives and a rare one-line hazard note are acceptable; rationale and narrative belong in the owning spec.
Local tests use disposable fixtures and have no production access. Run affected tests, fix failures caused by the requested change, and rerun them without asking for approval at each step.
- Iterate with the smallest relevant unit or focused E2E target.
- For shipped app behavior or integration changes, run the complete no-agent browser suite
(
bun run e2e) once after the combined implementation and before final handoff or PR — not once per TODO item or commit. - When the change touches real agent behavior, also run the focused live specs that cover it, e.g.
bun run e2e:full e2e/agent-naming.live.spec.ts; that needs no approval. Ask the user before running the completebun run e2e:fullsuite: it spends real provider tokens and much more time. - Documentation/spec-only changes and test-harness-only changes use targeted checks unless they can affect the shipped runtime.
- Fast gates:
bun run check:deps,bun run check:boundaries,bun run check:seams,bun run lint, andbun run typecheck. Unit tests arebun run test;bun run check:spec-surfacevalidates enrolled spec/barrel public surfaces;bun run check:compilerfails when a web function newly bails out of the React Compiler (or starts compiling) against the committed census baseline. bun run test:workflowsis on-demand: it uses real provider tokens and is not a commit/CI gate.- Binary and desktop artifact modes have separate gates; use them when changing those artifacts.
All runner modes, isolation guarantees, credential handling, cancellation behavior, and debugging
commands live in e2e/SPEC.md; workflow harness details live in e2e/workflows/SPEC.md.
Green gates are necessary but not sufficient:
- Before a local handoff, review the task-scoped working tree and commits. Before opening or updating a PR, review the full branch diff against its base plus the working tree.
- For nontrivial implementation, do a subtraction pass: remove avoidable abstractions, state owners, dependencies, compatibility layers, and fallbacks. Report material removals and justify layers that remain; do not add ceremony for a localized edit.
- Never add
biome-ignore,@ts-expect-error,@ts-ignore,eslint-disable, oras anymerely to make a gate pass. Treat the error as a design signal. If a suppression is genuinely required, get explicit user approval first. - Audit newly added comments and suppressions in the same diff range being reviewed. Do not let prior, unrelated branch history contaminate a task-local handoff.
- Centralize duplicated nontrivial derivations. In the web app, derived store state belongs in selectors and writes that always travel together belong in one atomic action.
- When replacing a pattern or state model, search for every old occurrence and migrate it, or name the intentional survivors.
README.mdis the user-facing front page. For a change that adds, removes, or renames a user-visible capability, or alters installation or analytics behavior, review its claims and update the affected ones in the same change; refresh a screenshot under.github/readme-assets/when the UI it depicts changes materially.- Apply safe cleanup that is inside the approved scope. Ask only for destructive, out-of-scope, or product-level decisions.
- Use the
shipping-a-prskill for PR lifecycle work, including screenshot expectations and PR templates. When creating an issue programmatically, reproduce the selected issue template and pass its frontmatter labels.
Bun + Turbo monorepo · TypeScript strict · React 19 + Zustand + Tailwind v4 · in-process pi
(Node >= 22.19). App state lives under ~/.thinkrail.
Dependencies pin exact versions. Cross-cutting dependencies are pinned once in the root
workspaces.catalog and referenced through catalog:; peer dependencies and local protocols are the
only exemptions. architecture.md Decision #10 owns the rationale.