@@ -259,6 +259,7 @@ function copyDocsIntoRepo(sourceRepoPath: string, targetRepoPath: string): void
259259 const sourceAgentsMd = path . join ( sourceRepoPath , 'AGENTS.md' )
260260 const targetDocsDir = path . join ( targetRepoPath , 'docs' )
261261 const targetAgentsMd = path . join ( targetRepoPath , 'AGENTS.md' )
262+ const targetClaudeMd = path . join ( targetRepoPath , 'CLAUDE.md' )
262263
263264 let copied = false
264265 if ( fs . existsSync ( sourceDocsDir ) ) {
@@ -267,13 +268,17 @@ function copyDocsIntoRepo(sourceRepoPath: string, targetRepoPath: string): void
267268 }
268269 if ( fs . existsSync ( sourceAgentsMd ) ) {
269270 fs . cpSync ( sourceAgentsMd , targetAgentsMd )
271+ // Ensure CLAUDE.md symlink exists so Claude Code auto-loads the same content
272+ if ( ! fs . existsSync ( targetClaudeMd ) ) {
273+ fs . symlinkSync ( 'AGENTS.md' , targetClaudeMd )
274+ }
270275 copied = true
271276 }
272277
273278 if ( copied ) {
274279 try {
275280 execSync (
276- 'git add docs/ AGENTS.md 2>/dev/null; git add -u docs/ AGENTS.md 2>/dev/null' ,
281+ 'git add docs/ AGENTS.md CLAUDE.md 2>/dev/null; git add -u docs/ AGENTS.md CLAUDE .md 2>/dev/null' ,
277282 { cwd : targetRepoPath , stdio : 'ignore' } ,
278283 )
279284 execSync ( 'git commit -m "evalbuff: pre-load docs" --allow-empty' , {
@@ -406,10 +411,10 @@ async function runCarveEval(options: CarveEvalOptions): Promise<void> {
406411 )
407412
408413 // Track which docs agents read across all runs for this feature
409- const baselineDocReads = mergeDocReads ( validBaseline . map ( ( r ) => extractDocReads ( r . agentTrace ) ) )
410- const docReadEntries = Object . entries ( baselineDocReads ) . sort ( ( a , b ) => b [ 1 ] - a [ 1 ] )
411- if ( docReadEntries . length > 0 ) {
412- console . log ( ` Docs read (baseline): ${ docReadEntries . map ( ( [ p , n ] ) => `${ p } (${ n } x)` ) . join ( ', ' ) } ` )
414+ let allDocReadsForFeature = mergeDocReads ( validBaseline . map ( ( r ) => extractDocReads ( r . agentTrace ) ) )
415+ const baselineDocReadEntries = Object . entries ( allDocReadsForFeature ) . sort ( ( a , b ) => b [ 1 ] - a [ 1 ] )
416+ if ( baselineDocReadEntries . length > 0 ) {
417+ console . log ( ` Docs read (baseline): ${ baselineDocReadEntries . map ( ( [ p , n ] ) => `${ p } (${ n } x)` ) . join ( ', ' ) } ` )
413418 } else {
414419 console . log ( ` Docs read (baseline): none` )
415420 }
@@ -486,6 +491,14 @@ async function runCarveEval(options: CarveEvalOptions): Promise<void> {
486491 const validRerun = rerunResults . filter ( ( r ) => r . score >= 0 )
487492 totalCost += rerunResults . reduce ( ( a , r ) => a + r . costEstimate , 0 )
488493
494+ // Accumulate doc reads from re-run
495+ const rerunDocReads = mergeDocReads ( validRerun . map ( ( r ) => extractDocReads ( r . agentTrace ) ) )
496+ allDocReadsForFeature = mergeDocReads ( [ allDocReadsForFeature , rerunDocReads ] )
497+ const rerunDocEntries = Object . entries ( rerunDocReads ) . sort ( ( a , b ) => b [ 1 ] - a [ 1 ] )
498+ if ( rerunDocEntries . length > 0 ) {
499+ console . log ( ` Docs read (iteration ${ iter + 1 } ): ${ rerunDocEntries . map ( ( [ p , n ] ) => `${ p } (${ n } x)` ) . join ( ', ' ) } ` )
500+ }
501+
489502 if ( validRerun . length === 0 ) {
490503 console . log ( ` Re-run failed. Reverting doc.` )
491504 if ( previousContent !== null ) {
@@ -556,7 +569,7 @@ async function runCarveEval(options: CarveEvalOptions): Promise<void> {
556569 docsKept,
557570 docsRejected,
558571 totalCost,
559- docsRead : baselineDocReads ,
572+ docsRead : allDocReadsForFeature ,
560573 } )
561574 }
562575
0 commit comments