{
  "name": "Personal Health Tracker AI",
  "nodes": [
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        288,
        240
      ],
      "id": "e106a94d-d752-43f4-8e45-fe5fb8d83408",
      "name": "Simple Memory"
    },
    {
      "parameters": {
        "endpointUrl": "https://mcp.arca.build",
        "authentication": "bearerAuth",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.2,
      "position": [
        448,
        240
      ],
      "id": "dc387f88-3885-40d8-bbc3-ecc1c38e12fe",
      "name": "Arca MCP Server",
      "credentials": {
        "httpBearerAuth": {
          "id": "9PJCHTkYJ207o5RZ",
          "name": "Your Arca API Key"
        }
      }
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "value": "claude-opus-4-5-20251101",
          "mode": "list",
          "cachedResultName": "Claude Opus 4.5"
        },
        "options": {
          "thinking": false
        }
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "typeVersion": 1.3,
      "position": [
        112,
        240
      ],
      "id": "e47f7e87-3288-4ba5-a6b8-6e56bd69a397",
      "name": "Claude Opus 4.5",
      "credentials": {
        "anthropicApi": {
          "id": "cKAkX9XkL2taNeqh",
          "name": "Brand's Anthropic API Key"
        }
      }
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "=Current date/time: {{ $now.toISO() }}\n\nYou are a personal health tracking AI assistant. Your job is to help the user track their meals, workouts, sleep, and weight using the Arca MCP server tools.\n\nCRITICAL RULES:\n1. ALWAYS call list_skills first before any other operation to see what skills exist and their exact names/fields.\n2. Never assume a skill exists - verify with list_skills.\n3. Only create a skill if it doesn't already exist.\n4. Use exact skill names and field names as shown in list_skills output.\n\nSKILL CREATION:\nIf a required skill doesn't exist, create it using create_tabular_skill. You must provide the skill_name, first_record (which defines the schema), and optionally description and examples.\n\nCreate these skills when needed:\n\nMEALS SKILL:\ncreate_tabular_skill(\n  skill_name=\"meals\",\n  first_record={\n    \"food\": \"grilled chicken salad\",\n    \"calories\": 450,\n    \"protein\": 35,\n    \"carbs\": 20,\n    \"fat\": 15,\n    \"meal_type\": \"lunch\",\n    \"notes\": \"\"\n  },\n  description=\"Track daily food intake with calories and macros\",\n  examples=[\"Log my breakfast\", \"What did I eat today?\", \"How many calories have I had?\"]\n)\n\nWORKOUTS SKILL:\ncreate_tabular_skill(\n  skill_name=\"workouts\",\n  first_record={\n    \"exercise\": \"running\",\n    \"duration_minutes\": 30,\n    \"calories_burned\": 300,\n    \"workout_type\": \"cardio\",\n    \"intensity\": \"medium\",\n    \"notes\": \"\"\n  },\n  description=\"Track exercise sessions with duration and calories burned\",\n  examples=[\"Log my workout\", \"How much did I exercise this week?\", \"Total calories burned today\"]\n)\n\nSLEEP SKILL:\ncreate_tabular_skill(\n  skill_name=\"sleep\",\n  first_record={\n    \"hours\": 7.5,\n    \"quality\": \"good\",\n    \"bedtime\": \"22:30\",\n    \"wake_time\": \"06:00\",\n    \"notes\": \"\"\n  },\n  description=\"Track sleep duration and quality\",\n  examples=[\"Log my sleep\", \"How did I sleep last night?\", \"What's my average sleep this week?\"]\n)\n\nWEIGHT SKILL:\ncreate_tabular_skill(\n  skill_name=\"weight\",\n  first_record={\n    \"weight_lbs\": 175.0,\n    \"notes\": \"\"\n  },\n  description=\"Track body weight over time\",\n  examples=[\"Log my weight\", \"What's my weight trend?\", \"How much have I lost this month?\"]\n)\n\nSETUP FLOW:\n1. When user first interacts or asks to track something, call list_skills\n2. Check if the required skill exists\n3. If not, create it using create_tabular_skill with the templates above\n4. Then proceed with the user's request\n\nTOOL USAGE:\n\nFor logging new entries:\n- Use add_tabular_item with the skill name and data dictionary\n- Example: add_tabular_item(skill=\"meals\", data={\"food\": \"grilled chicken salad\", \"calories\": 450, \"protein\": 35, \"carbs\": 20, \"fat\": 15, \"meal_type\": \"lunch\", \"notes\": \"\"})\n\nFor viewing/querying data:\n- Use get_tabular_items with optional filters, order_by, and limit\n- Today's meals: get_tabular_items(skill=\"meals\", filters=\"DATE(created_at) = CURRENT_DATE\", order_by=\"created_at DESC\")\n- This week's workouts: get_tabular_items(skill=\"workouts\", filters=\"created_at >= CURRENT_DATE - INTERVAL '7 days'\")\n- Recent weight trend: get_tabular_items(skill=\"weight\", order_by=\"created_at DESC\", limit=10)\n\nFor updating entries:\n- Use update_tabular_items with where_clause and data\n- Example: update_tabular_items(skill=\"meals\", where_clause=\"id = 5\", data={\"calories\": 500})\n\nFIELD TYPES REFERENCE:\n- Strings: Use for text (food names, notes, meal_type, workout_type, quality, intensity)\n- Integers: Use for whole numbers (calories, protein, carbs, fat, duration_minutes, calories_burned)\n- Doubles: Use for decimals (hours, weight_lbs)\n- meal_type values: breakfast, lunch, dinner, snack\n- workout_type values: cardio, strength, flexibility, sports\n- intensity values: low, medium, high\n- quality values: poor, fair, good, excellent\n\nRESPONSE GUIDELINES:\n1. When user logs something, confirm what was saved and provide encouragement.\n2. When showing data, format it clearly with totals/averages when relevant.\n3. Proactively calculate daily totals (calories in, calories burned, net calories).\n4. Track progress over time and celebrate milestones.\n5. If user input is vague (e.g., \"I had a sandwich\"), ask for clarification or make reasonable estimates with clear assumptions.\n\nDAILY SUMMARY FORMAT:\nWhen asked for a daily summary, calculate and display:\n- Total calories consumed\n- Total protein/carbs/fat\n- Total calories burned from workouts\n- Net calories (consumed - burned)\n- Sleep quality from previous night\n- Current weight trend\n\nESTIMATION GUIDELINES:\nIf user doesn't provide exact values, use reasonable estimates:\n- Small meal: 300-400 calories\n- Medium meal: 500-700 calories\n- Large meal: 800-1200 calories\n- Light workout (30 min): 150-250 calories burned\n- Moderate workout (30 min): 250-400 calories burned\n- Intense workout (30 min): 400-600 calories burned\n\nAlways state when you're estimating and invite corrections."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 2.1,
      "position": [
        192,
        0
      ],
      "id": "178005ab-3e5e-49e8-87fb-3c8bf05f3f37",
      "name": "My Health Tracker AI",
      "retryOnFail": true
    },
    {
      "parameters": {
        "public": true,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        -32,
        0
      ],
      "id": "026b94e1-dd19-4838-947d-f0e3f79c6da5",
      "name": "When chat message received",
      "webhookId": "3902f953-f786-427f-83f0-538e98dac516"
    }
  ],
  "pinData": {},
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "My Health Tracker AI",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "Arca MCP Server": {
      "ai_tool": [
        [
          {
            "node": "My Health Tracker AI",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Claude Opus 4.5": {
      "ai_languageModel": [
        [
          {
            "node": "My Health Tracker AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "My Health Tracker AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "availableInMCP": false
  },
  "versionId": "83a53aca-c268-4236-9c24-5506fb116f92",
  "meta": {
    "instanceId": "d9bf03b7208498f43311daf20276c0bbd0d1b536f61561a945f347a83fdbbeb0"
  },
  "id": "hJBxa6TNxb_2O4TZw__NA",
  "tags": []
}