* Get verify plan reminder attachment if the model hasn't called VerifyPlanExecution yet.
( messages: Message[] | undefined, toolUseContext: ToolUseContext, )
| 3974 | * Get verify plan reminder attachment if the model hasn't called VerifyPlanExecution yet. |
| 3975 | */ |
| 3976 | async function getVerifyPlanReminderAttachment( |
| 3977 | messages: Message[] | undefined, |
| 3978 | toolUseContext: ToolUseContext, |
| 3979 | ): Promise<Attachment[]> { |
| 3980 | if ( |
| 3981 | process.env.USER_TYPE !== 'ant' || |
| 3982 | !isEnvTruthy(process.env.CLAUDE_CODE_VERIFY_PLAN) |
| 3983 | ) { |
| 3984 | return [] |
| 3985 | } |
| 3986 | |
| 3987 | const appState = toolUseContext.getAppState() |
| 3988 | const pending = appState.pendingPlanVerification |
| 3989 | |
| 3990 | // Only remind if plan exists and verification not started or completed |
| 3991 | if ( |
| 3992 | !pending || |
| 3993 | pending.verificationStarted || |
| 3994 | pending.verificationCompleted |
| 3995 | ) { |
| 3996 | return [] |
| 3997 | } |
| 3998 | |
| 3999 | // Only remind every N turns |
| 4000 | if (messages && messages.length > 0) { |
| 4001 | const turnCount = getVerifyPlanReminderTurnCount(messages) |
| 4002 | if ( |
| 4003 | turnCount === 0 || |
| 4004 | turnCount % VERIFY_PLAN_REMINDER_CONFIG.TURNS_BETWEEN_REMINDERS !== 0 |
| 4005 | ) { |
| 4006 | return [] |
| 4007 | } |
| 4008 | } |
| 4009 | |
| 4010 | return [{ type: 'verify_plan_reminder' }] |
| 4011 | } |
| 4012 | |
| 4013 | export function getCompactionReminderAttachment( |
| 4014 | messages: Message[], |
no test coverage detected