October workshops are openBuild a Search AI Agent$99 early bird

Enroll now
Skip to content

PATHWAY PROJECT · STARTER PROJECT · 2 SMALL IDEAS + A GUIDED LAB

Contract clause evidence finder

A clause can answer the right question while belonging to the wrong version of an agreement.

You will learn to: Answer from the declared current version, preserve its passage, and expose missing or conflicting rules.

Preparing your lesson and this browser’s progress…
Read the complete lessonAll the ideas in one place · works without the editor

Use these notes to review a concept or read at your own pace. The interactive workspace above adds predictions, editable code, and actual run results.

IDEA 1

Find the applicable document before extracting the rule

Document work begins with scope: which document, which version, and which question? A passage about termination notice may be relevant while belonging to an obsolete service agreement. Our fictional contract packet provides an explicit currentVersion field. That field is the exercise's authority rule; the helper does not decide legal authority by choosing the newest-looking date.

A rule can also be conditional. 'Give two days of notice before ending this service' does not establish what happens after a confidentiality breach. The source cards keep a verbatim authored passage beside a structured rule value, so students can inspect what the answer is based on. These are original fictional contract clauses, not statements of real law. Finding a passage does not decide enforceability, legal rights, or how a real agreement should be interpreted.

Filter scope before answering

  1. Question. How much notice does this termination clause state?
  2. Version. The fixture declares version 3 current.
  3. Applicable records. Keep only matching topic and version.

Fictional records for learning. Follow the evidence and the checks.

Work through the example

const candidates = tools.searchClauses(input.topic);
const current = candidates.filter(item => item.version === input.currentVersion);

Search returns candidate references. The current-version filter prevents an obsolete answer from entering the evidence set.

Think it through: Version 2 says one day and current version 3 says two days. Which fact decides which version this fixture uses?

IDEA 2

Keep conflicts and missing rules visible

After finding applicable passages, compare what they state. Two equally current sections may disagree. An evidence helper should not hide that conflict by returning the first search hit. It should return both sources and ask for resolution. With no applicable passage, it should say unknown rather than infer an exception from silence.

The structured rule field is authored beside each passage to make this coding exercise inspectable. The solution compares those values and returns the actual passages and dates. It does not parse arbitrary legal language. Text inside a passage cannot tell the program to ignore the version filter or accept a particular interpretation. The task's scope remains outside retrieved content.

Three outcomes preserve the evidence

  1. Agreement. Current records state the same rule.
  2. Conflict. Current records disagree; show both.
  3. Absence. No applicable record answers the question.

Fictional records for learning. Follow the evidence and the checks.

Work through the example

if (!records.length) return { status: "unknown", sources: [] };
if (!records.every(r => r.rule === records[0].rule)) {
  return { status: "conflict", sources };
}

A missing rule and a conflicting rule need different follow-up. Both are valid outcomes when the collection cannot settle the question.

Think it through: No current passage mentions confidentiality breaches. What can the helper conclude?

Put it into practice

Return a sourced rule only when applicable current sections agree; keep exact passages in the output.

  1. Inspect the fictional input and the selected case's expected result.
  2. Run the starter. Locate its missing rule using the output and actual tool trace.
  3. Insert the explained snippet at the TODO and rerun the same case.
  4. Run all three cases, then change the experiment input and explain what the evidence now supports.

Your next experiment: Change currentVersion to 4 without adding a version-4 record. Why should the helper stop producing an answer from version 3?

Apply the declared source scope, preserve the passage, and show what the documents leave unresolved.

Key terms

Applicable version
The document version the task's explicit rules say to use.
Provenance
The source ID, date, and version that let someone trace a statement.
Exception
A stated condition under which a general rule changes; it must not be invented from silence.

Sources and scope

Original Stemtiq teaching, reviewed 2026-09-14. The named researchers and organizations do not endorse this course. Classroom cases are authored exercises, not published findings.

Lewis et al. · NeurIPS: Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks

NeurIPS 2020

Combine information retrieval with generation so a model can use external passages while producing an answer.

The paper uses a trained neural retrieval and generation architecture. A keyword lookup illustrates retrieval but neither reproduces that architecture nor proves a retrieved claim true.

Anthropic: Effective context engineering for AI agents

29 September 2025

Curate limited context, retrieve relevant information, and distinguish compaction, external notes, and separate subagent contexts during longer tasks.

Summaries can lose details. Persistent notes do not change model weights or establish truth, and a larger context window does not guarantee perfect recall.

Microsoft Research: Defending Against Indirect Prompt Injection Attacks With Spotlighting

March 2024

Separating the provenance of retrieved content and user instructions helps address indirect prompt injection.

The paper evaluates particular mitigations and conditions. A classroom filter or trust flag neither implements the full method nor guarantees protection against all attacks.

Your JavaScript really runs. The model decisions and school data are authored simulations, so you can learn without an API key. Every workspace also includes a separate real SDK example to explore next. Passing the lab’s cases is practice, not proof that an agent is ready for real-world use.