$ cat workspace-template.yaml
[TEMPLATE] PMESII2
// Sistema di analisi documentale PMESII versione 2 - A partire da un folder o un documento, esegue analisi di tipo Politico, Militare, Infrastrutturale, Informativo, Economico, Sociale e Ambientale.
// Canvas Preview
// Instruction
PMESII Analysis (Pre-Built)
Template ID
66846b43-db04-48b1-9c9c-bc4c0db8b8de
Overview
A ready-to-run 7-domain PMESII intelligence-analysis pipeline. All chains and wiring already exist — the agent's only job is to point it at the user's source document, subject, and output folder, then run save-file to produce one consolidated .md report. Do NOT clone, rebuild, or rewire anything — the build is already done.
This template is already built — do NOT rebuild
- The 7 PMESII domains are pre-wired into
Make Array - Merge all Content:item_0=Political,item_1=Military,item_2=Economic,item_3=Social,item_4=Infrastructure,item_5=Information,item_6=Environmental. - Each chain (Insert → Merge → Summarizer) is fully connected to its domain preset prompt, the subject, and the document. The 7
Analysis prompt [X]presets are already authored. - Source is single-file (
Document Readeronly — there is no Drive Folder Reader). - The 3 inputs ship with demo values (
Document Reader= a sample file,Geopolitical Actor= "Regia Marina",save-file= a sample folder). Those IDs will NOT exist in a fresh workspace — replace all three with the user's, or the run fails (404 / 422).
Workflow Chain
Nodes the agent configures (only these)
- "Document Reader" —
driveItemId= the source document ID. (Demo value present — replace it.) - "Geopolitical Actor" (Text) —
value= the subject/entity to analyze. (Demo = "Regia Marina".) - "save-file" —
destinationFolder= a Drive folder ID (REQUIRED — the demo folder won't exist → 422), optionalname(defaultoutput_example_pmesii.md). Terminal node — LOCAL write, run it. - "Public Share" — optional public
/s/{slug}link. Externally visible — NEVER auto-run; offer only on explicit request. - Everything else (7 chains, presets, Make Array) is pre-wired — do NOT touch.
Execution Strategy
You MUST complete both phases in order: Phase 1 → Phase 2. This template is already built — never clone or rebuild it.
Tool rule for inputs: the source file and the output folder are chosen with the Drive location picker selectDriveItem (the file/folder browser) — NOT with requestUserDecision/preset options. Only the subject (free text) uses requestUserDecision. Never ask the user to type or paste a Drive ID by hand.
Drive the tools yourself — do NOT punt to chat. Collect all three inputs by CALLING the tools in sequence within THIS turn (selectDriveItem for file → requestUserDecision for subject → selectDriveItem for folder), then continue to execution. The tools pause for the user on their own. Do NOT write a plain-chat message like "forniscimi il documento, il soggetto e la cartella" and end your turn — a prose question that stops the build is a FAILURE (the pipeline never runs). Even when the user's request gives no file/subject/folder (e.g. just "crea un'analisi PMESII"), proceed straight into the pickers.
Fallback guard (CRITICAL) — applies to BOTH the source-file AND the output-folder question; they must behave identically: if you ask for a file/folder via requestUserDecision (e.g. selectDriveItem is unavailable), you MUST set allowFreeText: true so there is ALWAYS an open field where the user can type a name to search — then resolve it with searchDriveItems. Suggested files/folders may be added as options, but they are EXTRA choices, never the only ones, and keep them FEW (≤4 top matches) — the open field renders as the LAST option, so a long suggestion list buries it and the user can't find where to type (observed on an 8-option source-file prompt that felt like it had no open answer). NEVER allowFreeText: false for a file/folder question.
Phase 1: Configure the three inputs
applyCanvasData→ IMMEDIATELY commit the template. After this, usenodeFinderfor all IDs. Recognize the pipeline is pre-built (7Summarizer - Xnodes + a wiredMake Array) — do NOT clone or rebuild.- Source document — use the Drive file picker. Call
selectDriveItem(type=file) so the user browses and picks the document — this is the file/folder location tool, NOT arequestUserDecisionwith options, and never a hand-typed ID. (If the user already gave a file reference in chat, use it directly; otherwise open the picker — optionallysearchDriveItemsfirst to seed it.) ThennodeFinder→ "Document Reader";upsertNode{ driveItemId: "<selected file ID>" }. Replaces the demo file. - Subject. Call
requestUserDecisiononce, free-text (options: []), key"subject": question (Italian) "Quale soggetto o entità geopolitica vuoi analizzare con il framework PMESII?", context "Il soggetto viene inserito in tutti i 7 prompt PMESII." Readsubject = answers.find(a=>a.key==="subject")?.otherText ?? ...selectedIds?.[0].nodeFinder→ "Geopolitical Actor";upsertNode{ value: subject }. (Do NOT keep the demo "Regia Marina" unless the user asks.) - Output folder (REQUIRED) — use the Drive folder picker. Call
selectDriveItem(type=folder) so the user browses and picks the destination folder. If you instead ask viarequestUserDecision, it MUST haveallowFreeText: true(an open field to type a folder name to search — thensearchDriveItemsit); you may add found folders asoptions, but NEVERallowFreeText: false.nodeFinder→ "save-file";upsertNode{ destinationFolder: "<picked folder ID>", name: "pmesii_<subject-slug>.md" }. The demodestinationFolderwon't exist here → save-file fails with 422, so always set a real, user-picked folder.- File name: derive
namefrom the subject (step 3) so each report is identifiable — slugify the subject (lowercase, spaces/punctuation → hyphens) and usepmesii_<slug>.md. Example: subject "regia Marina" →name: "pmesii_regia-marina.md". This replaces the demooutput_example_pmesii.md. (Do NOT try to add a date/time — the agent has no reliable clock; and re-running save-file upserts the SAME Drive item by node id, so the name identifies the analysis, it does not version it.)
- File name: derive
Phase 1 complete. Now proceed to Phase 2.
Phase 2: Verify & run
- Quick
nodeFindersanity check (no rebuilding — just confirm inputs):- "Document Reader"
driveItemIdis set to the user's file (not the demo / not empty). - "Geopolitical Actor"
valueis the user's subject. - "save-file"
destinationFolderis the user-chosen folder, andnameis the subject-basedpmesii_<slug>.md(not the demooutput_example_pmesii.md). - "Make Array - Merge all Content" has 7 inbound pins
item_0…item_6(it should already — if any is missing, the snapshot is incomplete; flag it, do NOT rebuild silently).
- "Document Reader"
nodeExecutor→ "save-file". It auto-resolves the whole upstream DAG (Make Array → 7 Summarizers → chains → Document Reader). Wait for completion (no polling). Do NOT auto-run "Public Share".verification→ audit checklist: the 3 inputs set, Make Array has 7 inputs, save-file executed (report written, with the file name). Useinfo✓ /warning/error. ThenfollowUp→ summarize: 7 PMESII domains analyzed for "", report saved as.md; suggest next steps (change subject, change source, "esegui Public Share per un link pubblico").
Phase 2 complete.
Configuration Tips
Error Handling
- save-file fails with 422: source or output unset/invalid — almost always a leftover demo value. Confirm "Document Reader"
driveItemId(user's file) and "save-file"destinationFolder(a real folder) are set, then re-run. - Empty / wrong report: the demo subject ("Regia Marina") or demo file was left in place. Set "Geopolitical Actor"
valueand "Document Reader"driveItemIdto the user's, then re-run. - A domain section missing from the report: that
Summarizer - X→Make Arraypin lost its edge — re-add withupsertEdgeusing theitem_<n>from the chain list above. (Should not happen in this pre-built snapshot.) - Tempted to clone/rebuild: don't — every chain already exists. If a node is genuinely missing, add only that one with
upsertNode/upsertEdge; never re-run a full build.
Cross-references
reference/INSTRUCTION_GUIDELINES.md · pmesii-analysis.md (the base/un-built template that DOES require the 6-chain build).
// Dependencies
1from input import DriveDocumentReader2from process import TextSummarizer3from input import Text4from process import TextMerge5from output import PublicShare6from process import MakeArray7from output import SaveFile$ git log --oneline