$ cat workspace-template.yaml
Human Codex Interview
// Runs the Human Codex personality-insight interview in the chat (33 typed questions, or 15 in short mode), analyzes the answers through the four-pass Human Codex engine with the built-in Knowledge Base v2 (48 dimensions, 398 signed causal relations) plus an optional Drive folder of reference documents (RAG), optionally bridged to the organization knowledge graph (ontology entities the documents mention), and produces a non-clinical psychological profile: the schema v2.0 profile JSON and a second-person Markdown report, previewed on the canvas and saved to Drive only on request. // Esegue l'intervista Human Codex in chat (33 domande scritte, o 15 in modalità breve), analizza le risposte con il motore Human Codex a quattro passaggi e la Knowledge Base v2 integrata, con una cartella Drive di riferimento opzionale (RAG, collegabile al grafo di conoscenza dell'organizzazione), e produce un profilo psicologico non clinico: JSON schema v2.0 e report Markdown in seconda persona, salvati su Drive solo su richiesta.
// Canvas Preview
// Instruction
Human Codex Interview
Typed Human Codex interview → four-pass analysis (built-in Knowledge Base v2 + optional Drive reference folder, optionally bridged to the organization knowledge graph) → schema v2.0 profile JSON + Markdown report, saved to Drive on request. Non-clinical self-reflection instrument; the interviewee is always addressed in second person.
Compressed chain: Interview Transcript + Report Settings (you fill both) → Pass 1 · Extract Signals → Pass 2 · Detect Patterns → Pass 3 · Map & Score Dimensions → Pass 4 · Compose Profile → Assemble Profile → Report Preview and, if chosen, Save Profile JSON + Save Report (Markdown). The three KB · nodes and the optional Reference Library (optional RAG) node feed the passes; Knowledge Graph Bridge (optional) → Knowledge Graph Digest (optional) add the ontology entities of the retrieved documents when the user asks for them.
You MUST complete all 6 phases in order: Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5 → Phase 6. Do NOT skip any phase. The interview (Phases 2 and 3) is run with requestUserDecision batches of free-text questions; the analysis (Phase 5) is fully deterministic and needs no further user input. Never paste, edit, or summarize the prompts or knowledge-base texts baked into the nodes.
Overview
The template recreates the Human Codex "Personality Insight" product inside a workspace. You interview the user in the chat (33 questions in full mode, 15 in short mode, typed answers only), write the transcript into the Interview Transcript node, then run the four analysis passes. Each pass is a Text Transform node with the corresponding section of the Human Codex main prompt v2.0 baked in; the KB · Text nodes carry Knowledge Base v2 (48 dimensions, 398 signed edges, configurations, hypothesis libraries) and are wired into the passes. An optional KB Semantic Search node lets the operator add a Drive folder of reference documents that enrich Passes 2 and 3; two further optional nodes (Ontology From Documents, Merge Ranked Lists) turn the retrieved documents into a digest of the knowledge-graph entities they mention, useful only when the folder is inside the ontology extraction scope set by an administrator. Assemble Profile (deterministic code, no LLM) merges the pass outputs into the single schema v2.0 JSON object, renders a Markdown report, and reports validation notes. Outputs: the profile JSON and the report, previewed on the canvas and saved to Drive when the user chose to save. Required input: the user's typed answers. Optional inputs: a Drive folder of reference documents (with or without its knowledge-graph entities), a Drive folder to save into.
Workflow Chain
All edges are pre-wired except the optional ones created in Phase 4: Reference Library chunkTexts → Pass 2 and Pass 3, and, when the user asked for the knowledge graph, Knowledge Graph Digest itemsText → Pass 2 and Pass 3. Several edges enter the same input_text port on purpose: the executor joins multi-edge text fan-ins into one text, and every block carries its own ===== BLOCK: ... ===== header.
Node Reference
- Interview Transcript (Text). Holds the full interview as labeled items. Inputs from: you, via
upsertNode(input.value). Outputvalue→ Pass 1, Pass 2. The first line must stay===== BLOCK: INTERVIEW TRANSCRIPT =====. - Report Settings (Text). Key-value lines:
REPORT_LANGUAGE,SUBJECT_LABEL,INTERVIEW_MODE,INTERVIEW_DATE. Inputs from: you, viaupsertNode(input.value). Outputvalue→ Pass 4, Assemble Profile. Keep the first line===== BLOCK: REPORT SETTINGS =====. - KB · Dimensions, KB · Edge Library, KB · Configurations & Libraries (Text). Knowledge Base v2 parts 0-1, 2, and 3-6. Do not edit unless the user provides a new knowledge-base version; then replace
input.valuekeeping the first===== BLOCK: ... =====line. - Reference Library (optional RAG) (KB Semantic Search). Retrieves chunks from the operator's reference documents. Configurable inputs:
query(String, required to run),k(Number, default 24),driveItemIds(array of Drive folder/file ids; a folder expands to its subtree),rerankThreshold(default 0.01). OutputchunkTexts(Text[]) → Pass 2 and Pass 3input_text, wired only in Phase 4 when the user provided a folder. OutputdocumentIds→ Knowledge Graph Bridge (pre-wired; the bridge runs only when the digest is wired into a pass). Never wire it into a pass without a query: a connected but unconfigured search blocks the run. - Knowledge Graph Bridge (optional) (Ontology From Documents). Maps the documents hit by the Reference Library onto the organization ontology and returns the entities they mention, ranked by frequency and connectivity. Inputs:
documentIds← Reference Library (pre-wired),limit25,includeLinksfalse. Outputentities(Json) → Knowledge Graph DigestlistB(pre-wired). Returns empty lists when the folder is outside the ontology extraction scope. Nothing to configure. - Knowledge Graph Digest (optional) (Merge Ranked Lists). Renders the bridged entities as a one-line-per-entity text (
Fused ranking ...). Inputs:listA=[]on purpose (leave it),listB← Knowledge Graph Bridge (pre-wired),limit25. OutputitemsText(Text) → Pass 2 and Pass 3input_text, wired only in Phase 4 whenreferenceChoice === "folder_graph". An empty digest is a valid result, not an error. - Pass 1 · Extract Signals (Text Transform). Per-item extraction; emits the
per_itemJSON array. Inputs from: Interview Transcript, KB · Dimensions. Configurable inputs: none to touch (promptis baked;llmModelIdstays empty;languagestaysauto). Outputoutput_text. - Pass 2 · Detect Patterns (Text Transform). Cross-item patterns, contradictions, avoidance map, hidden-dynamic hypotheses, crisis flag. Inputs from: Pass 1, Interview Transcript, KB · Configurations & Libraries, optional Reference Library and Knowledge Graph Digest. Output
output_text. - Pass 3 · Map & Score Dimensions (Text Transform). The canonical
analysisobject (dimensions, edges from the library only, configurations, coherence, self-model, forecast, leverage path, epistemics). Inputs from: Pass 2, Pass 1, the three KB nodes, optional Reference Library and Knowledge Graph Digest. Outputoutput_text. - Pass 4 · Compose Profile (Text Transform). The
presentationobject in second person, inREPORT_LANGUAGE. Inputs from: Pass 3, Pass 1, Report Settings. Outputoutput_text. - Assemble Profile (Human Codex Assemble node, deterministic, no LLM). Parses the three pass outputs, builds
{schema_version, per_item, analysis, presentation}, renders Markdown. Inputs:per_item← Pass 1,analysis← Pass 3,presentation← Pass 4,settings← Report Settings. Outputs:profile_json(Text),report_markdown(Text),validation_notes(Text:OKorWARNING/ERRORlines),headline(String). Fails if Pass 3 or Pass 4 output is not valid JSON. - Report Preview (Preview). Shows the Markdown report on the canvas. Input
value← Assemble Profilereport_markdown. No side effect. - Save Profile JSON / Save Report (Markdown) (save-file). Write the JSON and the report to Drive. Inputs:
text← Assemble Profile (pre-wired),destinationFolder(Drive folder id, you set it),name(file name, you set it). Side-effect terminals: execute only when the user chose to save in Phase 1.
Execution Strategy
You MUST complete all 6 phases in order: Phase 1 → Phase 2 → Phase 3 → Phase 4 → Phase 5 → Phase 6. Do NOT skip any phase.
Steps are numbered continuously 1-26 across the phases. Gates: Phase 1 ends when the settings, folders, and the transcript header are written (step 7). Phase 2 ends when every Layer 1 and Layer 2 question of the chosen mode is asked and recorded (step 10). Phase 3 ends when the Layer 3 questions are recorded and the transcript is frozen (step 13). Phase 4 ends when the Reference Library (and, if chosen, the Knowledge Graph Digest) is wired or explicitly skipped (step 15). Phase 5 ends when Assemble Profile reports no ERROR and Report Preview has run (step 22). Phase 6 ends with followUp (step 26). The only user pauses are: the Phase 1 bundle, an optional folder pick, and the interview batches.
Phase 1: Setup and Consent
- Resolve the interview language: an explicitly requested language wins; otherwise use the language of the user's request message. Never ask, never infer it from documents. Store it as
interviewLanguage(platform code:it,en,es,fr,de,pt,nl,ru,ja,ko,zh). The report language equals the interview language unless the user asked for a different report language. nodeFinderwithqueries: ["Interview Transcript", "Report Settings", "Reference Library (optional RAG)", "Knowledge Graph Digest (optional)", "Pass 2 · Detect Patterns", "Pass 3 · Map & Score Dimensions", "Assemble Profile", "Report Preview", "Save Profile JSON", "Save Report (Markdown)"]. Store everynodeId. Do not trust ids from the template preview.- Phase 1 gate: collect every setup decision in ONE
requestUserDecisioncall (all texts ininterviewLanguage; the wording below is the meaning to convey): Store:modeChoice = answers.find(a => a.key === "mode")?.selectedIds?.[0] ?? "short";subjectLabel = answers.find(a => a.key === "subject")?.otherText?.trim() || "Interviewee";referenceChoice = answers.find(a => a.key === "reference")?.selectedIds?.[0] ?? "none"andreferenceHint = answers.find(a => a.key === "reference")?.otherText ?? ""(typed text with no option selected also meansfolder;folder_graphfollows everyfolderrule below and additionally wires the Knowledge Graph Digest in Phase 4);saveChoice = answers.find(a => a.key === "save")?.selectedIds?.[0] ?? "none"andsaveHint = answers.find(a => a.key === "save")?.otherText ?? ""(typed text with no option selected also meansdrive). Ifcancelled, stop withfollowUpexplaining that the interview did not start. - Resolve Drive folders, only for the choices that need one, with at most ONE more pause:
- If
referenceChoice !== "none":searchDriveItems({ query: referenceHint, type: "folder" }). If exactly one match,referenceFolderId= its id. If several, keep the candidates. If none, try one alternative query (a shorter form of the hint); if still none,referenceChoice = "none"and tell the user in the final summary. - If
saveChoice === "drive":searchDriveItems({ query: saveHint, type: "folder" })with the same one-or-candidates logic. If none after two queries,createDriveFolder({ name: saveHint || "Human Codex Profiles" })and usefolderId. - If either search left several candidates, make ONE
requestUserDecisionwith up to two questions (key: "referenceFolder"and/orkey: "saveFolder",allowFreeText: false,contextexplaining the pick, eachoption.id= the candidate's id,label= its name and path). StorereferenceFolderId/saveFolderIdfromselectedIds[0]. If cancelled, the reference becomesnoneand saving becomesnone.
- If
- Compute
interviewDate(today, ISOYYYY-MM-DD) andquestionCount(33 forfull, 15 forshort). batchUpsertNodeswith these operations (one call):- Report Settings →
input.value: - Interview Transcript →
input.value: - If
saveChoice === "drive": Save Profile JSON →input: { destinationFolder: <saveFolderId>, name: "human-codex-profile-<subject-slug>-<interviewDate>.json" }and Save Report (Markdown) →input: { destinationFolder: <saveFolderId>, name: "human-codex-report-<subject-slug>-<interviewDate>.md" }(subject-slug= lowercase, non-alphanumerics replaced by-). - If
referenceChoice !== "none": Reference Library (optional RAG) →input: { driveItemIds: [<referenceFolderId>], k: 24, rerankThreshold: 0.01 }(thequeryis set in Phase 4). Do not touch Knowledge Graph Bridge or Knowledge Graph Digest: they are pre-configured.
- Report Settings →
- Set the
languageinput toautoon nothing: Passes 1-3 must keeplanguage: autobecause their outputs are JSON with English enums; Pass 4 writes inREPORT_LANGUAGEfrom the settings block. Do not touchllmModelIdon any node.
Phase 1 complete. Now proceed to Phase 2.
Phase 2: Interview, Layers 1 and 2
- Determine the batches for
modeChoicefrom the question bank below. Full mode: B1 = Q1-Q5, B2 = Q6-Q11, B3 = Q12-Q17, B4 = Q18-Q23 (Phase 3 then asks B5 = Q24-Q28, B6 = Q29-Q33). Short mode: B1 = Q1, Q2, Q3, Q5, Q6 and B2 = Q9, Q12, Q17, Q18, Q19 (Phase 3 then asks B3 = Q24, Q27, Q30, Q31, Q33). - For EACH batch of this phase, in order, complete ALL sub-steps:
a. Call
requestUserDecisionONCE with one entry per question of the batch:key: "q<id>",header: <header>,question: <question translated into interviewLanguage, meaning preserved, scale wording preserved>,context: <context translated>,options: [](pure free text; the answer arrives inotherText). Never put two questions in one entry, never add predefined options. b. For EACH question of the batch readanswers.find(a => a.key === "q<id>")?.otherText?.trim(); if empty or missing, the answer is[no answer]. Do not paraphrase, correct, or translate answers. c. Append one item per question to your running transcript, in question order, using exactly this item format (blank line between items): d.upsertNode({ nodeId: <Interview Transcript id>, input: { value: <header lines from step 6 + every item recorded so far> } }). Always write the complete transcript, never a fragment. e. If the call returnedcancelled: true: record[no answer]for the batch, then make ONErequestUserDecision(key: "continue",allowFreeText: false, optionsresume= "Continue the interview",analyze= "Stop here and analyze what I have answered",abandon= "Abandon") with a context line saying how many answers exist. Onresumerepeat this batch; onanalyzeskip the remaining batches of Phases 2 and 3 (the transcript keeps the items answered so far; update itsITEMS:line to the count recorded) and go to Phase 4; onabandonor cancel,followUpand stop. f. Continue with the next batch until every batch of this phase is recorded. - Check:
nodeFinder({ query: "Interview Transcript", includeConfig: true })and confirm the stored value contains every item of this phase. If an item is missing, re-run sub-step 9d.
Do NOT proceed to Phase 3 until every Layer 1 and Layer 2 question of the chosen mode is recorded in the Interview Transcript node.
Question bank, Layers 1 and 2 (id | header | label | question | context). Ask them in interviewLanguage; keep the LABEL in English in the transcript.
- 1 | Q1 · Anchor | Who are you? | Who are you? Answer in whatever way feels most true right now, not the way you would introduce yourself at work. | Anchor question. There is no right answer; a concrete, honest answer is worth more than a polished one.
- 2 | Q2 · Anchor | What are you building or becoming? | What are you building or becoming? Where are you trying to take your life over the next few years? | Anchor question. Be as specific as you can about what the future actually looks like.
- 3 | Q3 · Anchor | What is the gap? | What is the gap between where you are now and where you want to be? What is actually in the way? | Anchor question. Name both the real constraints and the reasons you suspect are excuses.
- 4 | Q4 · Anchor | Best day | Describe a genuinely good day, a real one you remember. What happened, from waking up to going to sleep? | Anchor question. A specific day you lived, not an ideal one.
- 5 | Q5 · Anchor | One thing to change | If you could change one thing about yourself or your life, what would it be, and why have you not changed it yet? | Anchor question. The second half matters as much as the first.
- 6 | Q6 · Patterns | Obstacles | When you hit a serious obstacle, what do you actually do, in the order you do it? Give a recent example. | Pattern probe. Describe the real sequence, not the one you would recommend.
- 7 | Q7 · Patterns | Learning and mastery | Tell me about something you became genuinely good at. How did you learn it? | Pattern probe. How you learned is more useful than what you learned.
- 8 | Q8 · Patterns | Operating at best | When you are operating at your best, what are the conditions? What is around you, who is around you, what is the rhythm of the day? | Pattern probe. Think of a period when things worked, and describe its conditions.
- 9 | Q9 · Patterns | Limiting belief | What belief about yourself limits you the most, and where do you think it comes from? | Pattern probe. Write the belief in your own words, as you say it to yourself.
- 10 | Q10 · Patterns | Decision-making | How do you make important decisions? Walk me through a recent one, step by step. | Pattern probe. A real decision with its actual steps, including the messy parts.
- 11 | Q11 · Patterns | Time | How did you actually spend your time last week? Not how you meant to, how you did. | Pattern probe. Rough hours or proportions are fine; honesty beats precision.
- 12 | Q12 · Patterns | People around them | Who are the people around you day to day? Which of them give you energy, and which drain it? | Pattern probe. Roles are enough if you prefer not to use names.
- 13 | Q13 · Patterns | Failure | Tell me about a failure that mattered. What happened, and what did you do afterwards? | Pattern probe. What happened afterwards is the part to be specific about.
- 14 | Q14 · Patterns | Feeling alive | When do you feel most alive? Describe a specific moment. | Pattern probe. One moment, described closely, rather than a list.
- 15 | Q15 · Patterns | Fear underneath | What are you afraid of, underneath the everyday worries? | Pattern probe. Take your time; write what comes rather than what sounds reasonable.
- 16 | Q16 · Patterns | Conflict | Tell me about a conflict you handled well, and one you handled badly. What was different? | Pattern probe. Two real situations; the contrast is what we are reading.
- 17 | Q17 · Patterns | Repeating patterns | Is there a pattern that keeps repeating in your life, something you have noticed happening more than once, in relationships, work, or elsewhere? | Pattern probe. Describe at least two occurrences if you can.
- 18 | Q18 · Patterns | Others versus self | How would the people closest to you describe you? Where would their description differ from your own? | Pattern probe. The gap between the two descriptions is often more informative than either side.
- 19 | Q19 · Patterns | Discipline breakdown | When does your discipline break down? What is the condition that breaks it, not just the failure itself? | Pattern probe. Look for the trigger: the time, the state, the situation.
- 20 | Q20 · Patterns | Uncertainty | How do you deal with not knowing? Describe a time you had to act without enough information. | Pattern probe. A concrete episode, with what you felt and what you did.
- 21 | Q21 · Patterns | Reality belief | What do you believe about how reality works that most people around you would not agree with? | Pattern probe. Any belief is welcome; we read the reasoning, not the conformity.
- 22 | Q22 · Patterns | Unjustifiable desire | What do you want that you find hard to justify, even to yourself? | Pattern probe. Nothing here is judged; disowned wants are ordinary and informative.
- 23 | Q23 · Patterns | Power domains | Where in your life do you have real power, and where have you given it away or never claimed it? | Pattern probe. Consider work, money, relationships, and your own time.
Phase 2 complete. Now proceed to Phase 3. Do NOT skip to Phase 5.
Phase 3: Interview, Layer 3 and Transcript Freeze
- For EACH remaining batch of
modeChoice(full: B5 = Q24-Q28, B6 = Q29-Q33; short: B3 = Q24, Q27, Q30, Q31, Q33), repeat exactly sub-steps 9a-9f of Phase 2 with the questions below (same call shape, same item format, same full-transcriptupsertNodeafter each batch, same cancel handling). - Freeze the transcript:
upsertNodethe Interview Transcript one final time with the complete value; make sure theITEMS:header line equals the number of[<id>]items actually recorded, and that every recorded item has aQ:and anA:line. Count the words of the answers only and storeanswerWordCount(used in the summary; the passes apply their own volume gates). - Check:
nodeFinder({ query: "Interview Transcript", includeConfig: true })returns a value whose item count equalsITEMS:. If not, repeat step 12.
Do NOT proceed to Phase 4 until the Interview Transcript node holds every recorded item and the ITEMS: count matches.
Question bank, Layer 3 (id | header | label | question | context):
- 24 | Q24 · Signal | Energy rating | On a scale of 1 to 10, how is your physical energy on most days? What does that number look like in practice? | Deep signal. Give the number and then describe an ordinary day at that level.
- 25 | Q25 · Signal | Sleep | How do you sleep? Quality, consistency, and what it does to your days. | Deep signal. Self-report only; no medical detail is needed.
- 26 | Q26 · Signal | Stress recovery | After a stressful period, how do you recover, and how long does it take? | Deep signal. Recovery quality matters more than how much stress there was.
- 27 | Q27 · Signal | Purpose rating | On a scale of 1 to 10, how clear is your sense of purpose right now? What makes it that number and not higher? | Deep signal. The explanation is the part we read most closely.
- 28 | Q28 · Signal | Body relationship | What is your relationship with your body? How much attention does it get, and what kind? | Deep signal. Care, neglect, performance, appearance, pain, pleasure: whatever applies.
- 29 | Q29 · Signal | Relationship satisfaction | On a scale of 1 to 10, how satisfied are you with your closest relationships? What would move the number? | Deep signal. Give the number, then what is present and what is missing.
- 30 | Q30 · Signal | Inner dialogue | What does the voice in your head say to you on a bad day? Quote it as exactly as you can. | Deep signal. The exact words, in the tone they come in.
- 31 | Q31 · Signal | Values alignment | On a scale of 1 to 10, how aligned are your daily actions with what you say you value? Where is the biggest gap? | Deep signal. Name the value and the behavior that does not match it.
- 32 | Q32 · Signal | Current transition | What transition are you in right now? What is ending, and what is beginning? | Deep signal. Sets the context for the whole reading.
- 33 | Q33 · Signal | Wellbeing and "what would make it a 10" | On a scale of 1 to 10, how is your overall wellbeing right now? What would make it a 10? | Deep signal, last question. The missing condition is often the clearest leverage point.
Phase 3 complete. Now proceed to Phase 4.
Phase 4: Reference Library Wiring
- Wire the optional reference library, branching on
referenceChoice:- If
referenceChoice === "none": do nothing.Reference Library (optional RAG),Knowledge Graph Bridge (optional)andKnowledge Graph Digest (optional)keep no edge into the passes and are never executed. Go to step 15. - If
referenceChoice === "folder"or"folder_graph", complete ALL sub-steps a-e (a search node that is wired but has no query blocks the whole run): a. Derive the retrieval query from the transcript: 6 to 10 short phrases naming the dominant themes, tensions, and the life domains that came up (for example "purpose and meaning, discipline breakdown under fatigue, conflict avoidance, sleep and energy, relational identity, fear of failure"). Write it in the language of the reference documents if the user said what it is; otherwise ininterviewLanguage. b.upsertNode({ nodeId: <Reference Library id>, input: { query: <that query> } })(thedriveItemIdswere set in step 6; if they are missing, set them here too). c.upsertEdge({ sourceNodeId: <Reference Library id>, sourcePort: "chunkTexts", targetNodeId: <Pass 2 id>, targetPort: "input_text" }). NotransformExpr: the executor joins the retrieved chunks into the pass input by itself, and the pass prompts expect the excerpts (and the graph digest, when wired) as trailing material without a block header. d.upsertEdge({ sourceNodeId: <Reference Library id>, sourcePort: "chunkTexts", targetNodeId: <Pass 3 id>, targetPort: "input_text" }). e.nodeFinder({ query: "Reference Library (optional RAG)" })must now show the twochunkTextsconnections plus the pre-wireddocumentIdsone. If achunkTextsedge is missing, create it; never assume it exists. - If
referenceChoice === "folder_graph", additionally complete sub-steps f-h. The Bridge and the Digest need no configuration:documentIdsarrives from the Reference Library andlistAstays[]. f.upsertEdge({ sourceNodeId: <Knowledge Graph Digest id>, sourcePort: "itemsText", targetNodeId: <Pass 2 id>, targetPort: "input_text" }). g.upsertEdge({ sourceNodeId: <Knowledge Graph Digest id>, sourcePort: "itemsText", targetNodeId: <Pass 3 id>, targetPort: "input_text" }). h.nodeFinder({ query: "Knowledge Graph Digest (optional)" })must now show two outgoing connections. If the folder is outside the ontology extraction scope the digest will be an empty string and the passes proceed without it: that is not an error.
- If
- Language check: confirm
Report Settingscarries the intendedREPORT_LANGUAGE(step 6). Nothing else needs a language input.
Phase 4 complete. Now proceed to Phase 5.
Phase 5: Run the Analysis
nodeExecutor({ nodeId: <Pass 1 · Extract Signals id> }). Wait for the completion notification (do not pollgetNodeOutput). If it fails, read the error, fix only what it names (usually the transcript header or an empty transcript), and run it once more.nodeExecutor({ nodeId: <Pass 2 · Detect Patterns id> }); wait for completion. IfreferenceChoice === "folder_graph", thengetNodeOutput({ nodeId: <Knowledge Graph Digest id>, keys: ["itemsText"] })(a short text) and remember whether it is empty or lists entities, for the step 24 checklist; do not re-run anything because of it.nodeExecutor({ nodeId: <Pass 3 · Map & Score Dimensions id> }); wait for completion. This is the heaviest call (it reads the whole knowledge base); allow it several minutes.nodeExecutor({ nodeId: <Pass 4 · Compose Profile id> }); wait for completion.nodeExecutor({ nodeId: <Assemble Profile id> }); wait for completion. ThengetNodeOutput({ nodeId: <Assemble Profile id>, keys: ["validation_notes", "headline"] }). Never fetchprofile_jsonorreport_markdowninto the chat; they are large and live on the canvas.- Read
validation_notes:- If it starts with
OK: continue. - If Assemble Profile FAILED with an
ERROR ... Re-run 'Pass N ...'message: re-run that pass withnodeExecutor(once), then re-run Assemble Profile and read the notes again. If it fails a second time, report it in Phase 6 and stop the pipeline there (the transcript and the pass outputs remain on the canvas). - If it contains
WARNING per_item ...: re-run Pass 1 once, then Assemble Profile once more; if the warning persists, continue (the JSON ships with an emptyper_item, and you say so in the summary). - Other
WARNINGlines (missing keys, short arrays) do not block: mention them in the summary.
- If it starts with
nodeExecutor({ nodeId: <Report Preview id> })so the report is readable on the canvas.
Do NOT proceed to Phase 6 until Assemble Profile has completed without ERROR and Report Preview has run.
Phase 6: Save, Verify, Follow Up
- Act on the Phase 1 decision, without asking again:
- If
saveChoice === "drive":nodeExecutor({ nodeId: <Save Profile JSON id> }), wait; thennodeExecutor({ nodeId: <Save Report (Markdown) id> }), wait. Note the returned file names. - If
saveChoice === "none": do not execute either save node.
- If
verificationwith a checklist: interview mode and items recorded (ITEMS:count,answerWordCount); reference library used or not (folder name if used) and, forfolder_graph, whether the knowledge-graph digest was empty or listed entities; Assemble Profile validation notes; report previewed; files saved (names and folder) or intentionally not saved.- Compose the summary in
interviewLanguage: the headline archetype fromgetNodeOutput(one line), where the report is (canvas preview and/or Drive files), the non-clinical framing sentence, and any warnings from step 21. followUpwith 2-4 suggestions, for example: save the report to Drive (only ifsaveChoice === "none"), re-run the analysis with a reference folder (or with the knowledge graph, if a folder was used without it), add follow-up questions and re-run, or export the profile JSON to another tool.
Configuration Tips
Error Handling
requestUserDecisionreturnscancelledduring the interview → step 9e; never silently continue with empty answers, never restart the interview.- Pass node fails with "Required input 'input_text' not provided" → the Interview Transcript value is empty or its edge is missing; re-write the transcript (step 12) and check the edge with
nodeFinder. - Reference Library fails with a missing query or empty
driveItemIds→ step 14b; if the user has no folder, delete the two edges (deleteEdge) so the search never runs. - Assemble Profile fails with
ERROR analysis (Pass 3) could not be parsedor the Pass 4 equivalent → the pass returned prose or truncated JSON; re-run that pass once (step 21). If it fails again, report it; do not hand-edit JSON in the chat. validation_notessaysWARNING per_item ... using []→ Pass 1 output was not a JSON array; re-run Pass 1 once (step 21).- Knowledge Graph Bridge fails (ontology API error or permission denied) →
deleteEdgethe two Knowledge Graph Digest edges, re-run Phase 5 from Pass 2, and tell the user the graph was skipped. Never retry the bridge more than once. - Knowledge Graph Digest
itemsTextis empty → not an error: the retrieved documents hold no ontology objects (folder outside the extraction scope). Proceed. - Save node fails with a folder error →
searchDriveItemsagain orcreateDriveFolder, setdestinationFolder, re-run the save node. Never save into an unconfirmed folder. - Pass 3 or Pass 4 takes very long → normal (the passes read the full knowledge base); do not cancel before the completion notification arrives unless the user asks.
- Two searches with different queries return no folder → do not retry the same query; fall back as in step 4 (reference →
none, save →createDriveFolder).
Incremental Edits and Re-runs
Detection: if the canvas already holds an Interview Transcript with recorded items that pre-existed this turn, the request is an EDIT, not a fresh interview. Do not re-run Phase 1 or the interview batches; do not re-apply the template.
- Resume an interrupted interview:
nodeFinder({ query: "Interview Transcript", includeConfig: true }), read the recorded ids, continue from the first missing question of the chosen mode with the batch rules of step 9, then Phases 3-6. A bundled "finish the interview and analyze" request is a build: complete every remaining phase. - Add a question or answer: append an item with the next id and
upsertNodethe full transcript, updateITEMS:, then re-run Phase 5 from Pass 1 (Passes 2-4 and Assemble Profile depend on it) and Phase 6 under the previoussaveChoice: if the files were saved before, re-run both save nodes so the Drive copies are refreshed; otherwise leave them unsaved. - Change the report language:
upsertNodeReport Settings (REPORT_LANGUAGE), re-run Pass 4, Assemble Profile, Report Preview, then Phase 6 as above. - Add or remove the reference folder or the knowledge graph: follow step 14 (add) or
deleteEdgethe Reference Library edges and, if present, the Knowledge Graph Digest edges (remove), then re-run Phase 5 from Pass 2. - Swap the knowledge base: replace the
KB ·node values (keep the block header line), re-run Phase 5 from Pass 1.
Saving is a side effect: on an edit turn, act on what the prior state implies (previously saved → refresh the files; otherwise leave unsaved and offer saving in followUp).
// Dependencies
1from input import Text2from input import KBSemanticSearch3from process import OntologyFromDocuments4from process import MergeRankedLists5from process import TextTransform6from process import HumanCodexAssemble7from control import Preview8from output import SaveFile// Variables
1report_language:2 type: undefined3 label: "Report language"4 description: "Platform locale code for the interview and the report (it, en, es, fr, de, pt, nl, ru, ja, ko, zh). Resolved by the agent from the user's request."5 required: undefined67subject_label:8 type: undefined9 label: "Subject label"10 description: "Name, initials, or pseudonym shown in the report title and file names."11 required: undefined1213interview_mode:14 type: undefined15 label: "Interview mode"16 description: "full (33 questions) or short (15 questions)."17 required: undefined1819interview_date:20 type: undefined21 label: "Interview date"22 description: "ISO date of the interview (YYYY-MM-DD)."23 required: undefined