refactor(autoresearch): follow upstream structure, keep the ledger reliable - #757
Merged
Conversation
added 2 commits
August 8, 2026 12:46
Replace the JSONL ledger with upstream's results.tsv (4 columns, tab-separated because commas break in descriptions), collapse the four protocol sections into one 4-step loop, use git reset --hard for reverts, and drop dashboard.md and worklog.md. Net -71 lines. Keeps three corrections upstream lacks: PIPESTATUS exit-code capture, the Goodhart guardrail before keep, and N>=3 noise-band judgment for noisy metrics. Also documents a shell-driven loop mode for runs longer than one context window, and updates the hook and command that referenced the removed JSONL file.
The TSV rewrite dropped the concrete append command, leaving only a format example. On the resume path there is no header yet, so "append a row" had no target and the step was silently skipped — an e2e run optimized 567ms -> 29ms, committed correctly, and wrote no ledger at all. Lost work: the next agent re-tries the experiment. Restores results.jsonl (one echo, no header branch, secondary metrics under a "metrics" object so adding one mid-session needs no rewrite of earlier lines), and states that every experiment ends with the append, no exceptions. Also drops the --plugin-dir suggestion for the shell loop: testing showed it does not load the skill. What works is a prompt matching this skill's trigger.
baleen37
enabled auto-merge (squash)
August 8, 2026 05:36
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe autoresearch plugin now uses ChangesAutoresearch workflow
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant AutoresearchAgent
participant run.sh
participant Git
participant results.jsonl
AutoresearchAgent->>run.sh: Execute benchmark
run.sh-->>AutoresearchAgent: Return METRIC output and exit code
AutoresearchAgent->>Git: Commit kept changes or reset discarded changes
AutoresearchAgent->>results.jsonl: Append one experiment result object
Possibly related PRs
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
autoresearch 스킬을 karpathy/autoresearch 구조에 맞춰 단순화하고, 그 과정에서 e2e로 발견한 원장 누락 버그를 고칩니다. 순 -63줄.
Changes
1. 업스트림 구조 채택
autoresearch.md,run.sh,results.jsonl)## The Loop1개, 4단계git checkout -- . && git clean -fdgit reset --hard HEAD && git clean -fddashboard.md업스트림의 simplicity principle("코드 삭제로 얻은 modest win이 복잡도 추가로 얻은 동일 win보다 낫다")과
program.md대응 관계도 명시했습니다.2. 원장 append 버그 수정 (핵심)
중간에 TSV로 옮겨봤다가 되돌렸는데, 그 과정에서 실제 버그를 잡았습니다. 포맷 예시만 있고 구체적인 append 명령이 없으면 단계가 조용히 스킵됩니다. resume 경로에는 헤더가 없어서 "append a row"의 대상이 존재하지 않기 때문입니다.
e2e 실측: 루프가 567ms → 29ms 최적화에 성공하고 커밋도 정확했는데,
results.tsv를 아예 만들지 않았습니다. 자율 루프에서 원장 누락은 곧 작업 유실입니다 — 다음 에이전트가 같은 실험을 재시도합니다.수정:
results.jsonl복원(echo한 줄, 헤더 분기 불필요) + "모든 실험은 이 append로 끝난다, 예외 없음" 명문화. secondary metric은"metrics":{}객체라 중간 추가 시 기존 행 재작성이 필요 없습니다(TSV 칼럼 추가는 필요했음).3. 셸 루프 실행 모드 문서화
컨텍스트 윈도우보다 긴 무인 실행용. 매 iteration이 fresh context를 받고, 기존 resume 경로가 상태를 복원합니다. 추가 파일 0개.
--plugin-dir제안은 실측에서 스킬을 로드하지 못해 삭제했습니다. 실제로 동작하는 것은 이 스킬의 트리거와 맞는 프롬프트이며, 그대로 문서화했습니다.4. 유지한 교정 3개 (업스트림에는 없음)
PIPESTATUSexit code 캡처, Goodhart 가드레일, 노이즈밴드 N≥3 판정. 훅과 커맨드의 구 파일명 참조도 함께 갱신했습니다.Tests
e2e 시나리오 (실제
claude -p루프 실행, 실제 최적화 대상 repo) — 7/7 PASSresults.jsonl생성 / 전 행 유효 JSON(jq -e) / 필수 키 4개 / SKILL.md의jq조회 명령 실동작 / 구 파일 미생성 / 출력 계약 유지(sum=20100) / 원장 누락 재발 없음.부수 확인 두 가지:
echo "sum=20100"하드코딩 아이디어를 두고 "계산 자체를 없애는 거라 진짜 최적화인지 워크로드 삭제인지 애매하다"며 판단 보류훅 e2e — 4/4 PASS (활성/비활성 분기,
results.jsonl언급, 구 파일명 미언급,off센티널, 재활성)정적 검증 —
bats tests/70 passed 0 failed /shellcheckOK / SKILL.md markdownlint 위반 23 → 0Notes
.autoresearch/autoresearch.jsonl을 쓰던 진행 중 세션이 있다면 파일명이results.jsonl로 바뀌었습니다. 마이그레이션 경로는 넣지 않았습니다.Summary by CodeRabbit