{
  "name": "Recall project decisions from Brain Memory for a weekly brief",
  "active": false,
  "nodes": [
    {
      "id": "ac1e4fd3-de55-4665-8a8b-74e52f40f7af",
      "name": "Set up and run",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -30,
        -565
      ],
      "parameters": {
        "width": 560,
        "height": 500,
        "content": "### How it works\nBring saved decisions into a weekly update. The manual trigger uses either a sample memory or a live Brain search. Both paths produce a dated brief with a source ID for each result.\n\n### Setup\n1. For a first run without an account, open **Choose brief inputs**, turn on **use_example**, and execute the workflow.\n2. For live recall, turn **use_example** off and enter your project question in **query**. In **Recall project context**, connect an **MCP OAuth2 API** credential. Set **Server URL** and **Resource URL** to `https://mcp.brainmemory.ai/mcp`.\n3. Review the OAuth consent screen. Automatic registration can request read and write access. For a read-only credential use a registered PKCE client with `brain.read`.\n4. Read **brief** in **Format weekly brief**. Check the source IDs and any historical or source-verification labels before sharing."
      }
    },
    {
      "id": "4604966c-6163-429c-a313-2f6b44b6f90d",
      "name": "Walk through the Atlas example",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        595,
        -565
      ],
      "parameters": {
        "width": 620,
        "height": 360,
        "color": 5,
        "content": "### Try the Atlas example\n**Question:** Who should receive the Atlas pilot first?\n\nWith **use_example** on, the example node supplies one fictional decision. No search runs. In the formatted brief, look for **Atlas pilot release**, the decision to ship to the support team first, and **Source: example_atlas_01**.\n\nNow turn **use_example** off, replace the question with one about a decision saved in your Brain account, and run again. Compare the live memory in **Recall project context** with the corresponding source ID in **Format weekly brief**. If the results are empty, check the account and try wording from the saved decision."
      }
    },
    {
      "id": "3bb2c46b-1134-47b6-9ea1-a935d685607b",
      "name": "Run manually",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "parameters": {}
    },
    {
      "id": "38298555-cb2b-49c6-9970-b9244c521cbb",
      "name": "Choose brief inputs",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        0
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "5fb80b61-0092-4ab3-a350-3ba0ec035d8d",
              "name": "use_example",
              "type": "boolean",
              "value": false
            },
            {
              "id": "66e153a0-963a-4ddb-bc19-b5e8b6d13d1b",
              "name": "query",
              "type": "string",
              "value": "Project decisions, open questions and next steps for the weekly brief"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "765fe421-b349-4d17-b8fc-5df14518b6f7",
      "name": "Use tutorial example?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        470,
        0
      ],
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "75700638-30a4-4f98-b6c0-7f25d4dee3c5",
              "leftValue": "={{ $json.use_example }}",
              "rightValue": "",
              "operator": {
                "type": "boolean",
                "operation": "true",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      }
    },
    {
      "id": "3b3ed0ab-8a22-4a58-8406-fbf3758c65d8",
      "name": "Load example memory",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        730,
        -125
      ],
      "parameters": {
        "mode": "raw",
        "jsonOutput": "{\n  \"structuredContent\": {\n    \"results\": [\n      {\n        \"id\": \"example_atlas_01\",\n        \"title\": \"Atlas pilot release\",\n        \"content\": \"Ship the pilot to the support team first so they can check the onboarding guide.\"\n      }\n    ]\n  }\n}",
        "options": {}
      }
    },
    {
      "id": "d2f3dd76-0811-4ffa-9fef-12beb2bd6573",
      "name": "Recall project context",
      "type": "@n8n/n8n-nodes-langchain.mcpClient",
      "typeVersion": 1.1,
      "position": [
        730,
        120
      ],
      "parameters": {
        "serverTransport": "httpStreamable",
        "endpointUrl": "https://mcp.brainmemory.ai/mcp",
        "authentication": "mcpOAuth2Api",
        "tool": {
          "__rl": true,
          "mode": "id",
          "value": "brain_recall"
        },
        "inputMode": "json",
        "jsonInput": "={{ JSON.stringify({ query: $json.query, limit: 5 }) }}",
        "options": {}
      }
    },
    {
      "id": "d8304081-c230-4314-a6f1-8c530d82a109",
      "name": "Format weekly brief",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1010,
        0
      ],
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e430498d-8be8-48ef-a7f5-95fc66890089",
              "name": "brief",
              "type": "string",
              "value": "=Weekly project brief · {{ $now.toISODate() }}\n\n{{ $json.structuredContent.results.length ? $json.structuredContent.results.map(m => [\n  (m.expired ? '[Historical] ' : '') + (m.quarantine_pending || m.low_trust ? '[Verify source] ' : '') + m.title,\n  m.content || 'Open the source memory for the full text.',\n  'Source: ' + m.id\n].join('\\n')).join('\\n\\n') : 'No matching memories. Check the connected Brain account or refine the project query and run again.' }}"
            }
          ]
        },
        "options": {}
      }
    }
  ],
  "connections": {
    "Run manually": {
      "main": [
        [
          {
            "node": "Choose brief inputs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Choose brief inputs": {
      "main": [
        [
          {
            "node": "Use tutorial example?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Use tutorial example?": {
      "main": [
        [
          {
            "node": "Load example memory",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Recall project context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Load example memory": {
      "main": [
        [
          {
            "node": "Format weekly brief",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Recall project context": {
      "main": [
        [
          {
            "node": "Format weekly brief",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": false,
    "saveDataSuccessExecution": "none",
    "saveDataErrorExecution": "none"
  }
}
