twining_verify
Run verification checks on development scopes to validate test coverage, warnings, assembly tracking, and drift detection. Automatically posts findings with summaries.
Instructions
Run verification checks on a scope. Checks test coverage (tested_by relations), warnings acknowledgment, assembly-before-decision tracking, drift detection (P2 stub), and constraints (P2 stub). Auto-posts a finding with the summary.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| scope | Yes | Scope to verify (e.g., "src/auth/" or "project") | |
| checks | No | Specific checks to run (default: all). Options: test_coverage, warnings, drift, assembly, constraints | |
| agent_id | No | Filter assembly check to a specific agent (default: all agents) | |
| fail_on | No | Check names that should cause a failure status if they don't pass |
Implementation Reference
- src/tools/verify-tools.ts:48-66 (handler)Tool handler implementation for 'twining_verify', which calls VerifyEngine.verify().
async (args) => { try { const result = await verifyEngine.verify({ scope: args.scope, checks: args.checks, agent_id: args.agent_id, fail_on: args.fail_on, }); return toolResult(result); } catch (e) { if (e instanceof TwiningError) { return toolError(e.message, e.code); } return toolError( e instanceof Error ? e.message : "Unknown error", "INTERNAL_ERROR", ); } }, - src/engine/verify.ts:57-128 (handler)The core business logic of the 'twining_verify' tool, which orchestrates various checks (coverage, warnings, assembly, drift, constraints).
async verify(input: { scope: string; checks?: string[]; agent_id?: string; fail_on?: string[]; }): Promise<VerifyResult> { const checksToRun: Set<CheckName> = new Set( input.checks ? (input.checks.filter((c) => ALL_CHECKS.includes(c as CheckName), ) as CheckName[]) : [...ALL_CHECKS], ); const result: VerifyResult = { scope: input.scope, verified_at: new Date().toISOString(), checks: {}, summary: "", }; // Load decisions in scope const allDecisions = await this.decisionStore.getByScope(input.scope); const activeDecisions = allDecisions.filter( (d) => d.status === "active" || d.status === "provisional", ); if (checksToRun.has("test_coverage")) { result.checks.test_coverage = await this.checkTestCoverage(activeDecisions); } if (checksToRun.has("warnings")) { result.checks.warnings = await this.checkWarnings(input.scope); } if (checksToRun.has("assembly")) { result.checks.assembly = this.checkAssembly(activeDecisions, input.agent_id); } if (checksToRun.has("drift")) { result.checks.drift = await this.checkDrift(activeDecisions, input.scope); } if (checksToRun.has("constraints")) { result.checks.constraints = await this.checkConstraints(input.scope); } // Build summary const parts: string[] = []; for (const [name, check] of Object.entries(result.checks)) { if (check) { parts.push(`${name}: ${check.status}`); } } result.summary = parts.join(", "); // Auto-post finding try { await this.blackboardEngine.post({ entry_type: "finding", summary: `Verification: ${result.summary}`, detail: JSON.stringify(result.checks, null, 2), tags: ["verify"], scope: input.scope, agent_id: input.agent_id ?? "verify-engine", }); } catch { // Non-fatal — verification result is still returned } return result; } - src/tools/verify-tools.ts:14-14 (registration)Registration of the 'twining_verify' tool within the MCP server.
"twining_verify",