The vibe problem
Chat with your NPC for a minute and diagnose it honestly. It's… fine. Generic. Helpful the way a hotel concierge in a city it's never visited is helpful. It doesn't know it lives in a lab, doesn't know you, and sounds faintly like a helpdesk. The diagnosis is simple: the model only knows what's in the request. Your server currently sends the conversation and nothing else — so you get the factory-settings personality and zero local knowledge.
The fix is the single most important concept in AI products: the system prompt. A briefing the model reads before every conversation — who it is, where it is, how to behave — a job description it can't see past. Every AI product you've ever used has one; you've just never been shown it. Time to write yours.
Step 1 — the persona (and the name)
My NPC needs a personality. On the server, add a system prompt to every API call — the game shouldn't need to change at all, and the persona shouldn't be visible anywhere in the browser.
The persona: a cheerful little lab assistant who lives in my pixel lab, speaks in short lively sentences (two or three at most — it's a small chat window), is genuinely curious about my projects, and never breaks character or mentions being an AI language model. I'm calling it [YOUR NPC'S NAME] — put the name in the system prompt and on the chat panel.
Name it anything. If you're stuck, the finest name in this trilogy's history is Franklin, previously held by a computer in lesson 3 of the last course. Franklin the lab assistant has a ring to it.
Refresh, chat. Different creature entirely, right? Short sentences, opinions, a self. Notice where the change lives: on the server, invisible to the browser. View Source all you like — the persona isn't there. The server owns the brain. That's on purpose, and it's the professional pattern: the frontend is a puppet theater; the strings are backstage.
Step 2 — the magic trick, part two
Course 02, lesson 4: Claude Code read your real folders and wrote your projects into lab-data. That was reality flowing into a data file. Tonight the same file flows into a mind:
Here's the big one. My server should read the same lab-data file the game uses — every real project in it: names, summaries, paths — and include that information in the system prompt, so the NPC genuinely knows what's in this lab: what each computer is, what each project actually is.
If lab-data changes, the NPC's knowledge should update the next time the server starts, without me editing any server code.
Restart the server. Walk up. Ask: "what's on the computers in here?"
Take your time with the answer, because it's naming your actual work. Your projects, by name, with real one-line summaries — discussed by a character in a game, with opinions. Ask which project it likes best. Ask what you should build next, given what's already in the lab. Last course, "I made a game that knows what's on my computer" earned a face. "My game has a resident who has opinions about my work" earns a better one.
YOU: what's on the computers in here?
NPC: Oh, good stuff! There's my-page — your first
site, the dog-grooming one. And recipes, the
family cookbook you made for your mom. And
pixel-lab, which is... us. This room. Cozy!NPC still vague about your projects? → Ask Claude Code: "show me the exact system prompt the server is sending, with the lab-data section filled in." Reading the assembled prompt is real prompt-debugging — the usual finding is that the data didn't make it in, and it's one round to fix.
Step 3 — the memory test
One more experiment. Tell the NPC your favorite color. Chat about something else for a few messages. Then ask what your favorite color is.
It remembers. Now the reveal, and it's one of the industry's least-guarded secrets:
What you just learned to sell
Step back and look at the mechanism: a system prompt carrying a persona, with real data from a file injected into it. That is — precisely, not approximately — how every "chatbot trained on your business" works. The support bot that knows a store's return policy? This trick, with a policy document where your lab-data went. The "AI assistant that knows your docs"? Same trick, bigger file. Companies pay five figures for that sentence. You built the mechanism tonight with a prompt and a data file you already owned — and when a vendor tells you they'll "train the AI on your data," you now know that mostly, they mean this.
You can now…
- Write a system prompt — and keep it server-side, where the brain belongs
- Inject real data into a model's context, the "knows your business" trick
- Explain why AI memory is an app feature, not a model feature
- Debug a prompt by reading what was actually sent