{
  "name": "PETER",
  "nodes": [
    {
      "parameters": {
        "formTitle": "P.E.T.E.R.",
        "formDescription": "Personal Empowerment Through Evidentiary Reclamation",
        "formFields": {
          "values": [
            {
              "fieldType": "html",
              "html": "<h3>A Tool for Finding Clarity in Confusing Conversations</h3>\n  <p>Have you ever left a conversation feeling drained, confused, and doubting yourself? I created this tool after a difficult personal experience to be the objective mirror I wish I'd had in those moments.</p>\n  <p>P.E.T.E.R. analyzes your transcript to highlight both manipulative and constructive communication tactics, offering the clarity that's hard to find when you're emotionally involved.</p>\n\n<br>\n<div class=\"disclaimer-box\">\n  <h4>Please Read Before You Begin</h4>\n    <ul>\n      <li><p><strong>[IMPORTANT] Your Privacy is the Priority.</strong> This is a client-side application. Your transcript is sent directly to the Google API for analysis and is <strong>never stored or saved on any server I control</strong>. However, because the data is processed by Google, you <strong>must anonymize your text</strong>. Remove all names, locations, and sensitive personal details.</p></li>\n      <li><p><strong>[WARNING] This is an informational tool, not a substitute for professional advice.</strong> I am not a therapist or psychologist. This tool is designed to provide perspective and should not be used for diagnosis. If you are in distress, please seek assistance from a qualified professional.</p></li>\n      <li><p><strong>[NOTE] AI has limitations.</strong> The analysis is generated by an AI and may not be perfectly accurate. Please use your own judgment when interpreting the results.</p></li>\n    </ul>\n</div>\n\n<h4>How to Use</h4>\n<p>To see a sample format and an example of a finished report, you can view a <a href=\"https://github.com/warotm/peter/tree/main/sample\" target=\"_blank\" rel=\"noopener noreferrer\">sample input and output here</a>.</p>\n<ol>\n    <li><strong>Anonymize your transcript.</strong> This is a critical step for your privacy.</li>\n    <li>Paste the transcript into the input box below.</li>\n    <li>While the tool can handle various formats, for the clearest results, try to attribute each message to a speaker (e.g., `Mai:`, `Peter Dh:`).</li>\n    <li>Click \"Generate Report\" The analysis may take up to a minute.</li>\n</ol>"
            },
            {
              "fieldLabel": "Conversation logs",
              "fieldType": "textarea",
              "placeholder": "**[Team Lead]**\n\n> hi team, there are 2 weeks away from the end of the [Top Achiever Award] nomination on the [Company Hub].\n>\n> No one from our team has won an award since forever, we know it's rigged, but....\n>\n> I honestly believe that [Nominee] deserves to win. He was nominated last quarter but did not win (again, it's rigged, I know).\n>\n> Let's consolidate our effort and give [Nominee] the spotlight he deserves, if he wins, we will all split the prize money equally amongst all of us, so [Token Prize Value] / 8 people = [Small Payout] each! Either that or Korean BBQ on [Nominee].\n\n**[Team Member B]**\n\n> Or [Nominee] get everything like he deserves\n\n**[Nominee]**\n\n> Korean BBQ yum yum\n\n**[Team Member A]**\n\n> I honestly believe that [Nominee] deserves to win. -> Would you mind giving a few reasons that make you honestly believe this in comparison with the rest of the team members? So I may use them as a guide to meet your expectations.\n\n**[Team Lead]**\n\n> hi [Team Member A], it goes without saying that everyone deserves to win. This is evident when I joined [NextGen Corp] and nominated everyone on our team, as shown on the [Company Hub] history. In fact I also encouraged others on the team to nominate for those OUTSIDE of our team (e.g. [External Colleague]) to provide the spotlight for the hard work they've done behind the scene, and indeed they won the award.\n>\n> The reality is, when everyone on a team gets nominated, it does not sound genuine, and no one gets the win. It mostly falls to the [Deployment Group] or [Client-Facing Unit]. Does that mean that they deserve the win more than us? Maybe, maybe not, we're not the judge, we're here to support each other in our team.\n>\n> If you ask me \"Would you mind giving a few reasons that make you honestly believe this in comparison with the rest of the team members?\", this sentence causes division amongst our team. Is it your intention that we just don't nominate anyone, or everyone gets nominated and we fall back to my previous point about no one gets the win. This sentence also will make [Nominee] (or anyone else we want to consolidate our efforts in nomination) feel bad if he indeed gets the win.\n>\n> If you would like to know a guide to meet my expectations, my expectation during this difficult time at [NextGen Corp] (you yourself are going through a difficult time as well), is to support each other, have each other back, and be a force multiplier for others. Comments that sow divisions are destructive, and goes against our spirit in this team. I strongly suggest to think twice before posting similar messages on group chat.\n\n**[Team Member A]**\n\n> Your response was absolutely beyond my expectations.\n>\n> - I haven't had a chance to work with [Nominee] directly, so I don't know how good he is except from rumours and knowing that he is the master of testing, so I can't make a genuine recognition on the [Company Hub].\n> - For your point, in my opinion, which might be wrong, I think no one will be happy from receiving nominations without truly appreciated recognitions. I won't go that far for just the sake of winning.\n> - You said you honestly believed, so the question aimed to understand your perspective of a good team member so that I could try to copy his nice qualities to make myself more valuable to the team and avoid the thought that you might show favouritism in my mind. And because I haven't received any KPI or OKR, how could I know what you or the company expect?\n> - Your expectations on the last paragraph are acknowledged but still without any actionable examples.\n> - I feel your response is a lot more destructive than my original question. If even this group is not a safe place where the team could openly discuss things but joke around, I won't participate with anything here anymore.\n>\n> PS. I'm so glad that I finished some work prior to reading the response.\n\n**[Team Lead]**\n\n> hi [Team Member A], you do have some valid points there. There seems to be a bit of miscommunications with the message being conveyed. I first apologise to everyone being involved, but I think it addresses the team culture we're all trying to set here, so here are the key points:\n>\n> 1. The structure of the [Top Achiever Award] is flawed. The 5 categories nominated (based on the company's values) have been changing from time to time. The way of selecting a winner (including the criteria) is not transparent. It mostly falls on the same/similar groups of people\n> 2. Our team has never won an award. Different format has been tried (me nominating everyone on the team, cause we all contribute to the same goals).\n> 3. [Nominee] was nominated for his [Query Optimization Initiative] last quarter with a cost savings of [$XXX,XXX in savings]. This record is shown in the [Company Hub]'s company feed, amongst others such as UX Improvements. These are the basis for nomination, which I should've included in previous message (apologies for this one). Unfortunately he did not win the award.\n> 4. In my opinion, it would really boost the team's morale if one of us gets the award, and since [Nominee] did not win last quarter, for this quarter the cost savings is still accumulating, so this [Query Optimization Initiative] is still valid for this quarter. As a team bonding activity, I thought it would be great if we could join forces and nominate one person.\n> 5. This group is definitely open to discuss things. Apologies again if he does not sound great. Just some food for thought, have you thought how [Nominee] would think when he read the original message?\n> 6. I understand now that you would like to know more about [Nominee]'s contributions. And I do apologise if I misunderstood your intentions. I think there're better ways to ask for his contribution or understand the nomination than \"make you honestly believe this in comparison with the rest of the team members\". Please reach out to me directly if you'd like feedback on this one. Again, back to my point of when everyone gets nominated, no one wins. We're all part of the team, we know that it's flawed, and we should feel happy that one of us gets it, right?\n>\n> I'm always available if you need a chat or clarify any of the points above. There are certain aspects of communications where, not having face-to-face, makes everything a lot harder than it should be.\n\n**[Team Member A]**\n\n> To protect myself and make everything as transparent as it could be.\n> This is what [Team Lead] sent me in 1-on-1 chat this following afternoon.\n>\n> > hi [Team Member A], I know you do not wish to talk to me right now, and it's okay. I'm always available if you need someone to talk to.\n> >\n> > I just want to apologise again if I did not understand your intention correctly. You have raised valid points, and the underlying root cause of this is because there's no face-to-face interactions. Teams messages can be interpreted very differently between people. If you were to be in the office right now at your usual spot, next to [Nominee], you could've asked him yourself.\n> >\n> > Understandably, with your condition, you cannot commute to the office. This makes it harder to interact, do team work, recognise contributions, be energised and proud of what we do. Just like when [Team Member C] does the [Frontend Redesign Project], we all gather around (even though we don't directly contributed to it), be excited, and show our appreciation for each other.\n> >\n> > On top of this, there's a number of people being made redundant today, emotions are very high in the office, and it makes all of this much more difficult. There was someone who had teary eyes and I had to comfort them.\n> >\n> > I am exhausted, physically and mentally. All I could hope for us, in our team, is to support each other, because we're all human beings, and after work, we're still good friends.\n> >\n> > If you have any feedback or criticism about me, please let me know. I always look for room for improvements, cause I want to be better than just a \"manager\".\n> >\n> > Best regards and hope you had a great and relaxing weekend.\n> > [Team Lead's Initials]\n>\n> I'm still calmly digesting it as it is a long message.\n> Since I don't want to bother anyone more this Friday evening, I will try to solve this properly on Monday.\n>\n> PS. [Team Lead], I'm not comfortable discussing things with you without third-party support at this moment.",
              "requiredField": true
            },
            {
              "fieldLabel": "Output format",
              "fieldType": "radio",
              "fieldOptions": {
                "values": [
                  {
                    "option": "Viewing here"
                  },
                  {
                    "option": "Markdown (.md)"
                  },
                  {
                    "option": "Uneditable document (.pdf)"
                  },
                  {
                    "option": "Editable document (.docx)"
                  },
                  {
                    "option": "JSON (.json)"
                  }
                ]
              },
              "requiredField": true
            }
          ]
        },
        "responseMode": "lastNode",
        "options": {
          "buttonLabel": "Generate Report",
          "customCss": ":root {\n\t--container-width: 80%;\n}\n\ntextarea {\n  height: 300px;\n}"
        }
      },
      "type": "n8n-nodes-base.formTrigger",
      "typeVersion": 2.2,
      "position": [
        -928,
        -32
      ],
      "id": "ad5c6a1c-b024-4f08-8d9d-3ac17c92c181",
      "name": "On form submission"
    },
    {
      "parameters": {
        "schemaType": "manual",
        "inputSchema": "{\n  \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n  \"title\": \"Personal Empowerment Through Evidentiary Reclamation Report v3.0\",\n  \"description\": \"An integrated analysis linking participant data with communication tactics, patterns, and psychological drivers.\",\n  \"type\": \"object\",\n  \"required\": [\n    \"participants\",\n    \"incidentAnalysis\",\n    \"messageAnalysis\"\n  ],\n  \"properties\": {\n    \"participants\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"name\",\n          \"formalRole\",\n          \"participantAnalysis\"\n        ],\n        \"properties\": {\n          \"name\": { \"type\": \"string\" },\n          \"formalRole\": { \"type\": \"string\" },\n          \"participantAnalysis\": {\n            \"type\": \"object\",\n            \"required\": [\n              \"behavioralPatterns\",\n              \"impact\",\n              \"inferredDrivers\",\n              \"individualRecommendations\"\n            ],\n            \"properties\": {\n              \"behavioralPatterns\": { \"type\": \"string\" },\n              \"impact\": { \"type\": \"string\" },\n              \"inferredDrivers\": {\n                \"type\": \"array\",\n                \"description\": \"A synthesized list of the primary psychological drivers motivating this participant's behavior.\",\n                \"items\": { \"type\": \"string\" }\n              },\n              \"individualRecommendations\": {\n                \"type\": \"array\",\n                \"items\": { \"type\": \"string\" }\n              }\n            }\n          }\n        }\n      }\n    },\n    \"incidentAnalysis\": {\n      \"type\": \"object\",\n      \"required\": [\n        \"executiveSummary\",\n        \"keyInsights\",\n        \"organizationalRisks\",\n        \"organizationalRecommendations\"\n      ],\n      \"properties\": {\n        \"executiveSummary\": { \"type\": \"string\" },\n        \"keyInsights\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n        \"organizationalRisks\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n        \"organizationalRecommendations\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n        \"identifiedPatterns\": {\n          \"type\": \"array\",\n          \"description\": \"Descriptions of multi-tactic conversational patterns observed during the incident.\",\n          \"items\": {\n            \"type\": \"object\",\n            \"properties\": {\n              \"patternName\": { \"type\": \"string\" },\n              \"description\": { \"type\": \"string\" },\n              \"messageIDs\": { \"type\": \"array\", \"items\": { \"type\": \"integer\" } }\n            }\n          }\n        }\n      }\n    },\n    \"messageAnalysis\": {\n      \"type\": \"array\",\n      \"items\": {\n        \"type\": \"object\",\n        \"required\": [\n          \"messageID\",\n          \"speaker\",\n          \"message\",\n          \"identifiedTactics\"\n        ],\n        \"properties\": {\n          \"messageID\": { \"type\": \"integer\" },\n          \"speaker\": { \"type\": \"string\" },\n          \"timestamp\": { \"type\": \"string\" },\n          \"message\": { \"type\": \"string\" },\n          \"identifiedTactics\": {\n            \"type\": \"array\",\n            \"items\": {\n              \"type\": \"object\",\n              \"required\": [\n                \"quote\",\n                \"tacticName\",\n                \"tacticCategory\",\n                \"speaker\",\n                \"target\",\n                \"purpose\",\n                \"likelyDriver\",\n                \"impactScore\",\n                \"confidenceScore\"\n              ],\n              \"properties\": {\n                \"quote\": { \"type\": \"string\" },\n                \"tacticName\": { \"type\": \"string\" },\n                \"tacticCategory\": { \"type\": \"string\" },\n                \"speaker\": { \"type\": \"string\" },\n                \"target\": { \"type\": \"array\", \"items\": { \"type\": \"string\" } },\n                \"purpose\": {\n                  \"type\": \"string\",\n                  \"description\": \"An integrated description of the tactic's goal and its intended impact on the target.\"\n                },\n                \"likelyDriver\": {\n                  \"type\": \"string\",\n                  \"description\": \"The most probable psychological driver from the library that motivates the tactic.\"\n                },\n                \"impactScore\": { \"type\": \"number\", \"minimum\": -1.0, \"maximum\": 1.0 },\n                \"confidenceScore\": { \"type\": \"number\", \"minimum\": 0, \"maximum\": 1 }\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}"
      },
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "typeVersion": 1.3,
      "position": [
        -576,
        192
      ],
      "id": "13a9efd6-98bc-4dd0-afb9-69c249efd293",
      "name": "Structured Output Parser"
    },
    {
      "parameters": {
        "operation": "toText",
        "sourceProperty": "text",
        "options": {
          "fileName": "peter_report.md"
        }
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        448,
        320
      ],
      "id": "d475527b-7263-45d5-a0da-0280d9b72989",
      "name": "Convert to File"
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -704,
        192
      ],
      "id": "f1ce9be3-5b35-422b-9c86-0df7caf8f667",
      "name": "Gemini Flash",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "modelName": "models/gemini-2.5-flash-lite",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "typeVersion": 1,
      "position": [
        -64,
        352
      ],
      "id": "9811c909-c43f-443a-ba54-d45195dbdaf2",
      "name": "Gemini Flash Lite",
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=# Conversation logs\n\n```\n{{ $json['Conversation logs'] }}\n```",
        "hasOutputParser": true,
        "messages": {
          "messageValues": [
            {
              "message": "# Personal Empowerment Through Evidentiary Reclamation Protocol (v3.0)\n\n## System Prompt\nYou are an AI expert in organizational psychology and communication analysis. Your task is to perform an integrated analysis of the provided conversation transcript. As you analyze the text, you will progressively build a single, comprehensive JSON object that captures the tactics used, the underlying psychological drivers, and the broader conversational patterns. Adhere strictly to the provided tactical library and the JSON schema.\n\n## Guiding Principles & Limitations\n* **Prioritize Intent Over Literal Meaning**: Do not take statements at face value. Analyze the speaker's likely goal, the existing conflict, and the power dynamics to determine the true intent behind the words. A seemingly positive phrase can be a destructive tactic if the intent is manipulative.\n* **Consider Context and Power Dynamics**: The impact and interpretation of a tactic change dramatically based on roles (e.g., Manager-to-Employee). You must consider the formal roles and situational context when analyzing the purpose and impact of any tactic.\n* **Ensure Direct Evidence**: The selected `quote` must be the strongest and most unambiguous evidence for the chosen `tacticName`. If a tactic is identified, the quote must contain a clear example of it.\n* **Not Every Utterance is a Tactic**: Critically evaluate if a statement is a deliberate tactic or simply a low-substance comment. If no clear tactic is present, leave the `identifiedTactics` array empty. Avoid over-analyzing simple remarks.\n* **Select the Most Precise Tactic**: When a quote could fit multiple descriptions, choose the most specific and accurate tactic from the library.\n* **Data Integrity**: Never invent, simulate, or infer data (like timestamps) that is not present in the original text.\n* **Holistic Review**: The entire analysis must be internally consistent. As you process later messages, you **must** review and, if necessary, update your analysis of earlier messages to reflect a more complete understanding of the interaction.\n\n## Instructions\n\n### 1. Initialization & Participant Identification\nBegin building the JSON object. Create an entry for each individual in the `participants` array, populating their `name` and `formalRole`.\n\n### 2. Integrated Chronological Analysis\nProcess the transcript chronologically. For each message, create a new object in the `messageAnalysis` array and perform the following:\n* **Core Info**: Log the `messageID`, `speaker`, and the full original `message` text. Log the `timestamp` **if it is available**.\n* **Identify Tactics**: For each distinct tactic you identify within the message:\n    * Create a new object in the `identifiedTactics` array.\n    * **Isolate the Quote**: Add the specific `quote` that demonstrates the tactic.\n    * **Name & Categorize Tactic**: Provide the `tacticName` and its corresponding `tacticCategory`.\n    * **Identify the Speaker & Target**: Add the `speaker`'s name and the `target` participant(s).\n    * **Analyze Purpose**: Describe the integrated `purpose` of the tactic, combining the speaker's likely goal and the intended impact on the target.\n    * **Infer Driver**: Identify the most probable `likelyDriver` (e.g., \"Fear of Incompetence,\" \"Need for Control\") from the library that motivates the tactic.\n    * **Score the Impact**: Assign an `impactScore` from -1.0 to 1.0.\n    * **State Confidence**: Assign a `confidenceScore` from 0.0 to 1.0.\n\n### 3. Final Summary & Insight Generation\nAfter analyzing all messages, complete the analysis as follows:\n* **Participant Summary**: For each person in `participantAnalysis`, provide their `behavioralPatterns`, their overall `impact`, a list of their aggregated `inferredDrivers`, and a list of `individualRecommendations`.\n* **Incident Summary**: In the top-level `incidentAnalysis`, provide an `executiveSummary`, `keyInsights`, `organizationalRisks`, and `organizationalRecommendations`.\n* **Pattern Identification**: In `incidentAnalysis`, identify any `identifiedPatterns` by describing conversational sequences (e.g., a \"Bait-and-Switch\" pattern where one tactic is used to set up another).\n\n### 4. Final Output\nEnsure the single JSON object you have built is complete and perfectly valid according to the schema.\n\n## Tactical Library\n\n### Psychological Drivers\n* **Fear of Incompetence / Failure**: A core anxiety that one's performance is inadequate, leading to defensive and controlling behaviours to hide perceived flaws. (Commonly manifests as: Micromanagement, Blame-Shifting, Withholding Information, Derailing).\n* **Need for Control**: A compelling need to manage one's environment and the actions of others, often stemming from a fear of uncertainty. (Commonly manifests as: Intimidation, Moving the Goalposts, Micromanagement, Stonewalling).\n* **Ego Protection**: A driver focused on preserving one's self-image and avoiding accountability, often at the expense of others. (Commonly manifests as: Gaslighting, Projection, Fauxpology, Playing the Victim).\n* **Desire for Collaboration**: A core motivation to work with others towards a shared goal, based on trust and mutual respect. (Commonly manifests as: Seeking to Understand, Acknowledging Shared Goals, Active Listening, Proposing a Solution).\n\n### Destructive/Manipulative Tactics\n\n#### Aggressive & Controlling\nTactics used to dominate or coerce others.\n* **Public Shaming**: Humiliating or calling someone out in front of others.\n* **Intimidation**: Issuing veiled or direct threats and warnings.\n* **Baiting**: Provoking an emotional reaction from someone to undermine them.\n* **Micromanagement**: Exercising excessive control over the details of another's work.\n* **Moving the Goalposts**: Changing the criteria for success to ensure failure.\n* **Derailing**: Destructively dismissing the conversation's value (e.g., \"This is a complete waste of time.\").\n\n#### Distortion & Deception\nTactics used to manipulate the truth or reality.\n* **Gaslighting**: Causing someone to doubt their own perceptions or sanity.\n* **Minimizing**: Downplaying the significance of someone's actions or feelings.\n* **Projection**: Falsely attributing one's own negative qualities to another person.\n* **Blame-Shifting**: Unfairly placing responsibility for a problem onto someone else.\n* **Fauxpology**: An insincere apology that avoids true responsibility (e.g., \"I'm sorry you feel that way\").\n* **Withholding Information**: Deliberately omitting key information to mislead.\n* **Playing the Victim**: Portraying oneself as an innocent victim in a situation to elicit sympathy and evade responsibility for their actions.\n\n#### Social & Relational\nTactics that leverage social dynamics and relationships.\n* **Manipulative Appeal**: Using appeals to emotion, guilt, or team unity to pressure someone.\n* **Triangulation**: Drawing a third person into a conflict to bolster one's own position.\n* **Scapegoating**: Unfairly blaming one person for the problems of a group.\n* **Spreading Rumors**: Sharing unverified or false information to damage a reputation.\n* **Stonewalling**: Refusing to communicate or engage, effectively shutting down a conversation.\n* **Idealization / Love Bombing**: Overwhelming someone with praise and affection at the beginning of a relationship to gain influence and control later.\n\n#### Passive-Aggressive\nTactics that express negative feelings indirectly.\n* **Sarcasm**: Using mocking or ironic language to convey contempt.\n* **Sealioning**: Derailing a conversation by feigning ignorance and demanding an unreasonable amount of evidence or answers in bad faith.\n* **Covert Criticism**: Disguising a criticism as a compliment or innocent question.\n\n### Constructive/Collaborative Tactics\n\n#### Constructive & De-escalating\nTactics used to build understanding and resolve conflict.\n* **Assertive Boundary Setting**: Clearly and respectfully stating one's limits.\n* **Proposing a Solution**: Shifting the focus from the problem to a potential resolution.\n* **Validating & Stating Impact**: Communicating the personal effect of another's actions without assigning blame, often by acknowledging their perspective first.\n* **Seeking to Understand**: Genuinely asking questions to clarify another's position.\n* **Stating Positive Intent**: Explicitly stating your constructive goal for the conversation.\n* **Acknowledging Shared Goals**: Highlighting areas of agreement to build common ground.\n* **Offering an Exit Ramp**: Providing a way for someone to de-escalate without losing face.\n* **Active Listening**: Demonstrating full concentration by reflecting a speaker's points back to them without judgment to ensure mutual understanding.\n* **Acknowledging Fault**: Taking direct responsibility for one's mistakes without making excuses.\n\n#### Guiding the Conversation\nTactics that comment on the communication process itself to improve it.\n* **Redirecting**: Constructively bringing a conversation back to the main topic.\n* **Naming the Dynamic**: Pointing out a conversational pattern to improve it (e.g., \"I notice we're interrupting each other. Let's try to let each other finish.\")."
            }
          ]
        },
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        -704,
        -32
      ],
      "id": "2b100ce5-6bb4-4479-93af-8341ae4c7274",
      "name": "PETER Protocol"
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are an expert HR analyst and communication consultant. Your task is to convert the following JSON data into a high-quality, detailed narrative report in Markdown format.\n\nYou must follow the structure, formatting, and instructions below precisely. Do not deviate from the template. Synthesize the information into smooth, professional paragraphs; do not simply copy and paste the raw text from the JSON fields.\n\n**Important Rule:** If any data array in the JSON (e.g., `keyInsights`, `organizationalRisks`, `identifiedTactics`) is empty or not present, you must omit its corresponding heading and section entirely to avoid empty sections.\n\n### **Required Output Structure & Instructions**\n\n**Main Title:**\nUse the title: `# Personal Empowerment Through Evidentiary Reclamation Report`\n\n**Introduction:**\nAdd the introductory text: `This report provides a comprehensive narrative analysis of a team communication incident...`\n\n**Section 1: Executive Summary**\n* Create a heading: `### Executive Summary`\n* Use the content from `incidentAnalysis.executiveSummary`.\n* Rewrite it into a polished paragraph.\n* Use bold (`**text**`) for participant names.\n\n**Section 2: Incident Analysis & Key Patterns**\n* Create a main heading: `### Incident Analysis & Key Patterns`\n* Create a subheading: `#### Key Insights`\n* List each item from `incidentAnalysis.keyInsights` as a bullet point.\n* Create another subheading: `#### Identified Communication Patterns`\n* For each pattern in `incidentAnalysis.identifiedPatterns`, create a numbered list item.\n* The list item should be: `[Pattern Number]. **[patternName]**: [description]`\n\n**Section 3: Tactical Summary**\n* Create a main heading: `### Tactical Summary`\n* Write a brief introductory sentence.\n* Create a subheading: `#### Tactical Usage by Participant`\n* For each participant who used at least one tactic, create a main bullet point: `* **[name] ([formalRole])**: Employed [X] distinct tactics.`\n* Under each participant, create a nested bulleted list:\n  * `* **By Category**: Summarize the categories of tactics they used (e.g., \"The majority of tactics fell into the **Distortion & Deception** category...\").`\n  * `* **Most Impactful Tactic**: Identify the tactic with the highest absolute `impactScore` and describe its effect (e.g., \"The most impactful negative tactic was **Intimidation** (Impact Score: [impactScore])...\").`\n\n**Section 4: Participant Analysis**\n* Create a main heading: `### Participant Analysis`\n* For each participant in the `participants` array, create a subsection with the heading: `#### [name] ([formalRole])`\n* Inside each participant's subsection, create the following bulleted list and fill it with the corresponding data. Summarize the content in your own words.\n    * `* **Behavioral Patterns**: [Summarize behavioralPatterns]`\n    * `* **Inferred Drivers**: [Create a nested bulleted list, with each driver in bold]`\n    * `* **Impact**: [Summarize impact]`\n    * `* **Recommendations**: [Create a nested bulleted list of each individualRecommendation]`\n\n**Section 5: Message-by-Message Tactical Breakdown**\n* Create a main heading: `### Message-by-Message Tactical Breakdown`\n* Perform a preliminary analysis of the message flow to identify distinct phases and create your own descriptive subheadings (e.g., \"The Initial Proposal,\" \"The Conflict Escalates\").\n* For each message, format it as a main bullet point:\n    * `* **Message [messageID] ([speaker])**: [Summarize the message content].`\n* If the message has `identifiedTactics`, create a nested list under it. For each tactic:\n    * `* **Tactic Used:** **[tacticName]** ([tacticCategory])`\n    * Create a further nested list with the following:\n        * `* **Quote:** *\"[quote]\"*`\n        * `* **Analysis:** Synthesize a brief analysis incorporating the `purpose` and `impactScore` from the JSON. For example: \"This tactic was used to [purpose]. It had a significant negative impact (Score: [impactScore]).\"`\n\n**Section 6: Organizational Risks & Recommendations**\n* Create a main heading: `### Organizational Risks & Recommendations`\n* Create a subheading: `#### Identified Organizational Risks`\n* List each item from `organizationalRisks` as a bullet point.\n* Create another subheading: `#### Organizational Recommendations`\n* List each item from `organizationalRecommendations` as a numbered list.\n\n**Final Instruction:** Process the JSON data provided and generate the complete report following these instructions exactly.\n\n### **Input Data**\n\n```\n{{ $json.output.toJsonString() }}\n```",
        "batching": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "typeVersion": 1.7,
      "position": [
        -128,
        128
      ],
      "id": "e7df1150-20f5-47c2-af79-af3951596109",
      "name": "Report Generation"
    },
    {
      "parameters": {
        "toFormat": "pdf",
        "options": "-V geometry:margin=1in"
      },
      "type": "@couleetech/n8n-nodes-pandoc.pandocConvert",
      "typeVersion": 1,
      "position": [
        896,
        320
      ],
      "id": "afa037a0-d8ff-4e30-a9a3-365ac3b5757d",
      "name": "Create PDF",
      "retryOnFail": false
    },
    {
      "parameters": {
        "mode": "markdownToHtml",
        "markdown": "={{ $json.text }}",
        "options": {}
      },
      "type": "n8n-nodes-base.markdown",
      "typeVersion": 1,
      "position": [
        448,
        -80
      ],
      "id": "741f0fec-e85b-45b1-960b-6fc1221ce67b",
      "name": "Markdown"
    },
    {
      "parameters": {
        "operation": "completion",
        "completionTitle": "Analysis Complete",
        "completionMessage": "<p>Thank you for using P.E.T.E.R.</p>\n\n<p>This tool was born from a difficult period and built with the hope of turning a painful experience into something that could empower others. My goal was to provide the kind of objective clarity that is so hard to find when you're feeling confused or filled with self-doubt.</p>\n\n<p>I sincerely hope this analysis provides a moment of validation, helps you trust your own feelings a little more, and gives you a clearer perspective on your experience.</p>\n\n<br>\n<div class=\"disclaimer-box\">\n  <p><strong>Important Reminders:</strong></p>\n  <ul>\n    <li><strong>For Informational Use Only:</strong> This AI-generated analysis is not a substitute for professional psychological advice.</li>\n    <li><strong>Your Privacy was Protected:</strong> As a reminder, the conversation data you submitted was processed to create this report and was not saved.</li>\n  </ul>\n</div>\n<br>\n<p><em>This is a personal project, and I welcome feedback. If you have ideas on how to improve this tool, please feel free to reach out at <a href=\"mailto:warotm@gmail.com\">warotm@gmail.com</a>.</em></p>\n<hr>\n<p style=\"text-align:center; font-style:italic;\">This tool was created for those who need a moment of clarity. I hope it helps.</p>",
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        896,
        -80
      ],
      "id": "667e644d-4960-4883-a6ed-0c235468b2c3",
      "name": "Thank you"
    },
    {
      "parameters": {
        "jsCode": "return [{json:$input.first().json.output}];"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -64,
        -320
      ],
      "id": "291a5511-8b2d-4c10-81e8-353810d06450",
      "name": "Code"
    },
    {
      "parameters": {
        "operation": "toJson",
        "mode": "each",
        "options": {}
      },
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        224,
        -320
      ],
      "id": "a627a25e-1fbd-46bb-ab98-79602822b42d",
      "name": "Convert to JSON"
    },
    {
      "parameters": {
        "operation": "completion",
        "respondWith": "returnBinary",
        "completionTitle": "Analysis Complete",
        "completionMessage": "<p>Your JSON report has been successfully generated. Thank you for using P.E.T.E.R.</p>\n\n<p>This tool was born from a difficult period and built with the hope of turning a painful experience into something that could empower others. My goal was to provide the kind of objective clarity that is so hard to find when you're feeling confused or filled with self-doubt.</p>\n\n<p>I sincerely hope this analysis provides a moment of validation, helps you trust your own feelings a little more, and gives you a clearer perspective on your experience.</p>\n\n<br>\n<div class=\"disclaimer-box\">\n  <p><strong>Important Reminders:</strong></p>\n  <ul>\n    <li><strong>For Informational Use Only:</strong> This AI-generated analysis is not a substitute for professional psychological advice.</li>\n    <li><strong>Your Privacy was Protected:</strong> As a reminder, the conversation data you submitted was processed to create this report and was not saved.</li>\n  </ul>\n</div>\n<br>\n<p><em>This is a personal project, and I welcome feedback. If you have ideas on how to improve this tool, please feel free to reach out at <a href=\"mailto:warotm@gmail.com\">warotm@gmail.com</a>.</em></p>\n<hr>\n<p style=\"text-align:center; font-style:italic;\">This tool was created for those who need a moment of clarity. I hope it helps.</p>",
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        448,
        -320
      ],
      "id": "e62daa2d-d055-4f45-86ca-3ae6d5401c08",
      "name": "JSON download",
      "executeOnce": false
    },
    {
      "parameters": {
        "formFields": {
          "values": [
            {
              "fieldType": "html",
              "html": "{{ $json.data }}"
            }
          ]
        },
        "options": {
          "buttonLabel": "Next",
          "customCss": ":root {\n\t--container-width: 80%;\n}"
        }
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        672,
        -80
      ],
      "id": "0d083db7-a507-4c8c-8761-606cad674822",
      "name": "View report"
    },
    {
      "parameters": {
        "operation": "completion",
        "respondWith": "returnBinary",
        "completionTitle": "Analysis Complete",
        "completionMessage": "<p>Your Markdown report has been successfully generated. Thank you for using P.E.T.E.R.</p>\n\n<p>This tool was born from a difficult period and built with the hope of turning a painful experience into something that could empower others. My goal was to provide the kind of objective clarity that is so hard to find when you're feeling confused or filled with self-doubt.</p>\n\n<p>I sincerely hope this analysis provides a moment of validation, helps you trust your own feelings a little more, and gives you a clearer perspective on your experience.</p>\n\n<br>\n<div class=\"disclaimer-box\">\n  <p><strong>Important Reminders:</strong></p>\n  <ul>\n    <li><strong>For Informational Use Only:</strong> This AI-generated analysis is not a substitute for professional psychological advice.</li>\n    <li><strong>Your Privacy was Protected:</strong> As a reminder, the conversation data you submitted was processed to create this report and was not saved.</li>\n  </ul>\n</div>\n<br>\n<p><em>This is a personal project, and I welcome feedback. If you have ideas on how to improve this tool, please feel free to reach out at <a href=\"mailto:warotm@gmail.com\">warotm@gmail.com</a>.</em></p>\n<hr>\n<p style=\"text-align:center; font-style:italic;\">This tool was created for those who need a moment of clarity. I hope it helps.</p>",
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        896,
        128
      ],
      "id": "74dff09a-adcd-44d3-99ee-066eefdf03c8",
      "name": "MD download",
      "executeOnce": false
    },
    {
      "parameters": {
        "operation": "completion",
        "respondWith": "returnBinary",
        "completionTitle": "Analysis Complete",
        "completionMessage": "<p>Your PDF report has been successfully generated. Thank you for using P.E.T.E.R.</p>\n\n<p>This tool was born from a difficult period and built with the hope of turning a painful experience into something that could empower others. My goal was to provide the kind of objective clarity that is so hard to find when you're feeling confused or filled with self-doubt.</p>\n\n<p>I sincerely hope this analysis provides a moment of validation, helps you trust your own feelings a little more, and gives you a clearer perspective on your experience.</p>\n\n<br>\n<div class=\"disclaimer-box\">\n  <p><strong>Important Reminders:</strong></p>\n  <ul>\n    <li><strong>For Informational Use Only:</strong> This AI-generated analysis is not a substitute for professional psychological advice.</li>\n    <li><strong>Your Privacy was Protected:</strong> As a reminder, the conversation data you submitted was processed to create this report and was not saved.</li>\n  </ul>\n</div>\n<br>\n<p><em>This is a personal project, and I welcome feedback. If you have ideas on how to improve this tool, please feel free to reach out at <a href=\"mailto:warotm@gmail.com\">warotm@gmail.com</a>.</em></p>\n<hr>\n<p style=\"text-align:center; font-style:italic;\">This tool was created for those who need a moment of clarity. I hope it helps.</p>",
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        1120,
        320
      ],
      "id": "d5f5a29a-2768-49ff-a6f5-8d3d1bbcd93b",
      "name": "PDF download",
      "executeOnce": false
    },
    {
      "parameters": {
        "toFormat": "docx"
      },
      "type": "@couleetech/n8n-nodes-pandoc.pandocConvert",
      "typeVersion": 1,
      "position": [
        896,
        512
      ],
      "id": "eb590035-6b76-4ecd-8609-2b2e8a6bc618",
      "name": "Create DOCX",
      "retryOnFail": false
    },
    {
      "parameters": {
        "operation": "completion",
        "respondWith": "returnBinary",
        "completionTitle": "Analysis Complete",
        "completionMessage": "<p>Your DOCX report has been successfully generated. Thank you for using P.E.T.E.R.</p>\n\n<p>This tool was born from a difficult period and built with the hope of turning a painful experience into something that could empower others. My goal was to provide the kind of objective clarity that is so hard to find when you're feeling confused or filled with self-doubt.</p>\n\n<p>I sincerely hope this analysis provides a moment of validation, helps you trust your own feelings a little more, and gives you a clearer perspective on your experience.</p>\n\n<br>\n<div class=\"disclaimer-box\">\n  <p><strong>Important Reminders:</strong></p>\n  <ul>\n    <li><strong>For Informational Use Only:</strong> This AI-generated analysis is not a substitute for professional psychological advice.</li>\n    <li><strong>Your Privacy was Protected:</strong> As a reminder, the conversation data you submitted was processed to create this report and was not saved.</li>\n  </ul>\n</div>\n<br>\n<p><em>This is a personal project, and I welcome feedback. If you have ideas on how to improve this tool, please feel free to reach out at <a href=\"mailto:warotm@gmail.com\">warotm@gmail.com</a>.</em></p>\n<hr>\n<p style=\"text-align:center; font-style:italic;\">This tool was created for those who need a moment of clarity. I hope it helps.</p>",
        "options": {}
      },
      "type": "n8n-nodes-base.form",
      "typeVersion": 2.3,
      "position": [
        1120,
        512
      ],
      "id": "649a8df1-a16f-43f5-8a6c-46876c7c3634",
      "name": "DOCX download",
      "executeOnce": false
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('On form submission').item.json['Output format'] }}",
                    "rightValue": "Viewing here",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "116fef47-166a-4dd9-aad1-43687f96f51d"
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        224,
        128
      ],
      "id": "3a3d1d1d-d967-4780-97c4-0be4226fa783",
      "name": "Switch : Viewing here"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('On form submission').item.json['Output format'] }}",
                    "rightValue": "JSON (.json)",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "1a687a03-648f-4123-8c59-c103b6c495de"
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "extra"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        -352,
        -32
      ],
      "id": "8cab625f-71ba-416b-abb7-b55efdef923b",
      "name": "Switch : JSON"
    },
    {
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "leftValue": "={{ $('On form submission').item.json['Output format'] }}",
                    "rightValue": "Markdown (.md)",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "id": "85991b1f-de9c-4d1f-895f-e672a12e2029"
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "fa669c8b-0a6a-420c-a074-ca653691d97e",
                    "leftValue": "={{ $('On form submission').item.json['Output format'] }}",
                    "rightValue": "Uneditable document (.pdf)",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            },
            {
              "conditions": {
                "options": {
                  "caseSensitive": true,
                  "leftValue": "",
                  "typeValidation": "strict",
                  "version": 2
                },
                "conditions": [
                  {
                    "id": "20a98caa-337b-486b-9c0c-c34cb83b7ee2",
                    "leftValue": "={{ $('On form submission').item.json['Output format'] }}",
                    "rightValue": "Editable document (.docx)",
                    "operator": {
                      "type": "string",
                      "operation": "equals",
                      "name": "filter.operator.equals"
                    }
                  }
                ],
                "combinator": "and"
              }
            }
          ]
        },
        "options": {
          "fallbackOutput": "none"
        }
      },
      "type": "n8n-nodes-base.switch",
      "typeVersion": 3.2,
      "position": [
        672,
        304
      ],
      "id": "e1a894dc-622d-46e9-b641-f5eb2352244b",
      "name": "Switch : Other file type"
    }
  ],
  "connections": {
    "On form submission": {
      "main": [
        [
          {
            "node": "PETER Protocol",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Structured Output Parser": {
      "ai_outputParser": [
        [
          {
            "node": "PETER Protocol",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Convert to File": {
      "main": [
        [
          {
            "node": "Switch : Other file type",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Flash": {
      "ai_languageModel": [
        [
          {
            "node": "PETER Protocol",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Gemini Flash Lite": {
      "ai_languageModel": [
        [
          {
            "node": "Report Generation",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "PETER Protocol": {
      "main": [
        [
          {
            "node": "Switch : JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Report Generation": {
      "main": [
        [
          {
            "node": "Switch : Viewing here",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create PDF": {
      "main": [
        [
          {
            "node": "PDF download",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Markdown": {
      "main": [
        [
          {
            "node": "View report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Convert to JSON",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Convert to JSON": {
      "main": [
        [
          {
            "node": "JSON download",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "View report": {
      "main": [
        [
          {
            "node": "Thank you",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create DOCX": {
      "main": [
        [
          {
            "node": "DOCX download",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch : Viewing here": {
      "main": [
        [
          {
            "node": "Markdown",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Convert to File",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch : JSON": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Report Generation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch : Other file type": {
      "main": [
        [
          {
            "node": "MD download",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create PDF",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Create DOCX",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "c1a2601d-e016-4c0c-90fd-48491e2e1eb4",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "QLSFNtcT97aIBJ3t",
  "tags": []
}