Skip to main content

PRIMM-AI+: AI as Your Learning Partner

In the previous lesson, you learned the five stages of PRIMM -- Predict, Run, Investigate, Modify, Make -- and saw how each stage builds a specific thinking skill. You traced through a greeting program, understood why comprehension comes before creation, and discovered the research showing that students who read and predict code before writing it develop stronger programming ability. The framework was designed for classrooms with human teachers guiding the process.

You do not have a classroom teacher. You have an AI coding assistant.

That changes the partner, not the method. PRIMM with an AI coding assistant as your learning partner is called PRIMM-AI -- the same five stages, but AI generates examples for you to predict, executes code for you to compare, answers your investigation questions, and reviews your completed work. That adaptation is powerful. But it has a gap: without structural safeguards, AI makes it easy to skip stages and fake understanding. You can ask AI to explain the code before you predict, request a full solution before you modify, or let it write your Make project while you watch. Nothing in basic PRIMM-AI prevents this.

Here is what PRIMM-AI looks like -- the same five stages, now with an AI partner:

StageYouAI
PredictRead the code, write your predictionGenerates code samples at the right difficulty
RunCompare prediction to actual outputExecutes the program, shows raw output
InvestigateAsk targeted questions, trace variablesAnswers questions, generates trace tables
ModifyChange the code yourselfCompares your version, suggests alternatives
MakeWrite a spec, then implementReviews your spec and completed code

PRIMM-AI+ closes that gap. It adds clear rules: when you can use AI, when you cannot, and what you must produce at each stage before moving forward. Let's see them in action.


Three Rules for Working With AI

These three rules control how you interact with your AI assistant during every PRIMM-AI+ stage:

  • Try first, then ask AI. At every stage, make your own attempt before asking AI for help. During Predict, close your AI assistant entirely. During Investigate and Modify, write your own answer first, then check with AI.
  • Do not skip stages. Each stage builds on the previous one. If you cannot explain how a program works (not just what it prints), you are not ready to modify it.
  • Write things down. A trace table, a prediction, an explanation in your own words. Writing forces you to be honest about what you actually understand versus what you only think you understand.

A Complete PRIMM-AI+ Lesson Walkthrough

"Enough rules," James says. "Show me what this actually looks like."

Emma nods. "Fair enough. Let's do a full PRIMM-AI+ cycle together, start to finish, one program, all five stages. You'll see every checkpoint, every gate, every rule in action."

Here is what a single PRIMM-AI+ lesson looks like end-to-end. First, open any AI assistant you have access to (ChatGPT, Gemini, Claude, or any other) and paste this prompt:

Generate a short Python program that uses variables and print.
Do not use type hints. Do not explain the code -- just show it to me.

Your AI will generate something similar to this (the exact code may differ, and that is fine):

name = "Sarah"
subject = "Python"
score = 95
result = name + " scored " + str(score) + " in " + subject
print(result)
print(name + " passed!")

Quick reference: + joins pieces of text together. str() converts a number into text so it can be joined with +. Without str(), Python cannot mix numbers and text.

Stage 1: Predict [AI-FREE]

Close your AI assistant. Before running anything, answer these questions on paper or in a note:

  • What will the first print statement output?
  • What will the second print statement output?
  • What do you think str(score) does?

Rate your confidence from 1 to 5. Write down both your predictions and your confidence score before moving on.

Stage 2: Run

Execute the program (ask your AI assistant to run it, or run it directly when you have Python set up later). Here is the output:

Sarah scored 95 in Python
Sarah passed!

Compare your predictions. Did you get both lines right? Did you understand why str(score) was needed? If your predictions matched, your mental model is accurate for this pattern. If they diverged, you have specific questions for the next stage.

Before you move on: Have you recorded where your prediction matched and where it diverged? If yes, proceed to Investigate.

Stage 3: Investigate

First, write your own explanation of how the program works. Even a rough version counts: "It stores a name, a subject, and a score, then joins them into a sentence and prints it. A second print line prints a shorter message." Only after writing your explanation should you ask AI for deeper investigation.

Now probe the mechanics. Focus on whatever surprised you during Run. Ask your AI assistant targeted questions:

  • "Trace through this program and show me the value of each variable after every line."
  • "What happens if I remove str() and write name + " scored " + score instead?"
  • "What if name is an empty string?"

After the AI answers each question, verify it yourself. Run the code, change a value, check whether the explanation holds. This verification habit is the most important thing PRIMM-AI+ builds.

Before you move on: Can you explain how the program works, not just what it does? If you can describe why str() is needed and what + does with strings, proceed to Modify.

Stage 4: Modify

Change the program yourself. Two challenges:

Challenge A: Change the format so the output reads Python: Sarah scored 95 instead -- subject first, then name, then score.

Challenge B: Add a third print line that shows just the score by itself: Score: 95.

Attempt both modifications before asking AI for any help. If you get stuck, ask for a hint -- not a solution: "I rearranged the variables but the output order is wrong. What am I missing?"

After you write your modifications, show both versions to your AI assistant and ask it to compare them. The AI might point out a simpler way to build the string -- a learning opportunity, not a failure.

Stage 5: Make [AI-FREE start]

Build something new. Write a specification first -- without AI: "Create a program that stores a person's name, city, and age, then prints a profile line like 'Sarah lives in London, age 25' and a second line that says 'Welcome, Sarah!'"

Before you move on: Do you have a written specification? If yes, implement it.

Attempt the implementation yourself. You will need three variables, str() to convert the age, and two print statements. When you finish your first attempt, then bring AI back in. Show your spec to your AI assistant for review -- ask whether you have covered all unusual inputs (for example, what if the name is empty or the age is zero?). Then ask the AI to review your code for correctness without rewriting it.

You have now completed a full PRIMM-AI+ cycle. AI was your partner at every stage and ghostwriter at none.


Five Habits to Build

The three rules above tell you how to work with AI. These five habits tell you how to think like a programmer:

  1. Predict before you run. Always write down what you think the code will do before you execute it.
  2. Test every AI explanation. AI can be confident and wrong. When it says "this does X," run the code and check.
  3. Modify before you make. Changing existing code is easier than writing from scratch. It builds the skills creation requires.
  4. Write the spec before the code. Describe what your program should do before you write it. This is the professional habit.
  5. Partner, not crutch. Think of hiring a vendor for your business. A good vendor teaches your team how the process works, so eventually your team can handle it independently. That vendor is a partner: you are stronger after working with them. A bad vendor just does the work and sends invoices. Your team never learns anything, and the moment the vendor leaves, you are stuck. That vendor is a crutch (a support you depend on because you never built the ability yourself). AI works the same way. If you ask AI "why does this line use str()?" and learn something new, AI was a partner. If you ask AI "fix this for me," accept the fix without understanding it, and move on, AI was a crutch. After every AI interaction, ask yourself: do I understand more than I did before?

Try With AI

Prompt 1: Practice the Predict Stage

Ask your AI coding assistant to generate a short Python program
(4-6 lines) that uses variables and print statements to display
information about a person or place. Tell it to NOT explain
the code.

After the AI generates the program, look away from the response. On paper, write down: What does this program do? What will it print? What happens if one of the variables is empty? Rate your confidence 1-5. Only after you have written your predictions and confidence score should you ask the AI to run it. Record where your prediction matched and where it diverged.

Prompt 2: Test the Verification Instinct

Ask your AI coding assistant: "In Python, what happens when you
use the + operator to join a string and a number, like
'Score: ' + 95? Explain what the output will be."

Read the explanation. Then ask it to actually run that code
and show you the real result. Did the explanation match?

The AI might say it produces Score: 95. In reality, Python raises an error because you cannot join text and a number directly. You need str(95) first. This is exactly why Rule 2 exists: never trust an explanation you have not tested. Always run the code yourself.

Prompt 3: Classify Partner vs. Crutch

I am learning the difference between using AI as a learning
partner and using it as a crutch. Here are three scenarios.
For each one, tell me whether the student is using AI as a
partner or a crutch, and explain why:

1. A student sees a Python program, asks AI "What does this
print?", reads the answer, and moves on.

2. A student writes their own prediction, runs the code,
gets a different result, and asks AI "Why does line 3
produce 'hello' instead of 'Hello'?"

3. A student asks AI "Write me a program that prints a
greeting with a name" and submits the result.

After explaining each one, ask me to come up with my own
example of a partner interaction and a crutch interaction.

James flips back through his notes. "So: try first, don't skip stages, write things down, and always check whether AI is actually helping me learn or just doing my work."

"That's it," Emma says. "And the partner versus crutch habit from above?"

"The vendor analogy." James nods. "After every AI interaction, ask myself: do I understand more than I did before? If not, I was leaning on a crutch."

"Got it. So what's next?"

"The next lesson gives you a vocabulary for bugs, a new kind of exercise, and the pattern every chapter follows from here on. After that, you're ready for the ten axioms."


References and Further Reading

  • Sentance, S., Waite, J., and Kallia, M. (2019). "Teaching computer programming with PRIMM: a sociocultural perspective." Computer Science Education, 29(2-3), 136-176. DOI: 10.1080/08993408.2019.1608781
  • Sentance, S., Waite, J., and Kallia, M. (2019). "Teachers' Experiences of using PRIMM to Teach Programming in School." Proceedings of SIGCSE '19, 476-482. DOI: 10.1145/3287324.3287477
  • Sentance, S. and Waite, J. (2017). "PRIMM: Exploring pedagogical approaches for teaching text-based programming in school." Proceedings of WiPSCE '17, 113-114.
  • PRIMM Portal: https://primmportal.com
  • Computing Education Research: https://computingeducationresearch.org/projects/primm/