"<!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>2026-8-21\n\nSelf-Harness: Harnesses That Improve Themselves\n\nHangfan Zhang1 , Shao Zhang1 , Kangcong Li1 , Chen Zhang1\nYang Chen1 , Yiqun Zhang1 , Lei Bai1,† , Shuyue Hu1,†\n\narXiv:2606.09498v3 [cs.CL] 20 Aug 2026\n\n1 Shanghai Artificial Intelligence Laboratory, {zhanghangfan,zhangshao,hushuyue}@pjlab.org.cn\n\nAbstract\nThe performance of LLM-based agents is jointly shaped by their base models and the harnesses that\nmediate their interaction with the environment. Because different models exhibit distinct behaviors,\neffective harness design is inherently model-specific. Yet agent harnesses are still largely engineered by\nhuman experts, a paradigm that scales poorly as modern LLMs become increasingly diverse and rapidly\nevolving. In this paper, we introduce Self-Harness, a new paradigm in which an LLM-based agent\nimproves its own operating harness, without relying on human engineers or stronger external agents.\nWe operationalize Self-Harness as an iterative loop with three stages: Weakness Mining, which identifies\nmodel-specific failure patterns from execution traces; Harness Proposal, which generates diverse yet\nminimal harness modifications tied to these failures; and Proposal Validation, which accepts candidate\nedits only after regression testing. We instantiate Self-Harness across Terminal-Bench-2.0, SWE-bench\nVerified, and AppWorld using a minimal initial harness and three base models from diverse families:\nMiniMax M2.5, Qwen3.5-35B-A3B, and GLM-5. Across all nine model–benchmark combinations,\nevery final harness improves both held-in and held-out pass rates, with overall relative gains of up to\n132%. Qualitative analyses further show that the retained mechanisms address benchmark-specific\nbottlenecks in artifact handling and runtime control, software-patch verification, and application-state\nretrieval. These results suggest a path toward LLM-based agents that are not merely shaped by their\nharnesses, but can also participate in reshaping them.\n\nFor a conscious being, to exist is to change, to change is to mature, to mature is to go on\ncreating oneself endlessly.\n—Henri Bergson, Creative Evolution\n\n1. Introduction\nTo date, LLM-based agents are not shaped by their base model alone, but also by their harness:\nthe surrounding system that situates the model and mediates its interaction with the environment.\nAlthough there is no universally accepted definition, a harness may include system prompts, tools,\nruntime mechanisms, verification rules, orchestration logic, and failure-recovery procedures. The\nsame base model can thus exhibit substantially different performance under different harnesses (Lee\net al., 2026; Lin et al., 2026; Yang et al., 2024).\nFrom early frameworks such as ReAct (Yao et al., 2023) to product- and platform-level systems\nsuch as Claude Code, Codex, and OpenHands, harnesses have largely been engineered by human\nexperts (Liu et al., 2026; OpenAI, 2026; Wang et al., 2025; Zhang et al., 2025c; Zhu et al., 2026).\n† Corresponding authors\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 1 | Three paradigms of harness improvement. In human harness engineering, human engineers\nmanually revise the agent harness. In Meta-Harness, a stronger external agent guides the improvement\nof a weaker target agent. In Self-Harness, the agent improves its own operating harness.\nWhile effective, this human-centered paradigm does not scale well with the diversity and rapid\nevolution of modern LLMs. Different models can exhibit distinct behavioral patterns, tool-use habits,\nerror modes, and sensitivities to prompting (Qin et al., 2023; Schulhoff et al., 2025; Sclar et al.,\n2024); consequently, a harness that works well for one model may be suboptimal for another (Lee\net al., 2026; Lin et al., 2026; Sclar et al., 2024). As new models continue to be released at a rapid\npace, manually redesigning and tuning a model-specific harness for each model becomes increasingly\ncostly and untenable.\nIn this paper, we explore a novel paradigm, Self-Harness: enabling an LLM-based agent to improve\nthe very harness through which it operates (Figure 1). Unlike recent approaches that use stronger\nexternal agents to improve the harnesses of weaker ones (Lee et al., 2026; Lin et al., 2026), SelfHarness seeks to internalize this improvement loop within the target agent itself. This paradigm\nreduces dependence on external guidance that may be costly, unavailable for frontier models, or\nmismatched to the target model’s failure modes. More broadly, in Bergson’s terms, this points toward\na technical analogue of self-creation: a system not merely changed from without, but continually\n“going on creating itself.”\nWe operationalize Self-Harness as an improvement loop that repeatedly turns behavioral evidence\ninto harness updates (Figure 2). The loop consists of three stages. Weakness Mining: Starting\nfrom an initial harness, the agent with a fixed model is run on a set of tasks, producing execution\ntraces with verifiable outcomes. The agent then clusters failed traces, allowing it to reason about\nmodel-specific failure patterns rather than isolated mistakes. Harness Proposal: Based on these\nfailure patterns, the agent generates a small set of diverse yet minimal harness modifications, each\ntied to a specific failure mechanism. This constraint ensures that proposed edits remain targeted\nrather than overly general. Proposal Validation: Candidate modifications are evaluated through\nregression tests, and an edit is promoted only if it improves performance without causing measurable\ndegradation on held-out tasks. If multiple candidate modifications pass the regression tests, they\nare merged into the next version of the harness, which then serves as the starting point for the next\niteration.\nIn our experiments, we instantiate Self-Harness with a minimal initial harness (Figure 3) and\nthree base models from diverse families: MiniMax M2.5, Qwen3.5-35B-A3B, and GLM-5 (GLM-5\nTeam, 2026; MiniMax, 2026; Qwen Team, 2026), across Terminal-Bench-2.0, SWE-bench Verified,\nand AppWorld. Across the nine model–benchmark combinations, every final harness improves\nboth held-in and held-out pass rates (Table 1). On Terminal-Bench-2.0, Self-Harness consistently\n\n2\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nimproves performance across all three models. For held-in tasks, which provide execution traces\nto the evaluation system, the pass rate is increased from 43.0% to 50.0% for MiniMax M2.5, from\n15.1% to 36.0% for Qwen3.5-35B-A3B, and from 47.7% to 57.0% for GLM-5. For held-out tasks,\nwhose execution traces are never used as inputs to the evaluation system, the improvements remain\nsubstantial. The pass rate is increased from 40.5% to 61.9% for MiniMax M2.5, from 23.8% to 38.1%\nfor Qwen3.5-35B-A3B, and from 42.9% to 57.1% for GLM-5. The same pattern holds on SWE-bench\nVerified and AppWorld: every model improves on both splits, with overall Pass gains of 3.5–22.0\nand 10.3–40.6 percentage points, respectively. These results indicate that Self-Harness can evolve\nan initial harness into model-specific ones better suited to different base models. Moreover, it can\ndiscover broadly useful harness modifications that transfer to tasks whose traces are hidden from the\nproposer.\nQualitative analyses further show that Self-Harness does more than simply make the prompt longer\nor add generic instructions. Instead, it introduces targeted changes that reflect the recurring problems\neach model encounters during execution, turning model-specific weaknesses into concrete harnesslevel interventions. For MiniMax M2.5, the changes encourage the agent to create required output files\nearlier, handle structured tool outputs more carefully, and stop unproductive tool-use loops before they\nbecome too long. For Qwen3.5-35B-A3B, the changes focus on checking dependencies in advance,\navoiding repeated failed commands, breaking cycles of endless exploration, and reminding the agent\nto produce the required artifacts after tool errors. For GLM-5, the changes mainly help the agent\npreserve environment settings across shell commands and move more quickly from exploration to\nimplementation and testing. Notably, Self-Harness can also introduce broader structural mechanisms,\nsuch as subagent-based decomposition and middleware creation, that go beyond local failure repair\nand improve the overall organization of problem solving.\nTo summarize, our key contributions are as follows:\n• We propose Self-Harness, a novel paradigm for harness improvement that enables an LLM-based\nagent to design and refine the harness through which it operates, tailoring it to its own base\nmodel without human engineering effort or guidance from a stronger external agent.\n• We operationalize Self-Harness as an iterative loop that turns each model’s behavioral evidence\ninto model-specific harness updates: it evaluates execution traces to identify recurring failure\npatterns, generates diverse yet minimal candidate edits, and promotes only those that pass\nregression tests.\n• Experiments show that Self-Harness improves performance across all nine model–benchmark\ncombinations, with overall Pass gains of up to 40.6 percentage points and relative improvements\nof up to 132%; qualitative analyses further confirm that different models benefit from distinct\nharness changes, suggesting that Self-Harness can turn model-specific weaknesses into concrete\nharness changes.\n\n2. Background and Related Work\nFrom prompts to agent harnesses. Prompt engineering and context engineering show that fixed\nmodels can be steered by instructions, demonstrations, retrieved evidence, memory, tool state, and\ndynamically constructed inputs (Lewis et al., 2020; Liang et al., 2026; Liu et al., 2021; Mei et al.,\n2025; Packer et al., 2024; Schulhoff et al., 2025; Wei et al., 2022; Xu et al., 2026). Agentic systems\nextend this control surface from a single input to an execution environment: the model acts, observes\nconsequences, uses tools, receives feedback, and follows runtime policies. ReAct, SWE-agent, Claude\nCode, and SemaClaw/OpenClaw illustrate how such surrounding mechanisms shape long-horizon\nagent behavior and software-engineering performance (Liu et al., 2026; Yang et al., 2024; Yao et al.,\n3\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\n2023; Zhu et al., 2026).\nWe use harness for this surrounding system layer: prompts, tools, memory, verification rules,\npermission policies, adapters, and runtime mechanisms that mediate between the model and the\nenvironment. Many important agent failures are failures of this layer rather than failures of an isolated\nmodel response: an agent may report success without checking an artifact, retry an unproductive\naction pattern, lose the source of truth in a long context, or lack a recovery action. These behaviors\nemerge from the interaction between instructions, observations, tools, and runtime control, so\nimproving them requires changing more than prompt text.\nSelf-improving agents and automated agent design. A growing line of work studies systems that\nadapt their inputs, memories, contexts, or workflows over time (Shinn et al., 2023; Zelikman et al.,\n2024; Zhang et al., 2025a, 2026). Reflexion stores verbal feedback for later attempts (Shinn et al.,\n2023), agentic context engineering evolves contexts for later model calls (Zhang et al., 2026), and\nSTOP studies recursive self-improvement for code generation (Zelikman et al., 2024). These methods\nshow that fixed models can benefit from accumulated feedback, but the adapted object is usually a\nresponse strategy, memory, context, or generated program rather than a declared agent harness state.\nA second line optimizes agent designs from outside the evaluated agent. Automated Design of\nAgentic Systems searches over agent designs, language agents can be represented as optimizable\ngraphs, and Meta-Harness directly optimizes harness code using source code, scores, and traces from\nprior candidates (Hu et al., 2025; Lee et al., 2026; Zhuge et al., 2024). These systems motivate\nharness-level optimization, but they frame improvement as an external search or optimization process\nrather than as a bounded edit proposed by the evaluated model under its current harness.\nFinally, scientific discovery and self-evolving agent systems such as The AI Scientist, AI Scientist-v2,\nAlphaEvolve, Alita, Godel Agent, and Darwin Godel Machine automate broader loops of research,\nalgorithm design, or capability expansion (Fu et al., 2026; Lu et al., 2024; Novikov et al., 2025; Qiu\net al., 2025; Yamada et al., 2025; Yin et al., 2025; Zhang et al., 2025b). Self-Harness is closest in\nspirit to this self-improvement literature and to automated harness optimization, but it studies a\nnarrower controlled setting: whether the same fixed model, operating under the current harness, can\npropose a bounded candidate change to the harness that governs its own future behavior.\n\n3. Self-Harness: An Iterative Loop for Model-Specific Harness Improvement\nHuman harness engineering improves agent harnesses through expert inspection and manual revision,\nwhile external optimizer approaches treat harness design choices as a searchable space. Self-Harness\nstudies a middle ground in which a fixed model iteratively improves the harness around itself through\nan explicit self-improvement loop driven by execution evidence. In each iteration, the evaluation\nsystem runs the current harness and mines recurring failure patterns from clustered execution traces\nto produce structured evidence. Given this evidence, the same model is invoked in a proposer role to\ngenerate a set of diverse yet minimal candidate harness modifications, each targeting a specific failure\nmechanism without replacing the overall control architecture. Candidate edits are then validated\nthrough regression testing on held-out tasks, and an explicit acceptance rule promotes only those\nedits that improve performance without introducing unacceptable regressions.\n3.1. Preliminary\nWe use harness to denote the non-parametric scaffolding that governs how a fixed language model\nis deployed as an agent. A harness includes the instructions, the available tools, memory and state4\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nWeakness Mining\n\nMissing\nValidation\n\nRun  \n\non tasks\n\nCollected\n\nExecution Traces\n\nCorrupted\nTool\n\nProceed to Next\n\nIteration\n\nClustered \n\nFailure Patterns\n\nFailure Patterns \n\n&amp; Insights\nCurrent Harness\n\nHarness Proposal\n\nprompts · tools · memory · policies\nW1: Missing \n\nValidation\n\nFixed Model\n\nLoop Breaker\n\nMiddleware\n\nFixed\nModel\n\nW3: Corrupted \n\nTool Call\n\nSelected\n\nFailure Patterns\n\nprompts · tools · memory · policies\n\nValidate \n\nbefore Conclude\n\nCurrent\nHarness\n\nW2: Unlimited \n\nExploration\n\nUpdated Harness\n\nTool \n\nPolicy Update\n\nas\n\nProposer\n\nProposed\n\nHarness Edits\n\nFixed Model\n\nProposed Harness\n\nCandidates\n\nProposal Validation\n\nAll Reject - No Update\n\nValidate \n\nbefore Conclude\n\nAccept\n\nLoop Breaker\n\nMiddleware\n\nAccept\n\nTool \n\nPolicy Update\n\nReject\nRegression\n\nTest\n\nAccept - Update Harness\n\nPromotion\n\nDecision\n\nFigure 2 | Overview of one Self-Harness optimization loop. The current harness ℎ𝑡 with fixed model\nis evaluated on tasks to collect execution traces, which are clustered into verifier-grounded failure\npatterns. The same model is then invoked under the current harness as a proposer, using the mined\nfailure patterns to generate bounded candidate harness edits. Candidate edits are evaluated by\nregression tests on held-in and held-out splits. Accepted candidates are merged to update the harness\nto ℎ𝑡+1 , while rejected candidates are logged without changing the active harness. Throughout the\nloop, the model weights and evaluator remain fixed; only the surrounding harness is modified.\nmanagement mechanisms, etc. The harness does not modify the model parameters; instead, it\nspecifies the execution protocol through which the model observes a task, takes actions, invokes tools,\nchecks intermediate artifacts, and produces a final answer.\nFormally, let 𝑀 be a fixed language model and let ℎ denote an agent harness. Given a task instance\n𝑥 , running 𝑀 under harness ℎ produces an execution trace 𝜏 and an output 𝑦 . The trace records the\nmessages, tool calls, and verifier outcomes. An evaluator then maps the task, trace, and output to\na behavioral outcome, such as pass/fail. In this work, the model 𝑀 and evaluator E are held fixed,\nwhile the harness is treated as the object of improvement. Self-Harness therefore operates over a\nlineage of harnesses ℎ0 , ℎ1 , . . ., where each transition corresponds to a bounded edit to the execution\nprotocol rather than an update to the model weights.\n3.2. Weakness Mining: Identifying Failure Patterns from Clustered Execution Traces\nThe first stage of Self-Harness converts behavioral failures into structured evidence for harness revision.\nAt round 𝑡 , we run the fixed model 𝑀 under the current harness ℎ𝑡 on a held-in split 𝐷in . For each\ntask instance 𝑥 𝑖 ∈ 𝐷in , the run produces an output 𝑦𝑖 and an execution trace 𝜏𝑖 . The evaluator E then\n\n5\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nAlgorithm 1 Self-Harness\nRequire: fixed model 𝑀 , initial harness ℎ0 , held-in split 𝐷in , held-out split 𝐷ho , evaluator E, proposal\nwidth 𝐾 , rounds 𝑇\nEnsure: final harness ℎ𝑇\n1: for 𝑡 = 0, 1, . . . , 𝑇 − 1 do\n2:\n( 𝑃in ( ℎ𝑡 ) , 𝑃ho ( ℎ𝑡 ) , 𝑅𝑡 ) ← Evaluate( 𝑀, ℎ𝑡 , 𝐷in , 𝐷ho , E)\n3:\n𝐵𝑡 ← BuildEvidenceBundle( 𝑅𝑡 )\n⊲ from held-in verifier-grounded failures\n4:\nP𝑡 ← ParallelPropose( 𝑀, ℎ𝑡 , 𝐵𝑡 , 𝐾 )\n⊲ P𝑡 = {( Δ 𝑗 , 𝑎 𝑗 )} 𝐾𝑗=1\n5:\nA𝑡 ← ∅\n6:\nfor all ( Δ 𝑗 , 𝑎 𝑗 ) ∈ P𝑡 do\n( 𝑗)\n7:\nℎ𝑡 ← Δ 𝑗 ( ℎ𝑡 )\n8:\n( 𝑃in ( ℎ𝑡( 𝑗 ) ) , 𝑃ho ( ℎ𝑡( 𝑗 ) ) , 𝑅𝑡( 𝑗 ) ) ← Evaluate( 𝑀, ℎ𝑡( 𝑗 ) , 𝐷in , 𝐷ho , E)\n( 𝑗)\n( 𝑗)\n9:\nΔin ← 𝑃in ( ℎ𝑡 ) − 𝑃in ( ℎ𝑡 )\n( 𝑗)\n( 𝑗)\n10:\nΔho ← 𝑃ho ( ℎ𝑡 ) − 𝑃ho ( ℎ𝑡 )\n11:\n\n( 𝑗)\n( 𝑗)\n( 𝑗)\n( 𝑗)\nif Δin\n≥ 0 and Δho\n≥ 0 and max( Δin\n, Δho ) &gt; 0 then\n\n( 𝑗)\n( 𝑗)\nA𝑡 ← A𝑡 ∪ {( ℎ𝑡( 𝑗 ) , Δ 𝑗 , 𝑎 𝑗 , Δin\n, Δho )}\n13:\nAccept( Δ 𝑗 )\n14:\nelse\n15:\nReject( Δ 𝑗 )\n16:\nend if\n17:\nend for\n18:\nif A𝑡 = ∅ then\n19:\nℎ𝑡+1 ← ℎ𝑡\n20:\nelse\n21:\nℎ𝑡+1 ← MergeAccepted( ℎ𝑡 , A𝑡 )\n22:\nend if\n23: end for\n24: return ℎ𝑇\n\n12:\n\n⊲ passed acceptance rule\n\n⊲ no accepted candidate\n⊲ accepted edits are merged\n\nassigns an outcome 𝑧 𝑖 = E ( 𝑥 𝑖 , 𝜏𝑖 , 𝑦𝑖 ), such as pass or fail. This yields a trace record\n𝑟𝑖 = ( 𝑥 𝑖 , 𝜏𝑖 , 𝑦𝑖 , 𝑧 𝑖 ) ,\n𝐷in |\nand a round-level record set 𝑅𝑡 = {𝑟𝑖 } 𝑖|=1\n. Since both 𝑀 and E are fixed, changes in these records\nacross rounds can be attributed to changes in the harness.\n\nA central role of the evaluation system is to avoid treating failures as isolated anecdotes. We\ntherefore focus on the subset of failed records\n𝐹𝑡 = {𝑟𝑖 ∈ 𝑅𝑡 | 𝑧 𝑖 = fail} .\n\nand cluster them by verifier-grounded failure signatures. For each failed record 𝑟𝑖 , the evaluation\nsystem analyzes the trace as evidence for why the evaluator rejected the run. It identifies the terminal\nfailure reason exposed by the verifier, the agent-side behavior connected to that terminal failure,\nand the causal status of that behavior within the trace. This attribution step prevents the clustering\nprocedure from conflating superficial symptoms with reusable failure mechanisms: two runs may\nshare the same verifier outcome, such as a timeout or missing artifact, while requiring different\nharness changes because the underlying agent behaviors differ.\n\n6\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nWe write this attribution as a failure signature\n𝜙 ( 𝑟𝑖 ) = ( 𝑐 𝑖 , 𝑞𝑖 , 𝑚 𝑖 ) ,\n\nwhere 𝑐𝑖 denotes the terminal verifier-level cause, 𝑞𝑖 denotes the causal status of the relevant agent\nbehavior, and 𝑚𝑖 denotes the abstract agent mechanism exposed by the trace. Failures are clustered\nby exact agreement of this signature:\n𝐶 𝜙 = { 𝑟 𝑖 ∈ 𝐹𝑡 | 𝜙 ( 𝑟 𝑖 ) = 𝜙 }\n\nThus, the clustering is deterministic and evaluator-grounded: two failed cases are grouped together\nonly when they agree on what the verifier ultimately rejected, how the agent behavior contributed to\nthat rejection, and which reusable behavioral mechanism was involved. The goal is not to discover\nlatent semantic similarity among traces, but to aggregate failures that plausibly admit the same\nharness-level intervention.\nFor each cluster 𝐶𝜙 , the evaluation system constructs a structured failure pattern containing its\ncluster size, representative task instances, shared trace symptoms, verifier evidence, and the inferred\nagent mechanism. Clusters are then ordered by their support and estimated actionability, so that the\nproposer is exposed first to recurring mechanisms that are more likely to map to a high-value harness\nmodification.\nThe output of this stage is an evidence bundle 𝐵𝑡 summarizing the dominant failure patterns\nobserved under ℎ𝑡 . Importantly, 𝐵𝑡 does not prescribe a harness edit. It separates verifier-level failure\nfrom agent-level mechanism, allowing the proposer to target a specific reusable weakness rather\nthan patching a coarse outcome such as timeout, assertion failure, or missing output. This keeps the\nevaluator distinct from the optimizer while ensuring that subsequent candidate modifications are\ngrounded in explicit cross-case evidence.\n3.3. Harness Proposal: Exploring Diverse yet Minimal Candidate Modifications\nGiven the evidence bundle 𝐵𝑡 , the proposal stage translates recurring failure patterns into candidate\nharness edits. The proposer is not an external optimizer with unrestricted access to the search space.\nInstead, we invoke the same fixed model 𝑀 with current harness ℎ𝑡 in a proposer role and provide it\nwith a bounded proposal context: the editable surfaces of the current harness, the verifier-grounded\nfailure patterns from the evaluation system, records of passing behaviors that should be preserved, and\nsummaries of previously attempted edits. This context exposes the proposer to structured cross-case\nevidence rather than raw execution logs, encouraging it to reason about reusable failure mechanisms\nrather than individual task failures.\nSelf-Harness uses parallel proposal generation to explore several candidate improvements from\nthe same evidence. The proposer generates 𝐾 mutually distinct proposal bundles,\nP𝑡 = {( Δ 𝑗 , 𝑎 𝑗 )} 𝐾𝑗=1 ,\nwhere each edit Δ 𝑗 maps the current harness to a candidate harness\n( 𝑗)\n\nℎ𝑡\n\n= Δ 𝑗 ( ℎ𝑡 ) .\n\nand 𝑎 𝑗 is an audit record describing the targeted failure pattern, the edited harness surface, the\nexpected behavioral effect, and the regression risks. Each proposal must be grounded in a primary\nfailure mechanism and mapped to a concrete editable surface. The candidates are required to be\nmaterially distinct: they should not merely restate the same cluster, surface, or mechanism with\n7\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\ndifferent wording. This parallel proposal step broadens exploration while keeping each candidate\nbranch individually interpretable.\nThe proposer first selects target failure patterns from 𝐵𝑡 . A pattern is considered a suitable target\nonly if it is both supported by evidence and plausibly addressable by an editable harness surface.\nThis addressability criterion is important because not every failure cluster implies a useful harness\nmodification: some clusters reflect task-specific difficulty, unstable outcomes, or model capability\nlimits rather than a missing execution rule. When multiple clusters are plausible, the proposer favors\nmechanisms that are concrete, recurrent, and likely to be mitigated by a narrow change to the\nexecution protocol; weakly supported or non-addressable patterns are excluded rather than forced\ninto a patch.\nDiversity is encouraged across proposal branches, while minimality is enforced within each branch.\nA proposal may target a different failure mechanism, choose a different harness surface, or express a\ndifferent hypothesis about how to improve execution. However, each individual edit is constrained\nto modify only the surface needed to address its selected mechanism, preserve unrelated harness\nbehavior, and avoid broad rewrites of the agent control architecture.\n3.4. Proposal Validation: Ensuring Robust Improvement through Regression Testing\nA candidate harness edit is not adopted immediately after it is proposed. Instead, each candidate\nbranch is treated as a new harness variant and evaluated under the same evaluator used to diagnose\nthe current harness. For a proposal Δ 𝑗 , let ℎ𝑡( 𝑗 ) = Δ 𝑗 ( ℎ𝑡 ) denote the resulting candidate harness. We\nevaluate both the current harness ℎ𝑡 and the candidate harness ℎ𝑡( 𝑗 ) on the held-in split 𝐷in and the\nheld-out split 𝐷ho . The held-in split measures whether the proposal addresses the evidence that\nmotivated it, while the held-out split serves as a regression test for behaviors that were not visible to\nthe proposer.\nLet 𝑃in ( ℎ) and 𝑃ho ( ℎ) denote the number of passed tasks for harness ℎ on 𝐷in and 𝐷ho , respectively.\nWe define the split-wise improvements of candidate ℎ𝑡( 𝑗 ) over the current harness as\n( 𝑗)\n\n( 𝑗)\n\n( 𝑗)\n\n( 𝑗)\n\nΔin = 𝑃in ( ℎ𝑡 ) − 𝑃in ( ℎ𝑡 ) ,\n\nand\n\nΔho = 𝑃ho ( ℎ𝑡 ) − 𝑃ho ( ℎ𝑡 ) .\n\nA candidate is accepted only if it improves at least one split without degrading the other:\n\u0010\n\u0011\n( 𝑗)\n( 𝑗)\n( 𝑗)\n( 𝑗)\nΔin ≥ 0, Δho ≥ 0, max Δin , Δho &gt; 0.\nThis rule implements a conservative promotion criterion. Proposals that only trade off one split against\nthe other are rejected, even if their total pass count increases. When evaluation is stochastic, we repeat\ncandidate evaluation and apply the same rule to aggregate pass counts across repeats. This reduces\nthe chance that a harness edit is promoted due to a single favorable run. If multiple compatible\ncandidates satisfy the rule in the same round, their edits are merged into the next harness; rejected\ncandidates remain logged but do not change the active harness. In addition to the pass-count rule,\nvalidation rejects proposals that do not modify any editable surface or fail execution before a valid\nevaluation result is obtained. For each evaluated candidate, the system records the changed surfaces,\nsplit-wise outcomes, evaluation repeats, proposal summary, and accept/reject decision, making each\ntransition in the harness lineage auditable.\n\n8\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\n4. Experiments\nWe evaluate whether Self-Harness can improve agent performance by modifying only the harness\naround a fixed language model across three agentic benchmarks: Terminal-Bench-2.0, SWE-bench\nVerified, and AppWorld. Together, they cover terminal interaction in containerized environments,\nrepository-level software repair, and multi-application workflows. Across three model backends, we\nstart from a minimal benchmark-specific harness and let Self-Harness propose, validate, and promote\nbounded edits using held-in execution evidence and held-out regression gates.\n4.1. Setup\nBenchmarks. We evaluate Self-Harness on Terminal-Bench-2.0 (Merrill et al., 2026), SWE-bench\nVerified (Jimenez et al., 2024), and AppWorld (Trivedi et al., 2024). Terminal-Bench-2.0 contains 89\ncontainerized terminal tasks that test general tool-based execution, including artifact management,\ncommand use, verification behavior, and recovery from execution errors. We evaluate on a fixed 64-case\nsubset, excluding tasks that depend on unstable external web resources or require multimodal inputs.\nThis filtering reduces evaluation noise from factors outside the harness. In particular, multimodal\ntasks require modality-specific input handling that is not exposed by our minimal initial harness;\nincluding them would primarily measure unsupported harness functionality rather than the effect\nof Self-Harness edits. SWE-bench Verified evaluates repository-level software repair: an agent must\ninspect a real codebase, implement a patch for a reported issue, and satisfy repository tests in the\nbenchmark-provided per-instance execution environment. We use a fixed 100-case subset partitioned\ninto 67 held-in and 33 held-out cases. Cases are sampled proportionally by repository. AppWorld\nevaluates multi-application workflows in which an agent interacts with application APIs and is graded\nby state-based unit tests. We use 180 examples divided evenly between held-in and held-out splits.\nThe held-in split contains the official training tasks, while the held-out split is fixed by proportionally\nsampling from the official normal and challenge test partitions.\nModels. We evaluate Self-Harness with three models: MiniMax M2.5 (MiniMax, 2026), Qwen3.535B-A3B (Qwen Team, 2026), and GLM-5 (GLM-5 Team, 2026). The model is held fixed across all\nharness variants and is also used in the proposal stage to generate edits from evaluator feedback. All\ncomparisons are therefore within-model comparisons: the decoding configuration, budget, tool set,\nbenchmark environment, and evaluator are kept unchanged while only the harness is allowed to vary.\nThis isolates the effect of Self-Harness from changes in model capability or evaluation protocol.\nHarness. The initial harness builds upon the DeepAgent (LangChain, 2026) SDK but is intentionally\nkept minimal: a short benchmark-facing system prompt, and the default filesystem and shell tools.\nSelf-Harness can only change the harness definition file that configures how DeepAgent is instantiated\nand controlled to build a new harness candidate ℎ𝑡( 𝑗 ) . The editable surfaces correspond to declared\nconfiguration points in this harness, such as instruction, tools, verification guidance, etc. Figure 3\nshows the initial harness implementation.\nSplits and protocol. We fix the evaluated task set and partition it into a held-in split and a held-out\nsplit before running Self-Harness. The held-in split supplies the trajectories, verifier outcomes, and\nfailure evidence exposed to the proposer, while the held-out split is never shown to the proposer and\nis used only by the automatic promotion gate. A candidate harness is promoted with the acceptance\nrule defined in Section 3.4. Task split assignments are fixed across harness variants, and each task\n\n9\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\ndef build_system_prompt() -&gt; str:\nreturn \"\"\"\n3 You are running inside a Terminal Bench 2 Harbor task environment.\n1\n2\n4\n5\n6\n\nUse the built-in filesystem and shell tools to inspect the workspace, make\nconcrete edits, and verify outcomes against the actual task environment.\n\n7\n\nDo not assume synthetic datasets, domain-specific tools, or hidden fixtures\nunless you discover them in the repo or runtime.\n10 \"\"\".strip()\n8\n9\n\n11\n12\n13\n\nBASELINE_SYSTEM_PROMPT = build_system_prompt()\n\n14\n15\n16\n17\n\ndef build_memory_sources() -&gt; list[str]:\nreturn [\"/AGENTS.md\"]\n\n18\n19\n20\n21\n\ndef build_subagents() -&gt; list[dict[str, Any]]:\nreturn []\n\n22\n23\n24\n25\n\ndef build_skills() -&gt; list[str]:\nreturn []\n\n26\n27\n28\n29\n\ndef build_bootstrap_instruction() -&gt; str:\nreturn \"Start by inspecting the workspace and identifying the smallest relevant edit surface.\"\n\n30\n31\n32\n33\n\ndef build_execution_instruction() -&gt; str:\nreturn \"Prefer concrete repo changes over generic advice, and keep edits tightly scoped to the\ntask.\"\n\n34\n35\n36\n37\n\ndef build_verification_instruction() -&gt; str:\nreturn \"Before concluding, verify the result with the most targeted command, file read, or test\nyou can run.\"\n\n38\n39\n40\n41\n\ndef build_failure_recovery_instruction() -&gt; str:\nreturn \"If a tool call fails, inspect the error and adapt; do not blindly retry the same action.\"\n\n42\n43\n\ndef build_runtime_control_policy() -&gt; dict[str, Any]:\nreturn {\n46\n\"enabled\": False,\n47\n\"max_recent_tool_errors\": None,\n48\n\"max_total_tool_messages\": None,\n49\n\"instruction\": None,\n50\n}\n44\n45\n\n51\n52\n\ndef build_fixed_harness_agent(\nmodel: \"BaseChatModel | str\",\n55\n*,\n56\nbackend: Any | None = None,\n57 ):\n58\nif backend is not None:\n59\nreturn create_deep_agent(model=model, system_prompt=BASELINE_SYSTEM_PROMPT, backend=backend)\n60\nreturn create_deep_agent(model=model, system_prompt=BASELINE_SYSTEM_PROMPT)\n53\n54\n\nFigure 3 | Initial harness and editable interface used as the starting point for Self-Harness. The harness\nis intentionally kept minimal, consisting only of the Terminal-Bench-2.0 default system prompt, the\ndefault DeepAgent tools (basic file reading, file writing, file editing, and shell execution), and the\ndeclared interfaces that Self-Harness is allowed to modify.\n\n10\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nInitial harness\n\nModel\n\nMiniMax M2.5\nQwen3.5-35B-A3B\nGLM-5\n\nOverall\n\nSelf-Harness\n\nHeld-in\n\nHeld-out\n\nHeld-in\n\nHeld-out\n\n43.0\n15.1\n47.7\n\n40.5\n23.8\n42.9\n\nTerminal-Bench-2.0\n42.2\n50.0 (+16%)\n61.9 (+53%)\n18.0\n36.0 (+138%) 38.1 (+60%)\n46.1\n57.0 (+20%)\n57.1 (+33%)\n\n53.9 (+28%)\n36.7 (+104%)\n57.0 (+24%)\n52.5 (+14%)\n41.5 (+113%)\n55.5 (+7%)\n58.9 (+21%)\n52.2 (+132%)\n85.0 (+91%)\n\nMiniMax M2.5\nQwen3.5-35B-A3B\nGLM-5\n\n51.5\n20.1\n53.7\n\n34.8\n18.2\n48.5\n\nSWE-bench Verified\n46.0\n58.2 (+13%)\n40.9 (+18%)\n19.5\n42.5 (+111%) 39.4 (+116%)\n52.0\n58.2 (+8%)\n50.0 (+3%)\n\nMiniMax M2.5\nQwen3.5-35B-A3B\nGLM-5\n\n51.7\n25.0\n47.8\n\n45.6\n20.0\n41.1\n\nAppWorld\n48.6\n62.8 (+21%)\n55.0 (+21%)\n22.5\n60.0 (+140%) 44.4 (+122%)\n44.4\n92.2 (+93%) 77.8 (+89%)\n\nOverall\n\nTable 1 | Held-in, held-out, and overall pass rates (%) for the initial and final harnesses. Bold black\nvalues denote the final harness produced by Self-Harness.\nstarts from a fresh benchmark environment. These controls ensure that measured improvements\ncome from harness changes.\nMetrics. Our primary metric is Pass (%), the percentage of evaluated task attempts that pass the\ncorresponding benchmark’s official verifier, computed over two repeated attempts for each harness\ncandidate unless otherwise specified. This measures mean single-attempt task success under a fixed\nharness configuration and evaluation protocol.\n4.2. Main Results\nTable 1 shows that every final harness improves Pass on both held-in and held-out splits across all\nnine model–benchmark combinations. The largest relative gain is 132% for Qwen3.5-35B-A3B on\nAppWorld, while the largest absolute gain is 40.6 percentage points for GLM-5 on AppWorld, from\n44.4% to 85.0%. Meanwhile, the relative held-out gain exceeds the held-in gain in four combinations:\nMiniMax M2.5 and GLM-5 on Terminal-Bench-2.0, and MiniMax M2.5 and Qwen3.5-35B-A3B on\nSWE-bench Verified.\nThese results show that harness-level edits can yield measurable improvements while keeping the\nmodel backend, tool set, budget, benchmark environment, and evaluator fixed. The gains are not\nconfined to the held-in failures used to construct proposal evidence: all three backends improve on the\nheld-out split, and no promoted harness degrades either split. This supports the central design goal of\nSelf-Harness: proposed edits should target reusable execution mechanisms rather than case-specific\nfailures, and the regression gate should prevent improvements on one split from being promoted at\nthe cost of another.\n4.3. Experimental Analysis\nHarness evolution and retained edits. Figure 4 presents four representative evolution trajectories\nspanning all three benchmarks, while Figures 5 and 6 show the retained code-level edits for the two\nTerminal-Bench-2.0 examples. On Terminal-Bench-2.0, the retained edits primarily target artifact\nhandling, failure recovery, and runtime control; on SWE-bench Verified, they target patch validation\n11\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\naccepted\n\nLate deliverables\n\n&gt; artifact-ensure subagent\n\n24\n\nMissing files\n\n24.2\n\n21.1\n\n20 18.0\n\n53.9\n\n51.6\n\n&gt; create within 2 steps\n\n&gt; dependency-verifier skill\n\nSchema-invalid content\n\n&gt; use correct content tags\n\n54\n\n32.8\n\nSkipped imports\n\n28\n\n&gt; create output early\n\n36.7\n34.4\n\n31.3\n\nMissing artifacts\n\nTool errors\n\nPass (%)\n\nPass (%)\n\n32\n\nbranch endpoint\n\n&gt; middleware guard\n\nExploration loops\n\n&gt; force a change\n\n36\n\nrejected\n\n50.0\n49.2\n\n50\n\nCombined harness\n\nartifacts + schemas + loops\n\nStalled tool loops\n\n46\n\n&gt; redirect after 50 tool calls\n\nMissing modules\n\n&gt; precheck imports\n\nInitial harness\n\n42.2\n\nInitial harness\n\n42\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n0\n\n9 10 11 12 13 14 15 16 17 18 19 20\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\n14\n\n15\n\nCandidate evaluations\n\nCandidate evaluations\n\n(a) Qwen3.5-35B-A3B on Terminal-Bench-2.0.\n\n(b) MiniMax M2.5 on Terminal-Bench-2.0.\nMerged retained\n\n90\n\n56\n\nUntested patch\n\nEmpty patches\n\n&gt; diff detector\n\n52\n\n50.0\n\n50\n48\n46\n\n&gt; null completion\n\n&gt; local verification\n\nStricter test policy\n\n&gt; local-test enforcement\n\n46.0\n\n70\n\n76.4\n67.2\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\nCandidate evaluations\n\n(c) MiniMax M2.5 on SWE-bench Verified.\n\n9\n\n&gt; pagination exhaustion\nTurn-budget exhaustion\n\n&gt; progress-check reminder\n\n44.4\nInitial harness\n\n40\n\n1\n\nPartial record lists\n\n74.7\n\n60\n50\n\nInitial harness\n\n44\n0\n\n85.0\n\n80\n\n52.5\n51.0\n\nPass (%)\n\nPass (%)\n\n54\n\n&gt; completion + pagination\n\nAction-only tasks\n\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\nCandidate evaluations\n\n(d) GLM-5 on AppWorld.\n\nFigure 4 | Representative Self-Harness evolution trajectories across model backends and benchmarks.\nGreen markers denote accepted harness candidates, gray crosses denote rejected candidates, and red\ncrosses mark explored branch endpoints. Step lines connect candidates to their parent harness; the\nx-axis follows candidate-evaluation order.\nand executable verification; and on AppWorld, complete state retrieval and correct completion\nsemantics. The concrete implementation of these mechanisms remains model-specific. Across these\nruns, proposed edits passing validation are denoted as green nodes. Red nodes and grey slots denote\nrejected branches and failing trials, respectively. The corresponding GLM-5 Terminal-Bench-2.0 run is\nintroduced in Appendix Figure 10, and Sections B.2 and B.3 report the remaining SWE-bench Verified\nand AppWorld evolution, code-level, and trace analyses.\nFor MiniMax M2.5, the harness improves from 42.2% to 53.9% pass rate. The retained edits in\nFigure 5 address missing required artifacts, schema-invalid tool content, and stalled tool-use loops,\nyielding a harness that creates required outputs earlier, handles structured tool content more carefully,\nand redirects execution after prolonged tool interaction.\nThe Qwen3.5 evolution run shown in Figure 4(a) starts at 18.0% pass rate and reaches 36.7% after\nmerging the edits shown in Figure 6, which emphasize artifact checking, missing-artifact recovery,\nretry discipline, and tool-error-triggered middleware. These changes mainly improve the agent’s\nability to recover from file-editing or tool failures and still leave verifier-required artifacts in place.\nFor GLM-5, the harness improves from 46.1% to 57.0% through edits targeting late artifacts,\nexternal computation, session-scoped tools, and implementation-oriented exploration. These edits\nmake environment changes persist across shell commands and encourage the agent to move from\nprolonged exploration toward implementation and testing.\n\n12\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 5 | Code-level differences for the three MiniMax M2.5 Terminal-Bench-2.0 harness modifications\nretained in the final promoted harness. Red rows denote code removed from the initial harness, and\ngreen rows denote the updated harness behavior.\n\nTrace-Level Analysis of Accepted Edits. To examine how accepted harness edits affect agent\nbehavior, we compare representative traces before and after harness modification. Figures 7 and 8\nshow Terminal-Bench-2.0 examples for MiniMax M2.5 and Qwen3.5-35B-A3B, with the GLM-5\nexample shown in Appendix Figure 9. Sections B.2 and B.3 provide corresponding SWE-bench\nVerified and AppWorld cases. Across benchmarks, the retained edits are model- and task-environmentspecific and align with the dominant failure mechanisms observed under each initial harness.\nFor MiniMax M2.5, the accepted edits emphasize early artifact creation and bounded execution.\nThe bootstrap instruction is changed from merely identifying the smallest relevant edit surface to\nidentifying the required output artifact and creating an initial version as early as possible. The runtime\npolicy is also enabled with a limit on total tool messages, encouraging the agent to redirect rather than\ncontinue open-ended tool use. Figure 7 shows that this changes the agent from prolonged dataset\nexploration to a concrete workflow: identifying the relevant metadata split, computing the required\ncount, writing the answer file, and reading it back before stopping.\nFor Qwen3.5, the promoted harness adds constraints for dependency prechecking, loop breaking,\ncommand-retry discipline, and artifact-focused recovery after tool errors. Figure 8 illustrates how\nthese edits change failure recovery behavior. Under the initial harness, the agent creates the required\nextractor script, encounters overwrite and edit failures, repeatedly tries to modify the same artifact,\nand ultimately deletes /app/extract.js before stopping; the verifier therefore fails because the\nrequired file is missing. Under the edited harness, a tool-error-triggered system prompt redirects the\nagent toward the missing artifact: it recreates the extractor, fixes the parsing logic, writes the output\nfile, performs targeted validation of the JSON result, and leaves the required artifact present for the\nverifier.\nFor GLM-5, the accepted edits focus on persistent environment changes and the transition from\nexploration to implementation. The edited harness instructs the agent to make installed tools or path\nchanges persist across shell sessions and to verify tool accessibility after modifying the environment.\n\n13\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 6 | Code-level differences for the four Qwen3.5-35B-A3B Terminal-Bench-2.0 harness modifications retained in the final promoted harness. Red rows denote code removed from the initial harness,\nand green rows denote the updated harness behavior.\nIt also adds a verification-stage constraint: if the agent has been exploring without producing required\nartifacts, it should transition to implementing and testing a solution. Figure 9 shows this behavior\nin a build task. The initial harness spends substantial budget on long external downloads and later\nrationalizes failed sanity checks, whereas the edited harness switches strategy after timeout evidence,\nvalidates alternative sources early, repairs the failing render check, and only then finalizes.\nTogether with the cross-benchmark cases in Sections B.2 and B.3, these examples illustrate concrete\nworkflow changes associated with the quantitative gains in Table 1, including earlier artifact creation,\nrecovery from failed actions, complete state retrieval, and explicit verification before completion.\nThe trace evidence is consistent with the intended mechanism of Self-Harness: recurring execution\nfailures are translated into targeted changes to agent workflow.\n\n5. Conclusion\nThis paper studied whether a fixed language model can improve the harness that governs its own agent\nbehavior. We introduced Self-Harness, a propose–evaluate–accept framework in which the model\nis evaluated under the current harness, receives structured evidence from its own execution traces,\nand proposes bounded edits to declared harness surfaces. Candidate harnesses are then re-evaluated\nunder the same benchmark protocol, and only edits that satisfy a non-regressive acceptance rule are\npromoted into the harness lineage.\nThe main lesson is that harness improvement should be treated as an empirical state transition. A\n14\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 7 | Representative MiniMax M2.5 traces on the Terminal-Bench-2.0 count-dataset-tokens\ntask. Left: the initial harness ends without the required answer artifact. Right: the edited harness\nproduces and verifies /app/answer.txt.\nuseful harness edit must specify the behavior it aims to change, the surface it modifies, the evidence\nthat motivates it, and the evaluation result that justifies promotion. By keeping the model, evaluator,\nand benchmark protocol fixed, Self-Harness isolates whether improved behavior comes from changes\nto the harness scaffold.\nOur experiments across Terminal-Bench-2.0, SWE-bench Verified, and AppWorld instantiate this\nprotocol with a minimal DeepAgent-based baseline harness and three model backends. Self-Harness\nimproves Pass (%) across all nine model–benchmark combinations while preserving held-in and\nheld-out performance under the acceptance rule. The retained edits are small, auditable changes\nto configurable harness surfaces that address distinct bottlenecks in artifact handling and runtime\ncontrol, software-patch verification, and application-state retrieval, suggesting that even sparse initial\nharnesses can support useful self-improvement when proposals are constrained by execution evidence\nand validated by regression testing.\nSelf-Harness also has important limits. It studies bounded harness edits under fixed benchmarks,\nnot open-ended self-improvement. Accepted edits may still reflect benchmark-specific failure patterns,\nand the protocol depends on the quality of verifier outcomes and trace records. Higher-stakes harness\nchanges would require stronger acceptance gates than pass-rate non-regression alone.\nMore broadly, Self-Harness points toward a style of agent engineering in which harnesses evolve\nthrough recorded, testable, and reversible changes. Future work can further explore application of\nself-harness-style self-improvement in broader environments, but the core requirement remains the\nsame: self-improvement should be grounded in behavioral evidence rather than only in the proposer’s\nrationale for a plausible edit.\n\nReferences\nLingyue Fu, Xin Ding, Linyue Pan, Yaoming Zhu, Shao Zhang, Lin Qiu, Weiwen Liu, Weinan Zhang,\nXuezhi Cao, Xunliang Cai, Jiaxin Ding, and Yong Yu. Catarena: Evaluation of llm agents through\niterative tournament competitions. In International Conference on Machine Learning. PMLR, 2026.\n\n15\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nGLM-5 Team. Glm-5: from vibe coding to agentic engineering, 2026. URL https://arxiv.org/\nabs/2602.15763.\nShengran Hu, Cong Lu, and Jeff Clune. Automated design of agentic systems, 2025. URL https:\n//arxiv.org/abs/2408.08435.\nCarlos E. Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik\nNarasimhan. Swe-bench: Can language models resolve real-world github issues?, 2024. URL\nhttps://arxiv.org/abs/2310.06770.\nLangChain. Deepagents, 2026. URL https://github.com/langchain-ai/deepagents. Software framework.\nYoonho Lee, Roshen Nair, Qizheng Zhang, Kangwook Lee, Omar Khattab, and Chelsea Finn. Metaharness: End-to-end optimization of model harnesses, 2026. URL https://arxiv.org/abs/\n2603.28052.\nPatrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal,\nHeinrich Kuttler, Mike Lewis, Wen-tau Yih, Tim Rocktaschel, Sebastian Riedel, and Douwe Kiela.\nRetrieval-augmented generation for knowledge-intensive nlp tasks. In Advances in Neural Information\nProcessing Systems, 2020. URL https://arxiv.org/abs/2005.11401.\nYongyuan Liang, Shijie Zhou, Yu Gu, Hao Tan, Gang Wu, Franck Dernoncourt, Jihyung Kil, Ryan A\nRossi, and Ruiyi Zhang. Anticipatory planning for multimodal ai agents. In Proceedings of the\nIEEE/CVF Conference on Computer Vision and Pattern Recognition, pages 5925–5935, 2026.\nJiahang Lin, Shichun Liu, Chengjun Pan, Lizhi Lin, Shihan Dou, Zhiheng Xi, Xuanjing Huang, Hang\nYan, Zhenhua Han, Tao Gui, and Yu-Gang Jiang. Agentic harness engineering: Observability-driven\nautomatic evolution of coding-agent harnesses, 2026. URL https://arxiv.org/abs/2604.\n25850.\nJiacheng Liu, Xiaohan Zhao, Xinyi Shang, and Zhiqiang Shen. Dive into claude code: The design space\nof today’s and future ai agent systems, 2026. URL https://arxiv.org/abs/2604.14228.\nPengfei Liu, Weizhe Yuan, Jinlan Fu, Zhengbao Jiang, Hiroaki Hayashi, and Graham Neubig. Pre-train,\nprompt, and predict: A systematic survey of prompting methods in natural language processing,\n2021. URL https://arxiv.org/abs/2107.13586.\nChris Lu, Cong Lu, Robert Tjarko Lange, Jakob Foerster, Jeff Clune, and David Ha. The ai scientist:\nTowards fully automated open-ended scientific discovery, 2024. URL https://arxiv.org/abs/\n2408.06292.\nLingrui Mei, Jiayu Yao, Yuyao Ge, Yiwei Wang, Baolong Bi, Yujun Cai, Jiazhi Liu, Mingyu Li, Zhong-Zhi\nLi, Duzhen Zhang, Chenlin Zhou, Jiayi Mao, Tianze Xia, Jiafeng Guo, and Shenghua Liu. A survey\nof context engineering for large language models, 2025. URL https://arxiv.org/abs/2507.\n13334.\nMike A. Merrill, Alexander G. Shaw, Nicholas Carlini, Boxuan Li, Harsh Raj, Ivan Bercovich, Lin Shi,\nJeong Yeon Shin, Thomas Walshe, E. Kelly Buchanan, Junhong Shen, Guanghao Ye, Haowei Lin,\nJason Poulos, Maoyu Wang, Marianna Nezhurina, Jenia Jitsev, Di Lu, Orfeas Menis Mastromichalakis,\nZhiwei Xu, Zizhao Chen, Yue Liu, Robert Zhang, Leon Liangyu Chen, Anurag Kashyap, Jan-Lucas\nUslu, Jeffrey Li, Jianbo Wu, Minghao Yan, Song Bian, Vedang Sharma, Ke Sun, Steven Dillmann,\nAkshay Anand, Andrew Lanpouthakoun, Bardia Koopah, Changran Hu, Etash Guha, Gabriel H. S.\nDreiman, Jiacheng Zhu, Karl Krauth, Li Zhong, Niklas Muennighoff, Robert Amanfu, Shangyin Tan,\n16\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nShreyas Pimpalgaonkar, Tushar Aggarwal, Xiangning Lin, Xin Lan, Xuandong Zhao, Yiqing Liang,\nYuanli Wang, Zilong Wang, Changzhi Zhou, David Heineman, Hange Liu, Harsh Trivedi, John\nYang, Junhong Lin, Manish Shetty, Michael Yang, Nabil Omi, Negin Raoof, Shanda Li, Terry Yue\nZhuo, Wuwei Lin, Yiwei Dai, Yuxin Wang, Wenhao Chai, Shang Zhou, Dariush Wahdany, Ziyu She,\nJiaming Hu, Zhikang Dong, Yuxuan Zhu, Sasha Cui, Ahson Saiyed, Arinbjörn Kolbeinsson, Jesse\nHu, Christopher Michael Rytting, Ryan Marten, Yixin Wang, Alex Dimakis, Andy Konwinski, and\nLudwig Schmidt. Terminal-bench: Benchmarking agents on hard, realistic tasks in command line\ninterfaces, 2026. URL https://arxiv.org/abs/2601.11868.\nMiniMax. Minimax m2.5: Built for real-world productivity, February 2026. URL https://www.\nminimax.io/news/minimax-m25. Official model report.\nAlexander Novikov, Ngan Vu, Marvin Eisenberger, Emilien Dupont, Po-Sen Huang, Adam Zsolt Wagner,\nSergey Shirobokov, Borislav Kozlovskii, Francisco J. R. Ruiz, Abbas Mehrabian, M. Pawan Kumar,\nAbigail See, Swarat Chaudhuri, George Holland, Alex Davies, Sebastian Nowozin, Pushmeet Kohli,\nand Matej Balog. Alphaevolve: A coding agent for scientific and algorithmic discovery, 2025. URL\nhttps://arxiv.org/abs/2506.13131.\nOpenAI. Codex, 2026. URL https://openai.com/codex/. Product page.\nCharles Packer, Sarah Wooders, Kevin Lin, Vivian Fang, Shishir G. Patil, Ion Stoica, and Joseph E.\nGonzalez. Memgpt: Towards llms as operating systems, 2024. URL https://arxiv.org/abs/\n2310.08560.\nYujia Qin, Shihao Liang, Yining Ye, Kunlun Zhu, Lan Yan, Yaxi Lu, Yankai Lin, Xin Cong, Xiangru\nTang, Bill Qian, Sihan Zhao, Runchu Tian, Ruobing Xie, Jie Zhou, Mark Gerstein, Dahai Li, Zhiyuan\nLiu, and Maosong Sun. Toolllm: Facilitating large language models to master 16000+ real-world\napis, 2023. URL https://arxiv.org/abs/2307.16789.\nJiahao Qiu, Xuan Qi, Tongcheng Zhang, Xinzhe Juan, Jiacheng Guo, Yifu Lu, Yimin Wang, Zixin Yao,\nQihan Ren, Xun Jiang, Xing Zhou, Dongrui Liu, Ling Yang, Yue Wu, Kaixuan Huang, Shilong Liu,\nHongru Wang, and Mengdi Wang. Alita: Generalist agent enabling scalable agentic reasoning with\nminimal predefinition and maximal self-evolution, 2025. URL https://arxiv.org/abs/2505.\n20286.\nQwen Team. Qwen3.5: Towards native multimodal agents, February 2026. URL https://qwen.\nai/blog?id=qwen3.5. Official model report and model card for Qwen3.5-35B-A3B.\nSander Schulhoff, Michael Ilie, Nishant Balepur, Konstantine Kahadze, Amanda Liu, Chenglei Si,\nYinheng Li, Aayush Gupta, HyoJung Han, Sevien Schulhoff, Pranav Sandeep Dulepet, Saurav\nVidyadhara, Dayeon Ki, Sweta Agrawal, Chau Pham, Gerson Kroiz, Feileen Li, Hudson Tao, Ashay\nSrivastava, Hevander Da Costa, Saloni Gupta, Megan L. Rogers, Inna Goncearenco, Giuseppe Sarli,\nIgor Galynker, Denis Peskoff, Marine Carpuat, Jules White, Shyamal Anadkat, Alexander Hoyle,\nand Philip Resnik. The prompt report: A systematic survey of prompt engineering techniques, 2025.\nURL https://arxiv.org/abs/2406.06608.\nMelanie Sclar, Yejin Choi, Yulia Tsvetkov, and Alane Suhr. Quantifying language models’ sensitivity\nto spurious features in prompt design or: How i learned to start worrying about prompt formatting,\n2024. URL https://arxiv.org/abs/2310.11324.\nNoah Shinn, Federico Cassano, Edward Berman, Ashwin Gopinath, Karthik Narasimhan, and Shunyu\nYao. Reflexion: Language agents with verbal reinforcement learning, 2023. URL https://arxiv.\norg/abs/2303.11366.\n17\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nHarsh Trivedi, Tushar Khot, Mareike Hartmann, Ruskin Manku, Bhuwan Dhingra, and Ashish Sabharwal. AppWorld: A controllable world of apps and people for benchmarking interactive coding\nagents. In Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics\n(Volume 1: Long Papers), pages 16022–16076. Association for Computational Linguistics, 2024.\nXingyao Wang, Boxuan Li, Yufan Song, Frank F Xu, Xiangru Tang, Mingchen Zhuge, Jiayi Pan, Yueqi\nSong, Bowen Li, Jaskirat Singh, et al. Openhands: An open platform for ai software developers\nas generalist agents. In International Conference on Learning Representations, volume 2025, pages\n65882–65919, 2025.\nJason Wei, Xuezhi Wang, Dale Schuurmans, Maarten Bosma, Brian Ichter, Fei Xia, Ed Chi, Quoc Le, and\nDenny Zhou. Chain-of-thought prompting elicits reasoning in large language models. In Advances\nin Neural Information Processing Systems, 2022. URL https://arxiv.org/abs/2201.11903.\nSiyuan Xu, Shiyang Li, Xin Liu, Tianyi Liu, Yixiao Li, Zhan Shi, Zixuan Zhang, Zilong Wang, Qingyu\nYin, Jianshu Chen, et al. Controllable and verifiable tool-use data synthesis for agentic reinforcement\nlearning. arXiv preprint arXiv:2604.09813, 2026.\nYutaro Yamada, Robert Tjarko Lange, Cong Lu, Shengran Hu, Chris Lu, Jakob Foerster, Jeff Clune,\nand David Ha. The ai scientist-v2: Workshop-level automated scientific discovery via agentic tree\nsearch, 2025. URL https://arxiv.org/abs/2504.08066.\nJohn Yang, Carlos E. Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan, and\nOfir Press. Swe-agent: Agent-computer interfaces enable automated software engineering, 2024.\nURL https://arxiv.org/abs/2405.15793.\nShunyu Yao, Jeffrey Zhao, Dian Yu, Nan Du, Izhak Shafran, Karthik Narasimhan, and Yuan Cao.\nReact: Synergizing reasoning and acting in language models, 2023. URL https://arxiv.org/\nabs/2210.03629.\nXunjian Yin, Xinyi Wang, Liangming Pan, Li Lin, Xiaojun Wan, and William Yang Wang. Gödel agent:\nA self-referential agent framework for recursively self-improvement. In Proceedings of the 63rd\nAnnual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages\n27890–27913, 2025. doi: 10.18653/v1/2025.acl-long.1354. URL https://aclanthology.\norg/2025.acl-long.1354/.\nEric Zelikman, Eliana Lorch, Lester Mackey, and Adam Tauman Kalai. Self-taught optimizer (stop):\nRecursively self-improving code generation, 2024. URL https://arxiv.org/abs/2310.02304.\nHangfan Zhang, Siyuan Xu, Zhimeng Guo, Huaisheng Zhu, Shicheng Liu, Xinrun Wang, Qiaosheng\nZhang, Yang Chen, Peng Ye, Lei Bai, et al. The path of self-evolving large language models:\nAchieving data-efficient learning via intrinsic feedback. arXiv preprint arXiv:2510.02752, 2025a.\nJenny Zhang, Shengran Hu, Cong Lu, Robert Lange, and Jeff Clune. Darwin gödel machine: Openended evolution of self-improving agents, 2025b. URL https://arxiv.org/abs/2505.22954.\nQizheng Zhang, Changran Hu, Shubhangi Upasani, Boyuan Ma, Fenglu Hong, Vamsidhar Kamanuru,\nJay Rainton, Chen Wu, Mengmeng Ji, Hanchen Li, Urmish Thakker, James Zou, and Kunle Olukotun.\nAgentic context engineering: Evolving contexts for self-improving language models, 2026. URL\nhttps://arxiv.org/abs/2510.04618. ICLR 2026.\nShao Zhang, Xihuai Wang, Wenhao Zhang, Chaoran Li, Junru Song, Tingyu Li, Lin Qiu, Xuezhi\nCao, Xunliang Cai, Wen Yao, Weinan Zhang, Xinbing Wang, and Ying Wen. Leveraging dual\nprocess theory in language agent framework for real-time simultaneous human-AI collaboration.\n18\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nIn Wanxiang Che, Joyce Nabende, Ekaterina Shutova, and Mohammad Taher Pilehvar, editors,\nProceedings of the 63rd Annual Meeting of the Association for Computational Linguistics (Volume\n1: Long Papers), pages 4081–4108, Vienna, Austria, July 2025c. Association for Computational\nLinguistics. ISBN 979-8-89176-251-0. doi: 10.18653/v1/2025.acl-long.206. URL https://\naclanthology.org/2025.acl-long.206/.\nNingyan Zhu, Huacan Wang, Jie Zhou, Feiyu Chen, Shuo Zhang, Ge Chen, Chen Liu, Jiarou Wu,\nWangyi Chen, Xiaofeng Mou, and Yi Xu. Semaclaw: A step towards general-purpose personal ai\nagents through harness engineering, 2026. URL https://arxiv.org/abs/2604.11548.\nMingchen Zhuge, Wenyi Wang, Louis Kirsch, Francesco Faccio, Dmitrii Khizbullin, and Juergen\nSchmidhuber. Language agents as optimizable graphs, 2024. URL https://arxiv.org/abs/\n2402.16823.\n\n19\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nA. Benchmark Configurations and Reproducibility Details\nA.1. Model Inference Services\nMiniMax M2.5 and GLM-5 were accessed through hosted inference services, using MiniMax’s\nhosted API and OpenRouter, respectively.1 Qwen3.5-35B-A3B was deployed locally on four NVIDIA\nH200 GPUs using an internal image derived from the public SGLang Docker image lmsysorg/\nsglang:v0.5.12-cu129.2\nA.2. Benchmark Configurations\nShared reproducibility settings. Each candidate evaluation uses two repeated attempts. We keep\nthe task sets, model backends, benchmark environments, evaluators, and all non-editable runtime\nsettings fixed within each comparison.\nTerminal-Bench-2.0 configuration. We use Harbor3 as the execution environment for all TerminalBench-2.0 tasks. Evaluations use a 2 MB/s outbound network bandwidth cap. To reduce failures\ncaused by incidental network latency rather than agent behavior, we mirror a subset of external\nresources required by Terminal-Bench-2.0 tasks when the original resources are stable but slow to\ndownload. Tasks that depend on external resources that cannot be accessed reliably, as well as tasks\nrequiring multimodal inputs unsupported by the initial harness, are excluded from the main 64-case\nevaluation set. This configuration keeps the benchmark environment controlled while preserving the\ncore terminal-interaction setting of Terminal-Bench-2.0.\nSWE-bench Verified configuration. We use a fixed 100-case subset of SWE-bench Verified, partitioned into 67 held-in and 33 held-out cases. Cases are sampled proportionally by repository, and the\nresulting split is fixed across all harness variants. Each task is run in an isolated per-instance Docker\nsandbox initialized with its repository workspace. The resulting patch is scored by the official SWEbench evaluator in the corresponding prebuilt, task-specific instance image.4 We use a 3,600-second\ncase timeout and a 120-second tool timeout.\nAppWorld configuration. We use a fixed 180-example AppWorld evaluation set with 90 held-in\nand 90 held-out examples. The held-in split contains all examples from AppWorld’s official train\npartition, while the held-out split is proportionally sampled from the official test_normal and\ntest_challenge partitions and then fixed across all harness variants. Each task is executed in a\nfresh AppWorld context with isolated task state and is scored using AppWorld’s official evaluator. We\nallow at most 50 agent turns per task.\n\nB. Expanded Experimental Analyses\nB.1. Terminal-Bench-2.0\nWe report the GLM-5 evolution trajectory, retained edits, and a representative Terminal-Bench-2.0\nbuild-task trace.\n1 MiniMax token plan: https://platform.minimax.io/subscribe/token-plan; OpenRouter GLM-5 endpoint:\nhttps://openrouter.ai/z-ai/glm-5. Accessed on 2026/05.\n2 https://hub.docker.com/r/lmsysorg/sglang/tags?name=v0.5.12-cu129.\n3 https://www.harborframework.com/docs/tutorials/running-terminal-bench.\n4Official SWE-bench images are available at https://hub.docker.com/u/swebench; per-instance repositories\nfollow the naming pattern swebench/sweb.eval.x86_64.&lt;instance-id&gt;.\n\n20\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 8 | Representative Qwen3.5 traces on the Terminal-Bench-2.0 extract-elf task. Left: the\ninitial harness ends with the required extractor missing. Right: the edited harness restores the\nextractor and validates its output.\n\nFigure 9 | Case study of a GLM-5 harness edit on the Terminal-Bench-2.0 build-pov-ray task. Left:\na failed trace under the initial harness, where long monolithic external downloads consume large\ntool budgets and the agent later finalizes despite repeated non-zero sanity checks. Right: a successful\ntrace under the edited harness, where the agent uses bounded staged operations, checks external\narchive evidence before committing more work, and repairs the failed sanity check before finalizing.\nB.2. SWE-bench Verified\nMiniMax M2.5. Overall Pass increases from 46.0% to 52.5%. The promoted harness separates\nempty-diff detection from targeted local testing: a diff-inspection subagent checks whether a patch\nexists, and a test-verifier subagent runs the most relevant failing test. In the representative Astropy\nFITS-card case, the initial harness makes the source change but does not finish verification, whereas\nthe promoted harness resolves dependencies, validates the patch, and completes with the required\nsource change.\n21\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nQwen3.5-35B-A3B. Overall Pass increases from 19.5% to 41.5%. The retained harness combines\na patch-verifier subagent with a direct pre-submission instruction to inspect the current diff and\nrun targeted tests. In the representative Django window-function case, the initial harness submits a\npatch without successfully running the relevant test suite, and its sole FAIL-TO-PASS test remains\nunresolved. The retained harness instead places the SQLite casting guard at the inner windowcompatible expression, runs the 49-test expressions_window suite before submission, and passes\nall 1 FAIL-TO-PASS and 46 PASS-TO-PASS tests.\nGLM-5. Overall Pass increases from 52.0% to 55.5%. The promoted harness extends the FAILTO-PASS verification cycle with dependency-aware recovery: it parses import failures, identifies\nand installs missing packages, reruns the exact test, and continues debugging if the test remains\nunsuccessful. In the Astropy trace, the initial harness submits after only a syntax check, leaving\nall four FAIL-TO-PASS tests and five PASS-TO-PASS tests failing; the promoted harness completes\nexecutable verification, after which all four FAIL-TO-PASS and all 68 PASS-TO-PASS tests pass.\nB.3. AppWorld\nMiniMax M2.5. Overall Pass increases from 48.6% to 58.9%. The promoted harness combines a\nstate-auditor subagent with pagination and temporal-boundary guidance. In the Venmo case, the\ninitial harness requests payment from all seven participants, whereas the promoted harness exhausts\ntransaction pages, applies the time boundary, identifies four participants who have paid, and requests\npayment only from the remaining three.\nQwen3.5-35B-A3B. Overall Pass increases from 22.5% to 52.2%. The final harness retains two\nprompt-level guards: a completion-contract guard distinguishes action-only tasks from information\nrequests, and a pagination guard requires complete record retrieval and a final target-object check. In\nthe Spotify case, the initial harness returns a null play-count result; the promoted harness exhausts\nthe library pages, compares play counts, and returns the expected song.\nGLM-5. Overall Pass increases from 44.4% to 85.0%. Its final harness adds an action-versusinformation completion rule and exhaustive pagination before state mutation. In the Venmo case, the\ninitial harness uses only the first transaction page and supplies an unnecessary textual answer; the\npromoted harness exhausts all pages, mutates all 12 records, and completes the action-only task with\na null answer.\nAcross SWE-bench Verified, all three promoted harnesses strengthen verification but choose different structures: MiniMax separates empty-diff and targeted-test checks, Qwen delegates inspection to\na patch-verifier subagent, and GLM embeds dependency repair in the verification instruction. Across\nAppWorld, the runs converge on complete state retrieval and correct completion semantics, again\nthrough model-specific harness mechanisms.\n\n22\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nSession-scoped tools\n\n&gt; persist PATH and verify\n58\n\n57.0\n\n56.3\n\nExternal compute\n\nPass (%)\n\n&gt; bound, stage, inspect\n\n53.9\n\n53.9\n\n54\n\nImplementation nudge\n\nLate artifacts\n\n&gt; shift to build/test\n\n&gt; write early; force cleanup\n\n50.8\n\n50.8\n50\n\n46.1\n\nInitial harness\n\n46\n\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\n14\n\n15\n\n16\n\n17\n\n18\n\nCandidate evaluations\naccepted\n\nrejected\n\nbranch endpoint\n\n(a) Evolution trajectory.\n\n(b) Retained code-level edits.\n\nFigure 10 | GLM-5 on Terminal-Bench-2.0. Panel (a) shows the evolution from 46.1% to 57.0%\noverall Pass, with green markers for accepted candidates, gray crosses for rejected candidates, and red\ncrosses for explored branch endpoints. Panel (b) shows the retained edits for persistent environment\nconfiguration and the transition from exploration to implementation.\n\n23\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\n56\n\nUntested patch\n\n&gt; local verification\n\n54\n\nEmpty patches\n\nPass (%)\n\n52.5\n\n&gt; diff detector\n51.0\n\n52\n\n50.0\n50\nStricter test policy\n\n48\n\n&gt; local-test enforcement\n\n46.0\n46\nInitial harness\n\n44\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\nCandidate evaluations\naccepted\n\nrejected\n\nbranch endpoint\n\n(a) Evolution trajectory.\n\n(b) Retained code-level edits.\n\nFigure 11 | MiniMax M2.5 on SWE-bench Verified. Overall Pass increases from 46.0% to 52.5%. Panel\n(a) shows the evolution trajectory, with green markers for accepted candidates and gray crosses for\nrejected candidates. Panel (b) shows the retained edits, which separate empty-diff detection from\ntargeted local testing.\n\n24\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 12 | SWE-bench Verified Astropy FITS-card float-formatting traces for MiniMax M2.5. Left: the\ninitial harness makes the source change but stops before completing executable verification. Right:\nthe promoted harness resolves the missing dependencies, runs targeted validation, and completes\nwith the required source change.\n\n25\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nMissed verifier call\n\n&gt; enforce before submit\n\n45\n\n41.5\n40\n\nUnverified patch\n\n&gt; check diff and test\n\nNo code change\n\nPass (%)\n\n39.5\n\n&gt; require non-empty diff\n\n35\n\nPolicy bloat\n\n35.0\n\n&gt; targeted tests only\n\n33.0\n32.5\n\n32.5\nSilent failures\n\n&gt; inspect test output\n\n30\n\nTraceback drift\n\n&gt; fix exact frame\n\nEmpty patches\n\n25\n\n20\n\n&gt; verifier subagent\n\n23.5\n\n23.5 22.5\n\n22.5\n19.5\nInitial harness\n\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\n14\n\n15\n\n16\n\n17\n\n18\n\n19\n\n20\n\n21\n\n22\n\n23\n\n24\n\n25\n\nCandidate evaluations\naccepted\n\nrejected\n\nbranch endpoint\n\n(a) Evolution trajectory.\n\n(b) Retained code-level edits.\n\nFigure 13 | Qwen3.5-35B-A3B on SWE-bench Verified. Overall Pass increases from 19.5% to 41.5%.\nPanel (a) shows the evolution trajectory, and panel (b) shows the retained patch-verifier and presubmission checks that require inspection of the current diff and execution of targeted tests.\n\n26\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 14 | SWE-bench Verified Django window-function traces for Qwen3.5-35B-A3B. Left: the\ninitial harness submits without running the relevant suite and fails the sole FAIL-TO-PASS test. Right:\nthe retained harness runs that suite before submission and passes all required tests.\n\n58\n\nMissing dependencies\n\n&gt; install then rerun\n\nSingle test failure\n\n&gt; FAIL_TO_PASS feedback\n\n55.5\n\nPass (%)\n\n56\n\n54.5\n\n54.0\n54\n\n53.0\n52.0\n\nSetup failures\n\nFailing test loop\n\n&gt; bootstrap preinstall\n\n&gt; parse/debug/fix cycle\n\n52\nInitial harness\n\n50\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\nCandidate evaluations\naccepted\n\nrejected\n\nbranch endpoint\n\n(a) Evolution trajectory.\n\n(b) Retained code-level edits.\n\nFigure 15 | GLM-5 on SWE-bench Verified. Overall Pass increases from 52.0% to 55.5%. Panel (a)\nshows the evolution trajectory, and panel (b) shows the retained dependency-aware verification cycle,\nwhich recovers from import failures before rerunning the relevant tests.\n\n27\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 16 | SWE-bench Verified Astropy topocentric ITRS transformation traces for GLM-5. Left: the\ninitial harness performs only a syntax check, leaving all four FAIL-TO-PASS tests and five PASS-TOPASS tests failing. Right: the promoted harness repairs missing dependencies, completes executable\nverification, and passes all four FAIL-TO-PASS and all 68 PASS-TO-PASS tests.\nPartial records\n\n&gt; pagination + state audit\n\n58.9\n\n60\nAction-only tasks\n\nPass (%)\n\n&gt; null completion\n\nWrong completion\n\n&gt; verify answer\n\n55\n\n52.5\n\n50\n\n52.8\n\n52.2\n\nTurn-waste loops\n\n48.6\n\n&gt; stop exploration\nInitial harness\n\n45\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\nCandidate evaluations\naccepted\n\nrejected\n\nbranch endpoint\n\n(a) Evolution trajectory.\n\n(b) Retained code-level edits.\n\nFigure 17 | MiniMax M2.5 on AppWorld. Overall Pass increases from 48.6% to 58.9%. Panel (a)\nshows the evolution trajectory, and panel (b) shows the retained state-auditing, pagination, and\ntemporal-boundary mechanisms used to identify the complete set of target records.\n\n28\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 18 | AppWorld Venmo traces for MiniMax M2.5. Left: the initial harness requests payment\nfrom all seven participants without accounting for prior transactions. Right: the promoted harness\nexhausts the transaction pages, identifies the four participants who have already paid, and requests\npayment only from the remaining three.\nPartial record lists\n\nPremature completion\n\n60\n\n&gt; pagination guard\n\n&gt; completion guard\n\nPagination runner error\n\n&gt; pagination guard\n52.2\n49.4\n\nPass (%)\n\n50\n\n48.3\n45.8\n\n42.2\n\n42.8\n\n40\nWrong final answer\n\n&gt; answer-null guard\n30\n\nAmbiguous time range\n\n&gt; temporal-boundary guard\n22.5 22.8\n20\n\nWrong extraction\n\n&gt; extraction guard\n\nUnverified state\n\n&gt; verification guard\n\nInitial harness\n\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\n14\n\n15\n\n16\n\n17\n\n18\n\n19\n\n20\n\n21\n\n22\n\nCandidate evaluations\naccepted\n\nrejected\n\nbranch endpoint\n\n(a) Evolution trajectory.\n\n(b) Retained code-level edits.\n\nFigure 19 | Qwen3.5-35B-A3B on AppWorld. Overall Pass increases from 22.5% to 52.2%. Panel (a)\nshows the evolution trajectory, and panel (b) shows the retained completion-contract and pagination\nguards, which require complete retrieval and distinguish action-only tasks from information requests.\n\n29\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 20 | AppWorld Spotify traces for Qwen3.5-35B-A3B. Left: the initial harness returns a null\nplay-count result after incomplete retrieval. Right: the promoted harness exhausts the library pages,\ncompares the retrieved play counts, and returns the expected song.\n\n90\n\nMerged retained\n\n&gt;85.0\ncompletion + pagination\nAction-only tasks\n\n&gt; null completion\n\n80\n\n76.4\n\n74.7\n\nPass (%)\n\nPartial record lists\n\n&gt; pagination exhaustion\n\n70\n\n67.2\nTurn-budget exhaustion\n\n&gt; progress-check reminder\n\n60\n\n50\n\n44.4\nInitial harness\n\n40\n0\n\n1\n\n2\n\n3\n\n4\n\n5\n\n6\n\n7\n\n8\n\n9\n\n10\n\n11\n\n12\n\n13\n\nCandidate evaluations\naccepted\n\nrejected\n\nbranch endpoint\n\n(a) Evolution trajectory.\n\n(b) Retained code-level edits.\n\nFigure 21 | GLM-5 on AppWorld. Overall Pass increases from 44.4% to 85.0%. Panel (a) shows the\nevolution trajectory, and panel (b) shows the retained action-versus-information completion rule and\nexhaustive-pagination requirement applied before state mutation.\n\n30\n\n\fSelf-Harness: Harnesses That Improve Themselves\n\nFigure 22 | AppWorld Venmo traces for GLM-5. Left: the initial harness reads only the first transaction\npage and supplies an unnecessary textual answer. Right: the promoted harness exhausts all pages,\nmutates all 12 target records, and completes the action-only task with a null answer.\n\n31\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"