Lex plugin
A plugin from a UK government lab that searches legislation, amendments and Parliament explanatory notes for AI agents.
- 82 ★ on the repository
- Last commit
- MIT
Extended access
Why this level
- Queries go to a hosted government server, so keep confidential data out of them.
Install
- Works in
In your terminal, with SkillFoxx CLI
npx skillfoxx add plugins/lexDetects the agents on your machine, shows the access level and pins the version.
Other ways to install
Access and checks
How we reviewExtended accessThe tool runs code or makes network calls and only reads external data.
- Queries go to a hosted government server, so keep confidential data out of them.
This is third-party code. Review the repository files before installing.
What it does
Lex opens the UK legislation corpus to an agent: Acts and statutory instruments from 1267, their amendments and explanatory notes. Search is hybrid and semantic, and the server answers over MCP at the address in the `.mcp.json` file. The `lex-uk-law` plugin carries a skill that sets the research order. The agent finds Acts first, drills into sections, checks amendments at section and Act level and reads explanatory notes to understand Parliament's intent. For old Acts the skill points to year filters and searches by references from other Acts.
Who it is for. Lawyers, policy analysts and researchers who need answers on UK law with links to specific Acts and sections.
Good fit when
- You need to learn which UK Acts govern a topic such as dismissal or tenancy.
- You need the exact text of a section and the list of its amendments.
- The analysis follows legislative history: how a rule changed over the years.
- An AI assistant must rely on official sources rather than model memory.
Not a fit when
- The question concerns another country's law: the corpus is UK only.
- You need court practice: case law is temporarily disabled in the service.
- The result goes into a production system: the authors call the service experimental.
Example request
Find UK Acts on personal data processing in AI, show the key sections and check how later Acts amended them.Limitations
The service is experimental and the authors ask not to make it a production dependency. Case law is temporarily disabled pending a National Archives licence. For Acts before 1963 the text is digitised from PDFs, so section structure and numbering can be uneven. Amendment data mostly starts around 2002 and is sparse for old Acts. Queries go to a hosted server, so avoid confidential wording in them. Answers are not legal advice.
How to disable. Remove the `lex-uk-law` plugin and the `lex` entry from the MCP configuration. Nothing else remains on your machine.
FAQ
How do I connect Lex to an agent?
Add an MCP server at https://lex.lab.i.ai.gov.uk/mcp with type `http`. The README points to service documentation with instructions for Claude Desktop, Claude Code, Cursor, Copilot Studio and VS Code with GitHub Copilot.
What is in the data?
About 220 thousand Acts and statutory instruments, 892 thousand amendments and 89 thousand explanatory notes. Case law is temporarily disabled.
Why a skill if there is MCP?
The skill sets the research order: Act, section, amendments, explanatory note. Without it a repeal or limit on a rule is easy to miss.
Can I run Lex myself?
Yes. You need Python 3.12, `uv`, Docker and Azure OpenAI access. Then `docker compose up -d` and `make ingest-all-sample` for sample data.
Who makes Lex?
The Incubator for AI (i.AI) of the UK Department for Science, Innovation and Technology, supported by The National Archives and the Ministry of Justice.
Discussion
No questions or reviews yet.
Related
PluginsA plugin with a local document and code index: hybrid semantic and keyword search, a dependency graph and three helper agents
Academic plugin for Claude Code, Gemini CLI, Codex and OpenCode: literature reviews, peer review and citation checks
Prompt caching audit
LLM Cache Audit Skill
Skill for Codex and Claude Code that traces what breaks LLM prompt caching in code and config and proposes a verification step
A self-improvement plugin for Claude Code, Codex and OpenCode: turns corrections into rules the agent follows in later sessions
A personal LLM wiki with a knowledge graph, cited RAG and memory, served to Claude Code and Cursor by an MCP server
A long-term memory plugin that keeps decisions, preferences and task state across sessions and injects only what a query needs
README in short
The README lists dataset coverage, MCP connection options and the local run procedure with sample or full data loading. Project architecture and documentation links are described separately.