elenchus_check_convergence_allowed
Check if session convergence is allowed by evaluating quality safeguards, with an optional strict mode for tighter requirements.
Instructions
Check if session convergence is allowed based on quality safeguards.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sessionId | Yes | Session ID | |
| strictMode | No | Use strict quality requirements |
Implementation Reference
- src/tools/safeguards-tools.ts:172-194 (handler)The main handler function for the 'elenchus_check_convergence_allowed' tool. It calls shouldAllowConvergence() from the safeguards module and returns a result with allowed status, blockers list, quality score, and a message.
/** * Check if convergence is allowed based on quality safeguards */ export async function checkConvergenceAllowedTool( args: z.infer<typeof CheckConvergenceAllowedSchema> ): Promise<{ allowed: boolean; blockers: string[]; qualityScore?: number; message: string; }> { const result = shouldAllowConvergence(args.sessionId, args.strictMode); const state = getSafeguardsState(args.sessionId); return { allowed: result.allow, blockers: result.blockers, qualityScore: state?.quality.score, message: result.allow ? 'Convergence allowed - quality safeguards passed' : `Convergence blocked: ${result.blockers.join(', ')}` }; } - src/tools/schemas.ts:323-326 (schema)Input schema for the 'elenchus_check_convergence_allowed' tool. Defines sessionId (required string) and strictMode (optional boolean, default false).
export const CheckConvergenceAllowedSchema = z.object({ sessionId: z.string().describe('Session ID'), strictMode: z.boolean().optional().default(false).describe('Use strict quality requirements') }); - src/tools/safeguards-tools.ts:216-221 (registration)Registration of the tool in the safeguardsTools object, mapping the tool name 'elenchus_check_convergence_allowed' to its description, schema, and handler.
elenchus_check_convergence_allowed: { description: 'Check if session convergence is allowed based on quality safeguards.', schema: CheckConvergenceAllowedSchema, handler: checkConvergenceAllowedTool } }; - src/safeguards/index.ts:318-353 (helper)Core helper function 'shouldAllowConvergence' that evaluates whether convergence should be allowed. In strict mode, blocks on POOR/UNACCEPTABLE quality or low confidence. In normal mode, blocks only on UNACCEPTABLE quality or ERROR-level concerns.
/** * Should session be allowed to converge? */ export function shouldAllowConvergence( sessionId: string, strictMode: boolean = false ): { allow: boolean; blockers: string[] } { const state = safeguardsStates.get(sessionId); if (!state) return { allow: true, blockers: [] }; const blockers: string[] = []; if (strictMode) { // Strict mode: block on any concern if (state.quality.level === 'POOR' || state.quality.level === 'UNACCEPTABLE') { blockers.push(`Quality level ${state.quality.level} is too low`); } if (state.quality.metrics.confidence < state.confidence.config.minimumAcceptable) { blockers.push(`Confidence ${Math.round(state.quality.metrics.confidence * 100)}% below threshold`); } } else { // Normal mode: block only on critical issues if (state.quality.level === 'UNACCEPTABLE') { blockers.push(`Quality level UNACCEPTABLE`); } // Check for critical concerns const criticalConcerns = state.quality.concerns.filter(c => c.severity === 'ERROR'); for (const concern of criticalConcerns) { blockers.push(concern.message); } } return { allow: blockers.length === 0, blockers }; } - src/tools/index.ts:41-54 (registration)Top-level tool registration in the composed 'tools' object which spreads all safeguardsTools (including elenchus_check_convergence_allowed) into the final MCP tool registry.
export const tools = { ...sessionLifecycleTools, ...issueManagementTools, ...mediatorTools, ...roleTools, ...reverifyTools, ...diffTools, ...cacheTools, ...pipelineTools, ...safeguardsTools, ...optimizationTools, ...dynamicRoleTools, ...llmEvalTools, };