MCPcopy
hub / github.com/codeaashu/claude-code / call

Function call

src/tools/TodoWriteTool/TodoWriteTool.ts:65–103  ·  view source on GitHub ↗
({ todos }, context)

Source from the content-addressed store, hash-verified

63 return null
64 },
65 async call({ todos }, context) {
66 const appState = context.getAppState()
67 const todoKey = context.agentId ?? getSessionId()
68 const oldTodos = appState.todos[todoKey] ?? []
69 const allDone = todos.every(_ => _.status === 'completed')
70 const newTodos = allDone ? [] : todos
71
72 // Structural nudge: if the main-thread agent is closing out a 3+ item
73 // list and none of those items was a verification step, append a reminder
74 // to the tool result. Fires at the exact loop-exit moment where skips
75 // happen ("when the last task closed, the loop exited").
76 let verificationNudgeNeeded = false
77 if (
78 feature('VERIFICATION_AGENT') &&
79 getFeatureValue_CACHED_MAY_BE_STALE('tengu_hive_evidence', false) &&
80 !context.agentId &&
81 allDone &&
82 todos.length >= 3 &&
83 !todos.some(t => /verif/i.test(t.content))
84 ) {
85 verificationNudgeNeeded = true
86 }
87
88 context.setAppState(prev => ({
89 ...prev,
90 todos: {
91 ...prev.todos,
92 [todoKey]: newTodos,
93 },
94 }))
95
96 return {
97 data: {
98 oldTodos,
99 newTodos: todos,
100 verificationNudgeNeeded,
101 },
102 }
103 },
104 mapToolResultToToolResultBlockParam({ verificationNudgeNeeded }, toolUseID) {
105 const base = `Todos have been modified successfully. Ensure that you continue to use the todo list to track your progress. Please proceed with the current tasks if applicable`
106 const nudge = verificationNudgeNeeded

Callers

nothing calls this directly

Calls 3

getSessionIdFunction · 0.85
featureFunction · 0.85

Tested by

no test coverage detected