Meet Code Coach
- Terminology and concepts to look out for: request · server · system prompt
- Relevance to me: Code Coach sits inside the bench now. Today you follow one question from the Ask button to the model and back, so you know what is answering you.
- Board Question: You press Ask in the Ask Code Coach panel on a bench job. Name the parts your question passes through, in order, and say which part the model runs on.
Open the discussion form on the right and answer Section 1 from your first reading.
One Question to Code Coach
This section follows one real Code Coach request, captured on October 19, 2026, from the Ask button to the model and back.
From the Bench Page to the Class Endpoint
Code Coach is the tool inside Bench Basics that explains a short piece of Java. On a job with code, its panel opens only after the student has checked an answer, so the student predicts first and asks second. The student then picks the whole code or one line from a list, and the bench writes the question. The bench page runs in the browser on the student's Chromebook, so the bench page is the client. When the student presses Ask, the page sends a request to the class endpoint at muggsofcompsci.net/api/class/ask. In the request, the field named tool holds the student's course code, the field named system holds Code Coach's system prompt, and the field named input holds the numbered code and the question.
The input from that request is below, numbered as the bench's code panel numbers it.
1 int score = 17;
2 int bonus = score % 5;
3 if (score + bonus > 20)
4 {
5 System.out.println("high");
6 }
7 else
8 {
9 System.out.println("low");
10 }
11 System.out.println(score + bonus);
Question: What does line 3 do?
A pick left empty is the contrast case for a request. If the student presses Ask without picking the whole code or a line, the bench shows the message "Paste or pick a line first" and no request leaves the page.
Two Servers Pass the Request Along
The class endpoint is a server, a program on Cloudflare's network that waits for requests and answers them. First, it checks the request against its limits. The input must not be empty or longer than 2,000 characters, the course code must be valid, and each student gets 12 runs in each class period. Next, the endpoint runs Mistral's moderation check on the system prompt and the input, which looks for content that is not appropriate for school. Then it puts a short school-safety line in front of the system prompt, adds the API key from Wednesday's lesson, and passes the request on to Mistral's API at api.mistral.ai. Mistral's computers are the second server, and the model, mistral-small-2603, runs there. The request to Mistral holds two messages: a system message with the safety line and the system prompt, and a user message with the student's input.
The bench page is the contrast case for a server. The page in the browser holds no model and no API key, so it cannot generate an explanation by itself. Figure 1 shows the whole path, through both servers and back.
The Response Comes Back
The model generates the explanation and returns it in Mistral's response. Mistral's server sends the response to the class endpoint, which runs the moderation check on the answer and passes the text back to the bench page. The bench shows the text under the job, labeled as generated by a model and to be checked against the code. The October 19 request was run twice, and this is the first explanation, word for word.
Line 3 checks if the sum of `score` (17) and `bonus` (calculated in line 2) is greater than 20. It calculates `17 + bonus` and compares it to 20. If true, it runs lines 5–6; if false, it runs lines 9–10.
The explanation describes line 3 correctly, but it never gives the value of bonus. Line 2 stores 2 in bonus, because 17 divided by 5 leaves a remainder of 2, so the sum is 19 and the program prints low. If the class endpoint does not answer, the bench shows a note that begins "Code Coach did not answer," and every job on the bench still works without it.
What the System Prompt Does
A system prompt is the builder's instructions, sent to the model with every request. Code Coach's system prompt has six lines, and the bench page puts the same six lines in the system field of every request it sends. The October 23 lesson said that in MuggsAI, the server adds the system prompt. In the tools that use the class endpoint, the page sends the system prompt, and the endpoint passes it on with a safety line in front. Either way, the student never sees those lines, but the model receives them each time, so they shape every answer. For example, line 4 serves R3, the requirement that Code Coach does not write new code for the student.
Do not write new code for the student, and do not rewrite the student's code.
The student's question is the contrast case for the system prompt. The question changes from one request to the next, because a student picks a different line or job. The system prompt stays the same in every request. The builder controls the bench page and the system prompt, but the builder does not control the exact words the model generates. The second explanation of the same request described line 3 in different words.
Summary
A Code Coach question starts as a request from the bench page, which is the client. The class endpoint, a server, checks the request, adds the API key and passes it to Mistral's server, where the model runs, and the response comes back the same way. The system prompt travels in every request, so it shapes every answer even though the student never sees it.
Sources: MDN Web Docs, Overview of HTTP (2026); MDN Web Docs, Client-server overview (2026); Mistral AI, Chat completions (n.d.); CS I passages, Clients, Servers and Requests and The Parts of an AI Tool (2026); Code Coach bench code, class endpoint code and system prompt, course repository (2026); Code Coach captured request, exam-line3-numbered (2026).
-
notebook cue: request
Name the things that a Code Coach request carries to the class endpoint.
Check
The request carries three fields: tool, which holds the student's course code; system, which holds Code Coach's system prompt; and input, which holds the numbered code and the question, such as "What does line 3 do?" It carries no API key. See From the Bench Page to the Class Endpoint, paragraph 1.
-
notebook cue: server
A Code Coach request passes through two servers. Name them in order, and say which one adds the API key.
Check
First the class endpoint at muggsofcompsci.net, then Mistral's server at api.mistral.ai, where the model runs. The class endpoint adds the API key before it passes the request on. See Two Servers Pass the Request Along, paragraph 1, and Figure 1.
-
notebook cue: system prompt
Two students ask Code Coach about different lines. What is the same in both requests, and what is different?
Check
The system prompt is the same, because the bench puts the same six lines in every request. The input is different, because each student's question names a different line (and may come from different code). See What the System Prompt Does, paragraphs 1 and 2.
-
notebook cue: request
Name the things that a Code Coach request carries to the class endpoint.
Check
The request carries three fields: tool, which holds the student's course code; system, which holds Code Coach's system prompt; and input, which holds the numbered code and the question, such as "What does line 3 do?" It carries no API key. See From the Bench Page to the Class Endpoint, paragraph 1.
-
notebook cue: server
A Code Coach request passes through two servers. Name them in order, and say which one adds the API key.
Check
First the class endpoint at muggsofcompsci.net, then Mistral's server at api.mistral.ai, where the model runs. The class endpoint adds the API key before it passes the request on. See Two Servers Pass the Request Along, paragraph 1, and Figure 1.
-
notebook cue: system prompt
Two students ask Code Coach about different lines. What is the same in both requests, and what is different?
Check
The system prompt is the same, because the bench puts the same six lines in every request. The input is different, because each student's question names a different line (and may come from different code). See What the System Prompt Does, paragraphs 1 and 2.
One Question to Code Coach
This section follows one real Code Coach request, captured on October 19, 2026, from the Ask button to the model and back.
From the Bench Page to the Class Endpoint
Code Coach is the tool inside Bench Basics that explains a short piece of Java. On a job with code, its panel opens only after the student has checked an answer, so the student predicts first and asks second. The student then picks the whole code or one line from a list, and the bench writes the question. The bench page runs in the browser on the student's Chromebook, so the bench page is the client. When the student presses Ask, the page sends a request to the class endpoint at muggsofcompsci.net/api/class/ask. In the request, the field named tool holds the student's course code, the field named system holds Code Coach's system prompt, and the field named input holds the numbered code and the question.
The input from that request is below, numbered as the bench's code panel numbers it.
1 int score = 17;
2 int bonus = score % 5;
3 if (score + bonus > 20)
4 {
5 System.out.println("high");
6 }
7 else
8 {
9 System.out.println("low");
10 }
11 System.out.println(score + bonus);
Question: What does line 3 do?
A pick left empty is the contrast case for a request. If the student presses Ask without picking the whole code or a line, the bench shows the message "Paste or pick a line first" and no request leaves the page.
Two Servers Pass the Request Along
The class endpoint is a server, a program on Cloudflare's network that waits for requests and answers them. First, it checks the request against its limits. The input must not be empty or longer than 2,000 characters, the course code must be valid, and each student gets 12 runs in each class period. Next, the endpoint runs Mistral's moderation check on the system prompt and the input, which looks for content that is not appropriate for school. Then it puts a short school-safety line in front of the system prompt, adds the API key from Wednesday's lesson, and passes the request on to Mistral's API at api.mistral.ai. Mistral's computers are the second server, and the model, mistral-small-2603, runs there. The request to Mistral holds two messages: a system message with the safety line and the system prompt, and a user message with the student's input.
The bench page is the contrast case for a server. The page in the browser holds no model and no API key, so it cannot generate an explanation by itself. Figure 1 shows the whole path, through both servers and back.
The Response Comes Back
The model generates the explanation and returns it in Mistral's response. Mistral's server sends the response to the class endpoint, which runs the moderation check on the answer and passes the text back to the bench page. The bench shows the text under the job, labeled as generated by a model and to be checked against the code. The October 19 request was run twice, and this is the first explanation, word for word.
Line 3 checks if the sum of `score` (17) and `bonus` (calculated in line 2) is greater than 20. It calculates `17 + bonus` and compares it to 20. If true, it runs lines 5–6; if false, it runs lines 9–10.
The explanation describes line 3 correctly, but it never gives the value of bonus. Line 2 stores 2 in bonus, because 17 divided by 5 leaves a remainder of 2, so the sum is 19 and the program prints low. If the class endpoint does not answer, the bench shows a note that begins "Code Coach did not answer," and every job on the bench still works without it.
What the System Prompt Does
A system prompt is the builder's instructions, sent to the model with every request. Code Coach's system prompt has six lines, and the bench page puts the same six lines in the system field of every request it sends. The October 23 lesson said that in MuggsAI, the server adds the system prompt. In the tools that use the class endpoint, the page sends the system prompt, and the endpoint passes it on with a safety line in front. Either way, the student never sees those lines, but the model receives them each time, so they shape every answer. For example, line 4 serves R3, the requirement that Code Coach does not write new code for the student.
Do not write new code for the student, and do not rewrite the student's code.
The student's question is the contrast case for the system prompt. The question changes from one request to the next, because a student picks a different line or job. The system prompt stays the same in every request. The builder controls the bench page and the system prompt, but the builder does not control the exact words the model generates. The second explanation of the same request described line 3 in different words.
Summary
A Code Coach question starts as a request from the bench page, which is the client. The class endpoint, a server, checks the request, adds the API key and passes it to Mistral's server, where the model runs, and the response comes back the same way. The system prompt travels in every request, so it shapes every answer even though the student never sees it.
Sources: MDN Web Docs, Overview of HTTP (2026); MDN Web Docs, Client-server overview (2026); Mistral AI, Chat completions (n.d.); CS I passages, Clients, Servers and Requests and The Parts of an AI Tool (2026); Code Coach bench code, class endpoint code and system prompt, course repository (2026); Code Coach captured request, exam-line3-numbered (2026).
Each table agrees on the parts in order, from the button to the answer on the screen, and counts them.
Chromebooks stay closed while your table talks. Sections 1 and 2 of the discussion form are already done. After you talk, finish Section 3 right here under My View. Submit before the exit ticket.
This form has three sections. Section 1: answer today's Board Question. Section 2: after the reading. Section 3 opens later in class. Today's Board Question: You press Ask in the Ask Code Coach panel on a bench job. Name the parts your question passes through, in order, and say which part the model runs on.
CR 1. Board Question: You press Ask in the Ask Code Coach panel on a bench job. Name the parts your question passes through, in order, and say which part the model runs on. Give your answer and one reason.
Write your answer in your lab notebook, labeled CR 1.
MC 1. Think about your answer to the board question. You press Ask in the Ask Code Coach panel on a bench job. Name the parts your question passes through, in order, and say which part the model runs on. Which position is closest to yours now?
- The bench page sends the question straight to the company that runs the model.
- The bench page sends a request to the class endpoint, which passes it to the model's server, and the response comes back the same way.
- Code Coach looks the answer up in a list of saved explanations.
MC 2. (Reading claim 1) Code Coach can answer without the bench page sending a request.
- Agree
- Disagree
MC 3. (Reading claim 2) The system prompt travels in the request with the student's question.
- Agree
- Disagree
MC 4. (Reading claim 3) The class endpoint is a server.
- Agree
- Disagree
MC 5. (Reading claim 4) The bench page puts the API key in the request before the request leaves the Chromebook.
- Agree
- Disagree
MC 6. (Reading claim 5) In the October 19 request, the question was "What does line 3 do?"
- Agree
- Disagree
MC 7. (Reading claim 6) When no line is picked, the bench sends a request with an empty input.
- Agree
- Disagree
MC 8. (Reading claim 7) The class endpoint checks the request against its limits before it passes the request on.
- Agree
- Disagree
MC 9. (Reading claim 8) The model runs on Mistral's server, not on the Chromebook.
- Agree
- Disagree
CR 2. (A different view) Write the view at your table that was most different from yours. If everyone agreed, write the strongest argument against your table's answer.
Write your answer in your lab notebook, labeled CR 2.
CR 3. Think about the Board Question again: You press Ask in the Ask Code Coach panel on a bench job. Name the parts your question passes through, in order, and say which part the model runs on. Do you have the same opinion as when you first answered the board question? If it is the same, what from the reading or table talk reaffirmed your opinion? If it is different, what from the reading or table talk changed your opinion?
Write your answer in your lab notebook, labeled CR 3.