Each week, searches the legal source you name for your research question and records each decision's court, date and outcome in a sheet.
Uses
Claude
Google Sheets
Jina AI
Serper
Keep a sheet of new court decisions on your research question
Once a week, your standing research question is searched on the one legal website you name, each decision found there is opened, and what the page states is copied into a row of your spreadsheet. It is a research aid, not legal advice, and it never says what a case means or how it applies.
You end up with one row per case in a 'Case notes' tab: case name, citation, court, decision date, the outcome as the page states it, a quoted passage, the source address and a note of what the page did not say. Only pages on the site you named are ever opened. Anything the page does not state is left empty, never guessed, and the quoted passage is checked against the text actually fetched: if those words are not on the page, the quote and outcome are emptied and the row says so. Cases already recorded are skipped, and each run reads a capped number of pages.
Before the first run you need a spreadsheet with a 'Case notes' tab, a research question, and the host name of the one site to read.
sheetUrl to blank.Set sheetUrl to blank.researchQuestion to blank.Set researchQuestion to blank.sourceHost to blank.Set sourceHost to blank.recordsTab to Case notes.Set recordsTab to Case notes.maxCasesPerRun to 5.Set maxCasesPerRun to 5.sourceHost lowercase and save it as hostRaw.Make sourceHost lowercase and save it as hostRaw.http:// with in hostRaw with https:// replaced by and save it as hostNoScheme.Replace http:// with in hostRaw with https:// replaced by and save it as hostNoScheme.hostNoScheme split by / and save it as host.Get the first item of hostNoScheme split by / and save it as host.host is emptyIf host is emptyurlPrefix to https://@host/.Set urlPrefix to https://@host/.recordedOn.Get today's date and save it as recordedOn.alreadyRecorded.Start an empty list and save it as alreadyRecorded.recordsTabErrorIf a step below fails, save the error as recordsTabErrorsheetUrl. Save it as done.Read the rows of sheetUrl. Save it as done.doneRow in done.rows:For each doneRow in done.rows:doneRow.Source and save it as doneSource. Trim doneRow.Source and save it as doneSource.doneSource in lowercase starts with https:// If doneSource in lowercase starts with https://doneSource to the end of alreadyRecorded and save it as alreadyRecorded.Add doneSource to the end of alreadyRecorded and save it as alreadyRecorded.Could not read the 'Case notes' tab, so this run treated it as empty. If that tab does not exist yet, create it..Show in the output: Could not read the 'Case notes' tab, so this run treated it as empty. If that tab does not exist yet, create it..host'. Save it as found.Search Google for '@researchQuestion site:host'. Save it as found.recorded to 0.Set recorded to 0.result in found.results:For each result in found.results:recorded multiplied by 1 is greater than or equal to maxCasesPerRun multiplied…If recorded multiplied by 1 is greater than or equal to maxCasesPerRun multiplied…result.link and save it as link.Trim result.link and save it as link.link in lowercase doesn't start with urlPrefixIf link in lowercase doesn't start with urlPrefixlink - it is not on the site named in the 'sourceHost' step.Show in the output: Skipped link - it is not on the site named in the 'sourceHost' step.alreadyRecorded contains linkIf alreadyRecorded contains linkrecorded.Add 1 to recorded.resultErrorIf a step below fails, save the error as resultErrorlink with Jina. Save it as page.Read the page at link with Jina. Save it as page.page.content and save it as pageText.Trim page.content and save it as pageText.pageText is less than 400If the length of pageText is less than 400link - the page had no readable text. It will be tried again on the next run.Show in the output: Nothing was recorded for link - the page had no readable text. It will be tried again on the next run.pageSection to PAGE TEXT - this is the only material you may use:Set pageSection to PAGE TEXT - this is the only material you may use:
pageText truncated to 16000 characters.prompt to You are copying details out of one page of legal material into a record. You have the text of that page and nothing else.Set prompt to You are copying details out of one page of legal material into a record. You have the text of that page and nothing else.
Answer with EXACTLY six values separated by ||| and nothing else - no labels, no numbering, no preamble.
1. The name of the case, as the page gives it.
2. The citation, as the page gives it.
3. The court, as the page names it.
4. The date of the decision, as the page gives it.
5. What the page states the outcome was, in one sentence, in the page's own terms.
6. One passage from the page, copied word for word and character for character, that carries the outcome you gave in value 5. Copy it exactly - do not tidy it, shorten it, join its lines or change its punctuation.
Rules you must follow, without exception:
- Use only the page text below. Do not use anything you know about this case, this court, or this area of law from anywhere else.
- If the page does not state something, write exactly NOT STATED for that value. A missing value is a correct answer; an invented one is not. Never produce a citation, a date or a court name that does not appear in the text below.
- Do not say what the case means, what it establishes, how it applies to anyone, or what a court would do. Report only what this page states.
- Do not write advice of any kind.
pageSection.prompt. Save it as reply.Ask Claude: prompt. Save it as reply.
Maximum response length: 900reply.response_text and save it as answer.Trim reply.response_text and save it as answer.answer by ||| and save it as parts.Split answer by ||| and save it as parts.parts is less than 6If the length of parts is less than 6link - the reading step did not answer in the expected form. Nothing was recorded, and it will be tried again on the next run.Show in the output: Nothing was recorded for link - the reading step did not answer in the expected form. Nothing was recorded, and it will be tried again on the next run.parts[0] and save it as caseName.Trim parts[0] and save it as caseName.caseName is null or caseName in lowercase is not statedIf caseName is null or caseName in lowercase is not statedcaseName to blank.Change caseName to blank.parts[1] and save it as citation.Trim parts[1] and save it as citation.citation is null or citation in lowercase is not statedIf citation is null or citation in lowercase is not statedcitation to blank.Change citation to blank.parts[2] and save it as court.Trim parts[2] and save it as court.court is null or court in lowercase is not statedIf court is null or court in lowercase is not statedcourt to blank.Change court to blank.parts[3] and save it as decided.Trim parts[3] and save it as decided.decided is null or decided in lowercase is not statedIf decided is null or decided in lowercase is not stateddecided to blank.Change decided to blank.parts[4] and save it as outcome.Trim parts[4] and save it as outcome.outcome is null or outcome in lowercase is not statedIf outcome is null or outcome in lowercase is not statedoutcome to blank.Change outcome to blank.parts[5] and save it as quote.Trim parts[5] and save it as quote.quote is null or quote in lowercase is not statedIf quote is null or quote in lowercase is not statedquote to blank.Change quote to blank.notStated to blank.Set notStated to blank.integrity to blank.Set integrity to blank.missing.Start an empty list and save it as missing.caseName is emptyIf caseName is emptythe case name to the end of missing and save it as missing.Add the case name to the end of missing and save it as missing.citation is emptyIf citation is emptythe citation to the end of missing and save it as missing.Add the citation to the end of missing and save it as missing.court is emptyIf court is emptythe court to the end of missing and save it as missing.Add the court to the end of missing and save it as missing.decided is emptyIf decided is emptythe decision date to the end of missing and save it as missing.Add the decision date to the end of missing and save it as missing.outcome is emptyIf outcome is emptythe outcome to the end of missing and save it as missing.Add the outcome to the end of missing and save it as missing.missing isn't emptyIf missing isn't emptynotStated to The page did not state: missing joined by , .Change notStated to The page did not state: missing joined by , .verified to false.Set verified to false.quote is greater than or equal to 25If the length of quote is greater than or equal to 25pageText contains quote (ignoring case) and save it as verified.Check whether pageText contains quote (ignoring case) and save it as verified.verified is noIf verified is noquote to blank.Change quote to blank.outcome to blank.Change outcome to blank.integrity to The outcome column was left empty: no passage in the page's own text could be found to support it. Open the Source link and read the decision itself..Change integrity to The outcome column was left empty: no passage in the page's own text could be found to support it. Open the Source link and read the decision itself..notStated integrity and save it as notes.Trim notStated integrity and save it as notes.recordsTab in sheetUrl.Add a row to recordsTab in sheetUrl.link this time; it will be tried again on the next run.Show in the output: Nothing was recorded for link this time; it will be tried again on the next run.