The Atlas BigLaw / Big Michael — documentation bound to its code
7 documents

Inside a DyTopo round

Open one round of Dynamic Topology Routing: agents declare what they Need and Offer, cosine similarity wires them into a comm graph, jurisdiction-ineligible agents are dropped, then everyone runs an agentic loop whose findings are gated, debated, verified, and rolled up into memory.

src/dytopo/jurisdiction.ts29 lines · jurisdictionMatch L20–28
Outline 1 symbols
1// SPDX-License-Identifier: AGPL-3.0-only
2// Copyright (C) 2026 Discover Legal
3// This program is free software: you can redistribute it and/or modify it
4// under the terms of the GNU Affero General Public License as published by
5// the Free Software Foundation, either version 3 of the License, or
6// (at your option) any later version. See <https://www.gnu.org/licenses/>.
7
8import type { AgentDefinition } from "../types.js";
9
10/**
11 * Returns true when an agent is eligible for a task's jurisdiction.
12 *
13 * Rules:
14 * - Agent has no jurisdictions (neutral) → always eligible.
15 * - Task has no jurisdiction → all agents eligible.
16 * - Otherwise: at least one of the agent's jurisdictions must be a
17 * case-insensitive prefix of the task jurisdiction (so agent "US"
18 * matches task "US-NY" and "US-CA"; agent "EU" does not match "US").
19 */
20export function jurisdictionMatch(agent: AgentDefinition, taskJurisdiction?: string): boolean {
21 if (!agent.jurisdictions?.length) return true;
22 if (!taskJurisdiction) return true;
23 const tj = taskJurisdiction.toUpperCase();
24 return agent.jurisdictions.some((j) => {
25 const aj = j.trim().toUpperCase();
26 return tj === aj || tj.startsWith(aj + "-");
27 });
28}
29