( claims: CompletionClaims, evidence: SessionEvidence, )
| 108 | * Conservative by design — only flags CLEAR contradictions to avoid nagging. |
| 109 | */ |
| 110 | export function checkCompletionClaims( |
| 111 | claims: CompletionClaims, |
| 112 | evidence: SessionEvidence, |
| 113 | ): string | null { |
| 114 | const problems: string[] = []; |
| 115 | |
| 116 | if (claims.claimsTestsPass && !evidence.didRunTests) { |
| 117 | problems.push( |
| 118 | 'You stated the tests pass, but no test command ran this session. Either run the ' + |
| 119 | 'test suite now and show the actual output, or remove the claim that tests pass.', |
| 120 | ); |
| 121 | } |
| 122 | if (claims.claimsFixOrChange && !evidence.didSuccessfulEdit) { |
| 123 | problems.push( |
| 124 | 'You stated you fixed/changed/created something, but no file edit succeeded this ' + |
| 125 | 'session. Either make the actual edit now, or correct your summary to say what you ' + |
| 126 | 'really did (e.g. only analyzed, or were blocked).', |
| 127 | ); |
| 128 | } |
| 129 | |
| 130 | if (problems.length === 0) return null; |
| 131 | return ( |
| 132 | '[COMPLETION_GATE] Before finishing, your claims must match what actually happened:\n' + |
| 133 | problems.map(p => ' • ' + p).join('\n') + |
| 134 | '\nDo the work or revise the claim — do not report success you cannot demonstrate.' |
| 135 | ); |
| 136 | } |
| 137 | |
| 138 | /** Convenience: one call from text + messages → corrective message or null. */ |
| 139 | export function evaluateCompletion(finalText: string, messages: MsgLike[]): string | null { |
no test coverage detected