cross_repo_snapshot
Returns the confidence score and drift summary across all registered repositories, surfacing the weakest repo to identify risks in multi-service workflows.
Instructions
Returns the latest confidence score and drift summary across every repository registered in the user-level registry at ~/.veris/registry.json. Useful when a single logical workflow spans multiple services — e.g., a checkout flow that touches a frontend repo, an orders service, and a payments service. Surfaces the weakest-confidence repo in the fleet first so an oncall engineer or release manager knows where to look.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/mcp/McpServer.ts:364-367 (handler)The handler method 'handleCrossRepoSnapshot' that executes the tool logic. It creates a CrossRepoRegistry instance and calls its snapshot() method, returning the results as text.
private handleCrossRepoSnapshot() { const reg = new CrossRepoRegistry(); return this.text(reg.snapshot()); } - src/mcp/McpServer.ts:153-155 (schema)Input/output schema definition for the cross_repo_snapshot tool. Declares empty input schema (no parameters) and describes the output as confidence score and drift summary across registered repos.
{ name: "cross_repo_snapshot", description: "Returns the latest confidence score and drift summary across every repository registered in the user-level registry at ~/.veris/registry.json. Useful when a single logical workflow spans multiple services — e.g., a checkout flow that touches a frontend repo, an orders service, and a payments service. Surfaces the weakest-confidence repo in the fleet first so an oncall engineer or release manager knows where to look.", inputSchema: { type: "object", properties: {}, required: [] } }, - src/mcp/McpServer.ts:78-78 (registration)Tool registration in the switch-case statement. Maps the string 'cross_repo_snapshot' to the handler method handleCrossRepoSnapshot.
case "cross_repo_snapshot": return this.handleCrossRepoSnapshot(); - The CrossRepoRegistry class that manages the user-level registry at ~/.veris/registry.json. The snapshot() method (lines 78-89) iterates over registered repos, loads each repo's VerisState SQLite DB, fetches the last run record, and returns the aggregated fleet view.
export class CrossRepoRegistry { private file: string; private data: RegistryShape; constructor() { const dir = path.join(os.homedir(), '.veris'); if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }); this.file = path.join(dir, 'registry.json'); if (fs.existsSync(this.file)) { try { this.data = JSON.parse(fs.readFileSync(this.file, 'utf8')); } catch { this.data = { repos: [] }; } } else { this.data = { repos: [] }; } } public list(): RepoEntry[] { return [...this.data.repos]; } public register(name: string, repoPath: string, tags?: string[]): RepoEntry { const abs = path.resolve(repoPath); const existing = this.data.repos.find(r => r.path === abs); if (existing) { existing.name = name; existing.tags = tags || existing.tags; this.persist(); return existing; } const entry: RepoEntry = { name, path: abs, addedAt: new Date().toISOString(), tags }; this.data.repos.push(entry); this.persist(); return entry; } public unregister(nameOrPath: string): boolean { const before = this.data.repos.length; this.data.repos = this.data.repos.filter(r => r.name !== nameOrPath && r.path !== nameOrPath); if (this.data.repos.length !== before) { this.persist(); return true; } return false; } /** * Reads the latest run from each registered repo's .veris/state.db. * Returns a confidence + drift snapshot across the fleet. */ public snapshot(): Array<RepoEntry & { lastRun: RunRecord | null }> { return this.data.repos.map(repo => { try { const state = new VerisState(repo.path); const lastRun = state.lastRun(); state.close(); return { ...repo, lastRun }; } catch { return { ...repo, lastRun: null }; } }); } private persist(): void { fs.writeFileSync(this.file, JSON.stringify(this.data, null, 2), 'utf8'); } } - Helper method 'lastRun()' on VerisState that queries the SQLite state.db for the most recent run record. Used by CrossRepoRegistry.snapshot() to retrieve per-repo confidence and drift data.
public lastRun(): RunRecord | null { if (!this.db) return null; const row = this.db.prepare(` SELECT run_id as runId, ts, diff_mode as diffMode, base_ref as baseRef, head_ref as headRef, overall_confidence as overallConfidence, execution_depth as executionDepth, nodes, edges, workflows, impacted_nodes as impactedNodes FROM runs ORDER BY ts DESC LIMIT 1 `).get() as RunRecord | undefined; return row || null; }