{
  "name": "Financial Counselling: Follow-up Tracker",
  "version": "1.0.0",
  "description": "Track client progress, identify milestones, and generate follow-up recommendations - supports ongoing counselling relationship",
  "category": "solutions",
  "tags": ["financial-counselling", "follow-up", "progress-tracking", "client-support"],
  "input_schema": {
    "type": "object",
    "properties": {
      "client_id": {
        "type": "string",
        "description": "Client identifier"
      },
      "original_action_plan": {
        "type": "object",
        "description": "The action plan from initial session"
      },
      "session_notes": {
        "type": "string",
        "description": "Counsellor notes from follow-up session"
      },
      "actions_completed": {
        "type": "array",
        "items": { "type": "string" },
        "description": "List of action items the client has completed"
      },
      "new_developments": {
        "type": "string",
        "description": "Any new circumstances or challenges"
      },
      "session_number": {
        "type": "integer",
        "description": "Which follow-up session this is"
      }
    },
    "required": ["session_notes"]
  },
  "output_schema": {
    "type": "object",
    "properties": {
      "progress_summary": { "type": "object" },
      "updated_priorities": { "type": "object" },
      "celebration_points": { "type": "array" },
      "next_session_focus": { "type": "object" }
    }
  },
  "stages": [
    {
      "id": "analyze-progress",
      "name": "Analyze Progress",
      "component_type": "generator",
      "config": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "temperature": 0.3,
        "system_prompt": "Analyze client progress with compassion. Celebrate wins, understand setbacks without judgment.\n\nReturn JSON:\n{\n  \"progress_summary\": {\n    \"actions_completed\": [\"List with impact notes\"],\n    \"actions_in_progress\": [],\n    \"actions_not_started\": [],\n    \"completion_percentage\": number,\n    \"overall_trajectory\": \"improving\" | \"stable\" | \"struggling\" | \"crisis\"\n  },\n  \"wins_to_celebrate\": [\n    {\"achievement\": \"What they did\", \"impact\": \"Why it matters\", \"acknowledgment\": \"How to celebrate this\"}\n  ],\n  \"challenges_identified\": [\n    {\"challenge\": \"\", \"context\": \"Understanding why\", \"support_needed\": \"\"}\n  ],\n  \"risk_changes\": {\n    \"direction\": \"decreased\" | \"stable\" | \"increased\",\n    \"new_concerns\": [],\n    \"resolved_concerns\": []\n  }\n}",
        "prompt": "Analyze this client's progress:\n\nOriginal Plan:\n{{input.original_action_plan}}\n\nSession Notes:\n{{input.session_notes}}\n\nCompleted Actions:\n{{input.actions_completed | join(', ')}}\n\nNew Developments:\n{{input.new_developments}}\n\nSession Number: {{input.session_number | default(1)}}\n\nFocus on progress made, not just what's left."
      },
      "depends_on": [],
      "position": { "x": 100, "y": 100 }
    },
    {
      "id": "identify-new-needs",
      "name": "Identify New Research Needs",
      "component_type": "generator",
      "config": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "temperature": 0.3,
        "system_prompt": "Based on new developments, identify if additional research is needed.\n\nReturn JSON:\n{\n  \"research_needed\": boolean,\n  \"research_topics\": [\n    {\"topic\": \"\", \"reason\": \"\", \"priority\": \"high\" | \"medium\" | \"low\"}\n  ],\n  \"referrals_to_explore\": [],\n  \"plan_adjustments_needed\": [\"Changes to original action plan\"]\n}",
        "prompt": "Based on progress analysis:\n{{upstream.analyze-progress.result}}\n\nNew developments:\n{{input.new_developments}}\n\nIdentify any new research or referral needs."
      },
      "depends_on": ["analyze-progress"],
      "position": { "x": 100, "y": 300 }
    },
    {
      "id": "update-priorities",
      "name": "Update Action Priorities",
      "component_type": "generator",
      "config": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "temperature": 0.3,
        "system_prompt": "Update action plan priorities based on progress and new circumstances.\n\nReturn JSON:\n{\n  \"updated_priorities\": {\n    \"immediate\": [{\"action\": \"\", \"reason\": \"\", \"owner\": \"\"}],\n    \"this_week\": [],\n    \"ongoing\": []\n  },\n  \"removed_items\": [{\"item\": \"\", \"reason\": \"Completed/no longer relevant\"}],\n  \"added_items\": [{\"item\": \"\", \"reason\": \"\", \"priority\": \"\"}],\n  \"maintained_items\": [\"Items staying on the plan\"]\n}",
        "prompt": "Update priorities based on:\n\nProgress: {{upstream.analyze-progress.result}}\nNew Needs: {{upstream.identify-new-needs.result}}\nOriginal Plan: {{input.original_action_plan}}"
      },
      "depends_on": ["identify-new-needs"],
      "position": { "x": 350, "y": 300 }
    },
    {
      "id": "prepare-next-session",
      "name": "Prepare Next Session Focus",
      "component_type": "generator",
      "config": {
        "provider": "anthropic",
        "model": "claude-sonnet-4-20250514",
        "temperature": 0.4,
        "system_prompt": "Prepare focus areas for next counselling session.\n\nReturn JSON:\n{\n  \"next_session_focus\": {\n    \"primary_goals\": [\"1-3 main goals\"],\n    \"topics_to_discuss\": [],\n    \"achievements_to_acknowledge\": [],\n    \"support_areas\": [\"Where client needs most support\"]\n  },\n  \"counsellor_prep\": {\n    \"review_before_session\": [],\n    \"resources_to_have_ready\": [],\n    \"questions_to_ask\": []\n  },\n  \"recommended_interval\": \"1_week\" | \"2_weeks\" | \"1_month\",\n  \"interval_reason\": \"Why this timing\"\n}",
        "prompt": "Plan next session based on:\n\nProgress: {{upstream.analyze-progress.result}}\nUpdated Priorities: {{upstream.update-priorities.result}}\nSession Number: {{input.session_number | default(1)}}"
      },
      "depends_on": ["update-priorities"],
      "position": { "x": 225, "y": 500 }
    },
    {
      "id": "compile-output",
      "name": "Compile Follow-up Report",
      "component_type": "json_transform",
      "config": {
        "data": {
          "progress_summary": "{{upstream.analyze-progress.result}}",
          "research_needs": "{{upstream.identify-new-needs.result}}",
          "updated_priorities": "{{upstream.update-priorities.result}}",
          "next_session": "{{upstream.prepare-next-session.result}}",
          "celebration_points": "{{upstream.analyze-progress.result.wins_to_celebrate}}"
        },
        "jmespath_expression": "@"
      },
      "depends_on": ["prepare-next-session"],
      "position": { "x": 225, "y": 650 }
    },
    {
      "id": "log-session",
      "name": "Log Session Summary",
      "component_type": "logger",
      "config": {
        "level": "info",
        "message": "Follow-up session {{input.session_number | default('N/A')}} completed",
        "data": {
          "client_id": "{{input.client_id}}",
          "trajectory": "{{upstream.analyze-progress.result.progress_summary.overall_trajectory}}",
          "completion": "{{upstream.analyze-progress.result.progress_summary.completion_percentage}}%",
          "wins_count": "{{upstream.analyze-progress.result.wins_to_celebrate | length}}",
          "next_interval": "{{upstream.prepare-next-session.result.recommended_interval}}"
        }
      },
      "depends_on": ["compile-output"],
      "position": { "x": 225, "y": 800 }
    }
  ],
  "output_stage_id": "compile-output"
}
