$ cat workspace-template.yaml

H

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.

Document Generation
#human-codex#personality#psychological-profile#interview#self-reflection#rag#ontology#knowledge-graph#report#json#profilo-psicologico#intervista#personalità

// Canvas Preview

canvas.flow

// Instruction

instruction.md

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 SignalsPass 2 · Detect PatternsPass 3 · Map & Score DimensionsPass 4 · Compose ProfileAssemble ProfileReport 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

[Interview Transcript] (Text, you write it)      [KB · Dimensions] [KB · Edge Library] [KB · Configurations & Libraries][Report Settings]      (Text, you write it)      [Reference Library (optional RAG)]  (KB Semantic Search, no edge into the passes until Phase 4)                                                   → documentIds → [Knowledge Graph Bridge (optional)] → entities → [Knowledge Graph Digest (optional)]  (pre-wired chain; itemsText reaches the passes only in Phase 4)  → [Pass 1 · Extract Signals]        ← Interview Transcript + KB · Dimensions    → [Pass 2 · Detect Patterns]      ← Pass 1 + Interview Transcript + KB · Configurations & Libraries (+ Reference Library, + Knowledge Graph Digest)      → [Pass 3 · Map & Score Dimensions] ← Pass 2 + Pass 1 + all three KB nodes (+ Reference Library, + Knowledge Graph Digest)        → [Pass 4 · Compose Profile]  ← Pass 3 + Pass 1 + Report Settings          → [Assemble Profile]        ← Pass 1 (per_item) + Pass 3 (analysis) + Pass 4 (presentation) + Report Settings            → [Report Preview]        ← report_markdown            → [Save Profile JSON]     ← profile_json   (side effect: Drive write, only if the user chose to save)            → [Save Report (Markdown)]← report_markdown (side effect: Drive write, only if the user chose to save)

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). Output value → 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, via upsertNode (input.value). Output value → 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.value keeping 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). Output chunkTexts (Text[]) → Pass 2 and Pass 3 input_text, wired only in Phase 4 when the user provided a folder. Output documentIds → 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), limit 25, includeLinks false. Output entities (Json) → Knowledge Graph Digest listB (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), limit 25. Output itemsText (Text) → Pass 2 and Pass 3 input_text, wired only in Phase 4 when referenceChoice === "folder_graph". An empty digest is a valid result, not an error.
  • Pass 1 · Extract Signals (Text Transform). Per-item extraction; emits the per_item JSON array. Inputs from: Interview Transcript, KB · Dimensions. Configurable inputs: none to touch (prompt is baked; llmModelId stays empty; language stays auto). Output output_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 analysis object (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. Output output_text.
  • Pass 4 · Compose Profile (Text Transform). The presentation object in second person, in REPORT_LANGUAGE. Inputs from: Pass 3, Pass 1, Report Settings. Output output_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: OK or WARNING/ERROR lines), 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 Profile report_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

  1. 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.
  2. nodeFinder with queries: ["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 every nodeId. Do not trust ids from the template preview.
  3. Phase 1 gate: collect every setup decision in ONE requestUserDecision call (all texts in interviewLanguage; the wording below is the meaning to convey):
    requestUserDecision({ questions: [  { key: "mode", header: "Interview",    question: "Ready to start the Human Codex interview? Choose the length.",    context: "Non-clinical self-reflection instrument: your typed answers are analyzed into a profile of pressures, not a diagnosis. You can skip any question. Choosing an option confirms you consent to the analysis.",    options: [ { id: "full", label: "Full interview (33 questions, about 40 minutes)" },               { id: "short", label: "Short interview (15 questions, about 15 minutes)" } ],    allowFreeText: false },  { key: "subject", header: "Name",    question: "What name or label should appear on the report and file names?",    context: "Used only for the report title and the file names. A first name, initials, or a pseudonym are fine.",    options: [] },  { key: "reference", header: "References",    question: "Should the analysis also use a Drive folder of reference documents?",    context: "Optional. The built-in Human Codex Knowledge Base v2 is always used; a reference folder adds retrieved excerpts to the pattern and scoring passes. The knowledge-graph option also lists the ontology entities those documents mention; it adds something only when an administrator has put the folder in the ontology extraction scope. If yes, type the folder name.",    options: [ { id: "none", label: "No, built-in knowledge base only" },               { id: "folder", label: "Yes, use a Drive folder (type its name below)" },               { id: "folder_graph", label: "Yes, a Drive folder plus its knowledge-graph entities (type the folder name below)" } ] },  { key: "save", header: "Save",    question: "Where should the profile (JSON + Markdown report) go when it is ready?",    context: "Saving writes two files to a Drive folder of your choice. Without saving, the report is still shown on the canvas.",    options: [ { id: "drive", label: "Save to Drive (type the folder name below)" },               { id: "none", label: "Do not save, just show it in the workspace" } ] }] })
    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" and referenceHint = answers.find(a => a.key === "reference")?.otherText ?? "" (typed text with no option selected also means folder; folder_graph follows every folder rule below and additionally wires the Knowledge Graph Digest in Phase 4); saveChoice = answers.find(a => a.key === "save")?.selectedIds?.[0] ?? "none" and saveHint = answers.find(a => a.key === "save")?.otherText ?? "" (typed text with no option selected also means drive). If cancelled, stop with followUp explaining that the interview did not start.
  4. 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 use folderId.
    • If either search left several candidates, make ONE requestUserDecision with up to two questions (key: "referenceFolder" and/or key: "saveFolder", allowFreeText: false, context explaining the pick, each option.id = the candidate's id, label = its name and path). Store referenceFolderId / saveFolderId from selectedIds[0]. If cancelled, the reference becomes none and saving becomes none.
  5. Compute interviewDate (today, ISO YYYY-MM-DD) and questionCount (33 for full, 15 for short).
  6. batchUpsertNodes with these operations (one call):
    • Report Settings → input.value:
      ===== BLOCK: REPORT SETTINGS =====REPORT_LANGUAGE: <interviewLanguage or requested report language>SUBJECT_LABEL: <subjectLabel>INTERVIEW_MODE: <modeChoice>INTERVIEW_DATE: <interviewDate>
    • Interview Transcript → input.value:
      ===== BLOCK: INTERVIEW TRANSCRIPT =====INTERVIEW_MODE: <modeChoice>INTERVIEW_LANGUAGE: <interviewLanguage>ITEMS: <questionCount>
    • 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 } (the query is set in Phase 4). Do not touch Knowledge Graph Bridge or Knowledge Graph Digest: they are pre-configured.
  7. Set the language input to auto on nothing: Passes 1-3 must keep language: auto because their outputs are JSON with English enums; Pass 4 writes in REPORT_LANGUAGE from the settings block. Do not touch llmModelId on any node.

Phase 1 complete. Now proceed to Phase 2.

Phase 2: Interview, Layers 1 and 2

  1. Determine the batches for modeChoice from 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).
  2. For EACH batch of this phase, in order, complete ALL sub-steps: a. Call requestUserDecision ONCE 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 in otherText). Never put two questions in one entry, never add predefined options. b. For EACH question of the batch read answers.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):
    [<id>] LABEL: <label from the bank, in English> | LAYER: <layer>Q: <question exactly as you asked it>A: <answer verbatim>
    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 returned cancelled: true: record [no answer] for the batch, then make ONE requestUserDecision (key: "continue", allowFreeText: false, options resume = "Continue the interview", analyze = "Stop here and analyze what I have answered", abandon = "Abandon") with a context line saying how many answers exist. On resume repeat this batch; on analyze skip the remaining batches of Phases 2 and 3 (the transcript keeps the items answered so far; update its ITEMS: line to the count recorded) and go to Phase 4; on abandon or cancel, followUp and stop. f. Continue with the next batch until every batch of this phase is recorded.
  3. 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

  1. 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-transcript upsertNode after each batch, same cancel handling).
  2. Freeze the transcript: upsertNode the Interview Transcript one final time with the complete value; make sure the ITEMS: header line equals the number of [<id>] items actually recorded, and that every recorded item has a Q: and an A: line. Count the words of the answers only and store answerWordCount (used in the summary; the passes apply their own volume gates).
  3. Check: nodeFinder({ query: "Interview Transcript", includeConfig: true }) returns a value whose item count equals ITEMS:. 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

  1. Wire the optional reference library, branching on referenceChoice:
    • If referenceChoice === "none": do nothing. Reference Library (optional RAG), Knowledge Graph Bridge (optional) and Knowledge 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 in interviewLanguage. b. upsertNode({ nodeId: <Reference Library id>, input: { query: <that query> } }) (the driveItemIds were 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" }). No transformExpr: 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 two chunkTexts connections plus the pre-wired documentIds one. If a chunkTexts edge 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: documentIds arrives from the Reference Library and listA stays []. 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.
  2. Language check: confirm Report Settings carries the intended REPORT_LANGUAGE (step 6). Nothing else needs a language input.

Phase 4 complete. Now proceed to Phase 5.

Phase 5: Run the Analysis

  1. nodeExecutor({ nodeId: <Pass 1 · Extract Signals id> }). Wait for the completion notification (do not poll getNodeOutput). If it fails, read the error, fix only what it names (usually the transcript header or an empty transcript), and run it once more.
  2. nodeExecutor({ nodeId: <Pass 2 · Detect Patterns id> }); wait for completion. If referenceChoice === "folder_graph", then getNodeOutput({ 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.
  3. 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.
  4. nodeExecutor({ nodeId: <Pass 4 · Compose Profile id> }); wait for completion.
  5. nodeExecutor({ nodeId: <Assemble Profile id> }); wait for completion. Then getNodeOutput({ nodeId: <Assemble Profile id>, keys: ["validation_notes", "headline"] }). Never fetch profile_json or report_markdown into the chat; they are large and live on the canvas.
  6. 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 with nodeExecutor (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 empty per_item, and you say so in the summary).
    • Other WARNING lines (missing keys, short arrays) do not block: mention them in the summary.
  7. 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

  1. Act on the Phase 1 decision, without asking again:
    • If saveChoice === "drive": nodeExecutor({ nodeId: <Save Profile JSON id> }), wait; then nodeExecutor({ nodeId: <Save Report (Markdown) id> }), wait. Note the returned file names.
    • If saveChoice === "none": do not execute either save node.
  2. verification with a checklist: interview mode and items recorded (ITEMS: count, answerWordCount); reference library used or not (folder name if used) and, for folder_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.
  3. Compose the summary in interviewLanguage: the headline archetype from getNodeOutput (one line), where the report is (canvas preview and/or Drive files), the non-clinical framing sentence, and any warnings from step 21.
  4. followUp with 2-4 suggestions, for example: save the report to Drive (only if saveChoice === "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

User saysConfigure
"Short version", "quick interview"Phase 1 mode = short (15 questions, 3 batches)
"Ask me in Italian" / request written in ItalianinterviewLanguage = it; Report Settings REPORT_LANGUAGE: it; questions asked in Italian
"Report in English but interview in Italian"Ask in it; Report Settings REPORT_LANGUAGE: en
"Use my Psychology folder as reference"Phase 1 reference = folder with hint "Psychology"; Phase 4 wires chunkTexts into Pass 2 and Pass 3
"Don't save anything"saveChoice = none; Phase 6 executes no save node
"Save it in Reports/Profiles"saveChoice = drive; searchDriveItems "Reports/Profiles"; set destinationFolder on both save nodes
"Call the report by my initials"subjectLabel = the initials → file names and report title
"New knowledge base version" (user pastes or points to a file)Replace input.value of the matching KB · node, keeping its first ===== BLOCK: line; then re-run from Pass 1
"Ask one more question about X"Incremental edit: append an item (next id, LABEL from the closest bank label or Custom), upsertNode the transcript, update ITEMS:, re-run Phase 5
"Retrieve more reference material"Reference Library k = 48 (max 100)
"Use my Psychology folder and the knowledge graph" / "include the ontology"Phase 1 reference = folder_graph; Phase 4 also wires Knowledge Graph Digest itemsText into Pass 2 and Pass 3
"Why is the graph digest empty?"The folder is outside the ontology extraction scope (an administrator sets it); the analysis still used the excerpts. Say so in the summary, do not retry

Error Handling

  • requestUserDecision returns cancelled during 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 parsed or 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_notes says WARNING 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)deleteEdge the 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 itemsText is empty → not an error: the retrieved documents hold no ontology objects (folder outside the extraction scope). Proceed.
  • Save node fails with a folder errorsearchDriveItems again or createDriveFolder, set destinationFolder, 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 upsertNode the full transcript, update ITEMS:, then re-run Phase 5 from Pass 1 (Passes 2-4 and Assemble Profile depend on it) and Phase 6 under the previous saveChoice: 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: upsertNode Report 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 deleteEdge the 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

requirements.py
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

variables.yaml
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