Skip to content

AntoineF23/ptolemy

Repository files navigation

Big Brother — EU regulatory-change monitoring (MCP server)

Big Brother watches official EU legal sources, intersects changes against a customer obligation graph, and tells you — clause by clause, with citations and dates — whether a change actually matters to a given company. It ships as an MCP server, so you drive it from Claude (or any MCP client) in plain English.

It is a deterministic pipeline, not an autonomous agent: the spine is testable code, and the LLM is used only for judgment — never to fetch, write, or decide what gets surfaced. Source data comes from official structured EU endpoints (CELLAR SPARQL + REST Formex XML), never from scraping HTML.

What it does

  • Pulls official text. Resolves a regulation's CELEX → its Formex XML via SPARQL + REST, parses it into a stable clause tree (Article 50(4), point (b), recital 27…), and content-addresses every version (idempotent, no double-processing).
  • Gates on a graph. Materiality starts as a pure lookup: if a changed clause touches no obligation bound to the profile, it stops — no LLM, no tokens.
  • Grounds every claim. Each assertion carries {celex, address, span_hash}; the verify_claims tool checks quotes against the stored law so invented obligations are caught, not surfaced.
  • Carries dates. Every obligation has an applicability date — a clause can change today but not bite until 2027.

Quick start

git clone <your-fork-url> big-brother && cd big-brother
python3.12 -m venv .venv
.venv/bin/pip install -e .

Then register the server with your MCP client and restart it:

Claude Desktop — Settings → Developer → Edit Config, merge (replace the path):

{
  "mcpServers": {
    "bigbrother": {
      "command": "ABSOLUTE_PATH_TO_REPO/.venv/bin/python",
      "args": ["-m", "big_brother.mcp_server"]
    }
  }
}

Claude Codeclaude mcp add bigbrother -- ABSOLUTE_PATH_TO_REPO/.venv/bin/python -m big_brother.mcp_server

That's it. On first use the server downloads the official text for every instrument in your graph (a few seconds, once). No API key is required — the connecting client's model does the analysis. Full setup notes: docs/MCP.md.

Tools

Tool Purpose
bigbrother_list_instruments Instruments monitored + ingest status
bigbrother_list_profiles Available customer profiles
bigbrother_get_obligations Obligations binding a profile (stored key or an inline profile)
bigbrother_get_clause Verbatim clause text + content fingerprint
bigbrother_assess_change Grounded analysis package for a change — the connecting model judges materiality
bigbrother_verify_claims Fact-checks the model's draft quotes against the official text

Try: "Which obligations apply to a company that's a deployer of limited-risk AI and a data controller in the EU? Then check whether this change to AI Act Article 50(4) is material for them: '…', and verify your claims before answering."

Define what it monitors

The obligation graph and profiles are yours. Put obligations_*.json and profile_*.json into data/ — see data/README.md for the format. Until you do, the bundled examples/ (an EU AI-Act / GDPR / AVMSD / DSA / Copyright set + two sample profiles) are used so it works immediately.

Profiles can also be supplied inline to the tools (roles / risk_tiers / jurisdictions), so you can analyse a company on the fly without a file.

How the analysis stays honest

The connecting model does the reasoning, so its output doesn't pass back through server code. The verify_claims tool exposes the citation check for the model to call on its own draft: it confirms a quoted phrase actually appears in the stored law (and says which article) and drops anything that doesn't. Note: in MCP mode this verification is a tool the model is instructed to use, not a hard gate. The fully code-enforced pipeline (where ungrounded output is structurally impossible to emit) lives in scripts/run_pipeline.py and uses its own LLM (configure via .env, see .env.example).

Operator scripts

.venv/bin/python scripts/ingest.py                 # pre-warm / refresh the text cache (optional)
.venv/bin/python scripts/applicable_obligations.py examples/profile_canalplus.json
.venv/bin/python scripts/run_pipeline.py           # full staged, code-gated demo (needs an LLM in .env)

Development

.venv/bin/pip install -e ".[dev]"
.venv/bin/python -m pytest -m "not live"   # offline suite (no network/keys)
.venv/bin/python -m pytest -m live         # hits the live EU endpoints (+ LLM, for run_pipeline)

Architecture and constraints: PLAN.md (design spec), SOURCES.md (verified endpoint behaviour), CLAUDE.md (contributor guide).

Status & honest caveats

A working end-to-end slice — not a finished compliance product:

  • No golden set yet. Materiality verdicts are unmeasured; build an eval set before trusting them at scale (see PLAN.md).
  • No amendment/temporal resolver yet. assess_change takes the proposed new text as input rather than computing the effective diff from an amending act.
  • The example graph is illustrative, not legal advice, and the consolidated-version gap means some later-amended articles (e.g. AVMSD Art 6a) may be absent from the fetched base text.

License

MIT — see LICENSE.

About

Ptolemy watches official EU legal sources, intersects changes against a customer obligation graph, and tells you whether a change actually matters to a given company. It ships as an MCP server, so you drive it from Claude (or any MCP client) in plain English.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages