MCPcopy Index your code
hub / github.com/codehamr/codehamr / maybeVerifyNudge

Method maybeVerifyNudge

internal/tui/model.go:1227–1249  ·  view source on GitHub ↗

maybeVerifyNudge appends one re-grounding system note when a substantial turn (>= verifyNudgeMinRounds tool calls) is about to finish with a clean, non-empty reply, then latches so it fires at most once per turn. Returns true when it nudged, so the caller re-prompts and the model can verify before i

()

Source from the content-addressed store, hash-verified

1225 Content: nudgeOrigin + fmt.Sprintf(
1226 "%d tool calls so far this turn without finishing. If you're still making real progress, keep going. If you're repeating a step that can't work here - a blocked install, a missing tool, a path failing the same way - stop chasing it (that loop burns the turn); verify another way. If you're stuck or unsure you're converging, tell the user where things stand and what's blocking you.",
1227 m.toolRounds),
1228 })
1229}
1230
1231// verifyNudgeMinRounds is how many tool calls a turn must have dispatched before
1232// the finish re-grounding nudge can fire. Set so only a turn that did real,
1233// multi-step work trips it: a quick answer or a one-line edit stays well under it,
1234// while a build / refactor / test-fix loop clears it easily. Below this the
1235// original request is still close in context and a re-ground would be noise; the
1236// galaxy runs that shipped broken-but-claimed-done artifacts each made dozens.
1237const verifyNudgeMinRounds = 8
1238
1239// maybeVerifyNudge appends one re-grounding system note when a substantial turn
1240// (>= verifyNudgeMinRounds tool calls) is about to finish with a clean, non-empty
1241// reply, then latches so it fires at most once per turn. Returns true when it
1242// nudged, so the caller re-prompts and the model can verify before its final
1243// summary. The false-green finish (a confident summary for an artifact that was
1244// never actually run) is invisible to the other three backstops, which only see
1245// repeated failures, runaway counts, or an empty reply. Framed as re-grounding +
1246// honest verification, never a stop order: telling a 30B to "stop" mid-task is the
1247// premature-completion failure we otherwise fight.
1248func (m *Model) maybeVerifyNudge() bool {
1249 if m.verifyNudged || m.toolRounds < verifyNudgeMinRounds {
1250 return false
1251 }
1252 // The nudge targets the false-green finish: a confident summary for work that

Callers 2

handleStreamClosedMethod · 0.95

Calls 2

dbgWritefFunction · 0.85

Tested by 1