Name a subject and it decides which questions are worth asking, then answers each one from a page it actually read.
Uses
Claude
Google Sheets
Jina AI
Serper
Work out the questions worth asking, then answer them
sheetUrl to blank.Set sheetUrl to blank.subject to blank.Set subject to blank.answersTab to Questions and answers.Set answersTab to Questions and answers.maxQuestions to 6.Set maxQuestions to 6.askedOn.Get today's date and save it as askedOn.alreadyAsked.Start an empty list and save it as alreadyAsked.answersTabErrorIf a step below fails, save the error as answersTabErrorTry
sheetUrl. Save it as done.Read the rows of sheetUrl. Save it as done.doneRow in done.rows:For each doneRow in done.rows:doneRow.Question and save it as doneQuestion. Trim doneRow.Question and save it as doneQuestion.doneQuestion isn't empty If doneQuestion isn't emptyYes
doneQuestion to the end of alreadyAsked and save it as alreadyAsked.Add doneQuestion to the end of alreadyAsked and save it as alreadyAsked.No
No steps
On error
Could not read the 'Questions and answers' 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 'Questions and answers' tab, so this run treated it as empty. If that tab does not exist yet, create it..planPrompt to You are choosing the questions worth answering about a subject, before anyone researches it.Set planPrompt to You are choosing the questions worth answering about a subject, before anyone researches it.
Write each question on its own line, ending in a question mark. No numbering, no bullets, no preamble, no commentary - only the questions themselves.
Ask the questions whose answers would actually change what someone does about this subject. Prefer questions a public source could settle with facts, figures or dates over questions only an opinion could answer.
Subject: subject
Write at most maxQuestions questions.planPrompt. Save it as plan.Ask Claude: planPrompt. Save it as plan.
Maximum response length: 500plan.response_text and save it as planText.Trim plan.response_text and save it as planText.planText is emptyIf planText is emptyYes
No
No steps
planText by a new line and save it as questions.Split planText by a new line and save it as questions.answered to 0.Set answered to 0.line in questions:For each line in questions:answered multiplied by 1 is greater than or equal to maxQuestions multiplied…If answered multiplied by 1 is greater than or equal to maxQuestions multiplied…Yes
No
No steps
line and save it as question.Trim line and save it as question.question doesn't end with ?If question doesn't end with ?Yes
No
No steps
question is less than 12If the length of question is less than 12Yes
No
No steps
alreadyAsked contains questionIf alreadyAsked contains questionYes
No
No steps
question to the end of alreadyAsked and save it as alreadyAsked.Add question to the end of alreadyAsked and save it as alreadyAsked.answered.Add 1 to answered.questionErrorIf a step below fails, save the error as questionErrorTry
question'. Save it as found.Search Google for '@subject question'. Save it as found.pageUrl to blank.Set pageUrl to blank.result in found.results:For each result in found.results:pageUrl is empty If pageUrl is emptyYes
result.link and save it as link.Trim result.link and save it as link.link in lowercase starts with https://If link in lowercase starts with https://Yes
pageUrl to link.Change pageUrl to link.No
No steps
No
No steps
pageUrl is emptyIf pageUrl is emptyYes
answersTab in sheetUrl.Add a row to answersTab in sheetUrl.No
pageUrl with Jina. Save it as page.Read the page at pageUrl 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 200If the length of pageText is less than 200Yes
answersTab in sheetUrl.Add a row to answersTab in sheetUrl.No
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 12000 characters.askSection to Question: question.Set askSection to Question: question.prompt to You are answering one question using a single web page and nothing else.Set prompt to You are answering one question using a single web page and nothing else.
Rules you must follow:
- Answer only from the page text below. Do not use anything you already know about the subject, and do not fill a gap from memory.
- If the page does not answer the question, reply with exactly NOT ANSWERED FROM THIS PAGE and nothing else. That is a correct answer; a plausible one from memory is not.
- Otherwise answer in a few plain sentences, keeping any figures, names and dates exactly as the page gives them.
askSection
pageSection.prompt. Save it as reply.Ask Claude: prompt. Save it as reply.
Maximum response length: 600reply.response_text and save it as answer.Trim reply.response_text and save it as answer.answer is empty or answer contains NOT ANSWERED FROM THIS PAGE (ignoring…If answer is empty or answer contains NOT ANSWERED FROM THIS PAGE (ignoring…Yes
answersTab in sheetUrl.Add a row to answersTab in sheetUrl.No
answersTab in sheetUrl.Add a row to answersTab in sheetUrl.On error
question this time; it will be tried again on the next run.Show in the output: Nothing was recorded for the question question this time; it will be tried again on the next run.