Lakepact
by elcioabrahao
README.md
# Lakepact
**Build, govern and evolve data contracts and data products for your Delta Lake and Unity
Catalog, by talking to an AI assistant.**
> **Status: alpha (v0.1.0).** Usable for evaluation and pilots, not yet for production. APIs
> and tool names may still change. See [Status and limits](#status-and-limits).
## Why Lakepact
A table in the lake is a promise to everyone who reads it: these columns, with this meaning,
this fresh, checked this way. Usually that promise is unwritten, and it breaks silently. A
**data contract** writes it down:
- what the data is for, and who owns it;
- the columns, their types and what they mean;
- the quality rules and the service levels;
- who approved it, and which version consumers can rely on.
Writing and keeping contracts usually takes specialists and a lot of YAML. Lakepact makes it
conversational and keeps it honest:
- **You talk, the assistant works.** Lakepact is an [MCP](https://modelcontextprotocol.io/)
server. Any MCP client (Claude, Copilot, your own agent) builds the contract with you, step
by step, or drafts it from an existing Unity Catalog table.
- **Humans decide.** A human steward approves, certifies and retires, with their own forge
account. An agent can never do any of these.
- **Value at every step.** A contract card, a data dictionary, a table preview, generated
quality checks and a service-level summary come out long before the contract is approved.
- **Standard and open.** Contracts are [ODCS v3.2](https://github.com/bitol-io/open-data-contract-standard)
and products [ODPS v1.1](https://github.com/bitol-io/open-data-product-standard) (Bitol,
Linux Foundation). They are plain YAML files in your own Gitea or Forgejo repository,
reviewed through pull requests, and released with Git tags.
## How it works
```mermaid
flowchart LR
U([You]) <--> A[AI assistant]
A <-->|MCP| L[Lakepact]
L <-->|YAML files, pull requests,<br/>reviews, tags, issues| F[(Gitea / Forgejo)]
S([Steward]) -->|approves, certifies, retires| F
L -->|scans, deploys, tests| C[(Unity Catalog<br/>Databricks or OSS)]
L -->|notices| N([Consumers])
```
1. The assistant asks Lakepact what to do next (`get_next_steps`), and builds the contract
with you, or drafts it from a scan of a Unity Catalog table.
2. You submit it: Lakepact opens a pull request on your forge.
3. A steward reviews and approves it with their own account. Lakepact records the approval
and merges.
4. Lakepact deploys the table, runs the contract's checks against the data, and makes the
contract **Active** with a release tag.
Nothing reaches the main branch, or Unity Catalog, until a human agrees.
## The lifecycle, and what each step gives you
Every contract and product moves through one lifecycle, with human gates:
| Stage | What happens | What you get |
|-------|--------------|--------------|
| Draft | Guided authoring in six stages: purpose, structure, meaning, quality, service levels, review | **Contract card**, **data dictionary** (Markdown/CSV), table preview, docs for people and for AI assistants |
| Proposed → Approved | A pull request; a steward reviews it with their own account | **Pull-request description**, plain-language `diff`, semver bump; breaking changes need a new major version |
| Active | Deployed to Unity Catalog; its first passing test run | The table with comments, `NOT NULL`, CHECK constraints and contract tags; **DQX and Lakeflow checks**; test results in Git; release tag |
| Certified | The certification policy is met: by default 30 green days, no open incidents, everything described and classified | **Evidence computed from the recorded runs**, never typed in; the certificate lapses by itself when the policy stops holding |
| Deprecated | A sunset date and a replacement; a new major version runs beside the old one | **Notices to every registered consumer**: a forge issue and a signed webhook |
| Retired | After the sunset, once nobody is registered as reading it | Final. The table and its data are kept |
Ask the assistant *"what can I already hand out?"*. It lists every deliverable as ready,
partial or unavailable.
## Try it
You need Docker and git. The development stack runs PostgreSQL, Keycloak, Gitea (and
optionally Forgejo), Unity Catalog OSS with a small Delta lake, and Lakepact on your machine.
```bash
git clone https://github.com/elcioabrahao/lakepact
cd lakepact
docker compose -f deploy/compose/docker-compose.yml up -d --build --wait
curl -s localhost:8100/readyz # "status": "ok" when ready
```
Get a development token as Alice, a data producer, and connect an assistant. The example
uses Claude Code; any MCP client that speaks Streamable HTTP works the same way:
```bash
TOKEN=$(curl -s -X POST localhost:8280/realms/lakepact/protocol/openid-connect/token \
-d grant_type=password -d client_id=lakepact-dev-cli \
-d username=alice -d password=alice -d scope=openid | python3 -c 'import sys, json; print(json.load(sys.stdin)["access_token"])')
claude mcp add --transport http lakepact http://localhost:8100/mcp --header "Authorization: Bearer $TOKEN"
```
Then ask, in plain language:
- *"What does Lakepact know? Call get_server_info."*
- *"Use the build_contract prompt: a contract for our customer orders, in the sales domain."*
- *"Put the table retail.sales.orders under contract."*
- *"What can I already hand out? Export the contract card."*
> The dev stack's credentials (such as `alice`/`alice`) are public defaults. Never use them
> outside your machine. Tokens are short-lived: fetch a new one when it expires.
Every check runs in Docker: `scripts/check.sh quick` (lint, types, docs, unit tests) or
`scripts/check.sh all` (also the dev stack, the contract tests on Gitea and Forgejo, the
image and a vulnerability scan).
## Documentation
| If you want to… | Read |
|-----------------|------|
| Build a first contract, step by step | [Tutorial: your first data contract](docs/guide/tutorials/first-contract.md) |
| Put an existing table under contract | [Tutorial: from a Unity Catalog table](docs/guide/tutorials/contract-from-table.md) |
| Deploy it, test it, make it Active | [Tutorial: deploy and test](docs/guide/tutorials/deploy-and-test.md) |
| Certify it on evidence | [Tutorial: certify](docs/guide/tutorials/certify.md) |
| Make a breaking change safely | [Tutorial: a new major version](docs/guide/tutorials/new-major-version.md) |
| Deprecate and retire a version | [Tutorial: deprecate and retire](docs/guide/tutorials/deprecate-and-retire.md) |
| Build an agent: tools, prompts, arguments, scopes | [MCP tools](docs/reference/tools.md) and [prompts](docs/reference/prompts.md) |
| Configure domains, gates, deploy targets, certification | [`lakepact.yaml`](docs/reference/lakepact-yaml.md) |
| Run it from a terminal or CI | [CLI](docs/reference/cli.md) |
| Know why it is built this way | [Architecture decisions](docs/decisions/) |
| Read the full specification | [REQUIREMENTS.md](REQUIREMENTS.md) |
The whole guide starts at [docs/guide](docs/guide/README.md). The reference is generated from
the server, so it always matches the code.
## Design principles
- **Your forge is the system of record.** Contracts, products, reviews, test results,
certification evidence and audit records all live in your Gitea or Forgejo repository.
Lakepact keeps only a cache and an audit log, and reports any edit made without it.
- **Only humans approve.** Approve, certify and retire need a human, acting with their own
forge account. Agents can draft, submit, deploy, test and deprecate, never approve.
- **Every change is traceable.** Every transition is a commit with `Lakepact-Transition` and
`Approved-By` trailers and an audit record. Every version is a release tag.
- **Evidence, not claims.** Tests read only counts and aggregates, never rows. Certification
is computed from recorded runs.
- **Untrusted text stays inert.** Catalog comments, issue titles and anything an assistant
drafts are returned as quoted data, so they cannot instruct an agent.
- **No UI of its own, and no GitHub dependency.** An MCP server for agents, a CLI for
operators and CI, a read-only HTTP API for software. Every check and build runs in Docker,
and nothing depends on GitHub, which only hosts this source.
## Status and limits
Lakepact is **alpha**:
- **Developed and tested against** Gitea 1.27.3, Forgejo 17.0.2 and Unity Catalog OSS 0.7.0.
- **Tested only against documented responses:** Databricks (deploys and tests through a SQL
warehouse, tags, lineage) and the lakeloom concept lookup. There is no live workspace in
the tests yet.
- **Not built yet:** running free-form SQL quality rules, Data Contract CLI output, and
"still reading" from Unity Catalog access logs. Consumers are what the registry says.
- **Pre-1.0:** tool names and APIs may change between releases. See the
[CHANGELOG](CHANGELOG.md).
## Contributing
Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) for the development setup,
tests and the DCO sign-off, and read the [Code of Conduct](CODE_OF_CONDUCT.md),
[Security policy](SECURITY.md) and [Governance](GOVERNANCE.md).
## Credits and license
Lakepact is licensed under the [Apache License 2.0](LICENSE); see also [NOTICE](NOTICE).
Contracts and products follow the Open Data Contract Standard and the Open Data Product
Standard of the [Bitol](https://bitol.io/) project (Linux Foundation AI & Data), whose JSON
Schemas are vendored unmodified. [THIRD_PARTY.md](THIRD_PARTY.md) credits the standards and
every tool Lakepact uses or ships, with their authors and licenses.
Lakepact is the sibling of [lakeloom](https://github.com/elcioabrahao/lakeloom): lakeloom
governs the business vocabulary, Lakepact governs the agreements about the data. Neither
needs the other.
Lakepact is an **independent project**. It is not affiliated with, endorsed by, or sponsored
by Bitol, the Linux Foundation, Databricks, Gitea, Forgejo or GitHub. All trademarks belong
to their respective owners.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessOutdated data