Build a Psychology Reflection Tool with Claude and GuidedTrack
Anthropic’s Claude is one of the most thoughtful and nuanced AI models available today. It excels at following layered instructions carefully, handling sensitive topics with care, and generating responses that feel considered rather than generic, making it a natural fit for reflection-based, research, and psychological programs built in GuidedTrack.
This tutorial walks you through a concrete example: a participant describes something that went well for them recently, and Claude reflects back what that moment reveals about their values and strengths, personalized entirely to what they wrote. But the underlying pattern is the same whether you want the AI to guide someone through an emotion journaling exercise, generate personalized feedback after a psychological assessment, help a participant explore a difficult experience with gentle prompting, analyze open-text responses for themes, or do almost anything else with language. Once you understand how to connect Claude to a GuidedTrack program, you can adapt it to a huge range of applications.
What You’ll Need
- An Anthropic API key (from console.anthropic.com)
- A GuidedTrack account with Custom Services enabled
Step 1. Generate an Anthropic API key
Log in to the Anthropic Console at console.anthropic.com, or sign up if you don’t have one. Once signed in, go to API Keys and click Create Key. Copy the key and store it somewhere safe, it’s only shown once. When I am testing this, it seems that you’ll need to top-up the account to get it running, so please be sure to top-up the account otherwise you won’t be able to interact using its API.
Step 2. Create and configure your GuidedTrack program
If you already have a GuidedTrack account, go here to login. If you don’t have a GuidedTrack account yet, go here to create one for free! Now, go to your programs page in GuidedTrack, and create a new GuidedTrack program and name it whatever you like.
Select Settings on the navigation bar, go to the Services tab and click on “+ Add external service”:

Use these values to fill in these fields:
| Name | Claude API |
| URL | https://generativelanguage.googleapis.com/v1beta |
Add a header with the name X-Api-Key and the value [your API key]. Add another header with the name anthropic-version and the value 2023-06-01.Click Save.

Step 3. Write your GuidedTrack program
Here’s a complete example, a positive psychology reflection tool that asks participants to describe something that went well for them recently, then has Claude reflect back what it reveals about their values and strengths:
>> claude_model = "claude-sonnet-4-6"
*question: Describe something that went well for you recently — big or small.
*type: paragraph
*save: good_moment
>> system_prompt_for_claude = "You are conducting a positive psychology reflection exercise. Your role is to help people recognize their own strengths and values through everyday moments. Do not be generic or give advice. Be thoughtful and specific to what they shared."
>> message_prompt_for_claude = "Someone described something that went well for them: '{good_moment}'. Reflect back to them what this moment reveals about what they value or what they're capable of. Be warm and specific to what they shared. Keep it to 2 short paragraphs."
Please wait, processing your reflection...
*service: Claude API
*path: /messages
*method: POST
*send: { "model" -> claude_model, "max_tokens" -> 1024, "system" -> system_prompt_for_claude, "messages" -> [ { "role" -> "user", "content" -> message_prompt_for_claude } ] }
*success
>> response_from_claude = it["content"][1]["text"]
>> raw_from_claude = it["content"]
>> text_from_claude = raw_from_claude[1]["text"]
*error
>> error_with_ai = 1
>> full_error_message = it
*wait: data
*clear
*if: error_with_ai
The AI had an error.
Full response including error: {full_error_message}
Please report this bug.
*if: not (error_with_ai)
*Your moment:*
{good_moment}
*A reflection:*
{text_from_claude}
How the code works
The program runs in three stages.
Stage 1 – Collect input
The program initializes the claude_model variable with the model to use and prompts the participant to describe something that went well for them recently. The participant’s response is saved in good_moment. The program then creates a system prompt and a message prompt that instruct Claude to reflect on what the participant’s experience reveals about their values or capabilities, while keeping the response warm, specific, and concise. While GuidedTrack processes the request, the participant sees “Please wait, processing your reflection…”
>> claude_model = "claude-sonnet-4-6"
*question: Describe something that went well for you recently — big or small.
*type: paragraph
*save: good_moment
>> system_prompt_for_claude = "You are conducting a positive psychology reflection exercise. Your role is to help people recognize their own strengths and values through everyday moments. Do not be generic or give advice. Be thoughtful and specific to what they shared."
>> message_prompt_for_claude = "Someone described something that went well for them: '{good_moment}'. Reflect back to them what this moment reveals about what they value or what they're capable of. Be warm and specific to what they shared. Keep it to 2 short paragraphs."
Please wait, processing your reflection...
This is what the user will see:


Stage 2 – Call the API
The *service block sends the participant’s input to Claude’s /messages endpoint. The request uses claude_model to specify the model, system_prompt_for_claude as the system instruction, and message_prompt_for_claude as the participant-specific prompt.
On success, the response content is stored in response_from_claude and raw_from_claude, and the generated text is extracted from raw_from_claude[1][“text”] and stored in text_from_claude.
If the API call fails, error_with_ai is set to 1, and the full error response is stored in full_error_message for further handling.
*service: Claude API
*path: /messages
*method: POST
*send: { "model" -> claude_model, "max_tokens" -> 1024, "system" -> system_prompt_for_claude, "messages" -> [ { "role" -> "user", "content" -> message_prompt_for_claude } ] }
*success
>> response_from_claude = it["content"][1]["text"]
>> raw_from_claude = it["content"]
>> text_from_claude = raw_from_claude[1]["text"]
*error
>> error_with_ai = 1
>> full_error_message = it
Stage 3 – Display the result
*wait: data ensures the API response and updated variables are fully synced before the program continues. *clear removes the loading message. If an error occurred during the API call, the participant is shown an error message along with the full error response. Otherwise, the participant sees their original moment followed by Claude’s reflection.
*wait: data
*clear
*if: error_with_ai
The AI had an error.
Full response including error: {full_error_message}
Please report this bug.
*if: not (error_with_ai)
*Your moment:*
{good_moment}
*A reflection:*
{text_from_claude}
This is what the user will see:

Adapting This for Your Use Case
The same pattern works for any scenario where you want Claude to respond to something a participant wrote:
- Emotion journaling: Ask participants to describe how they’re feeling and have Claude help them identify the core emotion underneath, without clinical language or advice.
- Values clarification: Participants describe a decision they made recently, and Claude reflects back what values or priorities seem to be driving them.
- Grief and loss studies: Participants describe a loss they’ve experienced. Claude offers a humanizing, non-clinical reflection, useful for research programs studying coping or resilience.
- System prompt variations: Everything about Claude’s tone, constraints, and output format is controlled through the system field in *send. Adjust it to change how Claude responds without touching anything else in the program.
Also Read
Build an AI-Powered Personal Coaching App with ChatGPT and GuidedTrack
Build an AI-Powered Learning App with Gemini and GuidedTrack
Use GuidedTrack to Build a ChatGPT-Style Web App with the OpenAI API
The basic of using *service to embed other apps and tools










