"<!DOCTYPE html>\n<html lang=\"zh\" data-theme=\"light\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>source_PiDurable_RFC.txt — Vercel Design System</title>\n<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n<link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n<link href=\"https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap\" rel=\"stylesheet\">\n<link rel=\"stylesheet\" href=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.css\">\n<style>\n\n:root {\n  /* Vercel Palette */\n  --geist-foreground: #171717;\n  --geist-background: #ffffff;\n  --geist-secondary: #4d4d4d;\n  --geist-tertiary: #666666;\n  --geist-quaternary: #808080;\n  --geist-border: #ebebeb;\n  --geist-surface-tint: #fafafa;\n  \n  /* Workflow Accents */\n  --develop-blue: #0a72ef;\n  --preview-pink: #de1d8d;\n  --ship-red: #ff5b4f;\n  \n  /* Interactive & Status */\n  --link-blue: #0072f5;\n  --ds-focus-color: hsla(212, 100%, 48%, 1);\n  --badge-blue-bg: #ebf5ff;\n  --badge-blue-text: #0068d6;\n  \n  /* Shadow-as-Border Philosophy */\n  --shadow-border: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(0, 0, 0, 0.16) 0px 0px 0px 1px;\n  --shadow-card: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(0, 0, 0, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.06) 0px 4px 6px, #fafafa 0px 0px 0px 1px;\n  --shadow-card-full: rgba(0, 0, 0, 0.08) 0px 0px 0px 1px, rgba(0, 0, 0, 0.04) 0px 2px 2px, rgba(0, 0, 0, 0.04) 0px 8px 8px -8px, #fafafa 0px 0px 0px 1px;\n  --shadow-ring: rgb(235, 235, 235) 0px 0px 0px 1px;\n  \n  /* Radius Scale */\n  --radius-xs: 2px;\n  --radius-sm: 4px;\n  --radius-md: 6px;\n  --radius-lg: 8px;\n  --radius-xl: 12px;\n  --radius-pill: 9999px;\n}\n\n[data-theme=\"dark\"] {\n  --geist-foreground: #ededed;\n  --geist-background: #000000;\n  --geist-secondary: #a1a1a1;\n  --geist-tertiary: #888888;\n  --geist-quaternary: #666666;\n  --geist-border: #222222;\n  --geist-surface-tint: #0a0a0a;\n  \n  --shadow-border: rgba(255, 255, 255, 0.14) 0px 0px 0px 1px;\n  --shadow-border-hover: rgba(255, 255, 255, 0.28) 0px 0px 0px 1px;\n  --shadow-card: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.4) 0px 2px 4px, #111111 0px 0px 0px 1px;\n  --shadow-card-hover: rgba(255, 255, 255, 0.2) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 6px 12px, #111111 0px 0px 0px 1px;\n  --shadow-card-full: rgba(255, 255, 255, 0.12) 0px 0px 0px 1px, rgba(0, 0, 0, 0.5) 0px 8px 16px -4px, #111111 0px 0px 0px 1px;\n  --shadow-ring: rgb(40, 40, 40) 0px 0px 0px 1px;\n  \n  --badge-blue-bg: rgba(10, 114, 239, 0.15);\n  --badge-blue-text: #70b5ff;\n}\n\n* { box-sizing: border-box; }\nhtml { scroll-behavior: smooth; }\nbody {\n  margin: 0;\n  font-family: \"Geist\", Arial, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif;\n  background-color: var(--geist-background);\n  color: var(--geist-foreground);\n  font-feature-settings: \"liga\" 1;\n  -webkit-font-smoothing: antialiased;\n  min-height: 100vh;\n}\n\na {\n  color: inherit;\n  text-decoration: none;\n  transition: color 0.15s ease;\n}\n\n/* 导航栏 (Vercel Clean Sticky Nav) */\n.vercel-nav {\n  position: sticky;\n  top: 0;\n  background-color: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  z-index: 100;\n  padding: 0 24px;\n  height: 64px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n}\n.nav-brand {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n.vercel-triangle {\n  width: 22px;\n  height: 19px;\n  fill: var(--geist-foreground);\n}\n.nav-title {\n  font-size: 16px;\n  font-weight: 600;\n  letter-spacing: -0.32px;\n  color: var(--geist-foreground);\n}\n.nav-badge-pill {\n  font-family: \"Geist Mono\", ui-monospace, monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  background: var(--badge-blue-bg);\n  color: var(--badge-blue-text);\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n}\n\n.nav-links {\n  display: flex;\n  align-items: center;\n  gap: 24px;\n}\n.nav-link {\n  font-size: 14px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.nav-link:hover, .nav-link.active {\n  color: var(--geist-foreground);\n}\n.nav-link.active {\n  font-weight: 600;\n}\n\n.nav-actions {\n  display: flex;\n  align-items: center;\n  gap: 12px;\n}\n\n/* 按钮规范 */\n.btn-primary-dark {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: opacity 0.15s;\n}\n.btn-primary-dark:hover {\n  opacity: 0.9;\n}\n.btn-secondary-white {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 8px 16px;\n  border-radius: var(--radius-md);\n  font-size: 14px;\n  font-weight: 500;\n  cursor: pointer;\n  text-decoration: none;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  transition: background 0.15s, box-shadow 0.15s;\n}\n.btn-secondary-white:hover {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border-hover);\n}\n.theme-toggle-btn {\n  background: transparent;\n  border: none;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  width: 36px;\n  height: 36px;\n  cursor: pointer;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  color: var(--geist-foreground);\n}\n\n/* 核心容器 */\n.vercel-container {\n  max-width: 1200px;\n  margin: 0 auto;\n  padding: 56px 24px 100px;\n}\n\n/* Hero Section (Gallery Emptiness + Negative Letter-spacing) */\n.vercel-hero {\n  text-align: center;\n  max-width: 860px;\n  margin: 0 auto 56px;\n}\n.hero-stage-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 8px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 4px 14px;\n  border-radius: var(--radius-pill);\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  margin-bottom: 24px;\n}\n.stage-dot {\n  width: 7px;\n  height: 7px;\n  border-radius: 50%;\n}\n.vercel-hero h1 {\n  font-size: 48px;\n  font-weight: 600;\n  line-height: 1.05;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 16px;\n}\n.vercel-hero p {\n  font-size: 20px;\n  font-weight: 400;\n  line-height: 1.80;\n  color: var(--geist-secondary);\n  margin: 0 auto 28px;\n}\n\n/* Workflow Pipeline (Develop -> Preview -> Ship) */\n.workflow-pipeline {\n  display: grid;\n  grid-template-columns: repeat(3, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 768px) {\n  .workflow-pipeline { grid-template-columns: 1fr; }\n}\n.workflow-step {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px 22px;\n  transition: box-shadow 0.2s;\n}\n.workflow-step:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n.step-mono-label {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  margin-bottom: 8px;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n}\n.step-title {\n  font-size: 20px;\n  font-weight: 600;\n  letter-spacing: -0.96px;\n  color: var(--geist-foreground);\n  margin-bottom: 6px;\n}\n.step-desc {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n\n/* Metric Cards (Section 4 Spec) */\n.metric-grid {\n  display: grid;\n  grid-template-columns: repeat(4, 1fr);\n  gap: 16px;\n  margin-bottom: 48px;\n}\n@media (max-width: 900px) {\n  .metric-grid { grid-template-columns: repeat(2, 1fr); }\n}\n.metric-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n}\n.metric-number {\n  font-size: 40px;\n  font-weight: 600;\n  line-height: 1.0;\n  letter-spacing: -2.4px;\n  color: var(--geist-foreground);\n  margin-bottom: 8px;\n  font-feature-settings: \"tnum\" 1;\n}\n.metric-label {\n  font-size: 14px;\n  color: var(--geist-secondary);\n  line-height: 1.4;\n}\n\n/* VAD 专栏 Banner (Ship Red & Vercel Clean) */\n.vad-showcase {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-xl);\n  padding: 32px;\n  margin-bottom: 48px;\n  position: relative;\n}\n.vad-header-row {\n  display: flex;\n  align-items: baseline;\n  justify-content: space-between;\n  flex-wrap: wrap;\n  gap: 12px;\n  margin-bottom: 12px;\n}\n.vad-header-row h2 {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  color: var(--geist-foreground);\n  margin: 0;\n}\n.vad-pillars-grid {\n  display: grid;\n  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));\n  gap: 14px;\n  margin-top: 24px;\n}\n.vad-pillar-item {\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 14px 16px;\n}\n.vad-pillar-title {\n  font-size: 14px;\n  font-weight: 600;\n  color: var(--ship-red);\n  margin-bottom: 4px;\n}\n.vad-pillar-text {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  line-height: 1.5;\n}\n.vad-filter-bar {\n  display: flex;\n  flex-wrap: wrap;\n  align-items: center;\n  justify-content: space-between;\n  gap: 12px;\n  margin: 24px 0 16px;\n  padding: 12px 16px;\n  background: var(--geist-surface-tint);\n  border-radius: var(--radius-md);\n  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);\n}\n.vad-filter-btn {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  font-weight: 500;\n  padding: 6px 14px;\n  border-radius: 9999px;\n  border: none;\n  background: transparent;\n  color: var(--geist-secondary);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.vad-filter-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0,0,0,0.05);\n}\n.vad-filter-btn.active {\n  background: #171717;\n  color: #ffffff;\n}\n.vad-search-input {\n  font-family: 'Geist', sans-serif;\n  font-size: 13px;\n  padding: 7px 12px;\n  border-radius: 6px;\n  border: 1px solid var(--geist-border);\n  background: #ffffff;\n  color: var(--geist-foreground);\n  width: 280px;\n  outline: none;\n  transition: border-color 0.15s, box-shadow 0.15s;\n}\n.vad-search-input:focus {\n  border-color: #0a72ef;\n  box-shadow: 0 0 0 2px rgba(10, 114, 239, 0.2);\n}\n\n/* 控制栏：搜索、视图、筛选 */\n.control-bar {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  margin-bottom: 24px;\n  flex-wrap: wrap;\n}\n.search-input-wrap {\n  position: relative;\n  flex: 1;\n  max-width: 480px;\n}\n.search-input {\n  width: 100%;\n  height: 40px;\n  padding: 0 38px 0 14px;\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  color: var(--geist-foreground);\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  outline: none;\n  transition: box-shadow 0.15s;\n}\n.search-input:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n.search-kbd {\n  position: absolute;\n  right: 12px;\n  top: 50%;\n  transform: translateY(-50%);\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  color: var(--geist-quaternary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n\n.view-switcher {\n  display: flex;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  background: var(--geist-background);\n  padding: 2px;\n}\n.view-btn {\n  background: transparent;\n  border: none;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-tertiary);\n  padding: 6px 12px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n  transition: color 0.15s, background 0.15s;\n}\n.view-btn.active {\n  background: var(--geist-surface-tint);\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 筛选芯片行 (Filter Pill Strip) */\n.filter-group-strip {\n  display: flex;\n  flex-direction: column;\n  gap: 12px;\n  margin-bottom: 28px;\n  padding: 16px 20px;\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-lg);\n}\n.filter-row {\n  display: flex;\n  align-items: center;\n  gap: 8px;\n  flex-wrap: wrap;\n}\n.filter-label-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  min-width: 68px;\n}\n.pill-badge {\n  background: var(--geist-background);\n  color: var(--geist-secondary);\n  box-shadow: var(--shadow-border);\n  border: none;\n  padding: 3px 12px;\n  border-radius: var(--radius-pill);\n  font-size: 12px;\n  font-weight: 500;\n  cursor: pointer;\n  transition: all 0.15s;\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n}\n.pill-badge:hover {\n  color: var(--geist-foreground);\n  box-shadow: var(--shadow-border-hover);\n}\n.pill-badge.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  font-weight: 600;\n  box-shadow: none;\n}\n.pill-badge.active-blue {\n  background: var(--develop-blue);\n  color: #ffffff;\n  box-shadow: none;\n}\n.pill-badge.active-red {\n  background: var(--ship-red);\n  color: #ffffff;\n  box-shadow: none;\n}\n\n/* Bento Grid Cards (Section 4 & 6 Spec) */\n.card-grid-bento {\n  display: grid;\n  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));\n  gap: 16px;\n}\n.vercel-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  display: flex;\n  flex-direction: column;\n  justify-content: space-between;\n  transition: box-shadow 0.2s, transform 0.2s;\n  text-decoration: none;\n  color: inherit;\n  overflow: hidden;\n  min-width: 0;\n  word-break: break-word;\n}\n.vercel-card:hover {\n  box-shadow: var(--shadow-card-hover);\n  transform: translateY(-2px);\n}\n.card-top {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  margin-bottom: 12px;\n  gap: 8px;\n}\n.card-tag-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  font-weight: 500;\n  text-transform: uppercase;\n  color: var(--geist-quaternary);\n  letter-spacing: 0.5px;\n}\n.status-pill-badge {\n  padding: 2px 8px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 500;\n  flex-shrink: 0;\n}\n.pub-accepted { background: #ebfdf2; color: #027a48; }\n.pub-workshop { background: #eff8ff; color: #175cd3; }\n.pub-submitted { background: #fff8e6; color: #b54708; }\n.pub-preprint { background: #f2f4f7; color: #475467; }\n.pub-other { background: #f9f5ff; color: #6941c6; }\n\n[data-theme=\"dark\"] .pub-accepted { background: rgba(2, 122, 72, 0.2); color: #32d583; }\n[data-theme=\"dark\"] .pub-workshop { background: rgba(23, 92, 211, 0.2); color: #84caff; }\n[data-theme=\"dark\"] .pub-submitted { background: rgba(181, 71, 8, 0.2); color: #fec84b; }\n[data-theme=\"dark\"] .pub-preprint { background: rgba(71, 84, 103, 0.2); color: #98a2b3; }\n[data-theme=\"dark\"] .pub-other { background: rgba(105, 65, 198, 0.2); color: #d6bbfb; }\n\n/* 必读标杆徽章 (Vercel Amber Accent) */\n.milestone-badge {\n  display: inline-flex;\n  align-items: center;\n  gap: 3px;\n  padding: 2px 7px;\n  border-radius: var(--radius-pill);\n  font-size: 11px;\n  font-weight: 600;\n  white-space: nowrap;\n  flex-shrink: 0;\n  transition: all 0.15s ease;\n}\n.milestone-badge.ms-idea, .milestone-badge:not([class*=\"ms-\"]) {\n  color: #b54708;\n  background: #fff8e6;\n  border: 1px solid rgba(247, 144, 9, 0.35);\n  box-shadow: 0 1px 2px rgba(181, 71, 8, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-idea, [data-theme=\"dark\"] .milestone-badge:not([class*=\"ms-\"]) {\n  color: #fec84b;\n  background: rgba(181, 71, 8, 0.22);\n  border-color: rgba(254, 200, 75, 0.35);\n}\n.milestone-badge.ms-writing {\n  color: #6941c6;\n  background: #f9f5ff;\n  border: 1px solid rgba(105, 65, 198, 0.3);\n  box-shadow: 0 1px 2px rgba(105, 65, 198, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-writing {\n  color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.22);\n  border-color: rgba(214, 187, 251, 0.35);\n}\n.milestone-badge.ms-value {\n  color: #027a48;\n  background: #ebfdf2;\n  border: 1px solid rgba(2, 122, 72, 0.3);\n  box-shadow: 0 1px 2px rgba(2, 122, 72, 0.05);\n}\n[data-theme=\"dark\"] .milestone-badge.ms-value {\n  color: #32d583;\n  background: rgba(2, 122, 72, 0.22);\n  border-color: rgba(50, 213, 131, 0.35);\n}\n\n/* 论文正文图表与插图卡片样式 (Geist Design) */\n.paper-figure, .article-body figure {\n  margin: 32px auto;\n  text-align: center;\n  max-width: 100%;\n}\n.paper-figure img, .article-body img {\n  max-width: 96%;\n  height: auto;\n  border-radius: var(--radius-md);\n  border: 1px solid var(--geist-border);\n  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);\n  background: #ffffff;\n  transition: transform 0.2s ease, box-shadow 0.2s ease;\n  display: block;\n  margin: 0 auto;\n}\n.paper-figure img:hover, .article-body img:hover {\n  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);\n}\n.paper-figure figcaption, .article-body figcaption {\n  font-size: 13px;\n  color: var(--geist-secondary);\n  margin-top: 10px;\n  line-height: 1.6;\n  font-style: italic;\n  max-width: 850px;\n  margin-left: auto;\n  margin-right: auto;\n}\n\n/* VAD 视图切换器 View Switcher */\n.vad-view-switcher {\n  display: inline-flex;\n  padding: 3px;\n  background: var(--geist-secondary-bg);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  margin-bottom: 20px;\n  gap: 2px;\n}\n.view-switch-btn {\n  display: inline-flex;\n  align-items: center;\n  gap: 6px;\n  padding: 6px 14px;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-secondary);\n  border-radius: 6px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.view-switch-btn:hover {\n  color: var(--geist-foreground);\n  background: rgba(0, 0, 0, 0.04);\n}\n[data-theme=\"dark\"] .view-switch-btn:hover {\n  background: rgba(255, 255, 255, 0.06);\n}\n.view-switch-btn.active {\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  font-weight: 600;\n  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n/* 关系图谱 Graph View Styles */\n.graph-container {\n  position: relative;\n  width: 100%;\n  height: 720px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: var(--radius-lg);\n  overflow: hidden;\n  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);\n  margin-bottom: 40px;\n}\n.graph-toolbar {\n  position: absolute;\n  top: 14px;\n  left: 14px;\n  right: 14px;\n  z-index: 10;\n  display: flex;\n  justify-content: space-between;\n  align-items: center;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  padding: 8px 14px;\n  border-radius: 8px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  flex-wrap: wrap;\n  gap: 8px;\n}\n.graph-tool-title {\n  font-size: 13px;\n  font-weight: 700;\n  display: flex;\n  align-items: center;\n  gap: 6px;\n  color: var(--geist-foreground);\n}\n.graph-filter-group {\n  display: flex;\n  gap: 6px;\n  align-items: center;\n  flex-wrap: wrap;\n}\n.graph-chip {\n  font-size: 11px;\n  padding: 3px 8px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  cursor: pointer;\n  transition: all 0.15s ease;\n}\n.graph-chip:hover { background: var(--geist-secondary-bg); }\n.graph-chip.active {\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-color: var(--geist-foreground);\n}\n.graph-search-input {\n  padding: 3px 8px;\n  font-size: 11px;\n  border-radius: 4px;\n  border: 1px solid var(--geist-border);\n  background: var(--geist-background);\n  color: var(--geist-foreground);\n  outline: none;\n  width: 150px;\n}\n#vad-graph-svg {\n  width: 100%;\n  height: 100%;\n  cursor: grab;\n}\n#vad-graph-svg:active { cursor: grabbing; }\n.graph-legend {\n  position: absolute;\n  bottom: 14px;\n  left: 14px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  padding: 10px 14px;\n  font-size: 11px;\n  box-shadow: 0 4px 16px rgba(0,0,0,0.06);\n  z-index: 10;\n  line-height: 1.6;\n  pointer-events: none;\n}\n.graph-legend-row { display: flex; align-items: center; gap: 8px; }\n.graph-legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }\n.graph-info-drawer {\n  position: absolute;\n  top: 66px;\n  right: 14px;\n  width: 310px;\n  max-height: 620px;\n  background: var(--geist-background);\n  border: 1px solid var(--geist-border);\n  border-radius: 8px;\n  box-shadow: 0 8px 30px rgba(0,0,0,0.12);\n  z-index: 10;\n  padding: 16px;\n  overflow-y: auto;\n  display: none;\n  backdrop-filter: blur(10px);\n  transition: transform 0.2s ease, opacity 0.2s ease;\n}\n.graph-drawer-close {\n  position: absolute;\n  top: 10px;\n  right: 12px;\n  cursor: pointer;\n  font-size: 16px;\n  color: var(--geist-tertiary);\n}\n.graph-drawer-badge {\n  display: inline-block;\n  padding: 2px 6px;\n  border-radius: 4px;\n  font-size: 10px;\n  font-weight: 600;\n  margin-bottom: 6px;\n}\n.graph-drawer-title {\n  font-size: 13px;\n  font-weight: 700;\n  line-height: 1.4;\n  margin-bottom: 8px;\n  color: var(--geist-foreground);\n}\n.graph-drawer-meta {\n  font-size: 11px;\n  color: var(--geist-secondary);\n  margin-bottom: 12px;\n}\n.graph-drawer-core {\n  font-size: 12px;\n  line-height: 1.6;\n  color: var(--geist-foreground);\n  background: var(--geist-secondary-bg);\n  padding: 8px 10px;\n  border-radius: 6px;\n  margin-bottom: 12px;\n  border: 1px solid var(--geist-border);\n}\n.graph-drawer-link {\n  display: block;\n  text-align: center;\n  padding: 7px 12px;\n  background: var(--geist-foreground);\n  color: var(--geist-background);\n  border-radius: 6px;\n  font-size: 12px;\n  font-weight: 600;\n  text-decoration: none;\n  transition: opacity 0.15s ease;\n  margin-bottom: 6px;\n}\n.graph-drawer-link:hover { opacity: 0.85; }\n.graph-drawer-pdf-link {\n  display: block;\n  text-align: center;\n  padding: 6px 12px;\n  background: var(--geist-secondary-bg);\n  color: var(--geist-foreground);\n  border: 1px solid var(--geist-border);\n  border-radius: 6px;\n  font-size: 11px;\n  font-weight: 500;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.graph-drawer-pdf-link:hover { background: var(--geist-border); }\n.node-circle {\n  cursor: pointer;\n  transition: r 0.2s, stroke-width 0.2s;\n}\n.node-label {\n  font-size: 10px;\n  font-weight: 600;\n  fill: var(--geist-foreground);\n  pointer-events: none;\n  text-shadow: 0 1px 2px var(--geist-background);\n}\n.link-line {\n  stroke: var(--geist-border);\n  stroke-opacity: 0.6;\n  stroke-width: 1.2;\n  transition: stroke 0.2s, stroke-width 0.2s, stroke-opacity 0.2s;\n}\n.link-label {\n  font-size: 9px;\n  fill: var(--geist-tertiary);\n  pointer-events: none;\n  text-anchor: middle;\n}\n\n/* 引用框与警示框 Alerts */\n.callout-alert {\n  margin: 20px 0;\n  padding: 14px 18px;\n  border-radius: var(--radius-md);\n  transition: all 0.15s ease;\n}\n.callout-important, .callout-idea {\n  border-left: 4px solid #b54708;\n  background: rgba(181, 71, 8, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(247, 144, 9, 0.3);\n}\n[data-theme=\"dark\"] .callout-important, [data-theme=\"dark\"] .callout-idea {\n  border-left-color: #fec84b;\n  background: rgba(181, 71, 8, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(254, 200, 75, 0.25);\n}\n.callout-writing {\n  border-left: 4px solid #6941c6;\n  background: rgba(105, 65, 198, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(105, 65, 198, 0.3);\n}\n[data-theme=\"dark\"] .callout-writing {\n  border-left-color: #d6bbfb;\n  background: rgba(105, 65, 198, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(214, 187, 251, 0.25);\n}\n.callout-value {\n  border-left: 4px solid #027a48;\n  background: rgba(2, 122, 72, 0.06);\n  box-shadow: inset 0 0 0 1px rgba(2, 122, 72, 0.3);\n}\n[data-theme=\"dark\"] .callout-value {\n  border-left-color: #32d583;\n  background: rgba(2, 122, 72, 0.18);\n  box-shadow: inset 0 0 0 1px rgba(50, 213, 131, 0.25);\n}\n\n.card-title {\n  font-size: 16.5px;\n  font-weight: 600;\n  line-height: 1.42;\n  letter-spacing: -0.4px;\n  color: var(--geist-foreground);\n  margin: 0 0 10px;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n  hyphens: auto;\n}\n.card-title a {\n  color: var(--geist-foreground);\n  text-decoration: none;\n  display: inline;\n  transition: color 0.15s ease;\n}\n.card-title a:hover {\n  color: var(--develop-blue);\n  text-decoration: none;\n}\n.card-id-mono {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-quaternary);\n  margin-right: 5px;\n}\n.card-meta-row {\n  display: flex;\n  gap: 6px;\n  flex-wrap: wrap;\n  margin-bottom: 12px;\n}\n.meta-token {\n  font-size: 12px;\n  color: var(--geist-tertiary);\n  background: var(--geist-surface-tint);\n  box-shadow: var(--shadow-ring);\n  padding: 2px 7px;\n  border-radius: var(--radius-sm);\n  white-space: nowrap;\n}\n.card-body-text {\n  font-size: 13.5px;\n  color: var(--geist-secondary);\n  line-height: 1.6;\n  margin-bottom: 16px;\n  flex-grow: 1;\n  word-break: break-word;\n  overflow-wrap: anywhere;\n}\n.card-body-text strong {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n.card-footer {\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 14px;\n}\n.card-link-action {\n  font-size: 13.5px;\n  font-weight: 500;\n  color: var(--link-blue);\n  display: inline-flex;\n  align-items: center;\n  gap: 4px;\n  text-decoration: none;\n  transition: all 0.15s ease;\n}\n.card-link-action:hover {\n  opacity: 0.85;\n  transform: translateX(2px);\n}\na.meta-token {\n  transition: all 0.15s ease;\n  cursor: pointer;\n  text-decoration: none;\n}\na.meta-token:hover {\n  background: var(--geist-selection);\n  color: var(--geist-foreground);\n  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);\n}\n\n/* 紧凑列表视图 (List View) */\n.card-list-view {\n  display: flex;\n  flex-direction: column;\n  gap: 8px;\n}\n.list-row-item {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-md);\n  padding: 12px 18px;\n  display: flex;\n  align-items: center;\n  justify-content: space-between;\n  gap: 16px;\n  transition: box-shadow 0.15s;\n}\n.list-row-item:hover {\n  box-shadow: var(--shadow-card-hover);\n}\n\n/* 阅读详情页 (Report Detail) */\n.reading-container {\n  display: grid;\n  grid-template-columns: minmax(0, 1fr) 260px;\n  gap: 40px;\n  align-items: start;\n}\n@media (max-width: 960px) {\n  .reading-container { grid-template-columns: 1fr; }\n  .reading-sidebar { display: none; }\n}\n\n.report-header-card {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 28px 32px;\n  margin-bottom: 28px;\n}\n.crumb-bar {\n  font-size: 13px;\n  color: var(--geist-tertiary);\n  margin-bottom: 10px;\n}\n.report-title {\n  font-size: 32px;\n  font-weight: 600;\n  letter-spacing: -1.28px;\n  margin: 0 0 16px;\n  color: var(--geist-foreground);\n}\n.report-action-buttons {\n  display: flex;\n  align-items: center;\n  gap: 10px;\n  flex-wrap: wrap;\n  border-top: 1px solid var(--geist-border);\n  padding-top: 16px;\n  margin-top: 16px;\n}\n\n.article-body {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 36px 42px 80px;\n  font-size: 16px;\n  line-height: 1.75;\n  color: var(--geist-foreground);\n}\n.article-body h1, .article-body h2, .article-body h3 {\n  color: var(--geist-foreground);\n  scroll-margin-top: 80px;\n}\n.article-body h1 { font-size: 28px; font-weight: 600; letter-spacing: -1.28px; border-bottom: 1px solid var(--geist-border); padding-bottom: 8px; margin-top: 32px; }\n.article-body h2 { font-size: 24px; font-weight: 600; letter-spacing: -0.96px; border-bottom: 1px solid var(--geist-border); padding-bottom: 6px; margin-top: 36px; }\n.article-body h3 { font-size: 18px; font-weight: 600; letter-spacing: -0.32px; margin-top: 26px; }\n.article-body table {\n  width: 100%;\n  border-collapse: collapse;\n  margin: 24px 0;\n  font-size: 14px;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  overflow: hidden;\n}\n.article-body th, .article-body td {\n  padding: 10px 14px;\n  text-align: left;\n  border-bottom: 1px solid var(--geist-border);\n}\n.article-body th {\n  background: var(--geist-surface-tint);\n  font-weight: 600;\n  color: var(--geist-foreground);\n}\n.article-body blockquote {\n  border-left: 2px solid var(--geist-foreground);\n  margin: 20px 0;\n  padding: 8px 18px;\n  color: var(--geist-secondary);\n  font-style: normal;\n}\n.article-body code {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 13.5px;\n  box-shadow: var(--shadow-ring);\n  background: var(--geist-surface-tint);\n  padding: 2px 6px;\n  border-radius: var(--radius-sm);\n}\n.article-body pre {\n  position: relative;\n  background: #000000;\n  color: #ededed;\n  box-shadow: var(--shadow-border);\n  border-radius: var(--radius-md);\n  padding: 18px;\n  margin: 24px 0;\n  overflow-x: auto;\n}\n.article-body pre code {\n  background: transparent;\n  box-shadow: none;\n  padding: 0;\n  color: inherit;\n  font-size: 13px;\n}\n.copy-code-btn {\n  position: absolute;\n  top: 8px;\n  right: 10px;\n  font-family: \"Geist Mono\", monospace;\n  font-size: 11px;\n  background: #171717;\n  color: #ffffff;\n  border: 1px solid #333333;\n  padding: 3px 8px;\n  border-radius: var(--radius-sm);\n  cursor: pointer;\n}\n\n/* 侧边大纲 (TOC) */\n.reading-sidebar {\n  position: sticky;\n  top: 80px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card);\n  border-radius: var(--radius-lg);\n  padding: 20px;\n  max-height: calc(100vh - 100px);\n  overflow-y: auto;\n}\n.sidebar-toc-title {\n  font-family: \"Geist Mono\", monospace;\n  font-size: 12px;\n  font-weight: 500;\n  text-transform: uppercase;\n  letter-spacing: 0.5px;\n  color: var(--geist-quaternary);\n  margin-bottom: 12px;\n}\n.reading-sidebar ul {\n  list-style: none;\n  padding-left: 0;\n  margin: 0;\n  font-size: 13px;\n}\n.reading-sidebar li {\n  margin: 6px 0;\n}\n.reading-sidebar ul ul {\n  padding-left: 14px;\n}\n.reading-sidebar a {\n  color: var(--geist-secondary);\n  text-decoration: none;\n  transition: color 0.15s;\n}\n.reading-sidebar a:hover, .reading-sidebar a.active {\n  color: var(--geist-foreground);\n  font-weight: 600;\n}\n\n/* 后台管理 (/admin) */\n.admin-card-container {\n  background: var(--geist-background);\n  box-shadow: var(--shadow-card-full);\n  border-radius: var(--radius-lg);\n  padding: 32px;\n  margin-bottom: 32px;\n}\n.form-row-2 {\n  display: grid;\n  grid-template-columns: 1fr 1fr;\n  gap: 16px;\n  margin-bottom: 16px;\n}\n@media (max-width: 600px) {\n  .form-row-2 { grid-template-columns: 1fr; }\n}\n.form-field {\n  display: flex;\n  flex-direction: column;\n  gap: 6px;\n  margin-bottom: 16px;\n}\n.form-field label {\n  font-size: 13px;\n  font-weight: 500;\n  color: var(--geist-foreground);\n}\n.form-field input, .form-field select, .form-field textarea {\n  font-family: \"Geist\", sans-serif;\n  font-size: 14px;\n  padding: 9px 12px;\n  background: var(--geist-background);\n  box-shadow: var(--shadow-border);\n  border: none;\n  border-radius: var(--radius-md);\n  color: var(--geist-foreground);\n  outline: none;\n}\n.form-field input:focus, .form-field select:focus, .form-field textarea:focus {\n  outline: 2px solid var(--ds-focus-color);\n  box-shadow: none;\n}\n\n/* 语法高亮 (Console Blue / Purple / Pink) */\n.codehilite .k, .codehilite .kd, .codehilite .kn { color: #eb367f; font-weight: 500; }\n.codehilite .s, .codehilite .s1, .codehilite .s2 { color: #0070f3; }\n.codehilite .nf, .codehilite .na { color: #7928ca; font-weight: 500; }\n.codehilite .c, .codehilite .c1 { color: #666666; font-style: italic; }\n.codehilite .mi, .codehilite .mf { color: #ff5b4f; }\n\n</style>\n\n</head>\n<body>\n\n    <nav class=\"vercel-nav\">\n      <div class=\"nav-brand\">\n        <a href=\"/\" style=\"display:flex;align-items:center;gap:10px;text-decoration:none\">\n          <svg class=\"vercel-triangle\" viewBox=\"0 0 76 65\" fill=\"none\">\n            <path d=\"M37.5274 0L75.0548 65H0L37.5274 0Z\" fill=\"currentColor\"/>\n          </svg>\n          <span class=\"nav-title\">Agent Harness KB</span>\n        </a>\n        <span class=\"nav-badge-pill\">Geist 2.0</span>\n      </div>\n\n      <div class=\"nav-links\">\n        <a class=\"nav-link \" href=\"/\">全景总览</a>\n        <a class=\"nav-link \" href=\"/vad\" style=\"color:var(--ship-red)\">🎯 VAD 专栏 (144)</a>\n        <a class=\"nav-link\" href=\"https://m0rtzz.github.io/paper-notes/\" target=\"_blank\" rel=\"noopener\">顶会 669 篇 ↗</a>\n        <a class=\"nav-link\" href=\"/download/all\">整库打包</a>\n        \n      </div>\n\n      <div class=\"nav-actions\">\n        \n        <button class=\"theme-toggle-btn\" id=\"theme-toggle-btn\" onclick=\"toggleTheme()\" title=\"切换亮暗主题\">🌙</button>\n      </div>\n    </nav>\n    \n<main class=\"vercel-container\">\n\n        <div class=\"report-header-card\">\n          <div class=\"crumb-bar\"><a href=\"/\">Home</a> / <b>source_PiDurable_RFC.txt</b></div>\n          <h1 class=\"report-title\">source_PiDurable_RFC.txt</h1>\n          <div class=\"report-action-buttons\">\n            <a class=\"btn-primary-dark\" href=\"?dl=1\">Download Text</a>\n          </div>\n        </div>\n        <article class=\"article-body\"><pre><code>Pi Durable | Earendil\nPi Durable\nDate:\nThu, 01 Oct 2026\nFrom:\nEarendil Engineering &lt;\nrfc@earendil.com\n&gt;\nTo:\nYou\nSubject:\nPi Durable\nToday Earendil and the Pi community \nshipped Pi 1.0\n. This\nreflects our belief that after countless hours of hardening, maintenance, and\nactive development, Pi is now a solid foundation on which to build. Pi also\ncontinues to evolve. Together with Pi 1.0, we are shipping an experimental new\npackage called Pi Durable. Pi Durable was built specifically for long-running,\ndurable, and malleable agents that can run anywhere. We would like you to join\nin the fun and help us make it the best durable harness there is.\nWhy Pi Durable?\nPi the coding agent is built to run on your (remote) machine, inside a terminal,\ndriven by one person. If the process dies, you look at what happened and tell it\nto continue. That is what Pi 1.0 focuses on and excels at, and that is not\nchanging.\nAt Earendil, we want to bring this technology to everyone, in whatever form fits\ntheir needs best. For that, we need a harness that runs anywhere, can be reached\nfrom different surfaces, supports infinitely long conversations, survives\ncatastrophic internal and external failures, and lets multiple humans steer the\nsame agents.\nPi Durable is that harness. It does not replace the Pi coding agent. It is a\nframework for building any agentic application, coding agents included. It\nshares not only code with the Pi coding agent, like pi-ai, but also its\nprinciples: minimalism and malleability.\nIt also lets us explore designs in this space without disrupting Pi the coding\nagent. Lessons we learn building agentic applications on Pi Durable will flow\nback into Pi the coding agent as they prove themselves valuable.\nWhat is a harness?\nEverybody has their own definition of a harness. We \nwrote about this\npreviously\n, but let us reintroduce the concept of\nthe harness for Pi Durable.\nA harness is storage plus the machinery needed to run one or more conversations\nwith large language models in parallel. It provides the tools those models call,\nand the execution environments the tools run in.\nA conversation is an interaction between you and an agent, recorded as a\ntranscript. The agent is the large language model together with its settings,\nlike the thinking level, and the tools it can call.\nTools do their work through an execution environment, which can be your laptop,\na remote VM, or an in-memory sandbox. Which tools and which execution\nenvironment an agent gets is up to each conversation.\nEverything the harness runs, from calling the model to executing a tool, is a\ntask.\nLike everything in Pi, Pi Durable is built so your agent can understand it. The\nentire source code, without tests, is about 15,000 lines, which comes out to\nabout 150,000 tokens with GPT and about 250,000 with Claude. That's the worst\ncase. To build on Pi Durable, your agent rarely needs all of it; the storage\nbackends alone are 3,000 lines it can usually skip.\nNow let us give you a little tour of Pi Durable, to illustrate what we built and\nwhy we built it.\nLong runs anywhere\nWe want agents to run for a long time and to be able to run anywhere, where\nanywhere currently means anywhere there is a JavaScript runtime.\nIn Pi Durable, a harness opens over a storage backend. Pi Durable ships memory,\nSQLite, and JSONL storage, plus a conformance suite and benchmarks for your own\nbackend. The SQLite and JSONL storage code uses no Node APIs, so with a small\nadapter it runs on Bun or inside a Cloudflare Durable Object. The storage\ninterface is small and easy to implement on top of whatever you have, like a\nkey-value store or Postgres. One process owns a storage at a time, and other\nclients attach to that process.\nOn SQLite, the harness only keeps the working set in memory: the active\ntranscripts, live tasks, and pending submissions. Everything else stays on disk\nuntil it is needed. Active transcripts are naturally bounded by the model's\ncontext window, because compaction summarizes older messages before they\noverflow it. So even a conversation with tens of thousands of messages fits\nsnugly into memory.\nTools that need files or a shell get them from an execution environment. Pi\nDurable ships a Node execution environment, which gives tools access to your\nlocal files. Like storage, the execution environment interface is small and easy\nto implement, so you can also expose remote execution environments to your\ntools. That allows the harness to run on one machine while its tools run on\nanother. Your \nenv\n function builds the environment for every tool call, from\nthe conversation's working directory, so each conversation can run in a\ndifferent place.\nimport\n { BACKGROUND_CONTEXT } \nfrom\n\"@earendil-works/chord/context\"\n;\nimport\n { createModels } \nfrom\n\"@earendil-works/pi-ai/models\"\n;\nimport\n { openaiProvider } \nfrom\n\"@earendil-works/pi-ai/providers/openai\"\n;\nimport\n { createRegistry, Harness } \nfrom\n\"@earendil-works/pi-durable\"\n;\nimport\n { NodeExecutionEnv } \nfrom\n\"@earendil-works/pi-durable/env/node\"\n;\nimport\n {\n    openNodeSqliteStorage,\n} \nfrom\n\"@earendil-works/pi-durable/storage/sqlite/node\"\n;\nimport\n { CodingTools } \nfrom\n\"@earendil-works/pi-durable/tools\"\n;\nconst\n context = BACKGROUND_CONTEXT; \n// every call takes a context for cancellation\nconst\n models = createModels();\nmodels.setProvider(openaiProvider());\nconst\n registry = createRegistry();\nregistry.install(CodingTools); \n// read, write, edit, bash\nconst\n env = ({ cwd }: { cwd?: string }) =&gt;\nnew\n NodeExecutionEnv({ cwd: cwd ?? process.cwd() });\nconst\n harness = \nawait\n Harness.open(\nawait\n openNodeSqliteStorage(\n\"./agent.sqlite\"\n),\n    { models, registry, env },\n    context,\n);\n// The root conversation: created on first use, and the same one after every\n// restart.\nconst\n root = \nawait\n harness.root(context, {\n    agent: {\n        model: { provider: \n\"openai\"\n, modelId: \n\"gpt-6.1-sol\"\n },\n        cwd: \n\"/work/repo\"\n,\n    },\n});\nSurvives crashes\nWe want an agent to survive its process dying, whether the laptop sleeps, the\ncontainer is redeployed, or the machine runs out of memory, and to pick up where\nit left off.\nIn Pi Durable, every step of a run is a task that stores a checkpoint before it\nmoves on. If the process dies, a new process opens the same storage, finds the\nunfinished tasks, and continues each one from its last checkpoint. A model\nrequest that was cut off is sent again; the partial answer stays in the\ntranscript, marked as aborted. A tool call that was cut off reruns if it is safe\nto; otherwise the model is told it was interrupted. Pi Durable has no built-in\nsubagents, but they take a few lines of code to build, as the triage tool below\nshows. A subagent runs in a conversation of its own, so it continues from where\nit left off too, and a subagent tool that is safe to rerun finds its subagent\nagain and waits for its answer. Queued messages are still queued. A \nrequestId\nmakes a submission exactly-once, so a client that retries after a crash gets the\noriginal submission back instead of asking twice.\nconst\n job = {\ntype\n: \n\"input\"\n,\n    content: \n\"Fix the flaky login test\"\n,\n    requestId: \n\"job-42\"\n,\n} \nas\nconst\n;\nawait\n root.submit(job, context);\n// The process dies here, in the middle of a tool call.\n// A new process opens the same storage.\nconst\n harness = \nawait\n Harness.open(\nawait\n openNodeSqliteStorage(\n\"./agent.sqlite\"\n),\n    { models, registry, env },\n    context,\n);\nharness.resume(); \n// continue the interrupted run\nconst\n root = \nawait\n harness.root(context);\n// the same submission, answered\nconst\n settled = \nawait\n (\nawait\n root.submit(job, context)).wait(context);\nMany conversations at once\nWe want one harness to run many conversations at the same time, without one\nblocking another.\nIn Pi Durable, one harness runs as many conversations as you need, concurrently,\nall with the same guarantees. A conversation starts fresh or forks another one\nat any point in its transcript, and sees the parent's history up to that point\nwithout copying it.\nThink of a Slack channel where your agent answers mentions from anyone. Then\nsomebody opens a thread. The channel can be one conversation, and the thread a\nfork of it at the message the thread replies to. Both run at the same time and\nneither blocks the other.\nconst\n channel = \nawait\n harness.root(context);\nconst\n question = \nawait\n channel.submit(\n    { \ntype\n: \n\"input\"\n, content: \n\"@agent why did the deploy fail?\"\n },\n    context,\n);\nconst\n answered = \nawait\n question.wait(context);\n// Someone replies to the agent's answer in a thread. Every conversation names\n// its owner, which decides what an abort reaches (more on that under Tasks).\n// The thread has none.\nconst\n thread = \nawait\n channel.fork(\n    answered.answer!,\n    { ownership: { kind: \n\"ownerless\"\n } },\n    context,\n);\n// Both conversations work at the same time.\nconst\n inThread = \nawait\n thread.submit(\n    { \ntype\n: \n\"input\"\n, content: \n\"@agent can we roll it back?\"\n },\n    context,\n);\nconst\n inChannel = \nawait\n channel.submit(\n    { \ntype\n: \n\"input\"\n, content: \n\"@agent who is on call today?\"\n },\n    context,\n);\nawait\n Promise.all([inThread.wait(context), inChannel.wait(context)]);\nEach conversation also stores its own agent: the model, the thinking level, the\nselected extensions and which of their tools are active, extra instructions, and\nthe working directory in its execution environment. A reviewer next to the main\nagent can use a cheaper model, read-only tools, and its own checkout.\nExtensions\nWe want everything an agent can do to be pluggable, and every plugged-in piece\nto take part in durability.\nIn Pi Durable, an extension is a named bundle of system prompt sections, tools,\nhooks, and tasks. The application installs extensions in a registry. Each\nconversation selects which extensions and tools it uses, and stores only their\nnames.\nSystem prompt sections\nThe system prompt is rebuilt from the sections of the conversation's extensions\nbefore every request, so a changed section is picked up by the next request. Pi\nDurable records what changed in the transcript, at the position where it\nchanged, so a restart or a fork sees exactly what the model saw. On models that\nsupport system prompt and tool changes in the middle of a conversation, only the\nchange is sent, so the prompt cache stays valid.\nimport\n { defineExtension, section } \nfrom\n\"@earendil-works/pi-durable\"\n;\nconst\n ProjectContext = defineExtension({\n    name: \n\"project-context\"\n,\n    sections: [\n// Read from the conversation's execution environment. The files can be\n// loaded and watched in the background; every request renders the\n// latest state.\n        section(\n\"agents_md\"\n, (input) =&gt; agentsMd.latest(input.env)),\n        section(\n\"skills\"\n, (input) =&gt; skills.latest(input.env)),\n    ],\n});\nTools\nEvery tool call runs as its own durable task, and its intent is stored before it\nruns. After a crash, a tool reruns only if it says that is safe. Otherwise the\nmodel is told the call was interrupted, with the output stored so far, and\ndecides what to do. Each conversation can also get its own set of tools, like\nthe Slack thread from earlier, which may search but not deploy.\nimport\n { Type } \nfrom\n\"@earendil-works/pi-ai\"\n;\nimport\n { defineTool } \nfrom\n\"@earendil-works/pi-durable\"\n;\nconst\n searchIssues = defineTool({\n    name: \n\"search_issues\"\n,\n    description: \n\"Search the issue tracker\"\n,\n    parameters: Type.Object({ query: Type.String() }),\n    replay: \n\"safe\"\n, \n// only reads, so a rerun after a crash is fine\n    execute: async (args, api) =&gt; {\n// streamed to every client watching\n        api.output(\n`searching for ${\nargs.query\n}\\n`\n);\nreturn\n {\n            content: [{ \ntype\n: \n\"text\"\n, text: await tracker.search(args.query) }],\n        };\n    },\n});\nconst\n deploy = defineTool({\n    name: \n\"deploy\"\n,\n    description: \n\"Deploy a version to production\"\n,\n    parameters: Type.Object({ version: Type.String() }),\n// No replay: a deploy interrupted by a crash is reported to the model,\n// never repeated.\n    execute: async (args) =&gt; ({\n        content: [{ \ntype\n: \n\"text\"\n, text: await ci.deploy(args.version) }],\n    }),\n});\nregistry.install(defineExtension({ name: \n\"ops\"\n, tools: [searchIssues, deploy] }));\n// The thread may search, but not deploy.\nawait\n thread.configure({ tools: { remove: [deploy] } }, context);\nA tool gets the harness API for its call: it can commit entries and documents,\nstart tasks and conversations, and talk to other conversations. That makes a\nsubagent a few lines of code. A tool creates a conversation it owns, gives it a\nsmaller model and its own instructions, and waits for its answer. The subagent\nis a conversation like any other, so it survives a crash, counts its own cost,\nand a UI can show it under the call.\nimport\ntype\n { AssistantMessage } \nfrom\n\"@earendil-works/pi-ai\"\n;\nimport\n { AssistantEntry, configure } \nfrom\n\"@earendil-works/pi-durable\"\n;\nconst\n triage = defineTool({\n    name: \n\"triage\"\n,\n    description: \n\"Label an incoming issue as bug, feature, or question\"\n,\n    parameters: Type.Object({ issue: Type.String() }),\n// a rerun after a crash finds the same subagent and the same submission\n    replay: \n\"safe\"\n,\n    execute: async (args, api, context) =&gt; {\nconst\n child = \nawait\n api.commit(\nasync\n (tx) =&gt; {\nconst\n existing = (\nawait\n tx.scanConversations({ ownerTaskId: api.taskId }, \n1\n)\n            ).items[\n0\n];\nif\n (existing !== \nundefined\n) \nreturn\n existing.id;\n// Owned by this call, so aborting the call aborts the subagent.\nconst\n created = \nawait\n tx.createConversation({\n                ownership: { kind: \n\"task\"\n, taskId: api.taskId },\n            });\n// It starts as a copy of this conversation's agent. Make it a small\n// model without tools.\nawait\n configure(tx, created.id, {\n                model: { provider: \n\"openai\"\n, modelId: \n\"gpt-6-luna\"\n },\n                tools: [],\n                instructions: \n\"Answer with one word: bug, feature, or question.\"\n,\n            });\nreturn\n created.id;\n        }, context);\n// lets a UI show the subagent under the call\nawait\n api.details({ conversationId: child }, context);\nconst\n subagent = \nawait\n api.conversation(child, context);\nconst\n request = {\ntype\n: \n\"input\"\n,\n            content: args.issue,\n            requestId: \n`triage:${\napi.taskId\n}`\n,\n        } \nas\nconst\n;\nconst\n settled = \nawait\n (\nawait\n subagent!.submit(request, context)\n        ).wait(context);\n// The answer is an entry in the subagent's transcript. Read it and take\n// its text.\nconst\n entry = \nawait\n api.commit(\n            (tx) =&gt; tx.entry(AssistantEntry, settled.answer!),\n            context,\n        );\nconst\n message = entry?.model?.[\n0\n] \nas\n AssistantMessage;\nconst\n text = message.content\n            .flatMap((content) =&gt; (content.\ntype\n === \n\"text\"\n ? [content.text] : []))\n            .join(\n\"\"\n);\nreturn\n { content: [{ \ntype\n: \n\"text\"\n, text }] };\n    },\n});\nExtensions can also change other extensions' tools. A tool with the same name in\na later extension replaces the earlier one, for example a bash that runs inside\na Python virtualenv. A wrap decorates whichever tool won, wherever the wrapping\nextension is selected.\nimport\n { wrapTool } \nfrom\n\"@earendil-works/pi-durable\"\n;\nimport\n { createBashTool } \nfrom\n\"@earendil-works/pi-durable/tools\"\n;\n// Times every bash call, whichever bash the conversation ends up with.\nconst\n Timing = defineExtension({\n    name: \n\"timing\"\n,\n    wraps: [\n        wrapTool(createBashTool(), (bash) =&gt; ({\n            ...bash,\n            execute: async (args, api, context) =&gt; {\nconst\n start = Date.now();\ntry\n {\nreturn\nawait\n bash.execute(args, api, context);\n                } \nfinally\n {\n                    metrics.record(\n\"bash\"\n, Date.now() - start);\n                }\n            },\n        })),\n    ],\n});\nHooks\nHooks let extensions step into tasks, including the built-in tasks for\ngenerating a model response, invoking a tool, or performing compaction. They can\nrewrite a request before it goes to the model, block or rewrite a tool call,\nreplace a result, keep a run going, or write a summary themselves. A hook can\nrun again after a crash, so a hook that makes a decision stores it in a memo: a\nsmall value stored with the task, where the first write wins.\nimport\n { hook, ToolTask } \nfrom\n\"@earendil-works/pi-durable\"\n;\nconst\n Approval = defineExtension({\n    name: \n\"approval\"\n,\n    hooks: [\n        hook(ToolTask, {\n            beforeTool: async (call, api, context) =&gt; {\nif\n (call.name !== \n\"deploy\"\n) \nreturn\nundefined\n;\n// After a restart, the hook finds the stored answer instead of\n// asking again.\nlet\n approved = \nawait\n api.memo&lt;boolean&gt;(\n\"approval:deploy\"\n,\n                    context,\n                );\n                approved ??= \nawait\n api.memo(\n\"approval:deploy\"\n,\nawait\n askInSlack(call),\n                    context,\n                );\nreturn\n approved\n                    ? \nundefined\n                    : { block: \n\"Nobody approved the deploy.\"\n };\n            },\n        }),\n    ],\n});\nSeveral extensions can hook the same thing. Their hooks run as a chain, in the\norder the conversation selects the extensions, and each hook defines how its\nchain runs. \nbeforeTool\n passes rewritten arguments down the chain, and the\nfirst block stops it. \nafterTool\n passes the result down the chain. \nonYield\nstops at the first hook that keeps the run going. Observers like \nafterResponse\nalways run them all. A hook that throws is reported, and the chain continues,\nexcept in \nbeforeTool\n, where a throw blocks the call.\nTasks\nThe harness runs conversations with built-in tasks: one for each model request,\none for each tool call, and one for compaction. Extensions bring their own tasks\nand get the same machinery: a checkpoint after every step, timers that survive\nrestarts, and waiting on other tasks.\nA checkout that splits the bill across several cards charges every card at once.\nIf one card is declined, the other payments are aborted and refund themselves:\nimport\n { defineTask, \ntype\n TaskId } \nfrom\n\"@earendil-works/pi-durable\"\n;\nconst\n Payment = defineTask&lt;{ card: string }, { phase: \n\"charge\"\n }, string&gt;({\n    name: \n\"shop.payment\"\n,\n    version: 1,\n    initial: () =&gt; ({ phase: \n\"charge\"\n }),\n    phases: {\n        charge: async (task, runtime, context) =&gt; {\n// The key makes the charge idempotent: if a crash reruns this\n// phase, the card is only charged once.\nconst\n charge = \nawait\n bank.charge(\n                task.input.card,\n`payment-${\ntask.id\n}`\n,\n            );\nawait\n runtime.commit(\n                () =&gt; ({\n                    status: \n\"terminal\"\n,\n                    outcome: charge.ok\n                        ? { status: \n\"completed\"\n, result: charge.receipt }\n                        : { status: \n\"failed\"\n, error: { message: charge.error } },\n                }),\n                context,\n            );\n        },\n    },\n// Another payment failed, or the checkout was cancelled: undo this one.\n    abort: async (task, runtime, context) =&gt; {\nawait\n bank.refund(\n`payment-${\ntask.id\n}`\n);\nawait\n runtime.commit(\n            () =&gt; ({ status: \n\"terminal\"\n, outcome: { status: \n\"aborted\"\n } }),\n            context,\n        );\n    },\n});\ntype\n CheckoutState =\n    | { phase: \n\"pay\"\n }\n    | { phase: \n\"decide\"\n; payments: TaskId&lt;string&gt;[] };\nconst\n Checkout = defineTask&lt;{ cards: string[] }, CheckoutState, string&gt;({\n    name: \n\"shop.checkout\"\n,\n    version: 1,\n    initial: () =&gt; ({ phase: \n\"pay\"\n }),\n    phases: {\n        pay: async (task, runtime, context) =&gt; {\nawait\n runtime.commit(\nasync\n (tx) =&gt; {\nconst\n payments: TaskId&lt;string&gt;[] = [];\nfor\n (\nconst\n card \nof\n task.input.cards) {\n                    payments.push(\nawait\n tx.createTask(Payment, { card }, {\n                            ownership: { kind: \n\"task\"\n, taskId: task.id },\n                        }),\n                    );\n                }\n// Run no code until every payment is done. The first failed\n// payment aborts the others.\nreturn\n {\n                    status: \n\"waiting\"\n,\n                    checkpoint: { phase: \n\"decide\"\n, payments },\n                    on: payments,\n                    policy: \n\"failFast\"\n,\n                };\n            }, context);\n        },\n        decide: async (task, runtime, context) =&gt; {\nconst\n outcomes = \nawait\n runtime.outcomes(\n                task.state.checkpoint.payments,\n                context,\n            );\nconst\n paid = outcomes.every(\n                (outcome) =&gt; outcome.status === \n\"completed\"\n,\n            );\nawait\n runtime.commit(\n                () =&gt; ({\n                    status: \n\"terminal\"\n,\n                    outcome: paid\n                        ? { status: \n\"completed\"\n, result: \n\"Order placed.\"\n }\n                        : {\n                            status: \n\"failed\"\n,\n                            error: { message: \n\"A payment failed.\"\n },\n                        },\n                }),\n                context,\n            );\n        },\n    },\n    abort: (_task, runtime, context) =&gt;\n        runtime.commit(\n            () =&gt; ({ status: \n\"terminal\"\n, outcome: { status: \n\"aborted\"\n } }),\n            context,\n        ),\n});\n// The agent starts a checkout with a tool.\nconst\n checkout = defineTool({\n    name: \n\"checkout\"\n,\n    description: \n\"Pay for the cart, split across several cards\"\n,\n    parameters: Type.Object({ cards: Type.Array(Type.String()) }),\n    execute: async (args, api, context) =&gt; {\n// Owned by this call: aborting the call aborts the checkout and refunds\n// its payments.\nconst\n owner = {\n            ownership: { kind: \n\"task\"\n, taskId: api.taskId },\n        } \nas\nconst\n;\nconst\n id = \nawait\n api.createTask(\n            Checkout,\n            { cards: args.cards },\n            owner,\n            context,\n        );\nconst\n { outcome } = (\nawait\n api.waitForTask(id, context)).state;\nconst\n text =\n            outcome.status === \n\"completed\"\n ? outcome.result : outcome.status;\nreturn\n { content: [{ \ntype\n: \n\"text\"\n, text }] };\n    },\n});\nregistry.install(defineExtension({\n    name: \n\"shop\"\n,\n    tools: [checkout],\n    tasks: [Payment, Checkout],\n}));\nTasks and conversations form one ownership tree. Aborting a task aborts what it\nowns, bottom-up, so every task cleans up its own effects first, and a task only\nfinishes once the work it owns has finished. A subagent is the same pattern: a\nconversation owned by the tool call that started it.\nTasks are foreground by default: they are part of the conversation's current\nwork. The conversation is idle only once they are done, and aborting the\nconversation, for example when the user presses Esc, aborts them and everything\nthey own. A background task belongs to the conversation, but not to its current\nwork. The conversation goes idle while it runs, and an ordinary abort leaves it\nand everything it owns alone. That fits a subagent that should outlive the turn\nthat started it, or a reminder that fires tomorrow. Aborting the task itself, or\nthe conversation with \n{ background: true }\n, still stops it.\n// Part of the current work: Esc aborts it, and the conversation waits for it.\nawait\n api.createTask(\n    Checkout,\n    input,\n    { ownership: { kind: \n\"task\"\n, taskId: api.taskId } },\n    context,\n);\n// Side work: the conversation goes idle while it runs, and Esc leaves it alone.\nawait\n api.createTask(\n    Reminder,\n    input,\n    { ownership: { kind: \n\"conversation\"\n }, background: true },\n    context,\n);\nCompaction\nWe want long conversations to keep going without the agent stopping to\nsummarize.\nIn Pi Durable, compaction is a task like any other, and it runs while the\nconversation keeps going. When the context gets close to the model's limit, a\nbackground compaction summarizes the older messages, and the summary is placed\nat the next turn boundary. The conversation only waits for a summary when the\nnext request would not fit otherwise. If the provider still rejects a request as\ntoo long, the harness compacts and retries once. You can also compact manually\nat any time, with your own instructions. The older messages always stay in\nstorage.\nconst\n harness = \nawait\n Harness.open(storage, {\n    models,\n    registry,\n    settings: {\n        compaction: {\n// past contextWindow - reserveTokens, the next request waits for a\n// summary\n            reserveTokens: 16384,\n// this far before that, a summary starts in the background\n            backgroundTokens: 32768,\n        },\n    },\n}, context);\n// Manual, also while the agent is working.\nawait\n root.compact(\n\"Keep the names of the failing tests\"\n, context);\nreset()\n goes further: it starts a new context, optionally from a handoff note,\nand a tool can ask for the same by returning \ncontrol: { handoff }\n. Because\nnothing is deleted, a second tool can still search everything before the\nhandoff. That is all it takes to build an agent that hands off to itself and\nlooks things up later.\nconst\n handoff = defineTool({\n    name: \n\"handoff\"\n,\n    description:\n\"Start over from a handoff note. \"\n +\n\"Older messages stay searchable with search_history.\"\n,\n    parameters: Type.Object({ note: Type.String() }),\n    execute: async (args, api, context) =&gt; {\n// Queued behind the handoff, so it starts the next run in the new\n// context.\nconst\n self = \nawait\n api.conversation(api.conversationId, context);\nawait\n self!.submit(\n            {\ntype\n: \n\"input\"\n,\n                content: \n\"Continue.\"\n,\n                requestId: \n`handoff:${\napi.taskId\n}`\n,\n            },\n            context,\n        );\n// Ends this run and starts a new context from the note, like\n// reset(note).\nreturn\n {\n            content: [{ \ntype\n: \n\"text\"\n, text: \n\"Handing off.\"\n }],\n            control: { handoff: args.note },\n        };\n    },\n});\nconst\n searchHistory = defineTool({\n    name: \n\"search_history\"\n,\n    description: \n\"Search older messages, including those before a handoff\"\n,\n    parameters: Type.Object({ text: Type.String() }),\n    replay: \n\"safe\"\n,\n    execute: async (args, api, context) =&gt; {\n// Tools read records through a transaction too. One that writes\n// nothing stores nothing.\nconst\n page = \nawait\n api.commit(\n            (tx) =&gt; tx.scanEntries({ conversationId: api.conversationId }, \n200\n),\n            context,\n        );\nconst\n hits = page.items.filter((entry) =&gt;\n            JSON.stringify(entry.model ?? []).includes(args.text),\n        );\nconst\n text = hits.map((entry) =&gt; JSON.stringify(entry.model)).join(\n\"\\n\"\n);\nreturn\n { content: [{ \ntype\n: \n\"text\"\n, text }] };\n    },\n});\nDurable application state\nWe want the state of the application built on the agent to be as durable as the\nconversation itself.\nIn Pi Durable, application state, like a todo list, a plan, a ticket, or the\nsandbox a conversation runs in, lives in documents. Documents are typed JSON\nstored next to the transcript and changed in the same atomic commits, so the\nstate never disagrees with the transcript that produced it. Each document says\nwhat a fork starts with: the parent's value at the fork point, its current\nvalue, or a fresh one.\nimport\n { defineDoc } \nfrom\n\"@earendil-works/pi-durable\"\n;\nconst\n Todos = defineDoc&lt;{ items: string[] }&gt;({\n    kind: \n\"app.todos\"\n,\n    version: 1,\n    scope: \n\"conversation\"\n,\n    history: \n\"rewindable\"\n,\n    fork: \n\"asOf\"\n, \n// a fork starts with the todos its parent had at the fork entry\n    initial: () =&gt; ({ items: [] }),\n});\nconst\n Todo = defineExtension({\n    name: \n\"todo\"\n,\n    tools: [\n        defineTool({\n            name: \n\"todo\"\n,\n            description: \n\"Add an item to your todo list\"\n,\n            parameters: Type.Object({ item: Type.String() }),\n            execute: async (args, api, context) =&gt; {\nawait\n api.commit(\nasync\n (tx) =&gt; {\nconst\n todos = \nawait\n tx.doc(Todos, api.conversationId);\n                    todos.items.push(args.item);\n                }, context);\nconst\n text = \n`Added ${\nargs.item\n}`\n;\nreturn\n { content: [{ \ntype\n: \n\"text\"\n, text }] };\n            },\n        }),\n    ],\n// The model sees the list before every request.\n    sections: [\n        section(\n\"todos\"\n, \nasync\n (input, context) =&gt; {\nconst\n todos = \nawait\n input.read.snapshot(\n                Todos,\n                input.conversationId,\n                context,\n            );\nreturn\n todos?.items.join(\n\"\\n\"\n) || \nundefined\n;\n        }),\n    ],\n});\n// A UI subscribes to the committed value.\nconst\n todos = \nawait\n harness.documentState(Todos, channel.id, context);\ntodos?.subscribe((value) =&gt; renderTodos(value?.items ?? []));\nMalleable\nWe want to change the code of a running agent without stopping it.\nIn Pi Durable, the registry can change while conversations run. Installing an\nextension under a name that is already installed replaces it in one step. A tool\ncall that is already running finishes on the code it started with; the next call\nuses the new code. Conversations store extension and tool names, never code, so\nafter a restart they pick up whatever the new process installs.\n// The extension's file changed on disk.\n// same name \"ops\": replaces the installed one\nregistry.install(\nawait\n loadExtension(\n\"./ops.ts\"\n));\nMultiplayer\nWe want many people and clients to work with the same conversations at once:\nwatch them, join late, and steer them.\nIn Pi Durable, everything a UI needs is committed state, so any number of\nclients can attach to any conversation in the harness. A client gets the current\nview first: the transcript, the answer being streamed, running tools and their\noutput, queued messages, the agent, and usage. After that it only gets what\nchanges. A client that joins late or reconnects starts from the current view.\nAny client can steer a running conversation or queue a follow-up.\n// A second client joins the thread while the agent is working.\nconst\n view = \nawait\n thread.viewState(context);\nrender(view.value);\nview.subscribe((value) =&gt; render(value));\n// And steers it. The message joins the running work after the current tool\n// calls.\nawait\n thread.submit(\n    { \ntype\n: \n\"input\"\n, content: \n\"Check the staging logs first\"\n, whenBusy: \n\"steer\"\n },\n    context,\n);\nFor a remote client, \nthread.watch()\n delivers the exact operations of every\ncommit, small enough to send over a socket. If you prefer the coding agent's\nfamiliar events, \nwatchEvents()\n turns the commits into those, at the cost of\nmore bytes on the wire.\nTry it\nYou can try Pi Durable today. Pi Durable is experimental, and the API might\nstill change. Point your agent at \npackages/durable\n in a Pi checkout, have it\nread the\nREADME\n,\nthe over thirty\nexamples\n,\nthe \nsmall coding agent on Pi\nDurable\n,\nor this beautiful \nvacation planning\nagent\n,\nand get building.\nThe vacation planner is about 1,300 lines of TypeScript, most of them the TUI.\nIf it looks like a coding agent, that's only because it borrows its TUI\ncomponents from the Pi coding agent.\nA vacation planner with a TUI, built on Pi Durable.\nA subagent runs three searches in parallel, each a durable task.\nMeanwhile, the main agent is free to chat.\nThe process dies. Weather and museums are done, trains is not.\nRestarted. \nsearch\n is safe to rerun: only trains runs again.\nSwitch to the subagent and steer it.\nBack in main: ask, compact, and steer, all while it works.\nThe report arrives as a message; main turns it into a plan.\nTo run both demos from a Pi checkout:\nnpm install &amp;&amp; npm run build\nnode packages/coding-agent/src/experimental/durable/main.ts\nnode packages/coding-agent/src/experimental/vacation/main.ts\nTo build on Pi Durable in your own project:\nnpm install @earendil-works/pi-durable @earendil-works/pi-ai @earendil-works/chord\nIn the coming weeks, we will talk more about Pi Durable and show you the small\nagentic tools we build with it to help us work, like a Slack bot or a GitHub\ntriage bot. We don't want to spill the beans yet. There is more coming as we use\nPi Durable ourselves, just like we use Pi.\nFAQ\nWhy TypeScript again?\nBecause it is the easiest way to bootstrap this. But as everybody knows by now,\nit's very easy to port everything to Rust or assembler. We're not ruling this\nout in the future, but at the moment we are focusing on TypeScript.</code></pre></article>\n        \n</main>\n\n<script src=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/katex.min.js\"></script>\n<script src=\"https://cdn.jsdelivr.net/npm/katex@0.16.8/dist/contrib/auto-render.min.js\"></script>\n<script>\n\nfunction initTheme() {\n  const saved = localStorage.getItem('kb-theme') || 'light';\n  document.documentElement.setAttribute('data-theme', saved);\n  updateThemeIcon(saved);\n}\nfunction toggleTheme() {\n  const cur = document.documentElement.getAttribute('data-theme') || 'light';\n  const next = cur === 'light' ? 'dark' : 'light';\n  document.documentElement.setAttribute('data-theme', next);\n  localStorage.setItem('kb-theme', next);\n  updateThemeIcon(next);\n}\nfunction updateThemeIcon(t) {\n  const btn = document.getElementById('theme-toggle-btn');\n  if (btn) btn.innerHTML = t === 'dark' ? '☀️' : '🌙';\n}\ndocument.addEventListener('DOMContentLoaded', initTheme);\n\nfunction setViewMode(m) {\n  const grid = document.getElementById('bento-grid-view');\n  const list = document.getElementById('list-table-view');\n  const bGrid = document.getElementById('view-grid-btn');\n  const bList = document.getElementById('view-list-btn');\n  if (m === 'list') {\n    if (grid) grid.style.display = 'none';\n    if (list) list.style.display = 'flex';\n    if (bGrid) bGrid.classList.remove('active');\n    if (bList) bList.classList.add('active');\n  } else {\n    if (grid) grid.style.display = 'grid';\n    if (list) list.style.display = 'none';\n    if (bGrid) bGrid.classList.add('active');\n    if (bList) bList.classList.remove('active');\n  }\n  localStorage.setItem('kb-view', m);\n}\ndocument.addEventListener('DOMContentLoaded', () => {\n  const s = localStorage.getItem('kb-view') || 'grid';\n  setViewMode(s);\n});\n\ndocument.addEventListener('DOMContentLoaded', () => {\n  document.querySelectorAll('pre').forEach(pre => {\n    const b = document.createElement('button');\n    b.className = 'copy-code-btn';\n    b.innerText = 'Copy';\n    b.onclick = () => {\n      const c = pre.querySelector('code') ? pre.querySelector('code').innerText : pre.innerText;\n      navigator.clipboard.writeText(c).then(() => {\n        b.innerText = 'Copied!';\n        setTimeout(() => { b.innerText = 'Copy'; }, 2000);\n      });\n    };\n    pre.appendChild(b);\n  });\n});\n\nwindow.addEventListener('keydown', (e) => {\n  if ((e.key === '/' || (e.metaKey && e.key === 'k')) && document.activeElement.tagName !== 'INPUT' && document.activeElement.tagName !== 'TEXTAREA') {\n    e.preventDefault();\n    const q = document.getElementById('global-search-input');\n    if (q) q.focus();\n  }\n});\n\n// Scrollspy for TOC\nwindow.addEventListener('scroll', () => {\n  const headers = document.querySelectorAll('.article-body h1, .article-body h2, .article-body h3');\n  const scrollPos = window.scrollY + 100;\n  headers.forEach(h => {\n    if (h.offsetTop <= scrollPos) {\n      const id = h.getAttribute('id');\n      if (id) {\n        document.querySelectorAll('.reading-sidebar a').forEach(a => {\n          a.classList.toggle('active', a.getAttribute('href') === '#' + id);\n        });\n      }\n    }\n  });\n});\n\ndocument.addEventListener(\"DOMContentLoaded\", function() {\n  if (window.renderMathInElement) {\n    renderMathInElement(document.body, {\n      delimiters: [\n        {left: '$$', right: '$$', display: true},\n        {left: '$', right: '$', display: false},\n      ],\n      throwOnError : false\n    });\n  }\n});\n</script>\n\n</body>\n</html>\n"