Turns a topic into the questions worth asking, searches each one, and files the findings in Notion with the source behind every line.

UsesClaudeJina AINotion

Research a topic question by question

Give it a topic and run it, and the AI breaks it into the specific questions it raises. Each question is searched separately, the search results become numbered extracts, and the AI writes one finding per extract with its number on every line.

What you get is a new page in your Notion database, titled with your topic, holding the questions asked, the findings with a link on every line to its source, and a numbered list of the pages behind them. Nothing unsourced reaches the page: a finding citing a number that was never fetched is discarded, as is any line containing a web address, and at most one finding is kept per source. If the results carry too little text to write from, or every finding is discarded, the run stops and nothing is filed. The page ends with a count of sources used and lines dropped, so a thin run cannot pass for a thorough one.

Each run files a fresh page and touches nothing you already have. The database needs to be shared with your Notion integration.

Set researchTopic to blank.Set researchTopic to blank.
Set notionDatabaseId to blank.Set notionDatabaseId to blank.
Set titlePropertyName to “Name”.Set titlePropertyName to “Name”.
Set maxQuestions to 5.Set maxQuestions to 5.
Set resultsPerQuestion to 4.Set resultsPerQuestion to 4.
Set maxSources to 12.Set maxSources to 12.
Set questionLimit to maxQuestions multiplied by 1.Set questionLimit to maxQuestions multiplied by 1.
If questionLimit is greater than 20If questionLimit is greater than 20
Yes
Change questionLimit to 20.Change questionLimit to 20.
No
No steps
Set sourceLimit to maxSources multiplied by 1.Set sourceLimit to maxSources multiplied by 1.
If sourceLimit is greater than 30If sourceLimit is greater than 30
Yes
Change sourceLimit to 30.Change sourceLimit to 30.
No
No steps
Set resultsWanted to resultsPerQuestion multiplied by 1.Set resultsWanted to resultsPerQuestion multiplied by 1.
If resultsWanted is greater than 10If resultsWanted is greater than 10
Yes
Change resultsWanted to 10.Change resultsWanted to 10.
No
No steps
Set planPrompt to Break the research topic below into the specific questions somebody would have to answer to cover it properly.Set planPrompt to Break the research topic below into the specific questions somebody would have to answer to cover it properly. Rules: - Write one question per line and nothing else. No numbering, no bullets, no preamble, no closing remark. - Every line must end with a question mark. A line that does not is ignored. - Each question must be answerable from public sources and specific enough to type into a search engine. - Ask about different parts of the topic rather than rewording one question. - Write at most maxQuestions questions. Topic: researchTopic.
Set planText to blank.Set planText to blank.
If a step below fails, save the error as planErrorIf a step below fails, save the error as planError
Try
ClaudeClaudeAsk Claude: planPrompt. Save it as plan.Ask Claude: planPrompt. Save it as plan. Maximum response length: 400
Trim plan.response_text and save it as planText.Trim plan.response_text and save it as planText.
On error
Stop and report a problem: Could not work out the research questions, so nothing was searched for and nothing was filed. Check that the app the model runs on is still connected and run it again.Stop and report a problem: Could not work out the research questions, so nothing was searched for and nothing was filed. Check that the app the model runs on is still connected and run it again.
Set questions to an empty list.Set questions to an empty list.
Set questionCount to 0.Set questionCount to 0.
For each planLine in planText split by a new line:For each planLine in planText split by a new line:
If questionCount is greater than or equal to questionLimitIf questionCount is greater than or equal to questionLimit
Yes
Stop repeating.Stop repeating.
No
No steps
Trim planLine and save it as candidate.Trim planLine and save it as candidate.
If candidate doesn't end with “?”If candidate doesn't end with “?”
Yes
Skip to the next item.Skip to the next item.
No
No steps
If the length of candidate is less than 8If the length of candidate is less than 8
Yes
Skip to the next item.Skip to the next item.
No
No steps
Add candidate to the end of questions and save it as questions.Add candidate to the end of questions and save it as questions.
Add 1 to questionCount.Add 1 to questionCount.
If questionCount is 0If questionCount is 0
Yes
Stop and report a problem: No research questions came back, so there was nothing to search for. Try a fuller description of the topic in the 'researchTopic' step.Stop and report a problem: No research questions came back, so there was nothing to search for. Try a fuller description of the topic in the 'researchTopic' step.
No
No steps
Set sources to an empty list.Set sources to an empty list.
Set sourceUrls to an empty list.Set sourceUrls to an empty list.
Set sourceCount to 0.Set sourceCount to 0.
Set evidenceCharacters to 0.Set evidenceCharacters to 0.
For each question in questions:For each question in questions:
If sourceCount is greater than or equal to sourceLimitIf sourceCount is greater than or equal to sourceLimit
Yes
Stop repeating.Stop repeating.
No
No steps
Set results to an empty list.Set results to an empty list.
If a step below fails, save the error as searchErrorIf a step below fails, save the error as searchError
Try
Jina AIJina AISearch the web for question with Jina. Save it as found.Search the web for question with Jina. Save it as found.
Change results to found.results.Change results to found.results.
On error
Show in the output: Could not search for one of the research questions: question. The other questions still ran.Show in the output: Could not search for one of the research questions: question. The other questions still ran.
For each result in results:For each result in results:
If sourceCount is greater than or equal to sourceLimitIf sourceCount is greater than or equal to sourceLimit
Yes
Stop repeating.Stop repeating.
No
No steps
Trim result.url and save it as resultUrl.Trim result.url and save it as resultUrl.
If resultUrl doesn't start with “http”If resultUrl doesn't start with “http”
Yes
Skip to the next item.Skip to the next item.
No
No steps
If sourceUrls contains resultUrlIf sourceUrls contains resultUrl
Yes
Skip to the next item.Skip to the next item.
No
No steps
Trim result.description and save it as resultText.Trim result.description and save it as resultText.
If resultText is empty or resultText is “null”If resultText is empty or resultText is “null”
Yes
Skip to the next item.Skip to the next item.
No
No steps
Trim result.title and save it as resultTitle.Trim result.title and save it as resultTitle.
If resultTitle is empty or resultTitle is “null”If resultTitle is empty or resultTitle is “null”
Yes
Change resultTitle to “Untitled page”.Change resultTitle to “Untitled page”.
No
No steps
Add 1 to sourceCount.Add 1 to sourceCount.
Add resultUrl to the end of sourceUrls and save it as sourceUrls.Add resultUrl to the end of sourceUrls and save it as sourceUrls.
Add a record of number, title, url, and snippet to the end of sources and save it as sources.Add a record of number, title, url, and snippet to the end of sources and save it as sources.
Change evidenceCharacters to evidenceCharacters plus the length of resultText.Change evidenceCharacters to evidenceCharacters plus the length of resultText.
If sourceCount is 0If sourceCount is 0
Yes
Stop and report a problem: The searches came back with nothing that had any text behind it, so there was nothing to write from and nothing was filed.Stop and report a problem: The searches came back with nothing that had any text behind it, so there was nothing to write from and nothing was filed.
No
No steps
If evidenceCharacters is less than 200If evidenceCharacters is less than 200
Yes
Stop and report a problem: There was not enough content behind the search results to write anything honest from, so nothing was filed. Try a broader topic, or raise 'resultsPerQuestion'.Stop and report a problem: There was not enough content behind the search results to write anything honest from, so nothing was filed. Try a broader topic, or raise 'resultsPerQuestion'.
No
No steps
Set evidenceLines to an empty list.Set evidenceLines to an empty list.
For each source in sources:For each source in sources:
Set headLine to “[source.number] source.title”.Set headLine to “[source.number] source.title”.
Add headLineAdd headLine source.snippet to the end of evidenceLines and save it as evidenceLines.
Join evidenceLines with a blank line and save it as evidenceText.Join evidenceLines with a blank line and save it as evidenceText.
Join questions with a new line and save it as questionText.Join questions with a new line and save it as questionText.
Set synthesisPrompt to You are writing up research findings from extracts that were fetched for you. Use only those extracts.Set synthesisPrompt to You are writing up research findings from extracts that were fetched for you. Use only those extracts. Rules: - Write one finding per line and nothing else. No preamble, no headings, no closing remark. - Each line must be exactly: the extract's number, a vertical bar, then one sentence. For example: 3|Two thirds of the councils surveyed took more than a week to respond. - The sentence must say what that one extract says. Do not merge two extracts into one line, and do not conclude anything the extract does not state. - Never write a web address. Cite by number only. A line containing an address is discarded. - A line whose number is not one of the extracts below is discarded, so do not invent numbers. - Leave out an extract that says nothing useful about the topic rather than filling the gap from memory. - Write at most one line per extract. Topic: researchTopic Questions asked: questionText.
Change synthesisPrompt to synthesisPromptChange synthesisPrompt to synthesisPrompt Extracts: evidenceText.
Set findingsText to blank.Set findingsText to blank.
If a step below fails, save the error as synthesisErrorIf a step below fails, save the error as synthesisError
Try
ClaudeClaudeAsk Claude: synthesisPrompt. Save it as synthesis.Ask Claude: synthesisPrompt. Save it as synthesis. Maximum response length: 1500
Trim synthesis.response_text and save it as findingsText.Trim synthesis.response_text and save it as findingsText.
On error
Stop and report a problem: Could not write up the findings, so nothing was filed. The searches ran, so a second attempt costs the search credits again.Stop and report a problem: Could not write up the findings, so nothing was filed. The searches ran, so a second attempt costs the search credits again.
Set findingBlocks to an empty list.Set findingBlocks to an empty list.
Set acceptedCount to 0.Set acceptedCount to 0.
Set droppedCount to 0.Set droppedCount to 0.
For each findingLine in findingsText split by a new line:For each findingLine in findingsText split by a new line:
If acceptedCount is greater than or equal to sourceCountIf acceptedCount is greater than or equal to sourceCount
Yes
Stop repeating.Stop repeating.
No
No steps
Trim findingLine and save it as rawLine.Trim findingLine and save it as rawLine.
If rawLine is emptyIf rawLine is empty
Yes
Skip to the next item.Skip to the next item.
No
No steps
If rawLine doesn't contain “|”If rawLine doesn't contain “|”
Yes
Add 1 to droppedCount.Add 1 to droppedCount.
Skip to the next item.Skip to the next item.
No
No steps
Split rawLine by “|” and save it as lineParts.Split rawLine by “|” and save it as lineParts.
Trim the first item of lineParts with “[” replaced by “” with “]” replaced by “” with “.” replaced by “” and save it as citedNumber.Trim the first item of lineParts with “[” replaced by “” with “]” replaced by “” with “.” replaced by “” and save it as citedNumber.
Trim the items from index 1 onward of lineParts joined by “|” and save it as findingText.Trim the items from index 1 onward of lineParts joined by “|” and save it as findingText.
If findingText is emptyIf findingText is empty
Yes
Add 1 to droppedCount.Add 1 to droppedCount.
Skip to the next item.Skip to the next item.
No
No steps
If findingText contains “http” (ignoring case)If findingText contains “http” (ignoring case)
Yes
Add 1 to droppedCount.Add 1 to droppedCount.
Skip to the next item.Skip to the next item.
No
No steps
Set citedUrl to blank.Set citedUrl to blank.
For each candidateSource in sources:For each candidateSource in sources:
If candidateSource.number is citedNumberIf candidateSource.number is citedNumber
Yes
Change citedUrl to candidateSource.url.Change citedUrl to candidateSource.url.
Stop repeating.Stop repeating.
No
No steps
If citedUrl is emptyIf citedUrl is empty
Yes
Add 1 to droppedCount.Add 1 to droppedCount.
Skip to the next item.Skip to the next item.
No
No steps
Add 1 to acceptedCount.Add 1 to acceptedCount.
Add a record of object, type, and paragraph to the end of findingBlocks and save it as findingBlocks.Add a record of object, type, and paragraph to the end of findingBlocks and save it as findingBlocks.
If acceptedCount is 0If acceptedCount is 0
Yes
Stop and report a problem: None of the write-up could be tied back to a page that was actually read, so nothing was filed. Nothing unsourced is ever written to Notion.Stop and report a problem: None of the write-up could be tied back to a page that was actually read, so nothing was filed. Nothing unsourced is ever written to Notion.
No
No steps
Shorten researchTopic to 90 characters and save it as pageTitle.Shorten researchTopic to 90 characters and save it as pageTitle.
Set page to nothing.Set page to nothing.
Set pageId to blank.Set pageId to blank.
If a step below fails, save the error as notionErrorIf a step below fails, save the error as notionError
Try
NotionNotionCreate the page pageTitle in notionDatabaseId. Save it as page.Create the page pageTitle in notionDatabaseId. Save it as page. Title column: titlePropertyName
Trim page.id and save it as pageId.Trim page.id and save it as pageId.
On error
Stop and report a problem: Could not create the page in Notion, so the write-up was not filed. Check that the database id is right and that the database is shared with your Notion integration.Stop and report a problem: Could not create the page in Notion, so the write-up was not filed. Check that the database id is right and that the database is shared with your Notion integration.
If pageId is empty or pageId is “null”If pageId is empty or pageId is “null”
Yes
Stop and report a problem: Notion did not return a page id, so there was nowhere to write the findings.Stop and report a problem: Notion did not return a page id, so there was nowhere to write the findings.
No
No steps
Set questionBlocks to an empty list.Set questionBlocks to an empty list.
For each askedQuestion in questions:For each askedQuestion in questions:
Add a record of object, type, and bulleted list item to the end of questionBlocks and save it as questionBlocks.Add a record of object, type, and bulleted list item to the end of questionBlocks and save it as questionBlocks.
Set sourceBlocks to an empty list.Set sourceBlocks to an empty list.
For each citedSource in sources:For each citedSource in sources:
Set sourceLabel to “[citedSource.number] citedSource.title -”.Set sourceLabel to “[citedSource.number] citedSource.title -”.
Add a record of object, type, and bulleted list item to the end of sourceBlocks and save it as sourceBlocks.Add a record of object, type, and bulleted list item to the end of sourceBlocks and save it as sourceBlocks.
Set coverageNote to “Written from sourceCount sources found across questionCount research questions.”.Set coverageNote to “Written from sourceCount sources found across questionCount research questions.”.
Change coverageNote to “@coverageNote droppedCount lines the model wrote were dropped because they did not point at one of those sources. Every statement above is what its own source says, not a conclusion drawn beyond it.”.Change coverageNote to “@coverageNote droppedCount lines the model wrote were dropped because they did not point at one of those sources. Every statement above is what its own source says, not a conclusion drawn beyond it.”.
Set pageBlocks to a list of 1 record.Set pageBlocks to a list of 1 record.
Combine pageBlocks and questionBlocks into one list and save it as pageBlocks.Combine pageBlocks and questionBlocks into one list and save it as pageBlocks.
Add a record of object, type, and heading 2 to the end of pageBlocks and save it as pageBlocks.Add a record of object, type, and heading 2 to the end of pageBlocks and save it as pageBlocks.
Combine pageBlocks and findingBlocks into one list and save it as pageBlocks.Combine pageBlocks and findingBlocks into one list and save it as pageBlocks.
Add a record of object, type, and heading 2 to the end of pageBlocks and save it as pageBlocks.Add a record of object, type, and heading 2 to the end of pageBlocks and save it as pageBlocks.
Combine pageBlocks and sourceBlocks into one list and save it as pageBlocks.Combine pageBlocks and sourceBlocks into one list and save it as pageBlocks.
Add a record of object, type, and paragraph to the end of pageBlocks and save it as pageBlocks.Add a record of object, type, and paragraph to the end of pageBlocks and save it as pageBlocks.
NotionNotionAdd content to pageId.Add content to pageId. Content blocks: pageBlocks
Show in the output: Filed acceptedCount sourced findings into Notion from sourceCount sources.Show in the output: Filed acceptedCount sourced findings into Notion from sourceCount sources.