Agents that know which version of the contract governs
The MSA was amended twice and there is a side letter. Ask most contract agents about the liability cap and you get the number from the original, quoted with total confidence.
The mixture
- 01 · Persistent memory
- Light
- 02 · Current context
- Leads
- 03 · Traceable decisions
- Uses
- 04 · Shared context
- Uses
- 05 · Scoped retrieval
- Uses
The redline is not the contract
Legal corpora are full of near-duplicates by design. That is precisely what similarity search is worst at.
- 01
Amendments are separate files
The amendment that changed the cap is a four-page PDF. The original is forty pages. Retrieval ranks the forty-page document higher on almost every query, because it has more matching text.
- 02
Drafts leak into answers
Negotiation drafts, markups and the executed copy sit in the same matter folder. An agent that cannot subtract drafts will quote a clause the other side struck out.
- 03
Matters bleed into each other
Two clients, similar templates, same clause numbers. Without matter-level scope, the agent answers one client's question with the other client's terms.
Mostly current context. Then three others.
Every application on Alchemyst is a different mixture of the same five jobs. That mixture is what makes this a different piece of software from the one next to it, even though the API underneath is identical.
Only the version in force reaches the window
Each document is stored with its matter, its status and what it supersedes. Drafts and superseded text are subtracted before ranking, and amendments are retrieved alongside the clauses they modify, so the answer reflects what was actually signed.
- Executed terms beat drafts, every time.
- Amendments travel with the clause they change.
- Matters never bleed into each other.
Uses · Traceable decisions
Cite the clause
Every answer carries the document and passage it came from, ready for a lawyer to check.
Uses · Scoped retrieval
This matter only
Client and matter scopes are intersected before anything is ranked.
Uses · Shared context
One reading of the definitions
"Affiliate" resolves to the definition in this agreement, not the template.
That is four of the five. The fifth, persistent memory (preferences and corrections survive the session, the handoff and the model swap), is what leads in Assistant agents, Commerce agents and EdTech & tutoring instead. Same API, different mixture.
The sources you already have
Bring sources in through the data-source integrations (PostgreSQL, MongoDB, Google Docs, Google Sheets, Amazon S3), an n8n workflow, or a direct context.add call. Each one lands scoped, so retrieval can intersect it with everything else.
01 · Ingest
Scope what you ingest
Every document lands with a groupName: the sets it belongs to. Those sets are what retrieval intersects later, so the structure you choose here is the precision you get there.
context.addimport AlchemystAI from "@alchemystai/sdk";const client = new AlchemystAI(); // reads ALCHEMYST_AI_API_KEYawait client.v1.context.add({ context_type: "resource", scope: "internal", source: "clm", documents: [{ content: "Section 9.2 Limitation of Liability. Aggregate liability shall not exceed fees paid in the twelve months preceding the claim.", }], metadata: { fileName: "acme-msa-2024-executed.pdf", groupName: ["legal", "client_acme", "matter_msa", "executed"], // the sets this belongs to },});02 · Write
Store the amendment with what it changes
An amendment is only useful next to the clause it modifies. Store it in the same matter scope, name what it supersedes, and keep drafts out of the executed scope entirely.
context.addawait client.v1.context.add({ context_type: "resource", scope: "internal", source: "clm", documents: [{ content: "Amendment No. 2: Section 9.2 is replaced. Liability shall not exceed 2x fees paid in the preceding twelve months.", supersedes: "acme-msa-2024-executed.pdf#9.2", }], metadata: { fileName: "acme-msa-amendment-2.pdf", groupName: ["legal", "client_acme", "matter_msa", "executed"], lastModified: "2026-02-14T00:00:00Z", },});03 · Search
Search before answering
Search intersects the scopes, subtracts superseded and duplicate content, and ranks what survives. Only that reaches the model, and the whole decision is recorded as a Context Trace.
context.searchconst { contexts } = await client.v1.context.search({ query: "What is our liability cap with Acme?", scope: "internal", similarity_threshold: 0.8, minimum_similarity_threshold: 0.5, metadata: { groupName: ["legal", "client_acme", "matter_msa", "executed"] }, // ∩ narrow scope});// − superseded, deduplicated → ranked → into the window// Every search is recorded as a Context Trace.const reply = await llm.respond(message, { context: contexts });
npm install @alchemystai/sdk or pip install alchemystai, both ship the same client. Full reference in the docs.
Privilege does not survive a careless vendor
Matter files are privileged and confidential. They belong on infrastructure you can defend to a client: scoped per matter, encrypted at rest, and on dedicated or self-hosted deployment when the engagement requires it.
Security & complianceManaged cloud
Encrypted in transit and at rest, isolated per organization, and scoped at write time.
Dedicated infrastructure
EnterpriseSingle-tenant, with VPC peering when your data cannot share a network boundary.
Self-hosted
On-premiseRun the context layer on your own infrastructure, with OpenTelemetry for observability.
The same API, a different mixture
Each of these leads with a different job, pulls from a different set of sources and needs a different call. All of them, by job.
Bring the clause it quotes wrong.
The one where the answer came from the draft, not the signed copy.