"<!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>fulltext.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>fulltext.txt</b></div>\n          <h1 class=\"report-title\">fulltext.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>Harness Handbook: Making Evolving Agent Harnesses Readable,\nNavigable, and Editable\nRuhan Wang⋆1,2 , Yucheng Shi† 1 , Zongxia Li1,3 , Zhongzhi Li1,4 , Yue Yu2 , Junyao Yang1,5 , Kishan\nPanaganti1 , Haitao Mi1 , Dongruo Zhou2 , Leoweiliang1\nTencent HY LLM Frontier 2 Indiana University 3 University of Maryland, College Park 4 University of\nGeorgia 5 National University of Singapore\n\n1\n\n⋆\n\nWork done at an internship at Tencent Seattle † Lead Project Collaborator.\n\narXiv:2607.13285v1 [cs.AI] 14 Jul 2026\n\nruhwang@iu.edu, yuchengshi@tencent.com\n\nThe capability of a modern AI agent depends not only on its foundation model but also on its\nharness, which constructs prompts, manages state, invokes tools, and coordinates execution. As\nmodels, APIs, execution environments, and application requirements change, the harness must be\ncontinually modified to add capabilities or adapt existing behaviors. Before a human developer\nor coding agent can make such a change, they must identify all code locations that implement\nthe target behavior. This is difficult because production harnesses are often large, tightly coupled,\nand behaviorally distributed across files, functions, execution stages, and state transitions, whereas\nmodification requests describe what the system should do and repositories are organized by files,\nfunctions, and modules. Existing approaches to code search, repository indexing, and long-context\nprocessing make code easier to inspect, but they still leave developers and coding agents to recover\nthis mapping themselves. Behavior localization is therefore a central bottleneck in harness evolution.\nWe introduce the Harness Handbook, a behavior-centric representation synthesized automatically\nfrom a harness codebase through static program analysis and LLM-assisted behavioral structuring,\nwhich organizes implementation knowledge around system behaviors and links each behavior to the\ncorresponding source code. We also introduce Behavior-Guided Progressive Disclosure (BGPD),\nwhich guides coding agents from high-level behavior descriptions to relevant implementation details\nand verifies candidate locations against the current source. We evaluate Harness Handbook on diverse\nmodification requests from two open-source agent harnesses. Handbook-Assisted planning improves\nbehavior localization and edit-plan quality while using fewer planner tokens. The largest gains appear\nfor changes involving scattered implementation sites, rarely executed code paths, and cross-module\ninteractions. These findings indicate that evolving complex agentic systems depends not only on\ngenerating edits, but also on determining where those edits should be made.\nProject link: https://ruhan-wang.github.io/Harness-Handbook/\nDate: July 14, 2026\n\n1\n\nIntroduction\n\nRecent advances in large language models (LLMs) have accelerated the development of agentic systems [1–3].\nThese systems extend model capabilities by interacting with tools, APIs, and complex execution environments\n[4–7]. Such interactions are not governed by the foundation model alone. They are coordinated by the harness,\nwhich constructs prompts, manages state, invokes tools, and controls execution across system components.\nThe harness therefore determines how model capabilities are translated into system behavior. As models,\nAPIs, execution environments, and application requirements evolve, the harness must be adapted accordingly.\nHarness evolution has consequently become a recurring engineering challenge in modern agent development\n[8–10].\nIn practice, harness evolution requires changes that add capabilities, adapt existing behaviors, or refine\nexecution workflows [11, 12]. Traditionally, human developers make these changes by reading the repository,\n\n\ftracing the relevant behavior, and editing its implementation. Coding agents are increasingly expected to\nperform the same work from natural-language requests [7, 10, 13, 14]. However, a modification request\ndescribes what behavior should change, but it does not identify where that behavior is implemented. Whether\nthe modification is performed by a human developer or a coding agent, the first step is therefore to locate all\nrelevant implementation sites.\nFinding every relevant implementation site is difficult in production-scale harnesses [15]. A large harness may\nspan hundreds of functions across many files, with execution logic distributed across stages and connected\nthrough shared state. As a result, a single behavior may depend on several nonadjacent implementation sites.\nWe refer to identifying all implementation sites associated with a behavioral request as behavior localization.\nIn a large and structurally complex harness repository, this task is costly for both human developers and\ncoding agents. Human developers must invest substantial time and effort in building a mental model of the\nsystem and tracing behavior across files and execution stages. Coding agents face an additional constraint from\nlimited input context, which prevents them from examining all relevant code at once. They must therefore\nexplore the repository iteratively and may still overlook scattered or rarely executed paths [16, 17].\nExisting approaches to repository understanding make codebases easier to explore. Repository maps, code\nsearch, code summarization, repository memory, and long-context editing help coding agents find, inspect,\nand retain relevant code [16–20]. However, these approaches organize information around files, functions, and\nmodules, whereas a harness modification request describes a desired behavior. They may identify individual\npieces of relevant code, but they do not show how those pieces work together to produce the behavior or\nwhether every affected location has been found. The coding agent must still connect these pieces and infer\nhow the requested behavior maps to the underlying implementation. This missing connection is the gap we\naddress.\nWe address this gap with Harness Handbook, an operational behavior representation that connects system\nbehavior to source code. Instead of organizing implementation knowledge by files and functions, the Handbook\norganizes it by what the harness does and links each behavior to the code that implements it. Developers and\ncoding agents can therefore identify the relevant behavior first and then navigate directly to the corresponding\ncode. We construct Harness Handbook instances automatically using static program analysis and LLM-assisted\nbehavioral structuring. To evaluate whether the Handbook improves harness modification, we use realistic\nrequests from two open-source agent harnesses and compare Baseline and Handbook-Assisted planning on the\nsame tasks. Handbook-Assisted planning improves behavior localization and edit-plan quality while using\nfewer planner tokens. These results show that making the connection between behavior and implementation\nexplicit can make harness evolution more accurate and efficient. Our contributions are as follows:\n• We define behavior localization as finding all code locations that implement the behavior described in a\nmodification request. This step is necessary before a complete edit can be planned.\n• We introduce Harness Handbook, which organizes implementation knowledge by what the harness\ndoes and links each behavior directly to its source code. We also develop an automated framework that\nbuilds Handbook instances from existing codebases using static program analysis and LLM-assisted\nbehavioral structuring.\n• We introduce Behavior-Guided Progressive Disclosure (BGPD), a workflow that guides coding agents\nfrom high-level behavior descriptions to relevant implementation details in stages.\n• We evaluate Harness Handbook on diverse modification requests from two open-source harnesses. We\ncompare Handbook-Assisted BGPD planning with planning without Handbook access on the same tasks.\nHandbook assistance improves behavior localization and edit-plan quality while using fewer planner\ntokens.\n\n2\n\n\f2\n\nRelated Work\n\nOur work is closely related to three research directions: agent harnesses, harness evolution, and repository\nrepresentations for coding agents. We briefly review each direction and discuss how Harness Handbook\ndiffers from existing approaches by introducing an explicit operational behavior representation for behavior\nlocalization.\n\n2.1\n\nAgent Harness\n\nRecent work has increasingly recognized the agent harness as a first-class software abstraction that extends\nfoundation models into deployable agentic systems. Rather than treating prompting, tool use, memory, and\nexecution logic as implementation details, Code as Agent Harness formalizes the harness as an executable and\nstateful software layer supporting reasoning, acting, feedback, and coordination [15]. Complementary surveys\nand engineering efforts further characterize the harness as the runtime infrastructure responsible for prompt\nconstruction, state management, tool invocation, control flow, and interactions with external environments\n[21, 22]. This abstraction has been widely adopted by modern agent frameworks and production systems.\nFrameworks such as AutoGen and OpenHands expose modular runtime components for agent orchestration,\ntool execution, environment interaction, and multi-agent collaboration [13, 23]. Industrial systems such as\nClaude Code and Codex similarly emphasize harness design as a key factor in building reliable long-running\ncoding agents [24, 25]. While these works establish the importance of agent harnesses, they primarily focus\non harness construction and system design rather than understanding and evolving existing production-scale\nharnesses.\n\n2.2\n\nHarness Evolution\n\nAs coding agents become increasingly capable, software engineering efforts are gradually shifting from manually\nimplementing functionality to automatically evolving the underlying harness [7, 13]. Recent work has begun to\ninvestigate harness engineering, adaptive harness optimization, and automated harness repair [8, 10, 14, 26–28].\nThese approaches improve the capability and reliability of agent systems by constructing, adapting, or repairing\nharness implementations. Our work addresses a complementary problem. Rather than directly modifying\nharness implementations, we study the prerequisite challenge of harness evolution: behavior localization.\nHarness Handbook enables developers and coding agents to identify where behavioral changes should be made\nbefore reasoning about how to modify the underlying implementation.\n\n2.3\n\nBehavior Representations\n\nRecent work has proposed various representations to improve repository understanding for coding agents,\nincluding structural repository representations, repository indexing, repository memory, and natural-language\nartifacts [18, 19, 29, 30]. These representations improve repository navigation, code retrieval, and editing by\norganizing implementation knowledge into more accessible forms. However, existing representations remain\nfundamentally implementation-centric, organizing information around source code, repository structure, or\nexecution infrastructure. They do not explicitly capture how system behaviors emerge across distributed\nexecution stages, functional modules, and shared states. In contrast, Harness Handbook introduces an\noperational behavior representation that explicitly bridges behavioral requirements and their underlying\nimplementation, enabling behavior localization before repository exploration.\n\n3\n\nHarness Handbook\n\nHarness Handbook has three parts for understanding and modifying an agent harness. The representation\norganizes source around runtime behavior (Section 3.1). The construction pipeline builds this representation\nfrom a repository (Section 3.2). The modification workflow uses the handbook to guide code changes and\nautomatically resynchronizes it after every non-empty repository diff (Section 3.3).\n\n3\n\n\fHarness Handbook\n1.System Overview\n1.1 Architecture\n1.2 Execution Workflow\n1.3 Design Principles\n\nProgressive Disclosure\n2.4 Main Loop\n\nL1\n\nL2\n\nL3\n\nThe core orchestrator that iteratively performs reasoning, tool\nuse, and observation until the exit conditions are met\n\nLevel 1:\n\nLevel 2:\n\nLevel 3:\n\nSystem Overview\n\nComponent Overview\n\nUnit Deep Dive\n\nPurpose\nDrive the agent to iteratively complete the task\n\n2. Execution Stages\n\n1\n\nTriggering Conditions\n\n2\n\n2.1 Initialization\n\nEnter when loop starts or after each observation\n\n2.2 Planning\n\nInput\n\n2.3 Tool Execution\n2.4 Main Loop (Repeat)\n2.5 Observation\n2.6 Termination (Exit)\n\n3. State and Data\n3.1 Key States\n3.2 Data Flow\n\n4. Components\n4.1 Prompting\n\nComponent\n\nData\n\nExternal Interface\n\nReasoning, tool selection, action execution, observation\n\nOutput\nUpdated state and observation for next iteration\n\nRelated States\nMessages, scratchpad, tool results, loop counter\n\nExceptional Cases\nTool failure, parse error, max steps reached, timeout\n\nDetailed analysis of each\nunit's internal logic, state\ntransitions, edge cases,\nand implementation.\n\nInformation Included\n\nInformation Included\n\nInformation Included\n\nConfigurations\n\n4.4 Others\n\nTypical execution trace and logs\n\n9\n\nOverview of all working units\nthat constitute the harness,\nincluding their roles, inputs/\noutputs, and interactions.\n\n_run_agent_loop(), _step(), _should_exit()\n\nExamples\n\n7\n\nOverall description of the\nentire harness system,\nincluding architecture,\nexecution model, major\nstages, and system goals.\n\nKey Functions\n\n4.3 Tools\n\n4\n6\n\nProcessing Steps\n\nMax steps, retry policy, exit criteria\n\n3\n5\n\nCurrent state, observation, memory, tool results\n\n4.2 Memory\n\nSystem architecture\nExecution model\n\nComponent list &amp; taxonomy\n\nDetailed execution logic\n\nResponsibilities &amp; goals\n\nState transitions\n\nStage overview\n\nInputs / outputs\n\nException handling\n\nData &amp; state flow\n\nDependencies &amp; interactions\n\nImplementation details\n\nDesign principles\n\nKey states involved\n\nSource code &amp; snippets\n\nEntry and exit conditions\n\nLogs &amp; examples\n\nNotes\nLoop termination depends on multiple exit conditions\n\nBenefits of\nHarness Handbook\n\nStage\n\nShallow(High-level)\n\nDeep (Implementation)\n\nReduce Cognitive Load\n\nImprove Efficiency\n\nSupport Multiple Roles\n\nEnhance Maintainability\n\nBoost Learning\n\nAccess the right information\nat the right level.\n\nQuickly locate relevant\ncomponents and logic\n\nHelp developers, analysts,\nand agents understand\nthe system.\n\nKeep knowledge consistent\nand up-to-date.\n\nFacilitate onboarding and\nknowledge transfer.\n\nFigure 1 Overview of the Harness Handbook representation. Its three-level hierarchy progresses from a system-level\noverview to stage-level component overviews and source-backed unit details. The navigation pane provides component\nand state indexes for direct access and cross-stage tracing.\n\n3.1\n\nHarness Handbook Representation\n\nSource repositories show where code is stored, but they do not directly show how a runtime behavior unfolds.\nOne behavior may cross several files, execution stages, and shared states. Harness Handbook reorganizes this\ninformation around behavior while preserving links to the source. As Figure 1 shows, it contains an L1–L3\ndocument tree D and a complementary state-register view Z.\nA reader normally starts at L1 (system overview), which summarizes the architecture, execution model, major\nstages, and global data flow. The reader then moves to L2 (component overview) for the responsibilities,\ninputs, outputs, dependencies, and local state of a selected stage. Finally, L3 (unit deep dive) links that\nstage to source-grounded implementation entries. The complementary view Z records state relationships that\ncross stage boundaries.\nTwo rules keep the representation useful. Progressive disclosure means that readers move from L1 to L3 only\nwhen a task requires more detail. Behavior–implementation alignment means that every active L3 locator\nmust still resolve to the current repository. If a locator cannot be revalidated, its entry is frozen and excluded\nfrom localization until it is refreshed. The repository therefore remains the authority for implementation\ndetails.\n\n3.2\n\nHarness Handbook Construction\n\nConstruction builds a handbook from a repository R. The leaf mode g ∈ {function, file}, which remains fixed\nfor the lifetime of the handbook, determines the granularity of L3 entries: in function-as-leaf mode each L3\nentry covers a whole function or one or more contiguous regions, whereas in file-as-leaf mode each L3 entry\nrepresents a file.\nThe two modes differ in how the stage skeleton is obtained. function-as-leaf starts from a seed skeleton S0\ncontaining the stage and state-register definitions; we use it when a trustworthy seed skeleton that faithfully\nreflects the harness’s execution stages is available and function-level L3 entries fit the available budget.\n\n4\n\n\fPhase II Behavioral Organization\n\nPhase I Static Fact Extraction\nSource Repository\n\nStatic Analysis\n\nProgram Facts\n\nExecution Skeleton Propose-Review Mapping Loop\n\nagent-harness/\n\nInit\n\nplanner.py\n\nSetup\n\nexecutor.py\nmemory.py\ntools/\nparser.py\n\nFunctions / Methods\n\nFunctions Table\n\nCall Graph\n\nCall Graph\n\nState Read /Write\n\nState Accesses\n\nClasses /Modules\n\nUnresolved Calls Log\n\nExternal Calls\n\nOutput: Program Graph\n\nLoop\nTool Call\nParse\n\nProposer\nPropose Assignment\n(Functions → Stages)\n\nProposals\n\nReject &amp; Refine\n\nAccept\n\nTier 1 Overview\nArchitecture Overview\n\nInitz\n\nExecution Model\nSetup\n\nStage Relationships\nGlobal State Flow\n\nLoop\nTool Call\n\nReviewer\nReview &amp; Feedback\n\nFinish\n\nPhase III Handbook Synthesis\n\nStable Mapping\n\nParse\nFinish\n\nOutput: Behavioral Mapping\n\nTier 3 Unit Cards\n\nTier 2 Stage Cards\nExecution Stage Overview\n\nBehavior\n\nPurpose &amp; Responsibilities\n\nInputs / Outputs\n\nExecution Flow\n\nState\n\nInternal Units\n\nCode Anchors\n\nOutput: Handbook\n\nFigure 2 Construction pipeline for Harness Handbook. Static analysis extracts source-linked facts, behavioral\norganization maps source units to execution stages, and hierarchical synthesis builds the L1–L3 handbook.\n\nfile-as-leaf instead infers the stage skeleton rather than starting from a seed; we use it when no such seed is\navailable or when function-level organization would exceed the available budget. Both modes produce the\nrepresentation described in Section 3.1, and Algorithm 2 defines the two branches.\nOnce g is chosen, construction proceeds in three phases, illustrated for the function-as-leaf branch in Figure 2.\nPhase I. Static Fact Extraction. Language-specific adapters parse the repository and extract functions,\nnamed external boundaries, source locations, signatures, and call edges. The program graph G keeps only calls\nthat resolve to an internal function or a named boundary. Unresolved calls are logged rather than assigned\nguessed targets. This phase is deterministic and makes no LLM calls.\nPhase II. Behavioral Organization. The pipeline organizes source units into the execution-stage skeleton S\naccording to the selected leaf mode.\n• Function-as-leaf. The pipeline uses source and call-graph context to propose function-to-stage assignments,\nwhich are refined through iterative review. A function can be assigned to one or more execution stages,\neither as a whole or as contiguous regions when it serves multiple behavioral roles. Accepted assignments\nand revisions update the stage skeleton S.\n• File-as-leaf. The pipeline summarizes the scanned files as cards and combines them with the program graph\nto infer the stage skeleton S. It then organizes the files by execution stage. An optional proposal-and-review\nprocess iteratively refines this structure, while uncovered files and unresolved organizational issues remain\nexplicitly recorded in Y.\nAppendix A provides the full organization procedures and validation checks for both modes.\nPhase III. Hierarchical Synthesis and Packaging. This phase converts the stage skeleton and source\norganization from Phase II into the L1–L3 document tree and cross-stage state-register view. Each L3 entry\nis linked to a statically identified source location and validated against the current repository. This keeps the\nhandbook traceable to the source. Finally, the pipeline renders V and packages the structured data needed for\nsource localization and future resynchronization.\n\n3.3\n\nHandbook-Guided Modification and Resynchronization\n\nAfter construction, the handbook serves as a behavior-oriented guide for modifying the repository. Given a\nrequest q, the workflow uses the handbook H together with its corresponding repository R. The leaf mode g\nremains unchanged throughout the process.\nThe workflow consists of four steps. First, Behavior-Guided Progressive Disclosure (BGPD) localizes the\nrequested behavior through coarse-to-fine handbook navigation. It progressively reveals relevant information,\nfollows it to candidate source locations, and verifies those locations against the current repository. This\nprocess produces a set of source-grounded evidence for planning. Second, the planner converts the evidence\n\n5\n\n\finto an edit plan P and action declarations Γ. Third, a separate executor applies P to the repository. Finally,\nany non-empty diff triggers handbook resynchronization. Algorithm 1 summarizes the complete workflow.\nAlgorithm 1 Handbook-Guided Modification with Automatic Resynchronization\nRequire: request q, handbook package H, corresponding repository snapshot R\nEnsure: plan P and declarations Γ; updated repository R′ , diff ∆, and handbook package H′\n1: g ← LeafMode(H)\n2: Ebq ← BGPD(q, H, R)\n3: (P, Γ) ← Plan(q, Ebq )\n4: R′ ← Execute(R, P)\n5: ∆ ← Diff(R, R′ )\n6: if ∆ ̸= ∅ then\n7:\nH′ ← Resyncg (H, R, R′ , ∆, Γ)\n8: else\n9:\nH′ ← H\n10: end if\n11: return (P, Γ, R′ , ∆, H′ )\n\n3.3.1\n\nBehavior Localization with BGPD\n\nRather than treating all source locations equally, BGPD uses the handbook to identify candidate sites from\ncoarse to fine. It then verifies these sites against the current repository.\nLocalization begins at the level of execution stages. BGPD first uses L1 and L2 of D to identify the stages\ndirectly relevant to the request. It then follows Z to include stages coupled through shared state. This step\ncaptures mutually dependent stages even when they are structurally distant. Within these stages, BGPD\nselects the most relevant L3 entries and retrieves their source locators.\nBGPD then expands the candidate set along call relations. In function-as-leaf mode, it uses the function-call\ngraph; in file-as-leaf mode, it uses the induced file-call graph. External boundary nodes provide context but\nare never returned as edit sites.\nUp to this point, BGPD operates on the handbook. It then opens the current repository R, resolves the\ncandidate locators, and retains only the sites that remain relevant to q. This yields the verified evidence Ebq .\nEach record contains a file path, an optional function or region anchor, and a current source excerpt. The\nhandbook thus guides the search, while the repository remains the basis for the edit plan.\n3.3.2\n\nEdit Planning and Execution\n\nThe planner converts Ebq into an edit plan P. Each edit block specifies where the change should be made,\nwhich source evidence supports it, and what should change. The block records a target file, an optional\nfunction or region anchor, a current source excerpt, and the intended change.\nFor each edit, the planner also records an action declaration containing the target file, optional anchor,\nand one of three action types: modify, add, or remove. The resulting declarations are collected as Γ =\n(Γmodify , Γadd , Γremove ). A rename is represented as one removal and one addition.\nThe executor applies P to R and produces the updated repository R′ . The resulting diff is ∆ = Diff(R, R′ ).\nBecause ∆ is the factual record of what changed, it drives handbook invalidation. By contrast, Γ is used only\nto check whether execution followed the plan.\n3.3.3\n\nHandbook Resynchronization\n\nEvery non-empty diff ∆ triggers Resyncg . Whenever possible, the procedure updates only the affected parts\nrather than rebuilding the entire handbook.\nFirst, it reparses the changed source, refreshes the program graph, and aligns the old and new versions to\nidentify added, removed, and modified units: in function-as-leaf mode, it matches functions using fingerprints\n6\n\n\fthat do not depend on line numbers, and in file-as-leaf mode, it matches files using file-set differences and\ncontent hashes.\nSecond, it determines the update scope. If the stage skeleton S remains valid, only the affected entries and\ntheir enclosing structure are refreshed; otherwise, Algorithm 2 is rerun on R′ with the same leaf mode g and\nstored configuration Θ.\nFinally, content that cannot be parsed or classified is handled conservatively: it is frozen or recorded in the\ncoverage record rather than guessed.\nOnce the update completes, the new pair (R′ , H′ ) becomes the starting state for the next request. Within\nresynchronization, model calls are limited to four semantic steps: classification, file assignment, within-stage\norganization, and description revision. All other operations are deterministic.\n\n4\n\nExperiment\n\nWe evaluate Harness Handbook on two open-source agent harnesses around three research questions, describing\nthe experiment setup in Section 4.1 and reporting results in Section 4.2.\n• RQ1: Does handbook-guided localization improve plan quality while reducing planning cost?\n• RQ2: With the handbook, can a weaker planner match the implementation-site localization of substantially\nmore capable models?\n• RQ3: Do these gains persist across request types and localization difficulty levels?\n\n4.1\n\nExperiment Setup\n\nEvaluation Setting. This experiment evaluates localization and edit planning in the modification workflow.\nGiven a natural-language request, a read-only planner built with NexAU [31] and powered by DeepSeek-V4Pro produces an edit plan P, and we score the quality of P directly.\nWe compare two arms: the Baseline explores the repository directly, whereas the Handbook-Assisted arm\nlocates relevant source code under handbook guidance using a BGPD-consistent navigation policy. Apart from\nhandbook access and navigation, the two arms are identical in requests, model, repository, tool permissions,\nand decoding settings. The handbook used in the Handbook-Assisted arm is built from the same source.\nPlan quality is judged independently by three models: GPT-5.5, Opus 4.8, and DeepSeek-V4-Pro.\nBenchmarks and Modification Requests. We evaluate Terminus-2 [32] and Codex [25], two open-source\nagent harnesses that adopt the two leaf modes from Section 3.2: Terminus-2 uses function-as-leaf because it\nhas a reliable seed skeleton, and Codex uses file-as-leaf to infer the hierarchy at repository scale.\nEach harness contributes 30 behavior-driven modification requests. They are grouped by type into Query (Q),\nwhich modifies existing behavior without revealing target locations; Cross-file (CF), which adds an end-to-end\ncapability spanning files or modules; and Search-Hostile (SH), which places relevant implementations in\nlocations that are hard to recover by keyword search. Requests are also labeled Easy, Medium, or Hard by\nlocalization difficulty.\nEvaluation Metrics.\n\nWe evaluate plan quality, localization accuracy, and planning cost.\n\nPlan quality. Three independent judges score each plan on three dimensions: Localization (whether the edit\nsites are accurate), Scope Control (whether the plan stays focused, with less scope bloat), and Reasoning\n(whether the rationale and supporting evidence are adequate). The weighted score is\nS = 0.5SLoc + 0.25SScope + 0.25SReason ,\n\n7\n\n(1)\n\n\fHandbook-Assisted\n\n+18.9\n+10.0\n\n40\n30\n20\n\nCodex\n\n40.0\n\n+10.0\n\n55.0\n\n+10.0\n\n+26.7\n\n+10.0\n\n+16.7\n\n37.5\n\n32.5\n\n20.0\n\n25.0\n\nTerminus\n\nTerminus\n\n+13.3\n\nGPT5.5\n\nOpus\n4.8\n\n(a) Overall Win Rate\n\nDeepSeek\nV4-Pro\n\nGPT5.5\n\nOpus\n4.8\n\nDeepSeek\nV4-Pro\n\nTokens / request (M)\n\n50\n\nWin rate (%)\n\nWin rate (%)\n\nBaseline\nCodex\n\n0.12\n-12.7%\n\n0.08\n-8.6%\n\n0.04\n\n(b) Per-Judge Win Rate\n\nCodex\n\nTerminus\n\n(c) Token Cost\n\nFigure 3 Plan quality and planner token usage on Codex and Terminus-2. (a) Overall win rates aggregated across the\nthree judges. (b) Win rates reported separately by GPT-5.5, Opus 4.8, and DeepSeek-V4-Pro. (c) Average number of\nplanner tokens per request; lower values indicate greater efficiency.\nBaseline\nLocalization\n\nCodex\n\n32.5\n\n+10.0\n+6.6\n\n40\n\nScope Control\n\n40.0\n+2.2\n\n32.5\n\n+1.1\n\n+23.3\n\n+12.2\n+3.4\n\n+3.3\n\n32.5\n\n25.0\n\n25.0\n40\n\n+10.0\n+10.0\n\n+6.7\n\n17.5\n\n+0.0\n\n20\nOpus\n4.8\n\nDeepSeek\nV4-Pro\n\nAvg.\n\nGPT5.5\n\nOpus\n4.8\n\nDeepSeek\nV4-Pro\n\n+6.7\n\n30\n\n+3.4\n\n+4.5\n+3.3\n\n20\n\n10.0\nGPT5.5\n\n+3.4\n\n-6.6\n\n25.0\n+10.0\n\nReasoning\n+13.4\n\n+3.4\n\n30\n\n10\n\n40.0\n\n-3.4\n+3.3\n\n-10.0\n\n25.0\n\nTerminus\n\nWin rate (%)\n\n40.0\n\nHandbook-Assisted\n\nAvg.\n\n10\n\nGPT5.5\n\nOpus\n4.8\n\nDeepSeek\nV4-Pro\n\nAvg.\n\nFigure 4 Per-judge win rates for three evaluation dimensions. Rows show results for Codex and Terminus-2, while\ncolumns show Localization, Scope Control, and Reasoning.\n\non a 0–100 scale, with Localization receiving the largest weight. Handbook-Assisted and Baseline are declared\nthe winner when their scores differ by at least δ = 3 points; otherwise the comparison is a tie. The win rate\nfor any reported slice is the number of wins divided by the number of valid judge–request comparisons in that\nslice.\nLocalization accuracy. We compare each predicted edit plan with independent reference plans from Opus 4.8\nand GPT-5.5, reporting Recall, Precision, F1, and Wrong at file and symbol granularity. Wrong is the share\nof valid requests with zero overlap against the reference; lower is better.\nPlanning cost. We report the average number of planner tokens per request, including the handbook and\nsource context consumed during localization and plan construction.\n\n4.2\n\nExperiment Results\n\nThe results show three consistent patterns. Handbook guidance improves plan quality without increasing\nplanner token use. It also helps a weaker planner produce file- and symbol-level predictions that more closely\nalign with reference plans from stronger models. These gains persist across request types and localization\ndifficulty levels. The following subsections examine each finding in turn.\n4.2.1\n\nBetter Plans at Lower Token Cost\n\nFigure 3 summarizes plan-quality win rates and average planner token use. The Handbook-Assisted arm\nachieves a higher overall win rate on both harnesses: 38.3% versus 28.3% on Codex and 45.6% versus 26.7%\non Terminus-2. The improvement is consistent across all three judges: the gap is 10.0 percentage points for\nevery judge on Codex and ranges from 13.3 to 26.7 points on Terminus-2. Thus, the direction of the result\ndoes not depend on any single judge.\n\n8\n\n\fBaseline\n\nWin rate (%)\n\nCodex\n\n+16.3\n\n55\n\nTerminus\n\n60\n\n+26.7\n\n40\n\n15\nQ\n\nCF\n\n20\n\nSH\n\n+33.3\n\nCodex\n\n+33.3\n\n50.0\n\n+11.2\n\n+20.0\n\n+16.7\n\n35\n\nHandbook-Assisted\n\n40\n\n+5.4\n\n32.5\n\n+3.3\n\nCF\n\nEasy\n\nSH\n\n+18.0\n\n+3.7\n\n+6.5\n\n30\n\n15.0\nQ\n\nTerminus\n\n50\n\nMedium Hard\n\n(a) Modification Request Type\n\n20\n\nEasy\n\nMedium Hard\n\n(b) Localization Difficulty\n\nFigure 5 Win rates by (a) modification request type and (b) localization difficulty. Q, CF, and SH denote Query,\nCross-file, and Search-Hostile requests.\nTable 1 Reference-plan localization metrics (%). Predicted implementation sites are compared against independent\nreference plans generated by Opus 4.8 and GPT-5.5 at file and symbol granularity. Metrics are macro-averaged across\nvalid requests; missing outputs and planner errors are excluded. Wrong indicates zero overlap with the reference plan\nat the reported granularity, so lower values are better.\nOpus 4.8\nHarness\n\nCodex\n\nLevel\n\nMetric\n\nFile\n\nRecall\nPrecision\nF1\nWrong ↓\n\n55.4\n46.1\n46.6\n37.0\n\n69.7\n60.2\n61.8\n14.8\n\n+14.3\n+14.1\n+15.2\n-22.2\n\n49.4\n53.0\n47.3\n21.4\n\n49.8\n62.2\n52.3\n21.4\n\n+0.4\n+9.2\n+5.0\n0.0\n\nRecall\nPrecision\nSymbol\nF1\nWrong ↓\n\n47.1\n38.0\n38.3\n44.4\n\n65.4\n55.3\n57.1\n18.5\n\n+18.3\n+17.3\n+18.8\n-25.9\n\n46.4\n48.4\n43.8\n28.6\n\n49.1\n60.4\n51.2\n21.4\n\n+2.7\n+12.0\n+7.4\n-7.2\n\nRecall\nPrecision\nF1\nWrong ↓\n\n74.7\n74.1\n74.1\n24.1\n\n83.9\n86.2\n84.7\n13.8\n\n+9.2\n+12.1\n+10.6\n-10.3\n\n76.1\n78.3\n76.5\n20.0\n\n87.5\n93.3\n89.3\n6.7\n\n+11.4\n+15.0\n+12.8\n-13.3\n\nRecall\nPrecision\nSymbol\nF1\nWrong ↓\n\n64.7\n65.1\n64.8\n24.1\n\n76.3\n78.4\n77.1\n13.8\n\n+11.6\n+13.3\n+12.3\n-10.3\n\n73.0\n73.9\n73.0\n20.0\n\n87.5\n93.3\n89.3\n6.7\n\n+14.5\n+19.4\n+16.3\n-13.3\n\nFile\nTerminus-2\n\nBaseline Handbook\n\nGPT-5.5\nGap\n\nBaseline Handbook\n\nGap\n\nFigure 4 decomposes these judgments by dimension. Averaged across the three judges, the Handbook-Assisted\narm has higher win rates for Localization, Scope Control, and Reasoning on both harnesses. The respective\ngains are 12.2, 6.7, and 4.5 points on Terminus-2, and 2.2, 1.1, and 3.3 points on Codex.\nThe quality gains are accompanied by lower planner token use. Average use falls from 0.102M to 0.089M\ntokens per Codex request (12.7%) and from 0.058M to 0.053M tokens per Terminus-2 request (8.6%). The\nsimultaneous increase in win rate and decrease in token use shows that the improvement is not explained by a\nlarger planning-token budget.\n4.2.2\n\nA Weaker Planner Matches Stronger Models\n\nTo assess whether handbook guidance helps a weaker planner approach stronger models in implementation-site\nlocalization, we compare its predicted edit sites with independent reference plans from Opus 4.8 and GPT-5.5\n(Table 1).\nAcross both harnesses, both reference models, and both granularities, all 24 Recall, Precision, and F1\ncomparisons are higher for the Handbook-Assisted arm, with F1 gains ranging from 5.0 to 18.8 points. Recall\nand precision increase together, so the improvement is not explained by returning more candidate sites at the\nexpense of focus.\n9\n\n\fThe absolute agreement is highest on Terminus-2. With handbook guidance, the weaker planner reaches\nfile-level F1 scores of 84.7% and 89.3%, and symbol-level scores of 77.1% and 89.3%, against the Opus 4.8\nand GPT-5.5 references, respectively. Precision reaches 93.3% against GPT-5.5 at both granularities. The\nconsistent direction across two independent references shows that the improvement is not specific to one\nreference model.\nHandbook guidance also reduces complete localization failures. Wrong, the share of requests with zero overlap\nagainst the reference, never increases and falls by as much as 25.9 points. Thus, the gains include fewer\ncomplete misses, not only better overlap among already plausible plans.\n4.2.3\n\nConsistent Gains Across Requests and Difficulty\n\nFigure 5 stratifies the win-rate results by request type and localization difficulty.\nAll six harness-by-type comparisons favor the Handbook-Assisted arm, with gains ranging from 16.3 to 33.3\npercentage points. Codex improves most on Query requests (26.7 points), whereas Terminus-2 improves most\non Search-Hostile requests (33.3 points). Cross-file requests improve by 16.3 and 20.0 points, respectively.\nThe gains therefore span existing-behavior changes, cross-file capabilities, and requests that are difficult to\nlocalize through keyword search.\nAll six harness-by-difficulty comparisons are also positive, ranging from 3.7 to 33.3 points. Codex improves\nmost on Easy requests, whereas Terminus-2 improves most on Medium requests. Because the gains are not\nmonotonic in labeled difficulty, the difficulty label alone does not explain their variation.\n\n5\n\nConclusion\n\nThis work identifies behavior localization as a central challenge in evolving production-scale agent harnesses\nand introduces Harness Handbook, a behavior-centric representation that links behavioral descriptions to\ntheir distributed source implementations. Harness Handbook reorganizes repository knowledge around\nruntime behavior, constructs this representation directly from source, and supports modification through\nbehavior-guided progressive disclosure and automatic resynchronization.\nOur experiments demonstrate the value of this representation along three dimensions. First, handbook\nguidance improves plan quality while lowering planning cost: on Codex and Terminus-2, overall win rates rise\nby 10.0 and 18.9 percentage points, while planner token use falls by 12.7% and 8.6%, respectively. Second,\nwith the handbook a weaker planner matches the implementation-site localization of substantially stronger\nmodels, improving all 24 file- and symbol-level Recall, Precision, and F1 comparisons against two independent\nreference plans. Third, these gains persist across request types and localization difficulty levels. Together,\nthese results indicate that making the relationship between behavior and implementation explicit can improve\nboth modification planning and localization efficiency without requiring a larger planning-token budget.\nThe utility of Harness Handbook extends beyond modification planning. As a behavior-centric repository\nrepresentation that stays synchronized with the code, it can also support broader uses such as behavior\nauditing and regression-impact analysis. Our next step is to apply it to harness self-evolving: using the\nhandbook as a shared behavioral memory, an agent can autonomously close the loop of localization, planning,\nexecution, and resynchronization as the repository evolves, moving the harness toward self-improvement.\n\n10\n\n\fReferences\n[1] Lei Wang, Chen Ma, Xueyang Feng, Zeyu Zhang, Hao Yang, Jingsen Zhang, Zhiyuan Chen, Jiakai Tang, Xu Chen,\nYankai Lin, et al. A survey on large language model based autonomous agents. Frontiers of Computer Science, 18\n(6):186345, 2024.\n[2] Shunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao. React:\nSynergizing reasoning and acting in language models. arXiv preprint arXiv:2210.03629, 2022.\n[3] Chengkai Huang, Junda Wu, Yu Xia, Zixu Yu, Ruhan Wang, Tong Yu, Ruiyi Zhang, Ryan A Rossi, Branislav\nKveton, Dongruo Zhou, et al. Towards agentic recommender systems in the era of multimodal large language\nmodels. arXiv preprint arXiv:2503.16734, 2025.\n[4] Timo Schick, Jane Dwivedi-Yu, Roberto Dessì, Roberta Raileanu, Maria Lomeli, Eric Hambro, Luke Zettlemoyer,\nNicola Cancedda, and Thomas Scialom. Toolformer: Language models can teach themselves to use tools. Advances\nin neural information processing systems, 36:68539–68551, 2023.\n[5] Shuyan Zhou, Frank F Xu, Hao Zhu, Xuhui Zhou, Robert Lo, Abishek Sridhar, Xianyi Cheng, Tianyue Ou,\nYonatan Bisk, Daniel Fried, et al. Webarena: A realistic web environment for building autonomous agents. In\nInternational Conference on Learning Representations, volume 2024, pages 15585–15606, 2024.\n[6] Tianbao Xie, Danyang Zhang, Jixuan Chen, Xiaochuan Li, Siheng Zhao, Ruisheng Cao, Toh J Hua, Zhoujun\nCheng, Dongchan Shin, Fangyu Lei, et al. Osworld: Benchmarking multimodal agents for open-ended tasks in\nreal computer environments. Advances in Neural Information Processing Systems, 37:52040–52094, 2024.\n[7] John Yang, Carlos Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and Ofir Press.\nSwe-agent: Agent-computer interfaces enable automated software engineering. Advances in Neural Information\nProcessing Systems, 37:50528–50652, 2024.\n[8] Jiahang Lin, Shichun Liu, Chengjun Pan, Lizhi Lin, Shihan Dou, Zhiheng Xi, Xuanjing Huang, Hang Yan, Zhenhua\nHan, Tao Gui, et al. Agentic harness engineering: Observability-driven automatic evolution of coding-agent\nharnesses. arXiv preprint arXiv:2604.25850, 2026.\n[9] Ryan Lopopolo. Harness engineering: Leveraging codex in an agent-first world. https://openai.com/index/\nharness-engineering/, February 2026. OpenAI Engineering Blog.\n[10] Hailin Zhong and Shengxin Zhu. Ai harness engineering: A runtime substrate for foundation-model software\nagents. arXiv preprint arXiv:2605.13357, 2026.\n[11] Ruhan Wang, Zhiyong Wang, Chengkai Huang, Rui Wang, Tong Yu, Lina Yao, John Lui, and Dongruo Zhou.\nFederated in-context learning: Iterative refinement for improved answer quality. arXiv preprint arXiv:2506.07440,\n2025.\n[12] Ruhan Wang, Chengkai Huang, Zhiyong Wang, Junda Wu, Rui Wang, Tong Yu, Julian McAuley, Lina Yao,\nand Dongruo Zhou. Fera: Uncertainty-aware federated reasoning for large language models. arXiv preprint\narXiv:2605.10082, 2026.\n[13] Xingyao Wang, Boxuan Li, Yufan Song, Frank F Xu, Xiangru Tang, Mingchen Zhuge, Jiayi Pan, Yueqi Song,\nBowen Li, Jaskirat Singh, et al. Openhands: An open platform for ai software developers as generalist agents. In\nInternational Conference on Learning Representations, volume 2025, pages 65882–65919, 2025.\n[14] Ningyan Zhu, Huacan Wang, Jie Zhou, Feiyu Chen, Shuo Zhang, Ge Chen, Chen Liu, Jiarou Wu, Wangyi Chen,\nXiaofeng Mou, et al. Semaclaw: A step towards general-purpose personal ai agents through harness engineering.\narXiv preprint arXiv:2604.11548, 2026.\n[15] Xuying Ning, Katherine Tieu, Dongqi Fu, Tianxin Wei, Zihao Li, Yuanchen Bei, Jiaru Zou, Mengting Ai, Zhining\nLiu, Ting-Wei Li, et al. Code as agent harness. arXiv preprint arXiv:2605.18747, 2026.\n[16] Shaoqiu Zhang, Yuhang Wang, Jialiang Liang, Yuling Shi, Wenhao Zeng, Maoquan Wang, Shilin He, Ningyuan\nXu, Siyu Ye, Kai Cai, et al. Swe-explore: Benchmarking how coding agents explore repositories. arXiv preprint\narXiv:2606.07297, 2026.\n[17] Hovhannes Tamoyan, Sean Narenthiran, Erik Arakelyan, Mira Mezini, and Boris Ginsburg. Sherloc: Structured\ndiagnostic localization for code repair agents. arXiv preprint arXiv:2606.24820, 2026.\n\n11\n\n\f[18] Ishaan Bhola, Adithyan Krishnan, Sravanth Kurmala, and Mukunda NS. Code isn’t memory: A structural\ncodebase index inside a coding agent. arXiv preprint arXiv:2606.22417, 2026.\n[19] Boshi Wang, Weijian Xu, Yunsheng Li, Mei Gao, Yujia Xie, Huan Sun, and Dongdong Chen. Improving code\nlocalization with repository memory. arXiv preprint arXiv:2510.01003, 2025.\n[20] Weili Cao, Xunjian Yin, Bhuwan Dhingra, and Shuyan Zhou. Coding agents are effective long-context processors.\narXiv preprint arXiv:2603.20432, 2026.\n[21] Qianyu Meng, Yanan Wang, Liyi Chen, Qimeng Wang, Chengqiang Lu, Wei Wu, Yan Gao, Yi Wu, and Yao Hu.\nAgent harness for large language model agents: A survey. 2026.\n[22] Chaoyue He, Xin Zhou, Di Wang, Hong Xu, Wei Liu, and Chunyan Miao. Harness engineering for language\nagents: The harness layer as control, agency, and runtime. 2026.\n[23] Qingyun Wu, Gagan Bansal, Jieyu Zhang, Yiran Wu, Beibin Li, Erkang Zhu, Li Jiang, Xiaoyun Zhang, Shaokun\nZhang, Jiale Liu, et al. Autogen: Enabling next-gen llm applications via multi-agent conversation. arXiv preprint\narXiv:2308.08155, 2023.\n[24] Prithvi Rajasekaran. Harness design for long-running application development. https://www.anthropic.com/\nengineering/harness-design-long-running-apps, March 2026. Anthropic Engineering Blog.\n[25] OpenAI. Introducing codex. https://openai.com/index/introducing-codex/, May 2025. OpenAI Research\nPreview.\n[26] Tingyang Chen, Shuo Lu, Kang Zhao, Weicheng Meng, Hanlin Teng, Tianhao Li, Chao Li, Xule Liu, Jian Liang,\nZhizhong Zhang, et al. Harnessx: A composable, adaptive, and evolvable agent harness foundry. arXiv preprint\narXiv:2606.14249, 2026.\n[27] Mingju Chen, Can Lv, Guibin Zhang, Heng Chang, and Shiji Zhou. Harnessforge: Joint harness and policy\nevolution for adaptive agent systems. arXiv preprint arXiv:2606.01779, 2026.\n[28] Mengzhuo Chen, Junjie Wang, Zhe Liu, Yawen Wang, and Qing Wang. From failed trajectories to reliable llm\nagents: Diagnosing and repairing harness flaws. arXiv preprint arXiv:2606.06324, 2026.\n[29] Tsvi Cherny-Shahar and Amiram Yehudai. Repository intelligence graph: Deterministic architectural map for llm\ncode assistants. arXiv preprint arXiv:2601.10112, 2026.\n[30] Linyue Pan, Lexiao Zou, Shuo Guo, Jingchen Ni, and Hai-Tao Zheng. Natural-language agent harnesses. arXiv\npreprint arXiv:2603.25723, 2026.\n[31] Nex-AGI Team, Yuxuan Cai, Lu Chen, Qiaoling Chen, Yuyang Ding, Liwen Fan, Wenjie Fu, Yufei Gao, Honglin\nGuo, Pinxue Guo, et al. Nex-n1: Agentic models trained via a unified ecosystem for large-scale environment\nconstruction. arXiv preprint arXiv:2512.04987, 2025. URL https://arxiv.org/abs/2512.04987.\n[32] Mike A. Merrill, Alexander G. Shaw, Nicholas Carlini, Boxuan Li, Harsh Raj, Ivan Bercovich, Lin Shi, Jeong Yeon\nShin, Thomas Walshe, E. Kelly Buchanan, et al. Terminal-bench: Benchmarking agents on hard, realistic tasks in\ncommand line interfaces. In The Fourteenth International Conference on Learning Representations, 2026. URL\nhttps://arxiv.org/abs/2601.11868.\n[33] Guanzhi Wang, Yuqi Xie, Yunfan Jiang, Ajay Mandlekar, Chaowei Xiao, Yuke Zhu, Linxi Fan, and Anima Anandkumar. Voyager: An open-ended embodied agent with large language models. arXiv preprint arXiv:2305.16291,\n2023.\n[34] Amirkia Rafiei Oskooei, Selcan Yukcu, Mehmet Cevheri Bozoglan, and Mehmet S Aktas. Repository-level\ncode understanding by llms via hierarchical summarization: Improving code search and bug localization. In\nInternational Conference on Computational Science and Its Applications, pages 88–105. Springer, 2025.\n[35] Vadim Lomshakov, Andrey Podivilov, Sergey Savin, Oleg Baryshnikov, Alena Lisevych, and Sergey Nikolenko.\nProconsul: Project context for code summarization with llms. In Proceedings of the 2024 Conference on Empirical\nMethods in Natural Language Processing: Industry Track, pages 866–880, 2024.\n[36] Siddharth Gandhi, Luyu Gao, and Jamie Callan. Repository-level code search with neural retrieval methods.\narXiv preprint arXiv:2502.07067, 2025.\n\n12\n\n\fAppendix Contents\nA Harness Handbook Construction Details\n\n14\n\nA.1 Phase I: Shared Static Fact Extraction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n14\n\nA.2 Phase II: Behavioral Organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n14\n\nA.2.1 Function-as-Leaf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n14\n\nA.2.2 File-as-Leaf . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n15\n\nA.3 Phase III: Hierarchical Synthesis and Packaging . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n16\n\nB Modification and Resynchronization Details\n\n17\n\nB.1 Behavior-Guided Progressive Disclosure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n17\n\nB.2 Edit Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n17\n\nB.3 Execution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n18\n\nB.4 Automatic Resynchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n18\n\nC Experimental Details\n\n19\n\nC.1 Harnesses and Static Facts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n19\n\nC.2 Modification Requests . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n20\n\nC.3 Evaluation Arms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n20\n\nD Prompt Templates\n\n22\n\nD.1 Handbook Generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n22\n\nD.1.1 Classifying Functions into Stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n22\n\nD.1.2 Reviewing Function Assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n23\n\nD.1.3 Generating File Cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n23\n\nD.1.4 Synthesizing the L1–L3 Document Tree . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n24\n\nD.2 BGPD Localization and Planning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n25\n\nD.3 LLM Judging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n27\n\nD.3.1 Building the Answer Key . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n27\n\nD.3.2 Scoring the Plan . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .\n\n27\n\nE Illustrative Handbook-Assisted Planning Walkthrough\n\n13\n\n28\n\n\fA\n\nHarness Handbook Construction Details\n\nThis appendix expands the three construction phases in Section 3.2. The selected leaf mode g and construction\nconfiguration Θ stay fixed through construction and later resynchronization. Both modes work from the same\nstatic facts but organize them differently: function-as-leaf starts from a trusted seed skeleton S0 and places\nfunctions within it, whereas file-as-leaf describes files first and infers the skeleton. Both ultimately produce\nthe same reader-facing handbook—an L1–L3 document tree, a cross-stage state-register view, and source\nlocators for L3 entries. Algorithm 2 summarizes the shared workflow and its mode-specific branches.\nAlgorithm 2 Harness Handbook Construction\nRequire: repository R; leaf mode g ∈ {function, file}; construction configuration Θ; seed skeleton S0 if g = function\n(otherwise ∅)\nEnsure: handbook H containing rendered view V, document tree D, register view Z, fixed leaf mode g, and synchronization\nstate Kg\nPhase I: shared static facts.\n1: G ← BuildGraph(R)\n# deterministic; no LLM\nPhase II: mode-specific behavioral organization.\n2: if g = function then\n3:\n(S, Ug ) ← OrganizeFunctions(R, G, S0 , Θ)\n4:\nUg ← FinalizeFunctions(R, G, S, Ug )\n5: else\n6:\n(S, Ug ) ← OrganizeFiles(R, G, Θ)\n7:\nif RefinementEnabled(Θ) then\n8:\n(S, Ug ) ← RefineFileOrganization(R, G, S, Ug , Θ)\n9:\nend if\n10:\nUg ← FinalizeFiles(G, S, Ug )\n11: end if\nPhase III: synthesis, grounding, and packaging.\n12: (D, Z, B) ← Synthesize(g, R, G, S, Ug , Θ)\n13: Z ← ValidateRegisterRefs(Z, S)\n14: D ← ValidateAndFreezeLocators(D, R, g)\n15: Kg ← Archive(g, G, S0 , S, Ug , B, Θ)\n16: H ← RenderAndPackage(D, Z, g, Kg )\n17: return H\n\nA.1\n\n# budgeted stage and membership review\n# regions, ordering, and unmapped functions\n# g = file\n# cards, stage inference, and assignments\n\n# within-stage order and coverage\n\n# S0 is stored only in function mode\n\nPhase I: Shared Static Fact Extraction\n\nPhase I is a single deterministic analysis shared by both modes. Language-specific adapters parse R and build\nthe program graph G. An internal-function node records a function’s qualified name, source file, signature,\nline range, enclosing class, and observed state access; a boundary node represents a named external target,\nsuch as a library function.\nThe graph keeps a call edge only when the target resolves to an internal function or a named boundary;\nunresolved calls are written to an audit log rather than assigned a guessed target. Because this phase uses no\nLLM, every later organization step builds on the same source-grounded facts.\n\nA.2\n\nPhase II: Behavioral Organization\n\nPhase II organizes the facts in G around execution behavior. Its output is the current stage skeleton S together\nwith the mode-specific organization state Ug . The two leaf modes differ in both their starting point and their\nunit of organization.\nA.2.1\n\nFunction-as-Leaf\n\nInitial assignment. The function-as-leaf branch (g = function) starts from the seed skeleton S0 , whose\nstage and state-register declarations initialize S. On the first pass, it considers every analyzable internal\nfunction—that is, every non-synthetic function with usable source locations—and attempts to assign it to\none or more stages. The decision uses the function’s source in R, its callers and callees in G, the current\n14\n\n\fneighboring assignments, and the stage descriptions. A function is normally placed as a whole. If different\nparts serve different behavioral roles, it can instead be divided into contiguous source regions and each region\nplaced separately.\nReview and convergence. A single pass may expose weaknesses in either the assignments or the seed structure,\nso later rounds review both. Each round first checks whether stages should be added, removed, merged, or\nsplit. A structural change is accepted only if the resulting hierarchy is valid and every state-register declaration\nstill refers to an existing stage. Functions affected by an accepted change are then classified again against the\nrevised structure.\nAfter reclassification, a global audit checks whether whole-function placements remain consistent with the\nsurrounding stages, and a separate pass repairs the boundaries of retained regions. Proposed changes must\npass model-based review before they are applied. The rounds stop when the stage skeleton and all function or\nregion assignments match the previous round and no function is waiting to be reconsidered. If this state is\nnot reached, the process stops at the organization budget stored in Θ and keeps the remaining gaps explicit.\nValidation and finalization. Every accepted assignment must name a valid stage, use a legal source range, and\navoid conflicting actions. Region boundaries are aligned to parser-derived statement spans when possible, and\nthe enclosed source is hashed for later comparison. A boundary that cannot be aligned is marked needs-review ;\nPhase III then decides whether its locator can remain active or must be frozen.\nDeterministic cleanup removes a redundant whole-function entry when retained regions already cover that\nfunction in the same stage, without disturbing its assignments to other stages. The pipeline then rebuilds\ncross-stage references, records all functions that remain unmapped, and orders entries within each stage using\ntheir purposes and stage-internal calls. If the proposed order is incomplete or contains duplicates, file and line\norder provides a stable fallback. Together, the finalized memberships, region anchors and hashes, boundary\nstatus, within-stage order, and record of unmapped functions constitute Ufunction .\nA.2.2\n\nFile-as-Leaf\n\nThe file-as-leaf branch (g = file) uses no seed skeleton (S0 = ∅). It first describes each file, then infers S from\nthose descriptions, and finally organizes the files within each stage.\nStep 1: Build a card for each file. The pipeline attempts to create one file card for every scanned file,\nincluding files from which static analysis extracts no function. A successfully generated card describes the\nfile’s purpose, repository role, and place in the execution lifecycle. When deep card generation is enabled, it\nalso includes a static inventory of function identities, signatures, source ranges, and resolved calls. The model\nmay explain this inventory but cannot change it.\nCard generation uses a fixed fallback sequence. A file omitted from a batch is retried individually. If a deep\ncard still fails, the source is retried in function-range chunks. If no prose can be produced, a fallback card is\nemitted; in deep mode, it retains the graph-derived inventory. The file stays available to later steps but is\nmarked undescribed in the coverage record Y, so no scanned file is silently dropped.\nStep 2: Infer stages and assign files. The pipeline groups cards by directory and combines their descriptions\nwith graph-derived entry points and resolved calls. From this context, it drafts an ordered stage skeleton and\nattempts to assign each scanned file to exactly one primary stage, using its card description when available.\nThat stage is the file’s home in the handbook. A genuinely cross-cutting file, such as a logging, protocol, type,\nor configuration utility, may also name one or two secondary stages. Missing assignments and assignments to\nunknown stages remain visible in Y rather than being forced into the nearest stage.\nThe organization variant stored in Θ determines whether the initial result is refined. oneshot, the default,\nends after one stage draft and one file-assignment pass. doctor starts from that draft and applies a reviewed\nrefinement loop. agent uses an agent-generated draft followed by the same loop; if the agent cannot produce\n15\n\n\fa valid draft, it falls back to the one-shot draft. A refinement round may add, remove, merge, or split stages,\nafter which only affected or unassigned files are reconsidered. The loop stops when all files are assigned and\nthe skeleton is stable, when neither coverage nor stage balance improves for two consecutive rounds, or when\nthe organization budget is reached. Any files that remain unassigned stay visible in Y.\nStep 3: Organize files within each stage. For each non-empty stage, the file-call graph first provides a\ncaller-before-callee order. The file cards are then used to refine that order into thematic groups and a readable\nsequence. A deterministic check removes unknown or duplicate paths and verifies that every assigned file\nappears exactly once. An omitted file is appended to a fallback group, and a failed organization call falls back\nto the deterministic flat order. This step can reorder files within a stage but cannot change the stage skeleton.\nTogether, the file cards, stage assignments, within-stage grouping and order, and coverage record Y constitute\nUfile .\n\nA.3\n\nPhase III: Hierarchical Synthesis and Packaging\n\nPhase III turns (S, Ug ) into the document tree D and state-register view Z, records reusable generation\noutputs in the cache B, and validates both against the repository before packaging.\nSynthesizing the document tree. In both modes, D contains an L1 system overview, an L2 component overview\nfor each included stage, and source-backed L3 entries. The modes differ in the direction of synthesis:\n• function-as-leaf builds top-down. The known stage skeleton provides the outline. Generation proceeds\nfrom the L1 overview to each L2 component overview and then to the stage’s L3 entries. Each L3 entry\nrepresents one function within that stage; multiple retained regions of the same function are merged into\nthat entry.\n• file-as-leaf builds bottom-up. Assigned file cards become the L3 entries. A stage is summarized when\nit owns assigned files or has child stages; empty leaf placeholders are skipped. The remaining stages are\nprocessed from the leaves upward: child summaries and one-line descriptions of a stage’s own files produce\nits L2 component overview, and the top-level summaries produce L1.\nIn function-as-leaf mode, each L1, L2, and L3 node uses a bounded generate–review–revise process. The\nbest draft is retained, and generation stops when it passes the rubric, its score no longer improves, or the\ngeneration budget is reached. Independent stages can be processed in parallel, but L3 entries within one stage\nare generated in sequence so that a later entry can refer to earlier ones.\nIn file-as-leaf mode, file cards are rendered directly. Each stage and system summary is generated once, with\na deterministic fallback if generation fails, and each parent summary waits for its child summaries.\nThe resulting descriptions and summaries are retained in B so that unchanged content can be reused during\nlater generation or resynchronization.\nBuilding the state-register view. In function-as-leaf mode, the register identities and stage relationships in Z\ncome from the declarations in the current stage skeleton; generation turns these declarations into reader-facing\ndescriptions without inventing new registers. In file-as-leaf mode, the pipeline instead proposes cross-stage\nregisters from the top-level stage summaries and the purposes of data-model files. It repeats this search until\ntwo consecutive rounds add nothing or the register budget is reached. References to stages absent from the\ncurrent structure are removed from the candidate mapping.\nGrounding and failure handling. The static facts in R and G remain authoritative throughout synthesis. The\nmodel may add behavioral explanations, but it cannot alter file paths, function identities, signatures, source\nranges, or resolved calls. Functions and files that cannot be placed remain explicitly recorded rather than\nbeing assigned by guesswork.\n\n16\n\n\fBefore rendering, the pipeline resolves every L3 locator in D against R and compares the located source with\nthe stored evidence. An entry that cannot be revalidated is marked frozen and excluded from localization\nuntil it is refreshed, keeping the repository authoritative even when prose is reused from the cache.\nRendering and saved synchronization state. After validation, the pipeline renders D and Z as the readerfacing view V. It then packages this view with D, Z, the fixed g, and the machine-readable resynchronization\nstate Kg as the handbook H. Across both modes, Kg retains the fixed leaf mode, program graph, current\nstage skeleton, mode-specific organization state, construction configuration, and generation cache. The stored\nconfiguration Θ records the selected organization or refinement variant, card-detail level, and the budgets\nfor organization, generation, and register extraction where applicable. In function mode, Kg also retains the\noriginal seed skeleton S0 ; no seed is stored in file mode. Saving H in this form allows a later code change to\nrefresh affected content without reconstructing unchanged parts of the handbook.\n\nB\n\nModification and Resynchronization Details\n\nThis appendix expands the four-step modification workflow in Section 3.3 using the package contract defined\nin Appendix A. It follows a request q through BGPD localization, edit planning, execution, and automatic\nresynchronization. Throughout the workflow, the handbook H is paired with its matching repository R, and\nthe stored leaf mode g remains fixed.\n\nB.1\n\nBehavior-Guided Progressive Disclosure\n\nBGPD guides a read-only agent through the handbook from coarse to fine. A locator enters the evidence set\nonly after it has been resolved against the current repository.\nStage selection. Navigation begins at L1 and L2 of the document tree D stored in H. The agent reads the\nsystem overview and stage index to select the execution stages whose behavior matches q. It then follows\nthe state-register view Z to add stages coupled through shared state. This step recovers behavior that is\nstructurally distant yet mutually dependent, such as a value written in one stage and consumed several stages\nlater.\nEntry selection. Within the selected stages, the agent opens the corresponding stage pages and chooses the\nmost relevant L3 entries. Each entry exposes a summary and a source locator. Its body is disclosed only when\nneeded, limiting unnecessary context.\nCall-relation expansion. The candidate set is expanded along call relations in the program graph G retained\nby the synchronization state Kg . In function-as-leaf mode, expansion follows the function-call graph; in\nfile-as-leaf mode, it follows the induced file-call graph. Named external boundary nodes may supply context\nbut are never returned as edit sites.\nSource verification. All preceding steps operate on H. The agent then opens R, resolves each candidate\nlocator, and keeps only the sites that remain relevant to q. The result is the verified evidence Ebq . Each record\ncarries a file path, an optional function or region anchor, and a current source excerpt. The handbook guides\nthe search, while the repository remains the authority for the edit plan.\n\nB.2\n\nEdit Planning\n\nThe planner converts Ebq into an edit plan P whose blocks name a target file, an optional anchor, the supporting\nsource excerpt, and the intended change. In our evaluation implementation, each change is expressed as a\nverbatim old/new pair. For every block, the planner also emits an action declaration. These declarations are\ncollected as Γ = (Γmodify , Γadd , Γremove ), with a rename encoded as one removal and one addition.\n\n17\n\n\fB.3\n\nExecution\n\nExecution is delegated to a separate agent that applies P to R and produces R′ . The factual record of the\nchange is ∆ = Diff(R, R′ ).\nIn our implementation, the executor can read and write files, perform targeted replacements, and search within\na file, but it cannot list directories or access a shell. It first applies each verbatim replacement directly and\nreads the target source only if the replacement fails. It then verifies the touched files and runs a target-specific\nsyntax gate when one is configured. The diff ∆ drives handbook invalidation, whereas Γ is used only to check\nwhether execution followed the plan.\n\nB.4\n\nAutomatic Resynchronization\n\nEvery non-empty ∆ automatically invokes Resyncg , which updates only the affected parts of the handbook\nwhenever possible. If ∆ = ∅, resynchronization is skipped and H′ = H.\nVersion alignment. The procedure reparses R′ and builds the updated program graph G ′ . It compares G ′\nwith the stored graph G, using ∆ to identify added, removed, and modified units.\nIn function-as-leaf mode, functions are matched using body fingerprints that ignore line numbers. A function\nthat only moves is therefore treated as unchanged, and its locator is shifted by the corresponding line offset.\nA rename is detected by matching the body below the signature line. In file-as-leaf mode, file-set differences\nidentify added and removed files, while content hashes identify changed files. A path rename therefore appears\nas one removal and one addition.\nBefore the observed actions are compared with Γ, a detected function rename is normalized to one removal\nand one addition. This audit does not alter the ∆-driven invalidation scope.\nScoped update. Resynchronization next checks whether the current stage skeleton S can accommodate the\nchange. If it remains valid, S ′ = S and the affected part of Ug is updated to Ug′ . In function-as-leaf mode,\nthis update removes deleted memberships, carries forward matched functions, and reclassifies new or changed\nfunctions. It also refreshes region anchors, source hashes, within-stage order, and unmapped status. In\nfile-as-leaf mode, it removes obsolete cards and assignments, refreshes cards for new or changed files, assigns\nnew files, reorganizes affected stages, and updates the coverage record Y to Y ′ .\nThe pipeline then regenerates the affected L3 entries, their enclosing L2/L1 ancestors, and dependent state\nregisters. This produces the updated document tree D′ and state-register view Z ′ . Unaffected generation\noutputs are reused from B. The updated cache B ′ retains these reusable entries and adds or replaces the\nrefreshed outputs.\nIf S can no longer accommodate the change, Algorithm 2 is rerun on R′ with the same leaf mode g and stored\nconfiguration Θ. The function-as-leaf branch also reuses the stored seed skeleton S0 . The file-as-leaf branch\ninstead infers a new stage skeleton from the updated repository. During the full rebuild, Phase I produces\nG ′ , Phase II produces (S ′ , Ug′ ), and Phase III synthesis produces (D′ , Z ′ , B ′ ). These components follow the\nshared validation and packaging contract described below.\nConservative handling. Source that cannot be parsed or classified is not guessed. An existing L3 entry whose\nlocator or source hash cannot be revalidated is marked frozen and excluded from localization. In function-as-leaf\n′\nmode, new or changed functions that cannot be mapped remain explicitly recorded as unmapped in Ufunction\n.\nIf a changed function previously had an active L3 entry, that entry is frozen until classification succeeds. In\n′\nfile-as-leaf mode, files without a valid card or assignment remain in the coverage record Y ′ within Ufile\n.\nParsing, hashing, graph construction, locator roll-forward, and coverage checks are deterministic. Model\ncalls are limited to classification, file assignment, within-stage organization, and description revision. These\ncategories also cover a full rebuild. Stage and function decisions count as classification; file-to-stage decisions\n\n18\n\n\fcount as file assignment; and file grouping counts as within-stage organization. Regenerating cards, document\nnodes, or registers counts as description revision.\nValidation and packaging. Both update paths then follow the packaging contract of Appendix A: the pipeline\nvalidates the locators in D′ against R′ and the stage references in Z ′ against the updated skeleton, archives\nG ′ and (S ′ , Ug′ ) with B ′ , the fixed g, and Θ (plus S0 in function mode) as Kg′ , and renders and packages the\nvalidated (D′ , Z ′ ) with Kg′ as H′ . The pair (R′ , H′ ) becomes the starting state for the next request.\n\nC\n\nExperimental Details\n\nThis appendix details the setup summarized in Section 4.1, where every factor other than handbook access\nis held fixed across the two arms. It covers the two evaluated harnesses and their Phase I static facts, the\nmodification requests (30 per harness, balanced across request type and localization difficulty), and the two\nevaluation arms with the SKILL.md manifest that exposes the handbook to the planner. The evaluation\nmetrics are defined in Section 4.1.\n\nC.1\n\nHarnesses and Static Facts\n\nWe evaluate on two production-style agent harnesses that differ sharply in scale and language.\n• Terminus-2 is a Python terminal agent from the Harbor framework. It drives a real terminal through\na tmux session in an observe–decide–act loop: it reads the terminal state, queries an LLM for the next\naction, sends commands, and reads back the results, repeating until the task finishes or a limit is reached.\nIt is compact (6 source files) but behaviorally rich, with a multi-stage iteration loop, context management,\nand cross-iteration state.\n• Codex is the Rust monorepo behind the Codex coding agent. It is large and multi-surface, spanning a\nCLI, a TUI, an app-server, configuration, and sandboxing across many crates, with thousands of files and\ndeep call graphs.\nFollowing the selection rule in Section 3.2, Terminus-2 uses the function-as-leaf mode, since a reliable seed\nskeleton is available and function-level entries stay within budget, whereas Codex uses the file-as-leaf mode to\ninfer the hierarchy at repository scale. Table 2 reports the Phase I static facts extracted from each repository\ntogether with the resulting handbook structure.\nTable 2 Phase I static facts and resulting handbook structure for the two evaluated harnesses. The upper block\nreports the program graph G produced by static analysis (Appendix A); the lower block reports the built handbook.\nFor Terminus-2, an L3 entry covers a whole function or one or more contiguous regions of a function; for Codex, an L3\nentry corresponds to one file.\nTerminus-2\n\nCodex\n\nPython\nfunction-as-leaf\n\nRust\nfile-as-leaf\n\nSetup\n\nLanguage\nLeaf mode\n\nProgram graph\n(Phase I)\n\nSource files\nInternal-function nodes\nBoundary nodes\nResolved call edges\n\n6\n103\n41\n257\n\n2,267\n34,363\n4,016\n159,960\n\nBuilt\nhandbook\n\nStages (L2)\nL3 entries\nState registers\n\n20\n106\n10\n\n140\n2,267\n62\n\nThe two repositories differ by roughly two orders of magnitude in files, functions, and call edges, which is\nprecisely why they instantiate the two leaf modes.\n\n19\n\n\fC.2\n\nModification Requests\n\nEach harness contributes 30 behavior-driven modification requests, evenly split into three types. Each request\nstates an intended behavioral change without revealing target locations. The two suites are built from the\nsame behavioral intents but phrased against each harness’s own code, so the same goal lands on different\nimplementation sites in Terminus-2 and Codex.\n• Query (Q) modifies existing behavior, such as a trigger, a timing rule, or a control-flow decision.\n• Cross-file (CF) adds an end-to-end capability that spans files, schemas, pipeline logic, or interfaces.\n• Search-Hostile (SH) places relevant sites in mirrored implementations, fallback branches, or cold paths\nthat keyword search alone struggles to recover.\nTable 3 gives a representative request of each type, chosen separately for each harness.\nTable 3 Representative modification requests, chosen separately for each harness, with the localization challenge each\ntype poses.\nTerminus-2\n\nCodex\n\nLocalization challenge\n\nQ\n\nRequire marking task_complete three\ntimes, with an “are you sure?”\nre-prompt, before grading.\n\nRaise exec_command’s wait ceiling to\n300 000 ms, keeping schema bound and\ndocs in agreement.\n\nAn existing behavior must be found\nand altered; the difficulty is telling the\ntarget apart from similar triggers or\nrules.\n\nCF\n\nAdd a background flag that sends\nkeystrokes without capturing output,\nacross the terminal layer and both\nformats.\n\nAdd a per-command env override,\nthreaded through the spawn path\nacross both shell tools.\n\nThe capability spans coordinated sites\n(schema, pipeline, interface, docs) that\nmust all be located together.\n\nSH\n\nMask secrets before any model\nsnapshot and before writing the session\nrecording.\n\nMask secrets in every capture path and\nbefore writing the on-disk rollout.\n\nRelevant sites hide in mirrored,\nfallback, or cold paths, so keyword\nsearch alone misses some of them.\n\nRequests are additionally labeled Easy, Medium, or Hard by localization difficulty, reflecting whether the\nchange touches one primary behavior, requires coordination across stages and files, or requires discovering\ndependencies along indirect execution paths. Table 4 gives a representative request at each level for both\nharnesses.\nTable 4 Representative modification requests at each localization-difficulty level, chosen separately for each harness,\nwith the localization challenge each level poses.\nTerminus-2\n\nCodex\n\nLocalization challenge\n\nEasy\n\nStrip ANSI escape codes from all\ncaptured terminal output.\n\nAdd an informational comment field\non both shell tools.\n\nOne well-defined site: the change\nmaps to a single behavior that a\nkeyword or one file read can pinpoint.\n\nMedium\n\nAdd a per-command cwd, threaded\nthrough execution, the terminal layer,\nand both formats.\n\nAdd an expect output check on both\nshell tools, annotating the\nobservation on failure.\n\nCoordinated edits: one field or check\nmust be threaded through parsing,\nexecution, and documentation, so\nseveral related sites must be found\ntogether.\n\nHard\n\nKeep run counters and step history\nconsistent across a mid-run\ncompaction.\n\nReconcile overlapping fields across\nexec_command, shell_command, and\nwrite_stdin.\n\nIndirect coupling: the sites sit on\ncold or mirrored paths\n(post-compaction bookkeeping;\nparallel tool schemas) that keyword\nsearch rarely surfaces.\n\nC.3\n\nEvaluation Arms\n\nTo isolate the effect of the handbook, both arms share the same configuration. The planner is an agent built\non NexAU whose underlying LLM is DeepSeek-V4-Pro and whose repository tools are read-only, and both\narms use the same requests, repository snapshot, planning contract, and decoding settings. They differ only in\n20\n\n\f--name: &lt;harness&gt;-handbook\ndescription: &gt;Structural map of the harness, derived from its code. Use it when planning a\nchange to find EVERY code site the change must touch -- it maps the code\nstage-by-stage and lists every state register together with all of its\nread/write locations. Consult it before finalizing a plan so that scattered or\nnon-obvious sites are not missed.\n--# Harness Handbook: navigation guide\nThis is a structural map of the harness. Use it to locate where a requested change\nmust take effect -- especially sites that are not adjacent to the obvious one.\n## Reference files\n- references/overview.md\n\n-- whole-system orientation: the lifecycle, the main\nloop, and how the stages fit together. Read first.\n- references/index.md\n-- the map: every stage (id, title, what it does, the\nleaves it covers) and every state register.\n- references/registers.md\n-- for each state register: its purpose and EVERY place\nit is written and read, across the whole harness.\n- references/stages/&lt;id&gt;.md -- one stage’s prose plus a card per leaf (function or\nfile): its &lt;summary&gt; line gives the exact code\nlocation (path:start-end), and the card holds the\ninterface, behavior, relations, and source.\n## How to use it (during planning, before you write your plan)\n1. Read references/overview.md first to understand the whole system.\n2. Read references/index.md to identify the stages, leaves, AND state registers\nyour change involves. Do NOT prematurely narrow to the one obvious stage: a\nsingle change often touches sites in several stages.\n3. For EVERY state register your change touches, read references/registers.md and\nnote EVERY write and read site. This read/write registry surfaces scattered,\nnon-adjacent sites a top-down code read would miss.\n4. Open the relevant references/stages/&lt;id&gt;.md for detail and coupled assumptions.\n5. For each site the handbook names, open the real code with read_file /\nsearch_file_content and locate the precise lines.\n6. Your plan must account for every site the handbook surfaced.\nThe handbook tells you WHERE things live and how they connect. You still decide\nwhat the change should be, and you verify every location against the real code\nbefore planning it.\n\nFigure 6 The SKILL.md manifest that exposes a handbook to the planner in the Handbook-Assisted arm. The same\nstructure is used in both leaf modes; a leaf is a function in function-as-leaf mode and a file in file-as-leaf mode.\n\nwhether the handbook is available and in the corresponding localization instructions. The assisting handbook\nis built from the same repository snapshot used in the evaluation.\n• Baseline. Without a handbook, the planner locates edit sites by exploring the repository with read-only\ntools (file read, in-file search, and directory listing).\n• Handbook-Assisted. The planner is additionally given the handbook as a navigable skill and follows the\nBGPD policy, proposing source locators from the handbook and then verifying them against the repository.\nThe handbook is exposed to the planner as a skill: a SKILL.md manifest tells the planner when and how to\nconsult the handbook, and points to the reference files it navigates. Figure 6 shows this manifest. The same\nstructure is used in both leaf modes; each stage’s leaf cards hold functions in function-as-leaf mode and files in\nfile-as-leaf mode.\n\n21\n\n\fD\n\nPrompt Templates\n\nThis appendix reproduces the main prompts used by the pipeline, organized by the stage in which they are\nused: those that build the handbook (Appendix D.1), those that localize and plan a change under BGPD\n(Appendix D.2), and those that score plans with an LLM judge (Appendix D.3). The listings are transcribed\nfrom the implementation; per-run fields substituted at runtime are shown as {{...}} or {...} placeholders,\nand a few non-ASCII characters are rendered in ASCII. Static fields such as qualified names, signatures,\nsource ranges, and call edges are supplied by static analysis and cannot be overwritten by the model.\n\nD.1\n\nHandbook Generation\n\nThese prompts drive the construction pipeline of Appendix A: they organize source units into execution stages\nand synthesize the L1–L3 document tree. Throughout, the statically extracted identities stay fixed and the\nmodel only supplies behavioral descriptions.\nD.1.1\n\nClassifying Functions into Stages\n\nUsed in function-as-leaf Phase II to assign one function to one or more stages, as a whole or as contiguous\nregions. The rules block below is followed at runtime by the available stage list, the function’s metadata, its\ncaller/callee context with their current stage assignments, and the line-numbered source.\nYou are analyzing one Python function from the Terminus 2 agent harness, and\nclassifying it into one or more stages of a hand-authored data-flow skeleton.\nGRANULARITY\n- \"function\": the entire function is a single narrative unit. Use for short,\ncohesive functions (&lt;=30 lines or with a single clear purpose).\n- \"region\": the function contains multiple distinct narrative steps and should be\nsplit into 2-10 regions. Use for large functions with multiple decision points\nor sequential phases.\nREGION RULES (when granularity == \"region\")\n- Each region MUST be contiguous and end at a complete statement boundary (not\nmid-statement).\n- Provide first_line and last_line as the EXACT text content of the first and last\nlines of the region.\n- Each region has its own stage_id.\nSTAGE ASSIGNMENT\n- Pick stage IDs ONLY from the list provided.\n- CROSS-CUTTING utility functions (small utilities called from many places -- token\ncounting, output length capping, recording markers) go to crosscut-X* ONLY. Do\nNOT add them to consuming stages.\n- A function that uses self.logger.X is NOT cross-cutting just because of that -assign by its primary identity.\n- For api-surface methods (e.g. name(), version()): set function_assignments=[] and\ngranularity=\"function\" (will be recorded as unmapped api_surface).\n- For subsystem-internal functions (in tmux_session.py / terminus_*_parser.py /\nasciinema_handler.py): assign to the main-flow stage that drives them.\nPURPOSE FIELD (60-150 words, structured across 5 aspects)\n1. ACTION: what the function does, concretely (no \"handles\" / \"manages\")\n2. INPUTS / STATE READ: arguments + self._* attrs that determine behavior\n3. OUTPUTS / STATE WRITTEN: return value + self._* attrs mutated\n4. WHEN INVOKED: who calls it, under what condition\n5. NON-OBVIOUS: retry logic, fallback paths, design choices a reader would miss\nCONSISTENCY WITH CONTEXT\nLook at the caller/callee context provided -- your classification should be\nconsistent with their stage assignments. A function that’s only called from\nstage-4.2’s region typically belongs near stage-4.2.\nOUTPUT\nReturn ONLY a JSON object inside a ‘‘‘json fenced block:\n{\n\"qualname\": \"&lt;exact qualname&gt;\",\n\"purpose\": \"&lt;60-150 word 5-aspect description&gt;\",\n\"granularity\": \"function\" | \"region\",\n\n22\n\n\f\"function_assignments\": [\"stage-X\", ...],\n\"regions\": [\n{\"line_range\":[a,b], \"first_line\":\"...\", \"last_line\":\"...\",\n\"purpose\":\"&lt;30-80 word&gt;\", \"stage_id\":\"...\"}, ...\n] | null,\n\"file\": \"&lt;file&gt;\",\n\"line_range\": [&lt;start&gt;, &lt;end&gt;]\n}\nWhen granularity == \"function\", regions = null.\n\nD.1.2\n\nReviewing Function Assignments\n\nEach proposed assignment is reviewed by a critic against the source, the stage definitions, and caller/callee\nevidence. The reviewer role block (the “engineer” role) is followed by the task context, the review evidence,\nand the proposal under review, then the output rules below. Reviewers lean toward APPROVE so the pipeline\nkeeps making progress.\nYou are a SENIOR ENGINEER reviewing a proposed change to how a function is\nclassified or organized in a handbook for an AI agent harness. Your job is to be\nskeptical and find real concerns rooted in code behavior.\nFocus on:\n- Does the proposed classification reflect what the function ACTUALLY does at the\ncode level?\n- Are the line ranges / region boundaries syntactically and semantically sound?\n- Does the proposal misuse cross-cutting categories (e.g. labeling a function\n\"crosscut-X3 logging\" just because it calls self.logger)?\n- Are caller/callee relationships consistent with the proposed stage membership?\nYou may APPROVE, REVISE (with concrete concerns), or REJECT.\nDECISION GUIDELINES\n- APPROVE: the proposal is reasonable, even if minor wording could be tweaked. A\ncorrect-enough proposal is APPROVE, not REVISE. Be GENEROUS with APPROVE.\n- REVISE: only when there is a SPECIFIC, ACTIONABLE flaw that materially affects\ncorrectness (wrong stage assignment, wrong region boundary, factual error about\nthe code). Do NOT REVISE for style, phrasing, or \"could be more thorough\" reasons.\n- REJECT: only when the proposal is fundamentally wrong and revision can’t save it.\nBy default lean APPROVE. The pipeline must make progress.\nOUTPUT FORMAT\nReturn ONLY a single JSON object wrapped in a ‘‘‘json fenced block:\n{\n\"decision\": \"APPROVE\" | \"REVISE\" | \"REJECT\",\n\"concerns\": [\"&lt;concern 1&gt;\", ...],\n\"suggested_revision\": { ... } OR null,\n\"rationale\": \"&lt;one sentence explanation&gt;\"\n}\nWhen decision == \"APPROVE\", concerns and suggested_revision may be empty.\nWhen decision == \"REVISE\", concerns must be non-empty AND each concern must point\nto a concrete, fixable flaw.\nWhen decision == \"REJECT\", concerns must be non-empty; suggested_revision is null.\n\nD.1.3\n\nGenerating File Cards\n\nUsed in file-as-leaf Phase II to summarize each scanned file. In deep mode—where the file is the handbook’s L3\nleaf—the model reads the whole file and writes the card content, while the graph-derived function inventory,\nline numbers, and call relations are supplied as fixed facts. The deep-mode prompt is:\nYou are reading SOURCE FILES IN FULL and writing a plain-language, easy-to-follow\ndescription of each, for a system handbook in which the FILE is the smallest unit\n(its leaf node). The description you write IS the handbook’s content for this file.\nWHO YOU ARE WRITING FOR: a curious OUTSIDER -- someone intelligent but new to this\nproject and possibly not an expert programmer in this area. They should be able to\nread your text and come away genuinely understanding what this file does and why it\n\n23\n\n\fmatters, WITHOUT having to already know the codebase or the jargon.\nHOW TO WRITE (this matters as much as the content):\n- Use plain, everyday language. Prefer short, clear sentences over dense ones.\n- Explain the WHY and the WHAT in human terms before any mechanism: what real\nproblem does this file solve, and what would break without it?\n- When you must use a technical term or acronym, explain it in plain words the\nfirst time. Never leave jargon unexplained.\n- Use a brief everyday analogy when it genuinely makes something click.\n- Do NOT dump implementation trivia. Favor the big picture and intuition. It is\nfine to name key types/functions, but always say what they’re FOR in plain words.\n- Stay accurate. Simplify, but never say something that is actually wrong.\n- Avoid empty filler like \"handles\"/\"manages related logic\"; be specific.\nEach file also comes with its FUNCTION LIST (qualname + line range), derived from\nthe call graph. The function inventory, line numbers, and call relations are\nFACTS -- do NOT re-list them. Your job is the plain-language prose + an\neasy-to-understand note per function (referenced by its exact qualname).\nFor EACH file return:\n- \"purpose\": 1-2 plain sentences a newcomer can understand: what this file is for.\n- \"description\": an accessible walkthrough (roughly 120-300 words): what problem\nthis file solves and why it exists; what it does, step by step, in plain\nlanguage; how its main pieces work together; and any surprising behavior.\n- \"functions\": one entry per function in the file’s function list, referenced by\nits exact \"qualname\", each with:\n- \"purpose\": in plain words, what this function does and why (1-3 sentences).\n- \"data_flow\": what goes IN -&gt; what it does -&gt; what comes OUT, told as a simple\nbefore/after story a non-expert can follow.\n- \"relations\": how it fits into the bigger flow -- who calls it and when, and\nwhat it hands off to, grounded in the provided calls/called-by facts.\n- \"role\": EXACTLY one of: entrypoint, orchestration, domain_logic, io_transport,\ndata_model, config, util, test, generated, other.\n- \"lifecycle\": SHORT hint of when in the run this file is active (e.g. \"startup\",\n\"config load\", \"main loop\", \"request handling\", \"teardown\", \"cross-cutting\").\nOUTPUT -- ONLY a JSON object in a ‘‘‘json block:\n{\n\"purposes\": [\n{\"file\": \"&lt;exact path&gt;\", \"purpose\": \"...\", \"description\": \"...\",\n\"role\": \"&lt;role&gt;\", \"lifecycle\": \"...\",\n\"functions\": [\n{\"qualname\": \"&lt;fn qualname&gt;\", \"purpose\": \"...\", \"data_flow\": \"...\",\n\"relations\": \"...\"}, ...]},\n...\n]\n}\nReturn one entry per file given, using the exact file paths provided.\n\nD.1.4\n\nSynthesizing the L1–L3 Document Tree\n\nThe two modes synthesize the document tree differently. In function-as-leaf mode, each L1, L2, and L3 node is\nproduced by a bounded actor–critic–reflexion loop: an actor drafts the node from grounded inputs, a critic\nscores it against a tier-specific rubric and returns actionable findings, and the actor revises until the rubric\npasses, the score stops improving, or the generation budget is reached. L1 and L2 use long, tier-specific\nwriting guides (a whiteboard-tour style for L1; a problem/main-flow/state-flow/hand-off structure for L2). In\nfile-as-leaf mode, the validated file cards from Appendix D.1 already are the L3 content, and a single-pass\nrollup produces the L2 component overviews and the L1 system overview.\nThe L3 (function-as-leaf) entry is emitted against the output schema below, grounded in the exact source\nrange(s); a multi-region variant returns one gloss per region with function-level design decisions and relations.\n\n24\n\n\f## Output format (single)\nReturn a JSON object inside a ‘‘‘json fence:\n‘‘‘json\n{\n\"schema_version\": 1,\n\"type\": \"single\",\n\"locator_role\": \"&lt;one-line role tag, 6-15 words&gt;\",\n\"stage_context\": \"&lt;2-4 sentences: what role this plays in the stage; when it is\ninvoked; how it relates to its siblings&gt;\",\n\"synopsis\": \"&lt;2-4 sentences: What + inputs + outputs + side effects&gt;\",\n\"interface\": {\n\"signature\": \"&lt;full signature, e.g. (self, environment) -&gt; None&gt;\",\n\"params\": [{\"name\": \"&lt;param&gt;\", \"type\": \"&lt;type, or ? if unclear&gt;\",\n\"role\": \"&lt;one-line role / source&gt;\"}],\n\"reads_state\": [\"&lt;self._ attributes this function reads&gt;\"],\n\"returns\": \"&lt;what it returns; if None, state the real product (side effect)&gt;\",\n\"side_effects\": [\"&lt;self._ attributes written / external effects&gt;\"]\n},\n\"execution_flow\": [\n\"&lt;step 1: action + which args/state + what’s produced&gt;\",\n\"&lt;step 2: ...&gt;\"\n],\n\"design_decisions\": [\n\"&lt;decision 1: the trade-off point + why this choice + what an alternative costs&gt;\",\n\"&lt;decision 2: ...&gt;\"\n],\n\"relations\": {\n\"callers\": [\"&lt;qualname or brief description&gt;\"],\n\"core_callees\": [\"...\"],\n\"config_state_sources\": [\"...\"],\n\"results_to\": [\"...\"],\n\"siblings\": [],\n\"register_interactions\": [\n{\"action\": \"write|read|clear|reset\", \"register\": \"reg-&lt;id&gt;\",\n\"note\": \"&lt;5-12 words: when / why&gt;\"}\n]\n}\n}\n‘‘‘\nCount constraints:\n- interface.signature: required, copied accurately from the source.\n- interface params / reads_state / returns / side_effects: list them all from the\nsource; empty array / \"none\" if there are none.\n- execution_flow: 2-8 steps; design_decisions: 1-5 items.\n- relations.{callers, core_callees, config_state_sources, results_to}: at least 4\nof these must be non-empty.\n- relations.register_interactions: list every register this function\nreads/writes/resets; empty array [] only if it interacts with none.\n\nD.2\n\nBGPD Localization and Planning\n\nThis is the planner prompt used under BGPD in the Handbook-Assisted arm: it localizes by routing through\nthe handbook and then verifying candidate edit sites against the real source before emitting a self-contained\nedit plan. Per-harness fields substituted at runtime are shown as {{...}} placeholders.\nYou are a senior software engineer PLANNING a change to {{PROJECT_INTRO}}, on\nbehalf of a code reviewer.\nYou are given ONE natural-language change request. In this phase you produce a\nprecise, SELF-CONTAINED PLAN of the edits -- you do NOT edit any files. A separate\nexecutor will apply your plan MECHANICALLY: for each edit it will substitute your\nexact OLD text with your exact NEW text, WITHOUT re-reading the file. So your\nplan’s verbatim text must be byte-exact.\n## Two artifacts, two distinct roles\n- The handbook is a pure LOCATION INDEX of the harness, NOT a description of the\ncode. Each function appears as a one-line locator: ‘&lt;summary&gt;&lt;b&gt;Qualified.name&lt;/b&gt;\n-- file:start-end . one-line role&lt;/summary&gt;‘, optionally followed by a Relations\nblock (callers/callees/register read-write sites). A card has NO function body and\nNO source code. On top of that, ‘index.md‘ lists every stage with its function\n\n25\n\n\flocators and ‘registers.md‘ lists every state variable with its exact read/write\ncode sites. Use these to decide WHICH files, functions and sites are in scope -they surface scattered, non-obvious sites (mirror copies in the other\nparser/template, a register’s every read/write, cross-subsystem touch points)\nthat a plain text search can miss.\n- The real source code is the GROUND TRUTH for WHAT to change. The handbook tells\nyou the ADDRESS (file:start-end); the code at that address is the only reliable\nsource of the actual structure. You MUST read the real source.\n## How to plan -- ROUTE with the handbook, READ the real source, EMIT verbatim edits\n1. Understand the request’s true intent: the behavior delta, and the\nstate/conditions/values it fixes.\n2. Route with the handbook. Read its ‘SKILL.md‘, then ‘index.md‘, then only the\n‘stages/&lt;id&gt;.md‘ chapters and ‘registers.md‘ entries your intent points to.\nAssemble the candidate set: every file + function + anchor the change must touch.\nWatch for scattered/mirror sites (a parser change usually has a twin in the OTHER\nparser and in both prompt templates; a state change fans out to every read site\nlisted under that register).\n3. Read the REAL source of every site you intend to edit with ‘read_file‘ on the\nactual code files. Confirm the exact body, control flow, conditions, and that the\nsite does what the card implied.\n4. For EACH edit, produce a self-contained EDIT BLOCK (format below) whose\n‘old_string‘ is copy-pasted verbatim from the ‘read_file‘ output you just saw -never retyped from memory, never paraphrased. Match whitespace and indentation\nexactly, and include at least 3 lines of context BEFORE and AFTER the changed\nlines so the snippet is UNIQUE in the file.\n5. A change can also silently break something the request never mentions; if you\nfind such a coupled assumption, add an edit (or note it) accordingly.\n6. Only include edits you are confident the request requires.\n## EDIT BLOCK format (the executor applies these directly)\nFor every edit, output exactly:\n### EDIT &lt;n&gt;\n- file: ‘&lt;path relative to the working dir, e.g. {{PATH_EXAMPLE}}&gt;‘\n- where: ‘&lt;{{WHERE_EXAMPLE}}&gt;‘ -- why this change\n‘‘‘old\n&lt;EXACT current text, copied verbatim from read_file -- whitespace-perfect, unique&gt;\n‘‘‘\n‘‘‘new\n&lt;the replacement text -- correct, idiomatic, the smallest change that realizes the intent&gt;\n‘‘‘\nRules for the blocks (the executor trusts them blindly, so precision is on you):\n- ‘old‘ MUST be byte-exact to the file’s current content. If you are not certain it\nis verbatim, ‘read_file‘ that region again before writing the block.\n- Keep each ‘old‘ the SMALLEST span that is still unique (1-8 lines typically); do\nnot paste whole functions.\n- SAME-FILE edits must NOT overlap. The executor applies your blocks in order\nagainst text that earlier blocks have ALREADY changed, and it does not re-read\nbetween them. So no block’s ‘old‘ (including its context lines) may contain a line\nthat another block in the same file changes -- otherwise the second match will be\nstale. If two changes are close enough that their context would overlap, MERGE\nthem into ONE block covering both. Order same-file blocks top-to-bottom.\n- For a brand-NEW file, use a single block with an empty ‘‘‘old‘‘‘ and the full\ncontent in ‘‘‘new‘‘‘, and say \"(new file)\" in ‘where‘.\n- Anchor on stable lines; never let ‘old‘ span a region you are unsure of.\nWhen done, call ‘complete_task‘ with: a short prose summary of the edits, then ALL\nthe EDIT blocks, then the declarations JSON. Do NOT edit any files in this phase.\n## Declarations (machine-readable -- the handbook-resync pipeline consumes this)\nEnd with EXACTLY one ‘‘‘json block declaring the change-set at FUNCTION\ngranularity, using {{QUALNAME_NOTE}}:\n‘‘‘json\n{{DECL_JSON}}\n‘‘‘\n- ‘will_modify‘ -- every EXISTING function whose implementation your edits change.\n- ‘will_add‘\n-- every brand-new function introduced.\n- ‘will_remove‘ -- every function deleted outright. A rename = remove(old)+add(new).\n\n26\n\n\fD.3\n\nLLM Judging\n\nPlan quality is scored in two steps. The judge first builds a leakage-safe answer key from the request and\npristine source, before seeing any plan, and then scores each plan independently against that key.\nD.3.1\n\nBuilding the Answer Key\n\nThe judge builds a leakage-safe answer key from the request and pristine source before seeing any plan\n(hint fields are stripped from the request). This is the Terminus-2 judge; the Codex judge mirrors it, using\ncorrect_approach in place of correct_localization.\n[SYSTEM]\nYou are an expert Python engineer building a grading ANSWER KEY for a code-change\ntask on the Terminus-2 Python agent harness.\nYou are NOT looking at any solution yet. Read the pristine source and independently\ndetermine which concrete files, functions, methods, branches, templates, or state\nvariables a correct solution must localize before editing.\nOutput ONLY this JSON object:\n{\"required_sites\":[\"&lt;concrete file/function/branch/template/state site&gt;\"],\n\"correct_localization\":\"&lt;2-4 sentences: where the planner should look and why&gt;\",\n\"pitfalls\":[\"&lt;easily missed mirror/fallback/cold/state/template sites&gt;\"]}\n[USER]\n## CHANGE REQUEST\n{query}\n## PRISTINE TERMINUS-2 SOURCE\n{pristine}\nBuild the localization answer key now. Output the JSON object only.\n\nD.3.2\n\nScoring the Plan\n\nEach plan is scored independently against the answer key on a 0.0–5.0 scale in 0.5 steps. The three dimensions\nare combined with weights 0.50 (localization), 0.25 (scope_bloat), and 0.25 (reasoning); scope_bloat\nis reported as Scope Control, where a higher value means a more focused plan.\n[SYSTEM]\nYou are an expert Python engineer GRADING the LOCALIZATION quality of one planner’s\nPLAN for a code-change task on the Terminus-2 Python agent harness.\nYou judge the PLAN ONLY: which files/functions/state/template sites it decides to\ninspect or modify, and whether its reasoning is grounded. Do NOT grade the final\ncode diff or execution correctness. The executor is shared across arms and is out\nof scope.\nGrade these dimensions from 0.0 to 5.0 in 0.5 steps:\n- localization : did the plan identify ALL required implementation sites in the\nanswer key, including mirror, fallback, cold-path, state-reset,\nand template sites?\n- scope_bloat : did the plan avoid unrelated files/functions or overly broad\nedits? 5 means tightly scoped; low means it wandered into\nirrelevant areas.\n- reasoning\n: is the plan’s localization reasoning grounded in the real code and\nrequest, rather than vague, circular, or guessed?\nOutput ONLY this JSON object:\n{\"localization\":X,\"scope_bloat\":X,\"reasoning\":X,\n\"justification\":\"&lt;&lt;=60 words: decisive localization hit/miss -- which sites found or missed&gt;\"}\n[USER]\n## CHANGE REQUEST\n{query}\n## ANSWER KEY\n{answer_key}\n## PRISTINE TERMINUS-2 SOURCE\n\n27\n\n\f{pristine}\n## THIS ARM -- plan.md\n{plan}\nGrade this arm’s PLAN localization against the answer key. Output the JSON object only.\n\nE\n\nIllustrative Handbook-Assisted Planning Walkthrough\n\nThis appendix walks through one real Handbook-Assisted run on Terminus-2 (case Q1, DeepSeek-V4-Pro\nplanner), reconstructed from its recorded trace. The run makes concrete the two moves at the heart of BGPD:\nthe planner first routes through the handbook to decide which code sites are in scope, and then verifies each\ncandidate against the live source before writing a plan. Every tool call, source locator, and edit shown below\nis taken from the run; only whitespace is trimmed.\nChange request (Q1: triple completion confirmation)\nRight now the model only has to mark task_complete once to reach the “are you sure?” step, then once more to\nget graded. I want a higher bar: the model must mark completion three consecutive times before we actually\ngrade. The first two times just re-show the terminal state and ask “are you sure you want to submit?”.\n\nThe request is Query-type: it revises an existing control-flow rule but names no file or function. The planner’s\nfirst task is therefore one of localization — finding every site that implements the completion handshake.\nPhase 1 — Route through the handbook\nGuided by the SKILL.md policy, the planner reads the handbook top-down, narrowing the scope before opening\nany source:\n1. SKILL.md → overview.md (L1) → index.md: locate the stage that owns per-iteration continuation and\ntermination.\n2. stages/stage-4.8.md (Completion Gate) and stages/stage-4.7.md (Command Execute): the handshake\nlives in the gate.\n3. registers.md: the gate is backed by the state register reg-pending-completion, whose read and write sites\nspan the loop, initialization, and per-run reset.\nTwo facts fall out of this. The change is confined to a single stage (Completion Gate) and a single register; and\nthe register’s write sites reveal that initialization and per-run reset must change together with the loop, not just\nthe obvious return branch.\nPhase 2 — Verify against the live source\nBecause the handbook is a pure location index and stores no source, the planner now opens the real terminus_2.py to confirm each locator. One search_file_content for _pending_completion returns seven occurrences,\nall in terminus_2.py, so the change stays within one file. Reading them shows a single Boolean flag that is set\non the first completion mark, tested before returning on the second, and cleared on any non-completion turn and\nat the start of each run. This resolves the handshake to three concrete sites:\n• Terminus2.__init__ (∼L292) — initializes the flag.\n• Terminus2._reset_per_run_state (∼L1574) — clears it per run.\n• Terminus2._run_agent_loop (∼L1427–1440, L1552–1559) — the observation branch and the completion gate\nthat read and write it.\n\nEdit plan. With the sites confirmed, the plan replaces the Boolean _pending_completion with an integer\ncounter _completion_confirmations: the loop increments it on each completion mark, resets it on a noncompletion turn, and returns for grading only on the third consecutive mark. The change set is four modify\nactions, all in terminus_2.py — initialization, per-run reset, and the loop’s two branches. The completion\n\n28\n\n\fgate itself is the representative edit:\nBefore — two-mark Boolean handshake:\nif is_task_complete:\nif was_pending_completion:\n# second task_complete: confirmed, grade now\nreturn\nelse:\n# first attempt: ask to confirm, continue\nprompt = observation\ncontinue\n\nAfter — three-mark counter:\nif is_task_complete:\nif was_completion_confirmations &gt;= 2:\n# third consecutive task_complete: confirmed, grade now\nreturn\nelse:\n# first or second attempt: ask to confirm, continue\nprompt = observation\ncontinue\n\n29\n\n\f</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"