Reads one Google Doc and writes three new documents from it: a study guide, a ten-minute briefing and a dated timeline.
Uses
Claude
Google Docs
Turn one document into a study guide, a briefing and a timeline
Point it at one Google Doc, a chapter, a report, a policy or a set of minutes, and run it to get three new documents in your Google Drive: a study guide, a briefing for someone with ten minutes, and a timeline of the dated events the document states. The AI writes all three from that document and nothing else, told to add no outside knowledge and to say where the document is silent rather than fill the gap.
The timeline is checked mechanically as well as asked for politely, because an invented date reads exactly like a real one. Every entry must quote its date as the document writes it, any entry whose date cannot be found in the text is dropped and listed at the foot of the page, and if the document states no dates the page says so instead of inventing a sequence. The source is only ever read. Three fresh documents named after your pack are created every run, and if any draft comes back empty the run stops before creating anything, so you never get a half-built set.
sourceDocumentLink to blank.Set sourceDocumentLink to blank.studyPackName to blank.Set studyPackName to blank.studyPackName and save it as packName.Trim studyPackName and save it as packName.sourceDocumentLink and save it as sourceLink.Trim sourceDocumentLink and save it as sourceLink.sourceDocumentId to sourceLink.Set sourceDocumentId to sourceLink.sourceLink starts with http (ignoring case)If sourceLink starts with http (ignoring case)sourceLink doesn't contain /d/If sourceLink doesn't contain /d/sourceLink split by /d/ split by / and save it as sourceDocumentId.Get the first item of the last item of sourceLink split by /d/ split by / and save it as sourceDocumentId.sourceDocumentId is emptyIf sourceDocumentId is emptysourceText to blank.Set sourceText to blank.readErrorIf a step below fails, save the error as readErrorsourceDocumentId. Save it as readResult.Read sourceDocumentId. Save it as readResult.readResult.text and save it as sourceText.Trim readResult.text and save it as sourceText.readError.message.Stop and report a problem: Could not read that document. Check the 'sourceDocumentLink' step points at a Google Doc your connected account can open. The reason given was: readError.message.sourceText is emptyIf sourceText is emptydocumentBlock to Set documentBlock to
DOCUMENT STARTS
sourceText truncated to 40000 characters (keeping words whole)
DOCUMENT ENDS.studyGuidePrompt to You are writing from ONE source document, which is reproduced in full below.Set studyGuidePrompt to You are writing from ONE source document, which is reproduced in full below.
Every statement you write must be supported by that text and by nothing else.
Do not add background knowledge. Do not add a name, a date, a figure, an event or a claim that is not in the text. Where the document does not cover something, write that the document does not say. Do not guess and do not fill gaps.
Write plain text. Do not use markdown, asterisks or hash marks.
Task: write a study guide for the document.
Use exactly these five sections, each introduced by its name on its own line:
SUMMARY
KEY IDEAS
KEY TERMS AND WHAT THE DOCUMENT SAYS THEY MEAN
QUESTIONS TO TEST YOURSELF
WHAT THIS DOCUMENT DOES NOT COVER
Define a term only if the document defines it. Every question must be answerable from the document alone.@documentBlock.studyGuideText to blank.Set studyGuideText to blank.studyGuideErrorIf a step below fails, save the error as studyGuideErrorstudyGuidePrompt. Save it as studyGuideReply.Ask Claude: studyGuidePrompt. Save it as studyGuideReply.
Maximum response length: 3000studyGuideReply.response_text and save it as studyGuideText.Trim studyGuideReply.response_text and save it as studyGuideText.studyGuideText to blank.Change studyGuideText to blank.briefingPrompt to You are writing from ONE source document, which is reproduced in full below.Set briefingPrompt to You are writing from ONE source document, which is reproduced in full below.
Every statement you write must be supported by that text and by nothing else.
Do not add background knowledge. Do not add a name, a date, a figure, an event or a claim that is not in the text. Where the document does not cover something, write that the document does not say. Do not guess and do not fill gaps.
Write plain text. Do not use markdown, asterisks or hash marks.
Task: write a briefing for someone who has ten minutes and has not read the document.
Use exactly these four sections, each introduced by its name on its own line:
WHAT THIS IS
WHAT IT SAYS
WHAT IT ASKS FOR OR DECIDES
QUESTIONS THE DOCUMENT LEAVES OPEN
Keep it under 400 words. Attribute every point to the document rather than asserting it as general fact.@documentBlock.briefingText to blank.Set briefingText to blank.briefingErrorIf a step below fails, save the error as briefingErrorbriefingPrompt. Save it as briefingReply.Ask Claude: briefingPrompt. Save it as briefingReply.
Maximum response length: 1500briefingReply.response_text and save it as briefingText.Trim briefingReply.response_text and save it as briefingText.briefingText to blank.Change briefingText to blank.timelinePrompt to You are writing from ONE source document, which is reproduced in full below.Set timelinePrompt to You are writing from ONE source document, which is reproduced in full below.
Every statement you write must be supported by that text and by nothing else.
Do not add background knowledge. Do not add a name, a date, a figure, an event or a claim that is not in the text. Where the document does not cover something, write that the document does not say. Do not guess and do not fill gaps.
Write plain text. Do not use markdown, asterisks or hash marks.
Task: list every dated event the document states, earliest first.
Write one event per line in exactly this format, with a vertical bar between the two parts:
date exactly as written in the document | what happened, in one short sentence
Copy the date text character for character from the document. Do not reformat it, do not complete a partial date, do not convert it to another calendar or style, and do not work out a date the document does not state.
Write no heading, no numbering and no commentary - only the event lines.
If the document states no dates at all, reply with exactly this one line and nothing else:
NO DATES IN THIS DOCUMENT@documentBlock.timelineText to blank.Set timelineText to blank.timelineErrorIf a step below fails, save the error as timelineErrortimelinePrompt. Save it as timelineReply.Ask Claude: timelinePrompt. Save it as timelineReply.
Maximum response length: 2000timelineReply.response_text and save it as timelineText.Trim timelineReply.response_text and save it as timelineText.timelineText to blank.Change timelineText to blank.studyGuideText is empty or briefingText is empty or timelineText is emptyIf studyGuideText is empty or briefingText is empty or timelineText is emptytimelineEvents to an empty list.Set timelineEvents to an empty list.untraceableDates to an empty list.Set untraceableDates to an empty list.timelineText contains NO DATES IN THIS DOCUMENT (ignoring case) and save it as sourceStatesNoDates.Check whether timelineText contains NO DATES IN THIS DOCUMENT (ignoring case) and save it as sourceStatesNoDates.sourceStatesNoDates is noIf sourceStatesNoDates is notimelineLine in timelineText split by a new line:For each timelineLine in timelineText split by a new line:timelineLine and save it as entry. Trim timelineLine and save it as entry.entry isn't empty and entry contains | If entry isn't empty and entry contains |entry split by | and save it as dateText.Trim the first item of entry split by | and save it as dateText.entry split by | and save it as eventText.Trim the last item of entry split by | and save it as eventText.dateText isn't empty and eventText isn't emptyIf dateText isn't empty and eventText isn't emptysourceText contains dateText (ignoring case)If sourceText contains dateText (ignoring case)dateText - eventText to the end of timelineEvents and save it as timelineEvents.Add dateText - eventText to the end of timelineEvents and save it as timelineEvents.dateText to the end of untraceableDates and save it as untraceableDates.Add dateText to the end of untraceableDates and save it as untraceableDates.untraceableDates and save it as droppedCount.Count the items in untraceableDates and save it as droppedCount.timelineEvents and save it as tracedCount.Count the items in timelineEvents and save it as tracedCount.sourceCredit to Set sourceCredit to
Written from one source document only: sourceLink
Drafted on today's date. Check anything you rely on against the source.studyGuideId.Trim the document id from the Google Docs “Create document” step and save it as studyGuideId.packName' to studyGuideId.Add the heading 'Study guide: packName' to studyGuideId.studyGuideId.Add text to studyGuideId.studyGuideText plus sourceCreditbriefingId.Trim the document id from the Google Docs “Create document” step and save it as briefingId.packName' to briefingId.Add the heading 'Briefing: packName' to briefingId.briefingId.Add text to briefingId.briefingText plus sourceCredittimelineId.Trim the document id from the Google Docs “Create document” step and save it as timelineId.packName' to timelineId.Add the heading 'Timeline: packName' to timelineId.tracedCount is greater than 0If tracedCount is greater than 0timelineId.Add a bulleted list to timelineId.timelineId.Add text to timelineId.The source document does not state any dates, so there is no timeline to build from it. Nothing has been invented to fill this page.timelineId.Add text to timelineId.No dated entry in the draft could be matched back to the wording of the source document, so nothing has been written here. Inventing a sequence would be worse than leaving this page empty.timelineCredit to sourceCredit.Set timelineCredit to sourceCredit.droppedCount is greater than 0If droppedCount is greater than 0timelineCredit to sourceCreditChange timelineCredit to sourceCredit
Left out of this timeline: droppedCount entry or entries whose date does not appear in the source document, so they could not be traced back to it. The dates dropped were: untraceableDates joined by ; .timelineId.Add text to timelineId.timelineCreditsourceLink: a study guide, a briefing, and a timeline holding tracedCount traced event(s) with droppedCount untraceable entry or entries left out.Show in the output: Made three documents from sourceLink: a study guide, a briefing, and a timeline holding tracedCount traced event(s) with droppedCount untraceable entry or entries left out.