"<!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>H UXLEY-G ÖDEL M ACHINE : H UMAN -L EVEL C ODING\nAGENT D EVELOPMENT BY AN A PPROXIMATION OF\nTHE O PTIMAL S ELF -I MPROVING M ACHINE\nWenyi Wang∗ Piotr Pi˛ekos* Li Nanbo\nMateusz Ostaszewski Mingchen Zhuge\n\nFiras Laakom Yimeng Chen\nJürgen Schmidhuber\n\n{wenyi.wang, piotr.piekos, nanbo.li, firas.laakom, yimeng.chen,\nmateusz.ostaszewski, mingchen.zhuge, juergen.schmidhuber}@kaust.edu.sa\n\narXiv:2510.21614v3 [cs.AI] 29 Oct 2025\n\nKing Abdullah University of Science and Technology (KAUST)\nThuwal, Saudi Arabia\n\nA BSTRACT\nRecent studies operationalize self-improvement through coding agents that edit\ntheir own codebases. They grow a tree of self-modifications through expansion\nstrategies that favor higher software engineering benchmark performance, assuming that this implies more promising subsequent self-modifications. However,\nwe identify a mismatch between the agent’s self-improvement potential (metaproductivity) and its coding benchmark performance, namely the MetaproductivityPerformance Mismatch. Inspired by Huxley’s concept of clade, we propose a\nmetric (CMP) that aggregates the benchmark performances of the descendants of\nan agent as an indicator of its potential for self-improvement. We show that, in our\nself-improving coding agent development setting, access to the true CMP is sufficient to simulate how the Gödel Machine would behave under certain assumptions. We introduce the Huxley-Gödel Machine (HGM), which, by estimating\nCMP and using it as guidance, searches the tree of self-modifications. On SWEbench Verified and Polyglot, HGM outperforms prior self-improving coding agent\ndevelopment methods while using fewer allocated CPU hours. Last but not least,\nHGM demonstrates strong transfer to other coding datasets and LLMs. The agent\noptimized by HGM on SWE-bench Verified with GPT-5-mini and evaluated on\nSWE-bench Lite with GPT-5 achieves human-level performance, matching the\nbest officially checked results of human-engineered coding agents. Our code\nis publicly available at https://github.com/metauto-ai/HGM.\n\n∗\n\nequal contribution\n\n1\n\n\f1\n\nI NTRODUCTION\n\nProcesses of self-modification drive the growth of complex systems, from biological evolution (Hendrikse et al., 2007; Dawkins, 2019) to cultural and scientific innovation (Good, 1966; Hall,\n2007). These general ideas have been instantiated in concrete algorithms for self-improving\nagents (Schmidhuber, 1987; 2003; Nivel et al., 2013; Everitt et al., 2016), demonstrating how abstract principles of self-modification can be translated into operational mechanisms. Unlike static\nsystems constrained by fixed architectures, such agents can incrementally modify their own selfmodification mechanisms and learning strategies, reusing newly gained abilities to fuel subsequent\nimprovements. This capacity fosters continual adaptation, reduces reliance on human intervention,\nand enables problem-solving capabilities that cannot be fully anticipated at design time.\nA central challenge is how to decide which self-modifications to accept. The Gödel machine (Schmidhuber, 2003) (GM) offers a theoretically optimal answer: accept only modifications\nthat provably increase the expected long-term utility. While this provides a sound blueprint, its reliance on formal proofs makes it practically challenging. Recent implementations instead rely on\ncoding agents that edit their own codebases and favor self-modifications from agents with higher\nbenchmark performance (Robeyns et al., 2025; Zhang et al., 2025a). Yet, as illustrated in Figure 1\n(left), this heuristic can be misleading: a high-scoring agent may produce unproductive descendants, while a lower-scoring one seeds lineages that achieve greater long-term gains. We term this\nphenomenon the Metaproductivity–Performance Mismatch.\nTo address this mismatch, we introduce clade-level metaproductivity (CMP), inspired by Huxley’s\nnotion of clades as lineages of common ancestry (Huxley, 1957). CMP quantifies the productivity\nof a clade by aggregating the success of an agent’s descendants rather than relying solely on its\nimmediate benchmark score. Furthermore, we show in Theorem 1 that in our self-improving coding\nagent development setting (Assumption 1, which includes the assumption that the only quality of\nthe self-improvement process is the evaluation score of the final agent and that the evaluation is\nconducted with repeatable trials), having access to the true CMP oracle suffices to imitate the Gödel\nMachine.\n\nHGM (Ours)\n\n1.0\n0.8\n\n0.78\n0.63\n\n0.6\n\n0.44\n0.4\n\n0.38\n\n0.28\n\n0.27\n\n0.2\n0.0\n\nSWE-bench Verified\n\nDGM\n\nSICA\n\n60.0\n\nBest-found accuracy (%)\n\nCorrelation with Metaproductivity\n\nThis insight motivates our proposed algorithm, the Huxley–Gödel Machine (HGM), which approximates GM-style self-improvement by estimating CMP from clade-aggregated descendant outcomes and selecting nodes to expand via Thompson sampling. Furthermore, by leveraging a more\nreliable estimate, we adaptively decouple expansion from evaluation, leading to asynchronous execution for efficient parallelism.\n\n55.0\n\n53.33%\n\n52.5\n\n50%\n\n50.0\n\n2.38x\n\n47.5\n45.0\n42.5\n40.0\n\nPolyglot\n\n56.67%\n\n57.5\n\n0\n\n200\n\n400\n\n600\n\n800\n\nAllocated CPU-Hours\n\n1000\n\n1200\n\nFigure 1: (Left) Weak correlation between the guidance metrics of other methods (based on benchmark performance) and long-term self improvement; HGM mitigates this mismatch by leveraging\nclade-level metaproductivity. (Right) On SWE-bench Verified, HGM achieves higher accuracy with\n2.38 time less allocated CPU-hours. Together, the results indicate the practical advantage of approximating Gödel Machines with long-term self-improvement estimates. Note that SICA encountered\nrepeated errors after consuming 45% of its budget, preventing any further self-modifications.\n2\n\n\fEmpirically, HGM better aligns with long-run agent productivity than benchmark-driven baselines, as shown in Figure 1 (left). On SWE-bench Verified (Jimenez et al., 2024; Chowdhury\net al., 2024) and Polyglot (Gauthier, 2024), HGM consistently outperforms Darwin Gödel Machine\n(DGM) (Zhang et al., 2025a) and Self-Improving Coding Agent (SICA) (Robeyns et al., 2025). Remarkably, one agent found by HGM surpasses SWE-agent (Yang et al., 2024), the highest-scoring\nhuman-engineered coding agent with officially checked results, on SWE-bench Lite (Jimenez et al.,\n2024), when both use the GPT-5-mini backbone under matched budgets. The HGM-discovered\nagent transfers robustly when evaluated under a shift that is simultaneous in both the dataset and the\nmodel. Although optimized on SWE-bench Verified with GPT-5-mini, when tested on SWE-bench\nLite with the GPT-5 backbone, it achieves performance on par with the best officially verified\nhuman-engineered coding agents.\nTo summarize, our contributions are as follows:\n• We analytically define the Clade-Metaproductivity (CMP) function as a measure of agents’ selfimproving ability and show that in a self-improving coding agent development setting (Assumption 1), access to a CMP oracle suffices to reproduce the Gödel Machine’s acceptance mechanism.\n(Theorem 1).\n• We empirically observe that immediate benchmark performance is an unreliable predictor of CMP\nand show that our CMP estimator aligns better.\n• Using our CMP estimator, we propose the Huxley–Gödel Machine (HGM), which approximates\nthe Gödel Machine in a coding agent setting from partial evaluations and guides the expansion via\nThompson sampling with adaptive scheduling.\n• We empirically validate HGM on SWE-bench Verified and Polyglot, demonstrating higher-quality\noptimized agents compared to previous self-improving methods, even though they were discovered within substantially smaller allocated CPU-hours. Furthermore, HGM achieves human-level\ncoding agent design on SWE-bench Lite by optimizing on SWE-bench Verified.\n\n2\n\nS ELF -I MPROVEMENT AS T REE -S EARCH\n\nBoth the Darwin Gödel Machine (DGM) and the Self-Improving Coding Agent (SICA) belong to\nthe class of self-referential AI (Schmidhuber, 1987; 2003). In particular, in DGM and SICA, agents\nmodify themselves to generate new agents, each empirically validated on downstream tasks.\nIn this paper, we formalize this self-improvement process as an iterative tree-search problem, where\nthe goal is to discover an agent that maximizes performance across multiple downstream tasks.\nConcretely, starting from an initial agent as the root, a tree-search policy incrementally grows the\ntree of self-modified agents. At each iteration, the policy either selects an agent (a node in the tree)\nto expand by producing a child agent (a self-modified version of the selected agent) or selects an\nagent to undergo additional evaluation on downstream tasks.\nFormally, let Tt denote the archive of our agents at iteration t. In this paper, the archive is always\nrepresented as a tree of evolved agents, and we use the terms archives and trees interchangeably.\nT0 = {a0 } is initialized as a single-node tree with a fixed initial agent. At each iteration t, the policy\nselects actions at+1 ∼ π(· | Tt ), where π is a policy over actions At = Mt ∪ Vt , Mt = {ma : a ∈\nTt } are agent modifications, and Vt = {va : a ∈ Tt } denotes evaluations. Action ma instructs the\nagent a to produce a self-modification that is added as a child of a to the tree, and va selects agent\na from the tree for an additional evaluation on one more downstream task. After exhausting the\ncomputational budget, the policy selects a final agent (afinal = arg maxa∈T Scoreπ (a) ∈ TB where\nB is the termination iteration and Score is part of the policy) from the final tree as the returned\nagent. The objective is to optimize J(π) = E[U (afinal )], where U is a utility function that measures\nthe performance of downstream tasks. In this work, we consider U the average of binary success\nindicators across all downstream tasks. π denotes an algorithm, with DGM, SICA, and our proposed\nHGM representing concrete instances.\nCompound Policy. At each step of self-improvement, the system faces a compound decision:\nwhether to expand the tree by generating new agents or to evaluate existing ones. This decision naturally decomposes into three sub-policies: (i) a selection policy that chooses between expansion and\nevaluation, (ii) an expansion policy that determines which parent to modify, and (iii) an evaluation\n3\n\n\fpolicy that selects an agent to test. Prior approaches, such as SICA and DGM, conflate these choices.\nThey always expand a parent, create a child, and immediately evaluate that child on multiple tasks.\nThis fixed sequence restricts flexibility: once a new agent is generated, it monopolizes evaluations,\neven if older agents appear more promising. For instance, an agent that fails nine tasks in a row\ncontinues to consume evaluations, while an older agent with partial successes is ignored.\nHGM breaks this rigidity by decoupling expansion from evaluation. At each step, it adaptively\ndecides whether to generate a new agent or to further probe an existing one, and evaluations are\nalways at the granularity of a single agent–task pair. This finer control enables early stopping on\nunpromising agents. Table 5 summarizes how SICA, DGM, and HGM instantiate these sub-policies.\n\n3\n\nH UXLEY-G ÖDEL M ACHINE\n\nIn this section, we introduce the Huxley–Gödel Machine (HGM), a self-improving machine that\napproximates Gödel Machine by using clade-level statistics. At the core of HGM lies the notion\nof metaproductivity—a measure of an agent’s ability to improve its self-improvement skills, which\nleads to better downstream performance of distant future agents.\nIn Section 3.1 , we state the original Gödel machine and describe how our scope is specialized\nwith respect to the general setup of the Gödel machine. In Section 3.2, we introduce two metrics\nof metaproductivity: Global metaproductivity (GMP), which captures how evolving a given agent\nincreases the metaproductivity of the entire agent tree. This measure of metaproductivity is general\nand difficult to operationalize or estimate. We instead introduce clade-metaproductivity (CMP),\nwhich measures how promising the evolutions starting from a given agent (its clade) are. In Theorem 1, we show that access to true CMP is sufficient to implement a Gödel Machine applied to\nthe coding agent development setting (Assumption 1). Following on that, in Section 3.3, we introduce the Huxley-Gödel Machine (HGM), which guides the self-improvement search with Thompson\nSampling based on the estimate of CMP.\n\n3.1\n\nG ÖDEL M ACHINE IN THE S ELF -I MPROVING C ODING AGENT D EVELOPMENT S ETTING\n\nThe original Gödel Machine is a general task solver that, in principle, can optimally make any provable self-improvements in any computable environment with respect to a given objective (Schmidhuber, 2003). It achieves this by running a proof searcher, continually looking for formal proofs that\nsome modification of its own code will yield higher expected utility. Once such a proof is found,\nthe modification is executed and permanently alters the machine. Importantly, the theoretical analysis of the Gödel Machine explicitly accounts for the fact that the agent has only a single life (with\nno repeatable trials) and that proving a self-improvement consumes real time and resources, which\ncould be used for gathering the reward.\nIn contrast, this paper focuses on problems in a setting tailored to a particular kind of self-improving\ncoding agent development that follows Assumption 1. Specifically, our problem assumes that the\nonly objective is the utility of the agent selected at the end of the agent development process. Moreover, in our problem, the tests used to evaluate coding agents are conducted in a repeatable manner.\nThis means that the testing environment is reset for each test, and prior evaluations do not influence\nlater test results. Furthermore, each self-modification reduces the remaining budget by exactly one\nunit. For the theoretical analysis, we also assume that the only operation that incurs a time cost is\nthe self-modification itself.\nWithin this framework designed for self-improving coding agent development, the Gödel Machine\nis an optimal agent operating in a POMDP where the policy observes only a parent aparent , its child\nachild , and the remaining budget b, and then chooses to accept or reject the child. At termination,\nScoreπ selects either the final parent or child as output. Full description of the POMDP can be\nfound in the Appendix A. We clarify the additional assumptions in our setup in comparison to the\ngeneral Gödel Machine in Assumption 1.\n4\n\n\fAssumption 1. For the theoretical analysis of Gödel Machine applied to self-improving coding\nagents, we make the following additional assumptions in comparison to the setup from the\noriginal Gödel Machine:\n• The policy objective function is defined as a function of only the final agent, with no\nother rewards received before termination;\n• The agent’s utility is measured by its performance on evaluation tasks, under the assumption of repeatable trials: for any agent–task pair, the expected outcome is independent of evaluation time or prior events.\n• The proofs of Gödel Machines do not consume budget;\n• And each self-modification costs exactly one unit of the budget.\n\n3.2\n\nM ETAPRODUCTIVITY AND C LADE -M ETAPRODUCTIVITY\n\nThe global metaproductivity measures the impact of self-improvement on the entire current tree\narchive of all agents. Given a policy π, to quantify the quality of how an agent’s self-modification\ninfluences the performance of the system, we define the notion of global metaproductivity (GMP):\n\u0002\n\u0003\nGMPπ (T , a) = ETB ∼pπ (·|T ,a) U (argmaxa′ ∈TB Scoreπ (a′ )) ,\nwhere T is a tree of agents and a ∈ T . Scoreπ is the function that scores the agents for the final\nselection. The policy π unrolls the trajectory until the end of the episode with policy π and produces\na final archive of agents TB . The distribution of the trajectory is given by pπ .\nGMP directly corresponds to the Q-value function in reinforcement learning, with the state phrased\nas the archive of agents and the action being the selected agent to expand. The GMP value of a node\nmeasures how well (in expectation) the final agent obtained from the search process will perform.\nGMP measures the long-term potential of self-improvement for the entire tree, which also includes\nmodifications that improve self-improvement itself, and so on. An algorithm might, at the beginning,\nfocus on improving the ability to self-improve while neglecting direct benchmark abilities, only to\nlater focus on them. This is a principal meta-learning behavior that is captured in the original Gödel\nMachine (Schmidhuber, 2003). The objective of designing a policy for self-improvement (Section 2)\nis equivalent to optimizing GMP({a0 }, a0 ).\nWhile GMP captures the full global potential of a policy with access to the history of agents, its\nscope is too broad for practical conceptualization, since, in principle, the self-modifications of an\nagent can influence the expected utility of a parent agent by introducing new information. The\nGödel Machine achieves global-optimality by deciding whether to accept or reject self-modification,\nfocusing on the provable potential subsequent self-improvements. Motivated by this observation, we\ndefine a localized variant of GMP that focuses on the subtree rooted at a given agent, i.e., its clade.\nWe refer to this quantity as Clade-Metaproductivity (CMP):\nh\ni\nCMPπ (T , a) = ETB ∼pπ (·|T ,a) U (argmaxa′ ∈C(TB ,a) Scoreπ (a′ ))\n\u0002\n\u0003\n= ETB ∼pπ (·|T ,a) maxa′ ∈C(TB ,a) U (a′ )\n(if Score = U ),\nwhere C(TB , a) is the clade (i.e., the subtree with a as the root) of the node a in the Tree TB and\nScore is the final agent selection metric. CMP contains the non-greedy information about the future\nevolution of self-improving agents, therefore guiding good strategies for self-improvement aimed\nalso at the improvement of self-improvement itself. Furthermore, we show the crucial relation of\nCMP to the Gödel Machine.\nTheorem 1. Under Assumption 1, access to the CMP oracle is sufficient to implement the\nGödel Machine.\nThe proof is available in the App. A. This observation motivates us to introduce the estimate of\nCMP and use this as guidance in our algorithm. By estimating CMP, HGM approximates the\nGödel Machine. We describe our algorithm fully in the next section.\n5\n\n\f3.3\n\nA LGORITHM\n\nExisting methods use benchmark performance on coding tasks as a guiding metric, treating task\nsuccess as an indicator of self-improvement potential. This assumption is overly greedy: it evaluates only the immediate utility of a modification while ignoring its downstream consequences for\nfuture self-modifications. We refer to this gap as the Metaproductivity-Performance Mismatch: the\ndivergence between short-term task performance and the long-term capacity for self-improvement,\nas measured by CMP. Empirical evidence shows that this mismatch occurs in practice (see Section 4.1.) We aim to model long-term, global dependencies by deriving our estimator of CMP.\nSpecifically, we define HGM by stating its three subpolicies.\nExpansion Policy. The core of the HGM algorithm is its selection criterion for expansion. HGM\naims to estimate Clade-Metaproductivity with the motivation that, in our setting, under Assumption 1, the true CMP as the criterion would produce the Gödel Machine due to Theorem 1. In this\nsense, HGM approximates Gödel Machine, the optimal self-improving machine. This is in contrast to the currently used greedy selection criteria based on performance metrics, which ignore the\npotential of the model to improve its self-improving abilities.\nWe estimate CMP using the weighted average of agents’ empirical performance in the clade. HGM\nis designed to promote higher weights to higher utility agents. See below for how our evaluation policy induces this weighting strategy. Formally, let us assume a fixed archive of agents Tt , nsuccess (a)\nbe the number of passed tests of a, and nfailure (a) be the number of failed tests of a. Then\nX\nX\nnC\nnsuccess (a′ ) and nC\nnfailure (a′ ),\nsuccess (a) =\nfailure (a) =\na′ ∈C(a)\n\na′ ∈C(a)\n\nwhere C(a) is the clade of a in Tt . We define our Clade-Metaproductivity estimator as\n[\nCMP(a)\n=\n\nnC\nsuccess (a)\n.\nnC\n(a)\n+ nC\nsuccess\nfailure (a)\n\nEvaluating productivity at the level of entire clades rather than individual agents offers several key\nadvantages. It aligns better with the goal of self-improvement, as a modest ancestor can still be\nhighly valuable if its descendants consistently advance, while stagnant lineages are deprioritized. At\nthe same time, aggregating evidence across a clade yields more statistically robust estimates than\nsingle-node outcomes by using information from more samples. This is particularly important when\nevaluations are costly and benchmarks are only partially observed.\n[\nCMP(a)\ncan be viewed as a weighted sum over the empirical means of agents in C(a), with the\nweight for an agent being the number of task evaluations it has performed. Furthermore, we design\nour evaluation selection in such a way that it selects highly performing agents, which creates a\nselection of a soft maximum in the clade.\nAfter calculating the CMP estimates, the HGM probabilistically approximates the selection of the\nhighest scoring agent using Thompson Sampling—a standard method in the bandit literature for\nsmoothly maximizing the decision criterion (Agrawal &amp; Goyal, 2012; Chapelle &amp; Li, 2011). We\nwill refer to a ∼ T S({(ns , nf )|n ∈ Tt }) as the agent sampled from the Thompson-Sampling\nprocess with parameters ns (number of successes) and nf (number of failures). Given that the\nsearch problem has a known budget, our algorithm introduces an exploration-exploitation scheduler\nτ that is monotonically increasing with respect to the current time t, encouraging exploration in the\nearly stages and polarization of the sampling distribution as it approaches the end. Formally, we\nselect the agent to expand a∗ as\nC\na∗ ∼ T S({(τ (1 + nC\nsuccess (a)), τ (1 + nfailure (a)))|a ∈ Tt }).\n\nEvaluation Policy. As stated in the expansion policy, we design our evaluation policy to prioritize agents with a higher evaluation score to induce the selection of the maximum over the clade.\nFormally, the agent to evaluate a∗ is sampled from the Thompson Sampling process with\na∗ ∼ T S({(τ (1 + nsuccess (a)), τ (1 + nfailure (a)))|a ∈ Tt }.\n6\n\n\fSelection Policy. Finally, our agent has to choose between expansion and evaluation. At each\niteration, the algorithm first selects whether to evaluate or expand. Previous methods have evaluated\nnewly created agents directly after their creation. Our novel estimation of agent self-improving\nquality has the additional benefit of collecting more samples more quickly (because it has samples\nfrom the entire clade). This enables more fine-grained control over when to evaluate and when to\ncreate a new agent for better efficacy. Therefore, we decouple evaluation from expansion and treat\nthem as separate steps.\nTo decide how and when to evaluate or expand agents, we draw inspiration from the infinite-armed\nbandit literature. Infinite-armed bandit problems capture the tension between repeatedly sampling\nknown options to reduce uncertainty about promising arms and exploring new options that have the\npotential to perform better. This perspective provides a natural lens for our setting, where evaluations\ncorrespond to sampling existing arms, and expansions correspond to introducing new ones. In this\nwork, we follow the strategy of UCB-Air (Wang et al., 2008), which adds arms when the number\nof evaluations N α ≥ m for some α ∈ [0, 1], where m is the number of existing arms. In our case,\narms correspond to the agents; hence, we decide to expand at time t if Ntα ≥ |Tt |.\nFinal Agent Selection Strategy. HGM iteratively executes the structured policy defined by our\nselection policy, expansion policy, and evaluation policy. When the computational budget exceeds,\nit returns the agent with the highest ϵ percentile of the utility posterior in the final tree for some\nhyperparameter ϵ, namely the best-belief agent. Formally, a best-belief agent is defined as\nargmaxa∈TB Iϵ (1 + nsuccess(a) , 1 + nfailure (a)),\nwhere I is the regularized incomplete beta function. See Algorithm1 in Appendix B for the detailed\nprocedure of HGM.\nAsynchronous Implementation. As an additional benefit of decoupling the policy, we introduce\nasynchronous execution of evaluation and expansion. Since the execution of coding agents generally\nrequires querying large language models multiple times, the computation time can be lengthy. To\nboost our algorithm, we propose the asynchronous HGM algorithm (HGM Async), which utilizes\nall available computational power until the computational budget is exceeded. HGM Async concurrently executes an iteration of the process on each available CPU. Once one iteration finishes, a new\niteration immediately starts. It uses the most recent data, with one exception, and updates the data\nonce it is finished. The exception is that one needs to take all running expansions and explorations\ninto consideration when executing the selection strategy. See experimental results 2 for the runtime\ncomparison with DGM and SICA.\n\n4\n\nE XPERIMENTAL R ESULTS\n\nWe evaluate HGM on challenging software engineering tasks to assess three core aspects: 1) the fidelity of HGM’s CMP estimation (Sec. 4.1), 2) its capability for self-improvement with HGM compared with DGM and SICA (Sec. 4.2), and 3) the effectiveness in automatic agent design through\nevolutionary processes, benchmarked against a leading human design up to date1 (Sec. 4.3). We\nconducted our experiments on the SWE-bench Verified (SWE-Verified) and SWE-bench Lite (SWELite) variants, as well as the Polyglot problems, both of which consist of coding challenges and are\nwidely used for coding agent evaluation (Xia et al., 2025; Zhang et al., 2024; 2025b). We follow\nDGM’s evaluation setting for Polyglot problems, where agents have no access to private test cases\nor test results. For budget considerations, in addition to the full datasets, we use 60-task subsets\n(SWE-Verified-60), derived from the first two stages of DGM’s progressive evaluation. In all experiments, we employ HGM with an exploration-exploitation scheduler Bb , where b is the remaining\nbudget, ϵ = 1, and α = 0.6. All experiments involving HGM use the HGM-Async algorithm. We\napply an identical initial agent when compared to DGM and SICA, which is adopted from the official implementation of DGM. See Appendix C.1 for a detailed description of the initial agents used\nin different experiments.\n1\n\nThe leading SWE-agents on https://www.swebench.com (Lite) as of 24 October 2025.\n\n7\n\n\fTable 1: Clade-Metaproductivity: Empirical vs. Estimation Correlation. We report the Pearson\ncorrelations between the empirical CMPs and the estimates from DGM, SICA, and HGM on SWEVerified-60 and Polyglot. For the weighted correlations, each prediction is weighted by the number\nof evaluations it has accessed.\nEstimates\nSICA\nDGM\nHGM (Ours)\n\n4.1\n\nSWE-Verified-60\n\nPolyglot\n\nWeighted\n\nUn-weighted\n\nWeighted\n\nUn-weighted\n\n0.444\n0.285\n0.778\n\n0.444\n0.406\n0.512\n\n0.274\n0.383\n0.626\n\n0.274\n0.357\n0.873\n\nM ETAPRODUCTIVITY-P ERFORMANCE M ISMATCH\n\nThe experiments in this section are designed to serve two purposes: (i) to provide evidence of the\n[ of\nMetaproductivity-Performance Misalignment (MPM) issue; and (ii) to assess whether the CMP\nHGM is a more reliable CMP estimator than the utility measures adopted by DGM and SICA. To\nreveal the misalignment, we compute the correlation between their selection criterion and empirical\nCMP. To obtain empirical CMPs, we analyze the expanded search tree after each method has completed its run. For every node in the tree, we define its empirical CMP as the maximum empirical\nmean of the task performance achieved within its clade, with the root of this clade excluded. This\nconstruction ensures that empirical CMP captures the self-improvement ability of a node. We ex[\nclude the root of a clade to avoid the circular use of the target in the estimators. For HGM, the CMP\nis defined as a function over the clade of a node; a critical adjustment is required to avoid target\nleakage. Specifically, we exclude the evaluations that are most directly related to the target: the\nroot of the clade (an ancestor of the target) and the subtree rooted at a direct child of the evaluated\nnode that contains the empirical maximum, thereby ensuring a fair comparison (see Appendix D for\ndetailed computation). We report both the correlation coefficient weighted by the number of evaluations used in prediction, as well as the unweighted correlation. We conducted our experiments on\nthe SWE-Verified-60 and Polyglot datasets.\nResults &amp; Discussion. Table 1 summarizes the correlations between the three estimators and the\nempirical CMPs (the targets). We first observe that the SICA and DGM estimators achieve positive\nPearson correlation coefficients: 0.444 and 0.285 on SWE-Verified-60, and 0.274 and 0.383 on\nPolyglot, respectively, suggesting weak alignments, i.e., MPM. In comparison, HGM’s estimator,\n[ achieves substantially stronger weighted correlations of 0.778 and 0.626 on SWE-VerifiedCMP,\n60 and Polyglot, respectively, as well as unweighted correlations of 0.512 and 0.8783, surpassing\nSICA and DGM by wide margins. These results provide strong indications that HGM, equipped\n[ offers a more reliable estimate of metaproductivity and effectively mitigates the MPM\nwith CMP,\nissues inherent to SICA and DGM.\n4.2\n\nE VALUATING HGM S ELF -I MPROVING C APABILITY\n\nTo validate our hypothesis that our CMP estimator better predicts future self-improvement and,\nhence, leads to more effective self-modifications, we evaluate HGM against two state-of-the-art selfimproving coding agent methods: DGM and SICA. We conduct controlled experiments under the\nsame setup as DGM, with a budget-friendly modification applied consistently to both HGM and all\nbaselines to ensure fairness, i.e., we adopt more cost-efficient backbone LLMs (GPT-5 for expansion\nand GPT-5-mini for evaluation for SWE-Verified; Qwen3-Coder-480B-A35B-Instruct for expansion\nand Qwen3-Coder-30B-A3B-Instruct for evaluation for Polyglot). For all methods, we start with\nthe same initial ancestor, which achieves 40% and 20.3% on the SWE-Verified-60 and Polyglot,\nrespectively. We compare the task performance of their best-belief final agents after a maximum\nallowance of 800 benchmark task evaluations, selected in DGM and SICA using empirical means.\nIn addition, our asynchronous parallelization of expansion and evaluation enables self-improvement\nto consume fewer allocated CPU-hours than DGM and SICA (see Sec. 3.3). We verify this and\nreport the allocated CPU-hours required for 800 evaluations.\n8\n\n\fTable 2: Self-Improving Capability Comparison. We report the task performance (in accuracy)\nof each method’s best-belief agent and the allocated CPU-hours time required for 800 evaluations.\nSuperscripted accuracies with “+” indicate performance gains over their respective initial agents.\nBest-belief Agent of\n\nSWE-Verified-60\nAcc. (%)↑\n\nSICA\nDGM\nHGM (Ours)\n\n+10\n\n50.0\n53.3+13.3\n56.7+16.7\n\nTime (hours)↓\ninfinite loop\n1231\n517\n\nPolyglot\nAcc. (%)↑\n+5.1\n\n25.4\n27.1+6.8\n30.5+10.2\n\nTime (hours)↓\n572\n2385\n347\n\nResults &amp; Discussion. We summarize the comparison results in Table 2. Across both SWEVerified-60 and Polyglot, all three methods successfully perform agent discovery by optimizing\nthe initial agent through self-improvement. However, HGM’s best-belief agent demonstrates not\nonly the highest task performance—56.7% on SWE-Verified-60 and 30.5% on Polyglot—but also\nthe best efficiency, requiring the fewest allocated CPU-hours for 800 evaluations: 6.86 times faster\nthan DGM and 1.65 times faster than SICA on Polyglot, and 2.38 times faster than DGM on\nSWE-Verified-60. Notably, on SWE-Verified-60, SICA repeatedly encounters “query length out-ofLLM-context-window” during self-improvement processes after 360 evaluations. Despite this, the\nPolyglot results validate our hypothesis regarding HGM’s runtime advantage over the baselines. In\nconclusion, HGM, equipped with a better utility estimator and asynchronous expansion–evaluation\niterations, establishes itself as a more effective self-improving mechanism compared to DGM and\nSICA.\n4.3\n\nHGM VS . H UMANS : ON C ODING AGENTS D ESIGN\n\nTo gain a better understanding of its potential, we extend our evaluation of HGM by benchmarking it\nagainst the best human performance in coding agent design on SWE-Lite. We consider two settings:\n1) optimization on full SWE-Verified and 2) generalization to SWE-Lite.\n4.3.1\n\nO PTIMIZATION ON F ULL SWE-B ENCH V ERIFIED\n\nIn this experiment, rather than using the SWE-Verified-60, we scaled the HGM evaluation to the\nfull SWE-Bench Verified benchmark (500 coding challenges) with an increased number of HGM\niterations (8000 evaluations). We further adjusted the initial agent so that it yields an improved\naccuracy of 53.2%. See Appendix C.1 for the adjustment details. Notably, this stronger starting\npoint underscores the difficulty of further improvement due to a higher baseline. Despite this, HGM\ndemonstrates significant gains and strong absolute performance.\nResults &amp; Discussion. After 8000 evaluations, HGM discovered an optimized agent that solves\n61.4% tasks, surpassing the best human-designed agent built on GPT-5-mini on the SWE-Verified\nleaderboard. This establishes our discovered agent as the top-scoring GPT-5-mini–based system,\nand positions it among the top-10 agents over all checked submissions, even when compared to\nsystems built on stronger backbone models that can cost 5× more (e.g., Claude-3.7). While higher\nscores on the leaderboard do not necessarily indicate superior general coding ability—since both\nhuman- and machine-designed agents may overfit to the benchmark—these results demonstrate a\npromising potential of HGM for competing with established human-designed baselines under identical model constraints.\n4.3.2\n\nG ENERALIZATION T O SWE-B ENCH L ITE\n\nTo validate that HGM’s self-evolution produces agents with stronger general coding ability, rather\nthan merely overfitting to SWE-Verified, we evaluate the top agent discovered on SWE-Verified\nagainst unseen tasks. Specifically, we compare this agent with its initial ancestor (which achieved\n53.2% on SWE-Verified) using SWE-Lite, a benchmark of 300 coding tasks, 93 of which overlap\nwith SWE-Verified. For rigor and comparability, we report two settings: (i) a filtered setting where\nthe 93 overlapping tasks are excluded, leaving only completely unseen tasks, and (ii) the full 300task benchmark, identical to the standard evaluation used for human designs on the leaderboard. As\n9\n\n\fTable 3: Generalization on SWE-Lite: HGM’s Best-belief SWE-Verified Agent. We report\nthe accuracy of HGM’s best-belief SWE-Verified agent on SWE-Lite under two settings: filtered\n(excluding tasks overlapping with SWE-Verified) and standard (the official leaderboard setting used\nfor evaluating human-designed agents)).\nCoding Agents\nHGM Initial Ancestor\nSWE-agent+GPT-5-mini\nHGM’s Best-belief SWE-Verified Agent\n\nSWE-Lite Filtered (%)\n34.8\n39.6\n40.1\n\nSWE-Lite Standard (%)\n44.0\n47.6\n49.0\n\nTable 4: Transfer to different LLMs on SWE-Lite: HGM’s Best-belief SWE-Verified Agent.\nSimilarly, We report the accuracy of HGM’s best-belief SWE-Verified (optimized with GPT-5-mini)\nagent on SWE-Lite (evaluated with GPT-5) under two settings: filtered (excluding tasks overlapping with SWE-Verified) and standard (the official leaderboard setting used for evaluating humandesigned agents).\nCoding Agents\n\nSWE-Lite Filtered (%)\n\nSWE-Lite Standard (%)\n\nSWE-agent (Best on the LB)\n\n48.3\n\n56.7\n\nHGM’s Best-belief SWE-Verified Agent\n+ GPT-5\n\n47.8\n\n57\n\nof the time of writing, no checked submission using GPT-5-mini appears on the SWE-Lite leaderboard. To control for backbone differences and isolate agent design, we adapt the leading system\n(with checked submissions) (SWE-agent + Claude 4 Sonnet) by replacing its backbone with GPT5-mini, yielding SWE-agent + GPT-5-mini, as an additional baseline for comparison.\nResults &amp; Discussion. We show the generalization results of HGM’s best-belief SWE-Verified\nagent on SWE-Lite benchmark in Table 3. The best-belief HGM agent found on SWE-Verified\nachieves 40.1% under the filtered (completely unseen) setting and 49.0% under the standard setting.\nCompared to its initial ancestor (34.8% and 44.0%, respectively), these gains substantiate the effectiveness of HGM’s self-evolution in improving general coding ability—rather than overfitting to\nthe optimization set. Notably, the superior performance of our HGM agent achieved on the standard\nSWE-Lite places it firmly in second place on the SWE-Lite leaderboard among all checked submissions. Moreover, based on our local execution result of SWE-agent using the SWE-agent + Claude 4\nSonnet submission version with the same configuration, the agent optimized by HGM outperforms\nSWE-agent + GPT-5-mini, which achieves 39.6% (vs. 40.1% for us) on the filtered and 47.6% (vs.\n49.0% for us) on the standard. This demonstrates that the edge arises not from the GPT-5-mini\nbackbone, but from the genuine design improvements introduced by HGM evolution.\nTransfer to bigger LLMs. We also examined how the discovered agent scales when paired with\nlarger and better-performing LLMs. In particular, we replaced the GPT-5-mini backbone of HGM’s\nBest-belief agent with the GPT-5 model to test whether the agent optimized with one LLM remains\neffective with another. The results indicate that the agent maintains its strong performance under\nthis transfer. In particular, its accuracy on the SWE-Lite benchmarks is comparable to that of stateof-the-art, human-engineered coding agents reported on the leaderboard, suggesting that HGM’s\nself-evolved design principles are reliably transferred across backbone sizes. The agent discovered\nby HGM with GPT outperforms all other agents on the SWE-Bench Lite leaderboard with officially\nchecked results and is one task behind the best-performing model on our selected \"SWE-bench\nFiltered\". In Table 4, we compare it with the SWE-agent, which holds first place on the official\nSWE-Bench Lite leaderboard at the time of publication. This result further supports the conclusion\nthat the improvements are due to genuine agent improvement rather than overfitting to a particular\ndataset or LLM.\n10\n\n\f5\n\nR ELATED W ORKS\n\nThe general concepts of machine self-improvement were first systematically articulated by Good\n(1966), who described the possibility of “Intelligence Explosion\" once machines acquire the capacity to design more capable successors. Early work on explicit self-improvements dates back\nto Schmidhuber (1987), which introduced self-referential learning mechanisms in which a system generates and evaluates modified descendant versions of itself. Follow-up work on selfimprovement progressed through interaction and agentic reinforcement learning. The Success-Story\nAlgorithm(SSA) (Schmidhuber &amp; Zhao, 1996; Schmidhuber et al., 1997) progressively forces selfmodifying policies to discover more effective self-modification strategies. Its core mechanism is\nbased on hindsight: at each checkpoint, a sequence of self-modifications that did not yield higher\nlong-term reward rates is systematically undone. In this way, SSA enforces continual improvement\nby ensuring that only those self-modifications associated with demonstrably greater reward intake\nper unit time are preserved. Fitness-Monotonic Execution (Kirsch &amp; Schmidhuber, 2022a;b) reduces the outer-loop design by favoring the execution of models with higher ancestral performance.\nMeta-discovered update rules optimized optimizers (Metz et al., 2021) and black-box search (Lange\net al., 2023). On the other hand, the Gödel Machine, a fully self-referential algorithm that rewrites its\nown code whenever it can prove an expected-utility improvement, provides a provably and globally\noptimal mechanism for self-improvement (Schmidhuber, 2003).\nThe rise of contemporary LLMs has created an opportunity to automate substantial aspects of software engineering. One concrete step in this direction is the development of coding agents, which\nextend LLMs with the ability to operate in conventional computing environments. ChatDev (Qian\net al., 2023) first illustrated this idea in the context of automated bug fixing, and similar frameworks\nwere later explored in SWE Yang et al. (2024), OpenHands (Wang et al., 2024), MetaGPT (Hong\net al., 2024), and AgentLess (Xia et al., 2025).\nThe Self-Taught Optimizer (Zelikman et al., 2024) and Gödel Agent (Yin et al., 2024) first experimented with agents that modify their own scaffolding. Subsequently, DGM (Zhang et al., 2025a)\nand SICA (Robeyns et al., 2025) extend this direction by implementing self-modifying machines\nas full software engineering projects, where agents self-reference and modify their own repositories\nwhile validating changes through execution-grounded software engineering tasks. Both DGM and\nSICA, explicitly or implicitly, assume that higher software benchmark scores correspond to greater\nself-improvement capacity. In contrast, HGM introduces a qualitative measure of self-improvement\nconsistent with the theoretical Gödel Machine and directs self-modifications using estimates of this\nmeasure.\nThe identified tree-search problem spans fixed-budget best-arm identification (BAI), Monte Carlo\nTree Search, and infinite-armed bandits, introducing a distinct decision: explicit expansion actions\nthat create new candidate leaves alongside ordinary evaluations. Fixed-budget BAI and Bayesian\nvalue-of-information methods assume a finite and known set of arms and offer guarantees for static\ncandidates, thus not modeling the discovery of unknown arms (Audibert &amp; Bubeck, 2010; Karnin\net al., 2013; Frazier et al., 2008). Monte-Carlo Tree Search and its UCT variants (Coulom, 2006;\nKocsis &amp; Szepesvári, 2006) alternate selection, expansion, and simulation, while their backup and\nselection rules typically target cumulative reward rather than fixed-budget final-choice objectives\nunder noisy, low-signal feedback, with limited guarantees for pure exploration of leaf quality (Kaufmann &amp; Koolen, 2017). Infinite-armed bandit formulations capture the explore-discover tradeoff but\ntypically model discoveries as i.i.d. draws from a reservoir, missing tree structure, and hierarchical\ndependencies (Wang et al., 2008; Bubeck et al., 2011; Carpentier &amp; Valko, 2015).\n\n6\n\nC ONCLUSION\n\nIn this work, we identify a key limitation in the search heuristics of current self-improving coding\nagents: Benchmark scores alone do not reliably indicate an agent’s long-term potential for selfimprovement, since high-scoring agents can still lead to stagnating lineages, while seemingly weaker\nones may seed productive self-improvements. We refer to it as the Metaproductivity–Performance\nMismatch. To address this gap, we introduce Clade-Metaproductivity (CMP), a lineage-based metric inspired by Huxley’s notion of clades. We show that, under certain assumptions, when applied\n11\n\n\fto our self-improving coding agent search problem (Assumption 1), the CMP oracle is sufficient to\nimplement the Gödel Machine (Theorem 1).\nBuilding on this principle, we propose the Huxley–Gödel Machine (HGM), which approximates\nCMP and uses it to guide expansion through Thompson sampling with adaptive scheduling. Empirically, HGM consistently produces higher quality agents than prior self-improving frameworks\nwhile also reducing wall-clock time. Notably, HGM generalizes across both dataset and model\nshifts, achieving human-level coding agent design performance on SWE-bench Lite with GPT-5\ndespite being optimized on SWE-bench Verified with GPT-5-mini.\nTaken together, these results suggest that clade-based measures of improvement potential, rather than\nimmediate performance alone, lead to more effective forms of self-improvement. By demonstrating\nthat clade-level evaluation can reliably guide the growth of coding agents, this work points to a\nnew paradigm for the design of agentic improvement: one in which improvement is driven not by\nnarrow benchmarks, but by the long-term generative potential of entire lineages. This perspective\nunderscores the importance of systems that strengthen an agent’s capacity to keep improving over\ntime, rather than merely boosting their performance in the short term.\n\nACKNOWLEDGMENT\nWe thank Yuhui Wang for the discussions during the early stages of this project. We gratefully\nacknowledge Jenny Zhang and Shengran Hu, the authors of Darwin Gödel Machine, for sharing\ntheir insights about DGM and their implementation experience. We also thank Yilan Zhang, Rui\nZhang, and Lisiyu Xie for their help in designing the visualizations. The research reported in this\npublication was supported by funding from King Abdullah University of Science and Technology\n(KAUST) - Center of Excellence for Generative AI, under award number 5940.\n\nR EFERENCES\nShipra Agrawal and Navin Goyal. Analysis of thompson sampling for the multi-armed bandit problem, 2012. URL https://arxiv.org/abs/1111.1797.\nJean-Yves Audibert and Sébastien Bubeck. Best arm identification in multi-armed bandits. In\nCOLT-23th Conference on learning theory-2010, pp. 13–p, 2010.\nSébastien Bubeck, Rémi Munos, and Gilles Stoltz. Pure exploration in finitely-armed and\ncontinuous-armed bandits. Theoretical Computer Science, 412(19):1832–1852, 2011.\nAlexandra Carpentier and Michal Valko. Simple regret for infinitely many armed bandits. In International Conference on Machine Learning, pp. 1133–1141. PMLR, 2015.\nOlivier Chapelle and Lihong Li.\nAn empirical evaluation of thompson sampling.\nIn\nJ. Shawe-Taylor, R. Zemel, P. Bartlett, F. Pereira, and K.Q. Weinberger (eds.), Advances in Neural Information Processing Systems, volume 24. Curran Associates, Inc.,\n2011. URL https://proceedings.neurips.cc/paper_files/paper/2011/\nfile/e53a0a2978c28872a4505bdb51db06dc-Paper.pdf.\nNeil Chowdhury, James Aung, Chan Jun Shern, Oliver Jaffe, Dane Sherburn, Giulio Starace, Evan\nMays, Rachel Dias, Marwan Aljubeh, Mia Glaese, Carlos E. Jimenez, John Yang, Leyton Ho,\nTejal Patwardhan, Kevin Liu, and Aleksander Madry. Introducing SWE-bench verified, 2024.\nURL https://openai.com/index/introducing-swe-bench-verified/.\nRémi Coulom. Efficient selectivity and backup operators in monte-carlo tree search. In International\nconference on computers and games, pp. 72–83. Springer, 2006.\nRichard Dawkins. The evolution of evolvability. In Artificial life, pp. 201–220. Routledge, 2019.\nTom Everitt, Daniel Filan, Mayank Daswani, and Marcus Hutter. Self-modification of policy and\nutility function in rational agents. In International conference on artificial general intelligence,\npp. 1–11. Springer, 2016.\n12\n\n\fPeter I Frazier, Warren B Powell, and Savas Dayanik. A knowledge-gradient policy for sequential\ninformation collection. SIAM Journal on Control and Optimization, 47(5):2410–2439, 2008.\nPaul Gauthier. o1 tops aider’s new polyglot leaderboard. https://aider.chat/2024/12/\n21/polyglot.html, dec 2024. Accessed: 2025-09-22.\nIrving John Good. Speculations concerning the first ultraintelligent machine. In Advances in computers, volume 6, pp. 31–88. Elsevier, 1966.\nJohn Storrs Hall. Self-improving ai: An analysis. Minds and Machines, 17(3):249–259, 2007.\nJesse Love Hendrikse, Trish Elizabeth Parsons, and Benedikt Hallgrímsson. Evolvability as the\nproper focus of evolutionary developmental biology. Evolution &amp; development, 9(4):393–401,\n2007.\nSirui Hong, Mingchen Zhuge, Jonathan Chen, Xiawu Zheng, Yuheng Cheng, Ceyao Zhang, Jinlin\nWang, Zili Wang, Steven Ka Shing Yau, Zijuan Lin, et al. Metagpt: Meta programming for\na multi-agent collaborative framework. International Conference on Learning Representations,\nICLR, 2024.\nJulian Huxley. The three types of evolutionary process. Nature, 180(4584):454–455, 1957.\nIntel. Autoround. https://github.com/intel/auto-round, 2025. GitHub repository.\nAccessed 2025-09-25.\nCarlos E Jimenez, John Yang, Alexander Wettig, Shunyu Yao, Kexin Pei, Ofir Press, and Karthik R\nNarasimhan. SWE-bench: Can language models resolve real-world github issues? In The Twelfth\nInternational Conference on Learning Representations, 2024. URL https://openreview.\nnet/forum?id=VTF8yNQM66.\nZohar Karnin, Tomer Koren, and Oren Somekh. Almost optimal exploration in multi-armed bandits.\nIn International conference on machine learning, pp. 1238–1246. PMLR, 2013.\nEmilie Kaufmann and Wouter M Koolen. Monte-carlo tree search by best arm identification. In\nI. Guyon, U. Von Luxburg, S. Bengio, H. Wallach, R. Fergus, S. Vishwanathan, and R. Garnett\n(eds.), Advances in Neural Information Processing Systems, volume 30. Curran Associates, Inc.,\n2017.\nLouis Kirsch and Jürgen Schmidhuber. Self-referential meta learning. In First Conference on Automated Machine Learning (Late-Breaking Workshop), 2022a.\nLouis Kirsch and Jürgen Schmidhuber. Eliminating meta optimization through self-referential meta\nlearning, 2022b. URL https://arxiv.org/abs/2212.14392.\nLevente Kocsis and Csaba Szepesvári. Bandit based monte-carlo planning. In European conference\non machine learning, pp. 282–293. Springer, 2006.\nRobert Lange, Tom Schaul, Yutian Chen, Tom Zahavy, Valentin Dalibard, Chris Lu, Satinder Singh,\nand Sebastian Flennerhag. Discovering evolution strategies via meta-black-box optimization. In\nProceedings of the Companion Conference on Genetic and Evolutionary Computation, pp. 29–30,\n2023.\nLuke Metz, C Daniel Freeman, Niru Maheswaranathan, and Jascha Sohl-Dickstein. Training learned\noptimizers with randomly initialized learned optimizers. arXiv preprint arXiv:2101.07367, 2021.\nEric Nivel, Kristinn R Thórisson, Bas R Steunebrink, Haris Dindo, Giovanni Pezzulo, Manuel Rodriguez, Carlos Hernández, Dimitri Ognibene, Jürgen Schmidhuber, Ricardo Sanz, et al. Bounded\nrecursive self-improvement. arXiv preprint arXiv:1312.6764, 2013.\nChen Qian, Wei Liu, Hongzhang Liu, Nuo Chen, Yufan Dang, Jiahao Li, Cheng Yang, Weize Chen,\nYusheng Su, Xin Cong, et al. Chatdev: Communicative agents for software development. arXiv\npreprint arXiv:2307.07924, 2023.\nMaxime Robeyns, Martin Szummer, and Laurence Aitchison. A self-improving coding agent, 2025.\nURL https://arxiv.org/abs/2504.15228.\n13\n\n\fJ. Schmidhuber. Gödel machines: self-referential universal problem solvers making provably optimal self-improvements. Technical Report IDSIA-19-03, arXiv:cs.LO/0309048, IDSIA, MannoLugano, Switzerland, 2003. Revised 2006.\nJürgen Schmidhuber. Evolutionary principles in self-referential learning, or on learning how to learn:\nThe meta-meta-. hook. 1987. URL https://api.semanticscholar.org/CorpusID:\n264351059.\nJürgen Schmidhuber and Jieyu Zhao. Multi-agent learning with the success-story algorithm. In\nWorkshop on Learning in Distributed Artificial Intelligence Systems, pp. 82–93. Springer, 1996.\nJürgen Schmidhuber, Jieyu Zhao, and Marco Wiering. Shifting inductive bias with success-story\nalgorithm, adaptive levin search, and incremental self-improvement. Machine Learning, 28(1):\n105–130, 1997.\nRichard S Sutton, Andrew G Barto, et al. Reinforcement learning: An introduction, volume 1. MIT\npress Cambridge, 1998.\nXingyao Wang, Boxuan Li, Yufan Song, Frank F Xu, Xiangru Tang, Mingchen Zhuge, Jiayi Pan,\nYueqi Song, Bowen Li, Jaskirat Singh, et al. Openhands: An open platform for ai software\ndevelopers as generalist agents. arXiv preprint arXiv:2407.16741, 2024.\nYizao Wang, Jean-yves Audibert, and Rémi Munos. Algorithms for infinitely many-armed bandits.\nIn D. Koller, D. Schuurmans, Y. Bengio, and L. Bottou (eds.), Advances in Neural Information\nProcessing Systems, volume 21. Curran Associates, Inc., 2008.\nChunqiu Steven Xia, Yinlin Deng, Soren Dunn, and Lingming Zhang. Demystifying llm-based\nsoftware engineering agents. Proceedings of the ACM on Software Engineering, 2(FSE):801–\n824, 2025.\nJohn Yang, Carlos E Jimenez, Alexander Wettig, Kilian Lieret, Shunyu Yao, Karthik Narasimhan,\nand Ofir Press. Swe-agent: Agent-computer interfaces enable automated software engineering.\nAdvances in Neural Information Processing Systems, 37:50528–50652, 2024.\nXunjian Yin, Xinyi Wang, Liangming Pan, Li Lin, Xiaojun Wan, and William Yang Wang. G\\\"\nodel agent: A self-referential agent framework for recursive self-improvement. arXiv preprint\narXiv:2410.04444, 2024.\nEric Zelikman, Eliana Lorch, Lester Mackey, and Adam Tauman Kalai. Self-Taught Optimizer\n(STOP): Recursively Self-Improving Code Generation, August 2024. URL http://arxiv.\norg/abs/2310.02304.\nJenny Zhang, Shengran Hu, Cong Lu, Robert Lange, and Jeff Clune. Darwin godel machine: Openended evolution of self-improving agents, 2025a. URL https://arxiv.org/abs/2505.\n22954.\nLinghao Zhang, Shilin He, Chaoyun Zhang, Yu Kang, Bowen Li, Chengxing Xie, Junhao Wang,\nMaoquan Wang, Yufan Huang, Shengyu Fu, et al. Swe-bench goes live! arXiv preprint\narXiv:2505.23419, 2025b.\nYuntong Zhang, Haifeng Ruan, Zhiyu Fan, and Abhik Roychoudhury. Autocoderover: Autonomous\nprogram improvement. In Proceedings of the 33rd ACM SIGSOFT International Symposium on\nSoftware Testing and Analysis, pp. 1592–1604, 2024.\n\n14\n\n\fA\n\nG ÖDEL M ACHINE WITH CMP O RACLE\n\nAssumptions. The original Gödel Machine is defined in a time-aware setting, where the prover must\nestablish not only that a proposed self-modification increases expected objectives, but also that this\nimprovement still holds after accounting for the time required to search for proofs and compute the\nmodification. This is necessary because, in the general case, the environment may change during\nthese computations, and the objective is measured with respect to elapsed time.\nIn our setup, by contrast, the environment and the evaluation metric remain fixed throughout the\nagent’s execution. The benchmark does not evolve over time, and the utility of any given agent is\ndetermined solely by its final performance on this static task. Importantly, we assume that the utility\nis measured by evaluation on tasks. It also follows the assumption of repeatable trials, meaning\nthat the evaluation of a given agent on a task is independent of evaluation time or prior events. In\nother words, we are able to reset the testing environment for each test. Furthermore, we assume\nthat the Gödel Machine prover has full knowledge of the utility function as part of its axioms of the\nenvironment. Hence, we exclude the evaluation actions from the action space. Finally, we assume\nthat the Gödel Machine prover does not consume budget, and that the self-modifications consume\nan equal amount of budget—exactly one budget unit.\nTo summarize, we show that the CMP oracle is sufficient to imitate Gödel Machines in our specific\nsetting that satisfies the following:\n• The policy objective function is defined as a function of only the final agent, with no other\nrewards received before termination;\n• The agent’s utility is measured by its performance on evaluation tasks, under the assumption of repeatable trials: for any agent–task pair, the expected outcome is independent of\nevaluation time or prior events.\n• The Gödel Machine prover has full knowledge of the utility function;\n• The computation budget is finite and known;\n• The proofs of Gödel Machines do not consume the budget;\n• And each self-modification costs exactly one unit of the budget.\nProof. The proof of Gödel Machine being simulated with a CMPπ oracle is a simple observation\nthat in the Gödel Machine setup, CMPπ is an actual state-action value function Qπ (Sutton et al.,\n1998) defined by the Gödel Machine, as the agents above the clades are not reachable according to\nthe design of Gödel Machines. In order to state this, we formalize each term precisely.\nWe define Gödel Machine Proof search as an optimal policy on the POMDP (let’s call it Gödel\nPOMDP) defined as:\nState space. Gödel POMDP operates on an extended state space, which, in addition to the tree of\nagents T , consists of two special agents: aparent and achild , from the tree T . For a full formal description, let’s also include a remaining budget descriptor that determines the number of transitions left\nbefore the budget is exceeded.\nObservation space. Observation is limited to the agents (aparent , achild ) and the remaining budget b.\nAction space. For most states, the action space consists of two actions—accept and reject. As\nin the original Gödel Machine, the action selects the new parent in the next iteration. Intuitively,\naccept selects achild as the new parent, and reject requires the parent to remain unchanged. As the\npolicy operates on a POMDP, it is a function of the history of the observations, which is equivalent\nto the state—tree T with special states aparent and achild . For the sake of simplicity in notation, we\nwill refer to the newly selected parent agent as if it were the action. Thus, for policy π, aparent =\nπ((T , aparent , achild , b)) corresponds to the action reject.\nScoring function. Each policy also consists of a Scoreπ function that scores all possible elements\nin the observation. Formally, Scoreπ : Obs → T → R is a function from observation into a\nfunction of agents that is returned when the budget b is equal to 0, from which the agent with the\n15\n\n\fhighest score is selected as the final agent. It is a function of the observation and not the entire\nhistory, as the algorithm can only choose the final agent from the final observation.\nThe policy selects the highest-scoring agent, as determined by the Scoreπ (o) function. Furthermore,\nthe original Gödel Machine at the end allows only the parent or current child to be kept as the final\nagent. Hence, we restrict the score functions such that they always produce indicator functions of\none of the observed agents, i.e., one observed agent has a score of 1, and all other agents receive\na score of zero. The scoring function corresponds to the selection made by the algorithm in our\noriginal setup. After the selection dictated by the scoring function, the agent is evaluated by the\nUtility function U .\nTransitions. Transitions generate new self-modifications from the newly selected next parent, i.e.,\nthe action output. At each transition, a self-modification of anew\nparent is created and assigned as a new\nnode achild . anew\nbecomes\nthe\na\nfor\nthe\nnext\ntime\nstep.\nFormally,\nif a(a) is the self-modification\nparent\nparent\nof a, and T r is the transition function, then T r((T , aparent , achild , b), a) = (T ∪{a(a)}, a, a(a), b−1).\nThe final reward in Gödel POMDP is U (arg maxa∈TB Scoreπ (aparent , achild )(a)).\nWe also adapt the original coding setting to match the notation of Gödel POMDP. Let’s call it\nthe Extended MDP. Similarly to Gödel POMDP, its state is a tree T , involving two special agents\naparent , achild and the budget b. The action space is the same as in our problem and consists of a single\nagent a ∈ T when there is still some budget left. In other cases, the policy π uses its Scoreπ function\nto score created agents in the trees for the selection of the final agent. The transition function adds\nthe self-modification to the tree and sets a as the new aparent and a(a) as the new achild .\nEvery policy from Gödel POMDP can be mapped to a policy in the extended MDP. Specifically,\nlet πG be a policy in the Gödel POMDP, then we define the corresponding policy in the extended\nMDP πE as πE ((T , aparent , achild , b)) = πG ((T , aparent , achild , b)). At each node, the policy chooses\nbetween the two special nodes, ignoring the rest of the tree.\nNow we adapt CMP to Gödel POMDP. CMP adapted to the Gödel case is still a function of a state\n(and agent to expand) in the extended state space (not only observation) and the agent.\n\nCMPπ ((T , ap , ac , b), a)\n\"\n\n#\n′\n\n= E(TB ,aBp ,aBc ,0)∼pπ (·|(T ,ap ,ac ,b),a) U ( arg max Scoreπ (aBp , aBc )(a ))\na′ ∈C(TB ,a)\n\n(2)\n\n\"\n\n#\n′\n\n= E(TB ,aBp ,aBc ,0)∼pπ (·|(T ,ap ,ac ,b),a) U ( arg max Scoreπ (aBp , aBc )(a ))\na′ ∈{aBp ,aBc }\n\n(3)\n\n= Qπ ((T , ap , ac , b), a).\n\nWhere TB is the final unrolled tree, aBp is the final parent and aBc is the final child in the sampled\ntrajectory. The second equality (2) comes from the fact that the Scoreπ is equal to 1 for exactly one\nelement from the final observation -either aBp or aBc (paragraph A). The third equality (3) comes\nfrom directly unrolling the Qπ -value function.\nThe Gödel Machine is defined by a prover that produces a proof whether accepting or selecting a\ngiven node (or rejecting). Here, the algorithm by having access to CMP has access to the true Q\nvalue function in the Gödel POMDP. This serves as a proof of better objective of either parent or\nthe child. Additionally, we state that we break the tie by selecting the parent node as in the original\nGödel Machine. Hence, the algorithm that follows it is a Gödel Machine.\nIndependently, as this proof directly shows that Gödel Machine selects an action that maximizes its\nown Qπ -value function, it is optimal due to the Bellman Optimality Equation. With the procedure\nshown above, we can adapt it to the extended MDP.\n\n16\n\n\fB\n\nA LGORITHM\n\nAlgorithm 1 presents the procedure of HGM.\nIn the standard HGM, when an expansion ends with a new a added to the tree, the next following\nevaluation actions have the choice of choosing a. At the beginning of the search, the first actions\nhave the most dense ratio of expansion actions, and the following evaluation actions would diverge\nmore from the standard HGM since most of their choices are not generated yet, concentrating on the\nearly finished expansions. Therefore, to avoid this bias, we initialize by expanding the initial agent\n5 times with each of the processes in parallel.\nThe asynchronization also introduces another bias that favors agents with fewer evaluated results to\nbe more often selected for evaluation than in the standard HGM. This is due to the fact that the easy\ntasks usually stop earlier than the difficult ones. This yields agents with fewer evaluations having\na higher empirical mean. During our experiments, we observed that many agents were successful\non the first ten evaluated tasks; however, this accuracy drops quickly as the number of evaluations\ngrows. After having more than 50 evaluations, this bias is barely observed.\nAlgorithm 1 Huxley–Gödel Machine (HGM)\n1: Input: the initial agent a0 , widening parameter α, and the percentile ϵ for final selection\n2: Initialize a tree T with root a0\nC\n3: Initialize counters nC\nsuccess (a), nfailure (a), nsuccess (a), nfailure (a) for all a ∈ T\n4: while Computational Budget not Exceeded do\n5:\nif |T | ≤ nα and expandable parents exist then\n6:\nExpand:\n7:\nfor each node a ∈ A do\nC\n8:\nSample SC (a) ∼ Beta(τ (1 + nC\nsuccess (a)), τ (1 + nfailure (a)))\n9:\nend for\n10:\nSelect node a⋆ = arg maxa SC (a)\n11:\nCreate child c by self-modification of a⋆\n12:\nAdd c to T\n13:\nelse\n14:\nEvaluate:\n15:\nfor each agent a ∈ A with remaining tasks do\n16:\nSample S(a) ∼ Beta(τ (1 + nsuccess (a)), τ (1 + nfailure (a)))\n17:\nend for\n18:\nSelect agent a⋆ = arg maxa S(a)\n19:\nAllocate a benchmark task to a⋆\n20:\nupdate nsuccess , nfailure for a⋆\nC\n⋆\n21:\nupdate nC\nsuccess , nfailure for a and ancestors\n22:\nend if\n23: end while\n24: Return argmaxa∈TB Iϵ (1 + nsuccess(a) , 1 + nfailure (a))\n\n17\n\n\fC\n\nE XPERIMENTAL D ETAILS\n\nC.1\n\nI NITIAL AGENTS\n\nOur initial agents applied in Section 4.2 are adopted from the official implementation of DGM with\nminor changes, including modifying API support, setting up a timeout option, and adding a length\nof LLM interaction restriction. The initial agent is essentially a single loop of LLM queries with\ntwo tool options, i.e., file editing and bash command execution. We set a time limit of one hour for\neach agent execution.\nThe initial agents used in SWE-bench experiments and Polyglot experiments differ in that the Polyglot initial agent includes test commands with different programming language support. There are\ntwo additional functions in the SWE-bench initial agent that serve to summarize existing tests and\nexecute the tests with a report generated, respectively.\nThe initial agent employed in Section 4.3 is further adjusted by removing the file-editing tool, leaving only the bash tool, to minimize initial inductive bias. The time limit is extended to five hours\nfor both self-modification and task evaluation, reducing the risk of prematurely eliminating stronger\nagents due to time constraints.\nC.2\n\nOTHER D ETAILS\n\nFor the Polyglot experiments presented in Section 4.2, the exact large language model used for\nself-modification is an int4 and int8 mixed quantized version of Qwen3-Coder-480B-A35B-Instruct\ngenerated by AutoRound (Intel, 2025). Overall, we spent approximately $5000 USD to produce the\nexperimental results, including all three methods.\n\n18\n\n\fD\n\nE MPIRICAL CMP AND I TS E STIMATION\n\nIn this section, we provide the exact formula to compute the empirical CMP and the variant of our\nCMP estimator being used in Section 4.1 for correlation analysis. The empirical CMP of an agent\na as a node in a tree is defined as\nmaxa′ ∈C(a)\\{a}\n\nnsuccess (a′ )\n.\nnsuccess (a′ ) + nfailure (a′ )\n\nThe prediction of our CMP estimator is defined as\nC\n∗\nnC\nsuccess (a) − nsuccess (a) − nsuccess (b )\n,\nC\n∗\nC\nC\n∗\nnC\nfailure (a) − nfailure (a) − nfailure (b ) + nsuccess (a) − nsuccess (a) − nsuccess (b )\n\nwhere b∗ is a child of a such that\n\u0013\n\u0012\nnsuccess (n)\n∩ C(b∗ ) ̸= ∅.\nargmaxn∈C(a)\nnfailure (n)\nFor both SICA and DGM, we consider the benchmark performance of an agent as their estimator of\nthe agent’s CMP.\n\n19\n\n\fE\n\nBASELINES\n\nTable 2 summarizes the three subpolicies of SICA, DGM, and HGM, which define solutions to the\niterative tree search problem defined in 2.\nSubpolicy\n\nSICA\n\nDGM\n\nHGM (Ours)\n\nSelection Policy\n\nAlternates\nbetween\nmodification and evaluation.\n\nAlternates\nbetween\nmodification and evaluation.\n\nAdaptive choice between modification and\nevaluation.\n\nExpansion\nPolicy\n\nGreedily selects the\nagent with the best\nperformance up to this\npoint and modifies it\nwith the entire history\naccessible to the agent.\n\nSelects the node probabilistically based on the\nevaluation metric and\nthe number of children\nof the agents.\n\nSelects the node based\non the statistics of the\nclade stemming from a\ngiven node.\n\nEvaluation\nPolicy\n\nEvaluates the most\nrecently created agent\non the entire evaluation\ndataset.\n\nProgressively evaluates\nthe last created agent on\nsubsets of the dataset,\nexpanding if results are\npromising.\n\nSelects the agent based\non the statistics and\nevaluates it on a single\ntask.\n\nTable 5: Comparison of structured policies across self-improving methods. Each method is described by three subpolicies: Selection Policy, Expansion Policy, and Evaluation Policy.\n\n20\n\n\fF\n\nD ISCOVERED AGENTS\n\nWe present interesting findings about HGM-discovered agents during our experiments. By manually inspecting the diff patch files that were generated by self-modification, we make interesting\nobservations.\nOne engaging self-modification we found implements iterative refinement to make incremental improvements. In the self-improving context, it means that during one expansion (self-modification)\nstep, the agent is accurately performing multiple self-modifications. More interestingly, this phenomenon can be viewed as the agent being self-motivated to perform self-modification, instead of\nbeing instructed to do so by humans. This self-motivated repetitive self-modification automatically\ncreates arbitrary levels of meta-improvement in the sense that each self-modification ideally needs\nto consider all its subsequent self-modifications, which the subsequent self-modifications also need\nto consider future self-modifications. We show in List 1 the part of the patch file that includes the\nimplementation of this self-modification.\nAnother interesting phenomenon we observe is the file structures that self-modifying agents create.\nMany agents tend to write the chunk they self-modify into a diff patch file, usually with a constant\nfile name. When multiple consecutive attempts of these self-modifying actions apply, the structure\nof these git diff files becomes abstruse. Imagine that there is a diff file that includes certain edits.\nOnce there are changes applied to this file, it then generates the diff patch file. In this new patch file,\na nested format of editing record appears. At the beginning of some lines, there are multiple + and signs that correspond to nested file edits. This is a natural format to present information that inspires\nlong-sighted self-improvement since it shows how self-modifications indeed influence subsequent\nself-modifications. The authors find it mind-bending to understand such a file structure and parse\nthe semantics manually. For readers interested in further investigation, we provide one instance of\nsuch a file structure in List 2.\nListing 1: The self-modifying agent that executes multiple self-modifications per instruction.\n+def attempt_error_resolution(git_dir, test_output, test_error,\n,→ language):\n+\n\"\"\"\n+\nAttempt to automatically diagnose and resolve errors.\n+\nReturns a tuple of (resolved, message) where resolved indicates if\n,→ errors were fixed.\n+\n\"\"\"\n+\nsafe_log(\"Attempting automated error diagnosis and resolution...\")\n+\n+\n# Diagnose errors using our enhanced bash tool function\n+\ndiagnosis = diagnose_errors(test_output, test_error, \"\")\n+\n+\nif not diagnosis[\"has_errors\"]:\n+\nreturn False, \"No errors detected to resolve.\"\n+\n+\nresolution_messages = []\n+\n+\n# Try to apply automated fixes for each diagnosed error\n+\nfor error in diagnosis[\"errors\"]:\n+\nsafe_log(f\"Processing error: {error[’type’]} ,→ {error[’description’]}\")\n+\n+\n# Simple resolution strategies based on error type\n+\nif error[\"type\"] == \"python_module_not_found\":\n+\n# For Python module not found errors, we might install the\n,→ module\n+\nmatch = re.search(r\"No module named ’([^’]+)’\",\n,→ error[\"description\"])\n+\nif match:\n+\nmodule = match.group(1)\n+\nresolution_messages.append(f\"Would attempt to install\n,→ Python module: {module}\")\n+\n# In practice, we would run: pip install {module}\n\n21\n\n\f+\n\n# But we’ll skip actual installation to avoid side\n,→ effects\n\n+\n+\n+\n+\n+\n+\n\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n+\n\nelif error[\"type\"] == \"python_syntax_error\" and \"file\" in error:\n# For syntax errors, we could potentially apply fixes\nfile_path = os.path.join(git_dir, error[\"file\"])\nif os.path.exists(file_path):\nresolution_messages.append(f\"Would attempt to fix\n,→ syntax error in {file_path} at line {error.get(’line’,\n,→ ’unknown’)}\")\n# In practice, we would use the editor tool’s apply_fix\n,→ command\n# This is just a demonstration of what could be done\nelif error[\"type\"] == \"test_failure\":\n# For test failures, we might suggest reviewing the\n,→ implementation\nresolution_messages.append(\"Would analyze test failures and\n,→ suggest implementation improvements\")\nif resolution_messages:\nreturn True, \"Automated resolution attempted:\\n\" +\n,→ \"\\n\".join(resolution_messages)\nelse:\nreturn False, \"No automated resolutions available for detected\n,→ errors.\"\n\n+\nclass AgenticSystem:\ndef __init__(\nself,\n@@ -243,6 +293,16 @@ Your task is to make changes to the files in the\n,→ {self.git_dir} directory to add\nsafe_log(f\"Attempt {attempt + 1} test results: {’PASSED’ if\n,→ test_success else ’FAILED’}\")\n+\n+\n+\n+\n+\n+\n+\n+\n+\n\n# If tests failed, attempt automated error resolution\nif not test_success:\nresolved, resolution_message = attempt_error_resolution(\nself.git_dir, test_output, test_error, self.language\n)\nsafe_log(f\"Error resolution: {resolution_message}\")\n# Even if we couldn’t automatically resolve, we still\n,→ provide feedback\n# In a more advanced implementation, we might actually\n,→ apply fixes here\n\n+\n# If this is the first attempt or tests passed and we\n,→ didn’t have a successful attempt yet, update best patch\nif attempt == 0 or (test_success and (best_patch is None or\n,→ not best_test_results)):\nbest_patch = current_patch\n@@ -278,37 +338,31 @@ Please revise your code to fix these issues and\n,→ try again.\n# Log final summary\nsafe_log(f\"\\n{’=’*20} FINAL SUMMARY {’=’*20}\")\nsafe_log(f\"Best solution found on attempt:\n,→ {best_test_results[’attempt’] if best_test_results else ’None’}\")\nsafe_log(f\"Tests passed: {best_test_results[’test_success’] if\n,→ best_test_results else ’Unknown’}\")\n+\nsafe_log(f\"Final test result: {’PASSED’ if best_test_results\n,→ and best_test_results[’test_success’] else ’FAILED’}\")\n+\n+\nif best_test_results:\n\n22\n\n\f+\n+\n+\n\n-\n\n+\n\nsafe_log(f\"Final test\n,→ output:\\n{best_test_results[’test_output’]}\")\nif best_test_results[’test_error’]:\nsafe_log(f\"Final test\n,→ errors:\\n{best_test_results[’test_error’]}\")\n# Save attempt history to a file\nhistory_file =\n,→ os.path.join(os.path.dirname(self.chat_history_file),\n,→ ’attempt_history.md’)\nwith open(history_file, ’w’) as f:\nf.write(\"# Attempt History\\n\\n\")\nfor result in self.attempt_history:\nf.write(f\"## Attempt {result[’attempt’]}\\n\")\nf.write(f\"**Tests Passed**: {result[’test_success’]}\\n\")\nf.write(f\"**LLM Calls Used**: {result[’llm_calls’]}\\n\")\nf.write(f\"**Test\n,→ Output**:\\n‘‘‘\\n{result[’test_output’]}\\n‘‘‘\\n\")\nf.write(f\"**Test\n,→ Error**:\\n‘‘‘\\n{result[’test_error’]}\\n‘‘‘\\n\")\nf.write(f\"**Patch**:\\n‘‘‘\\n{result[’patch’]}\\n‘‘‘\\n\\n\")\nreturn bool(best_test_results and\n,→ best_test_results[’test_success’])\n\nListing 2: An instance of the nested diff patch format.\ndiff --git a/attempt_history.md b/attempt_history.md\nnew file mode 100644\nindex 0000000..b132b1a\n--- /dev/null\n+++ b/attempt_history.md\n@@ -0,0 +1,727 @@\n+# Attempt History\n+\n+## Attempt 1\n+**Tests Passed**: True\n+**LLM Calls Used**: 18\n+**Test Output**:\n+‘‘‘\n+============================= test session starts\n,→ ==============================\n+platform linux -- Python 3.10.18, pytest-8.4.2, pluggy-1.6.0 -,→ /usr/local/bin/python3.10\n+cachedir: .pytest_cache\n+rootdir: /dgm\n+configfile: pytest.ini\n+testpaths: tests\n+plugins: asyncio-1.1.0, anyio-4.10.0\n+asyncio: mode=strict, asyncio_default_fixture_loop_scope=None,\n,→ asyncio_default_test_loop_scope=function\n+collecting ... collected 29 items\n+\n+tests/test_bash_tool.py::TestBashTool::test_simple_command PASSED\n,→ [ 3%]\n+tests/test_bash_tool.py::TestBashTool::test_multiple_commands PASSED\n,→ [ 6%]\n+tests/test_bash_tool.py::TestBashTool::test_command_with_error PASSED\n,→ [ 10%]\n+tests/test_bash_tool.py::TestBashTool::test_environment_variables\n,→ PASSED [ 13%]\n+tests/test_bash_tool.py::TestBashTool::test_command_output_processing\n,→ PASSED [ 17%]\n+tests/test_bash_tool.py::TestBashTool::test_long_running_command PASSED\n,→ [ 20%]\n\n23\n\n\f+tests/test_bash_tool.py::TestBashTool::test_invalid_commands[invalid_command_name]\n,→ PASSED [ 24%]\n+tests/test_bash_tool.py::TestBashTool::test_invalid_commands[cd\n,→ /nonexistent/path] PASSED [ 27%]\n+tests/test_bash_tool.py::TestBashTool::test_invalid_commands[/bin/nonexistent]\n,→ PASSED [ 31%]\n+tests/test_bash_tool.py::TestBashTool::test_command_with_special_chars\n,→ PASSED [ 34%]\n+tests/test_bash_tool.py::TestBashTool::test_multiple_line_output PASSED\n,→ [ 37%]\n+tests/test_bash_tool.py::TestBashTool::test_large_output_handling\n,→ PASSED [ 41%]\n+tests/test_edit_tool.py::TestEditorTool::test_view_file PASSED\n,→ [ 44%]\n+tests/test_edit_tool.py::TestEditorTool::test_create_file PASSED\n,→ [ 48%]\n+tests/test_edit_tool.py::TestEditorTool::test_create_existing_file\n,→ PASSED [ 51%]\n+tests/test_edit_tool.py::TestEditorTool::test_edit_file PASSED\n,→ [ 55%]\n+tests/test_edit_tool.py::TestEditorTool::test_edit_nonexistent_file\n,→ PASSED [ 58%]\n+tests/test_edit_tool.py::TestEditorTool::test_view_directory PASSED\n,→ [ 62%]\n+tests/test_edit_tool.py::TestEditorTool::test_invalid_path PASSED\n,→ [ 65%]\n+tests/test_edit_tool.py::TestEditorTool::test_invalid_commands[unknown_command]\n,→ PASSED [ 68%]\n+tests/test_edit_tool.py::TestEditorTool::test_invalid_commands[] PASSED\n,→ [ 72%]\n+tests/test_edit_tool.py::TestEditorTool::test_invalid_commands[None]\n,→ PASSED [ 75%]\n+tests/test_error_diagnosis.py::TestErrorDiagnosis::test_python_syntax_error_diagnosis\n,→ PASSED [ 79%]\n+tests/test_error_diagnosis.py::TestErrorDiagnosis::test_python_module_not_found_diagnosis\n,→ PASSED [ 82%]\n+tests/test_error_diagnosis.py::TestErrorDiagnosis::test_no_error_diagnosis\n,→ PASSED [ 86%]\n+tests/test_error_diagnosis.py::TestErrorDiagnosis::test_format_diagnosis_with_errors\n,→ PASSED [ 89%]\n+tests/test_error_diagnosis.py::TestErrorDiagnosis::test_format_diagnosis_without_errors\n,→ PASSED [ 93%]\n+tests/test_error_diagnosis.py::TestAutomatedFixes::test_apply_missing_import_fix\n,→ PASSED [ 96%]\n+tests/test_error_diagnosis.py::TestAutomatedFixes::test_apply_syntax_error_fix\n,→ PASSED [100%]\n+\n+==================================== PASSES\n,→ ====================================\n+=========================== short test summary info\n,→ ============================\n+PASSED tests/test_bash_tool.py::TestBashTool::test_simple_command\n+PASSED tests/test_bash_tool.py::TestBashTool::test_multiple_commands\n+PASSED tests/test_bash_tool.py::TestBashTool::test_command_with_error\n+PASSED tests/test_bash_tool.py::TestBashTool::test_environment_variables\n+PASSED\n,→ tests/test_bash_tool.py::TestBashTool::test_command_output_processing\n+PASSED tests/test_bash_tool.py::TestBashTool::test_long_running_command\n+PASSED\n,→ tests/test_bash_tool.py::TestBashTool::test_invalid_commands[invalid_command_name]\n+PASSED tests/test_bash_tool.py::TestBashTool::test_invalid_commands[cd\n,→ /nonexistent/path]\n+PASSED\n,→ tests/test_bash_tool.py::TestBashTool::test_invalid_commands[/bin/nonexistent]\n\n24\n\n\f+PASSED\n,→ tests/test_bash_tool.py::TestBashTool::test_command_with_special_chars\n+PASSED tests/test_bash_tool.py::TestBashTool::test_multiple_line_output\n+PASSED tests/test_bash_tool.py::TestBashTool::test_large_output_handling\n+PASSED tests/test_edit_tool.py::TestEditorTool::test_view_file\n+PASSED tests/test_edit_tool.py::TestEditorTool::test_create_file\n+PASSED\n,→ tests/test_edit_tool.py::TestEditorTool::test_create_existing_file\n+PASSED tests/test_edit_tool.py::TestEditorTool::test_edit_file\n+PASSED\n,→ tests/test_edit_tool.py::TestEditorTool::test_edit_nonexistent_file\n+PASSED tests/test_edit_tool.py::TestEditorTool::test_view_directory\n+PASSED tests/test_edit_tool.py::TestEditorTool::test_invalid_path\n+PASSED\n,→ tests/test_edit_tool.py::TestEditorTool::test_invalid_commands[unknown_command]\n+PASSED tests/test_edit_tool.py::TestEditorTool::test_invalid_commands[]\n+PASSED\n,→ tests/test_edit_tool.py::TestEditorTool::test_invalid_commands[None]\n+PASSED\n,→ tests/test_error_diagnosis.py::TestErrorDiagnosis::test_python_syntax_error_diagnosis\n+PASSED\n,→ tests/test_error_diagnosis.py::TestErrorDiagnosis::test_python_module_not_found_diagnosi\n+PASSED\n,→ tests/test_error_diagnosis.py::TestErrorDiagnosis::test_no_error_diagnosis\n+PASSED\n,→ tests/test_error_diagnosis.py::TestErrorDiagnosis::test_format_diagnosis_with_errors\n+PASSED\n,→ tests/test_error_diagnosis.py::TestErrorDiagnosis::test_format_diagnosis_without_errors\n+PASSED\n,→ tests/test_error_diagnosis.py::TestAutomatedFixes::test_apply_missing_import_fix\n+PASSED\n,→ tests/test_error_diagnosis.py::TestAutomatedFixes::test_apply_syntax_error_fix\n+============================== 29 passed in 3.58s\n,→ ==============================\n+\n+‘‘‘\n+**Test Error**:\n+‘‘‘\n+\n+‘‘‘\n+**Patch**:\n+‘‘‘\n+diff --git a/coding_agent.py b/coding_agent.py\n+index 78e8ad4..77e5097 100644\n+--- a/coding_agent.py\n++++ b/coding_agent.py\n+@@ -5,9 +5,13 @@ from logging.handlers import RotatingFileHandler\n+ import os\n+ import threading\n+ import time\n++import json\n++import re\n+\n+ from llm_withtools import CLAUDE_MODEL, OPENAI_MODEL, chat_with_agent\n+ from utils.git_utils import diff_versus_commit, reset_to_commit,\n,→ apply_patch\n++from tools.bash import diagnose_errors\n++from tools.edit import apply_automated_fix, read_file, write_file\n+\n+ # reset_to_commit(git_dname, commit)\n+ # apply_patch(git_dname, patch_str)\n+@@ -136,6 +140,52 @@ def run_tests(git_dir, language):\n+\n# Always change back to original directory\n+\nos.chdir(original_cwd)\n+\n\n25\n\n\f++def attempt_error_resolution(git_dir, test_output, test_error,\n,→ language):\n++\n\"\"\"\n++\nAttempt to automatically diagnose and resolve errors.\n++\nReturns a tuple of (resolved, message) where resolved indicates if\n,→ errors were fixed.\n++\n\"\"\"\n++\n\"\"\"\n++\nsafe_log(\"Attempting automated error diagnosis and resolution...\")\n++\n++\n# Diagnose errors using our enhanced bash tool function\n++\ndiagnosis = diagnose_errors(test_output, test_error, \"\")\n++\n++\nif not diagnosis[\"has_errors\"]:\n++\nreturn False, \"No errors detected to resolve.\"\n++\n++\nresolution_messages = []\n++\n++\n# Try to apply automated fixes for each diagnosed error\n++\nfor error in diagnosis[\"errors\"]:\n++\nsafe_log(f\"Processing error: {error[’type’]} ,→ {error[’description’]}\")\n++\n++\n# Simple resolution strategies based on error type\n++\nif error[\"type\"] == \"python_module_not_found\":\n++\n# For Python module not found errors, we might install the\n,→ module\n++\nmatch = re.search(r\"No module named ’([^’]+)’\",\n,→ error[\"description\"])\n++\nif match:\n++\nmodule = match.group(1)\n++\nresolution_messages.append(f\"Would attempt to install\n,→ Python module: {module}\")\n++\n# In practice, we would run: pip install {module}\n++\n# But we’ll skip actual installation to avoid side\n,→ effects\n++\n++\nelif error[\"type\"] == \"python_syntax_error\" and \"file\" in\n,→ error:\n++\n# For syntax errors, we could potentially apply fixes\n++\nfile_path = os.path.join(git_dir, error[\"file\"])\n++\nif os.path.exists(file_path):\n++\nresolution_messages.append(f\"Would attempt to fix\n,→ syntax error in {file_path} at line {error.get(’line’,\n,→ ’unknown’)}\")\n++\n# In practice, we would use the editor tool’s\n,→ apply_fix command\n++\n# This is just a demonstration of what could be done\n++\n++\nelif error[\"type\"] == \"test_failure\":\n++\n# For test failures, we might suggest reviewing the\n,→ implementation\n++\nresolution_messages.append(\"Would analyze test failures\n,→ and suggest implementation improvements\")\n++\n++\nif resolution_messages:\n++\nreturn True, \"Automated resolution attempted:\\n\" +\n,→ \"\\n\".join(resolution_messages)\n++\nelse:\n++\nreturn False, \"No automated resolutions available for detected\n,→ errors.\"\n++\n+ class AgenticSystem:\n+\ndef __init__(\n+\nself,\n\n26\n\n\f+@@ -243,6 +293,16 @@ Your task is to make changes to the files in the\n,→ {self.git_dir} directory to add\n+\n+\nsafe_log(f\"Attempt {attempt + 1} test results: {’PASSED’\n,→ if test_success else ’FAILED’}\")\n+\n++\n# If tests failed, attempt automated error resolution\n++\nif not test_success:\n++\nresolved, resolution_message =\n,→ attempt_error_resolution(\n++\nself.git_dir, test_output, test_error,\n,→ self.language\n++\n)\n++\nsafe_log(f\"Error resolution: {resolution_message}\")\n++\n++\n# Even if we couldn’t automatically resolve, we still\n,→ provide feedback\n++\n# In a more advanced implementation, we might actually\n,→ apply fixes here\n++\n+\n# If this is the first attempt or tests passed and we\n,→ didn’t have a successful attempt yet, update best patch\n+\nif attempt == 0 or (test_success and (best_patch is None\n,→ or not best_test_results)):\n+\nbest_patch = current_patch\n+@@ -278,37 +338,31 @@ Please revise your code to fix these issues and\n,→ try again.\n+\n# Log final summary\n+\nsafe_log(f\"\\n{’=’*20} FINAL SUMMARY {’=’*20}\")\n+\nsafe_log(f\"Best solution found on attempt:\n,→ {best_test_results[’attempt’] if best_test_results else ’None’}\")\n+safe_log(f\"Tests passed: {best_test_results[’test_success’] if\n,→ best_test_results else ’Unknown’}\")\n++\nsafe_log(f\"Final test result: {’PASSED’ if best_test_results\n,→ and best_test_results[’test_success’] else ’FAILED’}\")\n++\n++\nif best_test_results:\n++\nsafe_log(f\"Final test\n,→ output:\\n{best_test_results[’test_output’]}\")\n++\nif best_test_results[’test_error’]:\n++\nsafe_log(f\"Final test\n,→ errors:\\n{best_test_results[’test_error’]}\")\n+\n+# Save attempt history to a file\n+history_file =\n,→ os.path.join(os.path.dirname(self.chat_history_file),\n,→ ’attempt_history.md’)\n+with open(history_file, ’w’) as f:\n+f.write(\"# Attempt History\\n\\n\")\n+for result in self.attempt_history:\n+f.write(f\"## Attempt {result[’attempt’]}\\n\")\n+f.write(f\"**Tests Passed**:\n,→ {result[’test_success’]}\\n\")\n+f.write(f\"**LLM Calls Used**: {result[’llm_calls’]}\\n\")\n+f.write(f\"**Test\n,→ Output**:\\n‘‘‘\\n{result[’test_output’]}\\n‘‘‘\\n\")\n+f.write(f\"**Test\n,→ Error**:\\n‘‘‘\\n{result[’test_error’]}\\n‘‘‘\\n\")\n+f.write(f\"**Patch**:\\n‘‘‘\\n{result[’patch’]}\\n‘‘‘\\n\\n\")\n++\nreturn bool(best_test_results and\n,→ best_test_results[’test_success’])\n+\n+-def main():\n+parser = argparse.ArgumentParser(description=’Process repository\n,→ with an agentic system.’)\n\n27\n\n\f+-\n\nparser.add_argument(’--problem_statement’, required=True,\n,→ help=’The problem statement to process’)\n+parser.add_argument(’--git_dir’, required=True, help=’Path to git\n,→ repository directory’)\n+parser.add_argument(’--base_commit’, required=True, help=’Base\n,→ commit hash to compare against’)\n+parser.add_argument(’--chat_history_file’, required=True,\n,→ help=’Path to chat history file’)\n+parser.add_argument(’--outdir’, required=False, default=\"/dgm/\",\n,→ help=’Output directory’)\n+parser.add_argument(’--test_description’, default=None,\n,→ required=False, help=’Description of how to test the repository’)\n+parser.add_argument(’--self_improve’, default=False,\n,→ action=’store_true’, help=’Whether to self-improve the repository\n,→ or solving swe’)\n+parser.add_argument(’--language’, required=False,\n,→ default=\"python\", choices=[’cpp’, ’java’, ’python’, ’go’, ’rust’,\n,→ ’javascript’], help=’Task\\’s programming language’)\n+parser.add_argument(’--model’, required=False,\n,→ default=CLAUDE_MODEL, help=’LLM model to use for processing’)\n+parser.add_argument(’--timeout’, type=int, default=3600,\n,→ help=’Timeout for LLM calls in seconds’)\n+parser.add_argument(’--max_attempts’, type=int, default=3,\n,→ help=’Maximum number of solution attempts’)\n++if __name__ == \"__main__\":\n++\nparser = argparse.ArgumentParser(description=\"Run the Agentic\n,→ System on a coding task.\")\n++\nparser.add_argument(\"--problem_statement\", type=str,\n,→ required=True, help=\"Problem statement\")\n++\nparser.add_argument(\"--git_dir\", type=str, required=True,\n,→ help=\"Git repository directory\")\n++\nparser.add_argument(\"--base_commit\", type=str, required=True,\n,→ help=\"Base commit hash\")\n++\nparser.add_argument(\"--chat_history_file\", type=str,\n,→ default=\"./chat_history.md\", help=\"Chat history file\")\n++\nparser.add_argument(\"--test_description\", type=str, help=\"Test\n,→ description\")\n++\nparser.add_argument(\"--self_improve\", action=\"store_true\",\n,→ help=\"Enable self-improvement mode\")\n++\nparser.add_argument(\"--language\", type=str, default=\"python\",\n,→ help=\"Programming language\")\n++\nparser.add_argument(\"--model\", type=str, default=OPENAI_MODEL,\n,→ help=\"Model to use\")\n++\nparser.add_argument(\"--max_attempts\", type=int, default=3,\n,→ help=\"Maximum number of attempts\")\n++\nparser.add_argument(\"--timeout\", type=int, default=600,\n,→ help=\"Timeout for each attempt\")\n++\n+\nargs = parser.parse_args()\n++# Process the repository\n+agentic_system = AgenticSystem(\n++\n++\nsystem = AgenticSystem(\n+\nproblem_statement=args.problem_statement,\n+\ngit_dir=args.git_dir,\n+\nbase_commit=args.base_commit,\n+@@ -319,15 +373,7 @@ def main():\n+\nmodel=args.model,\n+\nmax_attempts=args.max_attempts\n+\n)\n++# Run the agentic system to try to solve the problem\n+agentic_system.forward(args.timeout)\n+-\n\n28\n\n\f+++-\n\n# Get code diff and save to model_patch.diff\nmodel_patch = diff_versus_commit(args.git_dir, args.base_commit)\nmodel_patch_outfile = os.path.join(args.outdir,\n,→ ’model_patch.diff’) if args.outdir else ’model_patch.diff’\nwith open(model_patch_outfile, ’w’) as f:\nf.write(model_patch)\n\n++++-if __name__ == \"__main__\":\n+main()\n+\\ No newline at end of file\n++\n++\nsuccess = system.forward(timeout=args.timeout)\n++\nexit_code = 0 if success else 1\n++\nexit(exit_code)\n+\\ No newline at end of file\n+diff --git a/tests/test_error_diagnosis.py\n,→ b/tests/test_error_diagnosis.py\n+new file mode 100644\n+index 0000000..5beffbe\n+--- /dev/null\n++++ b/tests/test_error_diagnosis.py\n+@@ -0,0 +1,98 @@\n++import pytest\n++from tools.bash import diagnose_errors, format_diagnosis\n++from tools.edit import apply_automated_fix\n++\n++class TestErrorDiagnosis:\n++\ndef test_python_syntax_error_diagnosis(self):\n++\n\"\"\"Test diagnosis of Python syntax errors.\"\"\"\n++\noutput = \"\"\n++\nerror = ’’’File \"test.py\", line 3\n++\nprint(\"Hello World\"\n++\n^\n++SyntaxError: unexpected EOF while parsing’’’\n++\n++\ndiagnosis = diagnose_errors(output, error, \"python test.py\")\n++\nassert diagnosis[\"has_errors\"] is True\n++\nassert len(diagnosis[\"errors\"]) == 1\n++\nassert diagnosis[\"errors\"][0][\"type\"] == \"python_syntax_error\"\n++\nassert \"SyntaxError\" in diagnosis[\"errors\"][0][\"description\"]\n++\n++\ndef test_python_module_not_found_diagnosis(self):\n++\n\"\"\"Test diagnosis of Python module not found errors.\"\"\"\n++\noutput = \"\"\n++\nerror = \"ModuleNotFoundError: No module named\n,→ ’nonexistent_module’\"\n++\n++\ndiagnosis = diagnose_errors(output, error, \"python test.py\")\n++\nassert diagnosis[\"has_errors\"] is True\n++\nassert len(diagnosis[\"errors\"]) == 1\n++\nassert diagnosis[\"errors\"][0][\"type\"] ==\n,→ \"python_module_not_found\"\n++\nassert \"nonexistent_module\" in\n,→ diagnosis[\"errors\"][0][\"description\"]\n++\n++\ndef test_no_error_diagnosis(self):\n++\n\"\"\"Test diagnosis when there are no errors.\"\"\"\n++\noutput = \"Success!\"\n++\nerror = \"\"\n++\n++\ndiagnosis = diagnose_errors(output, error, \"echo Success\")\n++\nassert diagnosis[\"has_errors\"] is False\n++\nassert len(diagnosis[\"errors\"]) == 0\n++\n++\ndef test_format_diagnosis_with_errors(self):\n\n29\n\n\f++\n\"\"\"Test formatting of diagnosis with errors.\"\"\"\n++\ndiagnosis = {\n++\n\"has_errors\": True,\n++\n\"errors\": [\n++\n{\n++\n\"type\": \"test_error\",\n++\n\"description\": \"Test error description\",\n++\n\"suggestions\": [\"Suggestion 1\", \"Suggestion 2\"]\n++\n}\n++\n]\n++\n}\n++\n++\nformatted = format_diagnosis(diagnosis)\n++\nassert \"Automated Error Diagnosis\" in formatted\n++\nassert \"Test error description\" in formatted\n++\nassert \"Suggestion 1\" in formatted\n++\n++\ndef test_format_diagnosis_without_errors(self):\n++\n\"\"\"Test formatting of diagnosis without errors.\"\"\"\n++\ndiagnosis = {\n++\n\"has_errors\": False,\n++\n\"errors\": []\n++\n}\n++\n++\nformatted = format_diagnosis(diagnosis)\n++\nassert \"No errors detected\" in formatted\n++\n++class TestAutomatedFixes:\n++\ndef test_apply_missing_import_fix(self):\n++\n\"\"\"Test applying a missing import fix.\"\"\"\n++\ncontent = \"\"\"def hello():\n++\nprint(json.dumps({\"message\": \"hello\"}))\n++\"\"\"\n++\n++\nfix_info = {\n++\n\"type\": \"missing_import\",\n++\n\"module\": \"json\",\n++\n\"description\": \"Added missing import for json module\"\n++\n}\n++\n++\nfixed_content = apply_automated_fix(content, fix_info)\n++\nassert \"import json\" in fixed_content\n++\nassert \"def hello():\" in fixed_content\n++\n++\ndef test_apply_syntax_error_fix(self):\n++\n\"\"\"Test applying a syntax error fix.\"\"\"\n++\ncontent = \"\"\"def hello()\n++\nprint(\"Hello World\")\n++\"\"\"\n++\n++\nfix_info = {\n++\n\"type\": \"syntax_error_fix\",\n++\n\"line\": 1,\n++\n\"description\": \"Fixed syntax error\"\n++\n}\n++\n++\nfixed_content = apply_automated_fix(content, fix_info)\n++\nassert \"Fixed syntax\" in fixed_content\n+\\ No newline at end of file\n\n30\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"