Prompt engineering through a virtual catgirl librarian

February 24, 2025

I once searched for “如何prompt赛博猫娘” (“how to prompt a virtual catgirl”). Here I'll ask her to work a shift at the library, helping a reader find a spare key. First, let's work on the prompt. Alongside asking her to end sentences with a “meow,” we can define her responsibilities and give her an example showing how to respond when nobody has logged the key.1

Once she can answer as intended, we can explore how to keep track of facts across turns. First I tell her the key is in the blue box. A little later I say I've moved it to the front desk drawer. Asking “Where's the key?” will show whether she's updated her record. We'll start by having her write the shift log at the end of every reply. If I want to come back tomorrow and ask in a new chat, where should that record live?23

What exactly goes into a prompt to get the reply you want?

Start with an everyday task. Give the model “Meeting Wednesday at 3 p.m. Bring the test report” and ask it to “organize this.” A summary, an announcement, or a checklist would all be plausible. Add “Extract the meeting time and what to bring, one item per line. Use ‘not mentioned’ for anything missing,” and you can check the response item by item. Flytree's tutorial treats instructions, input material, and example answers separately.1

[!NOTE] If you want to reuse a rule, give it a name. The Prompt Engineering Guide calls this convention a Prompt Function. Following the tutorial's pattern, send the model something like this first.4

看到“整理会议(原文)”时,按下面的规则处理括号里的通知。
function_name: 整理会议
input: 一条会议通知
rule: 分两行列出开会时间和要带的材料。通知里没写的填“未提及”。

This defines a function named 整理会议 (“organize meeting”). Its input is a meeting notice, and its rule is to list the meeting time and materials on separate lines, writing “not mentioned” for anything omitted. In the same chat, send 整理会议(周五上午十点开会) (“organize meeting: Friday at 10 a.m.”). The expected two lines are “Time: Friday at 10 a.m.” and “Materials: not mentioned.” The function name is shorthand you've agreed on with the model within that conversation.

Back to the catgirl librarian: we can test each requirement with a concrete input.

What to controlHow to phrase itHow to check it
The task“You're the catgirl on duty at the library. Help readers find lost property.”If a reader says they've lost an umbrella, does she ask them to describe it?
Tone and format“Answer the question first, end with one ‘meow,’ and keep the reply to one sentence.”Can she be clear in one sentence while keeping the voice?
Missing informationGive a sample exchange: “Has anyone turned in a scarf?” “I don't have a scarf logged yet, meow.”Ask about an unregistered hat instead. Does she invent a location?

If all you say is “act a little aloof,” it's hard to say exactly where the reply went wrong. The CNBlogs example configures the character over several turns. One instruction is 「与我对话每一句话后面都要加上“喵”」 (“add ‘meow’ after every sentence when talking to me”), and only then does the role-play begin. GitHub has similar early discussions. When experimenting, keep the question fixed and change one requirement at a time to see whether the difference is in tone, substance, or length.15

How can the last line of a reply help the catgirl remember?

Another article I opened at the time was 太好啦!这样操作,我的猫娘终于真正有记忆了! (“Great! With this trick, my catgirl finally really remembers!”).2 This invented conversation shows how to keep memory inside replies. Ask the character to write the facts needed on the next turn at the end of every answer. The model can read them back, and the reader can correct them on the spot.

Put this in the first message:

You're the catgirl on duty at the library. Answer the reader in one sentence ending in “meow.” On a new line, write “Shift log” and record only items and locations the reader has explicitly told you about. When a location changes, replace the old one. If there's no new information, copy the previous turn's shift log.

ReaderExpected reply
I put the spare key in the blue box.Got it, the key's in the blue box, meow.Shift log: The spare key is in the blue box.
I just moved it to the front desk drawer.Okay, I've updated it to the front desk drawer, meow.Shift log: The spare key is in the front desk drawer.
Where's the key now?In the front desk drawer, meow.Shift log: The spare key is in the front desk drawer.

The second turn is the most revealing. If the log lists both the blue box and the front desk drawer, the model has preserved both statements but missed that the location changed. If it answers “In the usual place, meow” on the third turn, the voice is right but it still hasn't supplied the fact.

This technique relies on the chat context. As long as the latest shift log is in the messages the model can read, it has a chance to answer correctly even after the first message has left the context window. In a fresh chat, try pasting in the last line and asking again. Copying the record each time can introduce errors, so keep it short enough to check at a glance, paying particular attention to the item that just changed.

Who keeps the log if you want to pick up next time?

If you want the catgirl to know where the key is when she comes on duty tomorrow, the application can save the latest shift log and supply it when the next chat starts. 李孟聊AI noted a detail from ChatGPT's February 2024 memory test: “ChatGPT的记忆与对话不绑定,删除对话记忆仍在。” (“ChatGPT's memories aren't tied to the conversation. They remain after the conversation is deleted.”) In the library example, deleting yesterday's chat leaves the key's location in the log. To clear the location, delete the corresponding entry as well. The author also speculated that something like RAG (retrieval-augmented generation) might retrieve relevant information from existing records before the model answers. That was his hypothesis about the implementation.6

When LangChain built a Dungeons & Dragons game master for OpenGPTs in 2023, it split “what do we need to know on the next turn?” into two records. Baoyu translated the example into Chinese.3

One record is the character profile. At the beginning, the game asks who the player is and what traits they have, then keeps the character fixed once created. The other is adventure progress. Each turn, it checks whether a location or event has changed and replaces the old progress only when there's something new. The application includes both records in the prompt when generating the next turn. Back at the library, “I'm the librarian on duty” can stay, but “the key is now in the front desk drawer” should change when the reader reports a move. Writing the entry in the reply makes it visible and correctable. Saving it in the application gives the next chat something to read.3

References

Footnotes

  1. 会飞的一棵树. (2023, December 10). 提示工程(Prompt Engineering)将ChatGPT调教为傲娇猫娘~喵 [Using prompt engineering to turn ChatGPT into a tsundere catgirl]. CNBlogs. Practical dialogue table, first character rule after entering setup mode. ↩ ↩2 ↩3

  2. 太好啦!这样操作,我的猫娘终于真正有记忆了! [Great! With this trick, my catgirl finally really remembers!]. (n.d.). Zhihu. ↩ ↩2

  3. The LangChain Team. (2023, November 29). Adding Long Term Memory to OpenGPTs. LangChain. Original “Dungeons and Dragons Chatbot” section · Baoyu's Chinese translation, “Dungeons and Dragons Chatbot” section. ↩ ↩2 ↩3

  4. DAIR.AI. (n.d.). Prompt Function. Prompt Engineering Guide. Naming and composing text tasks in the “English study assistant” example. The meeting notice above is a teaching example adapted from this pattern. ↩

  5. PlexPt. (2023, February 8). 【2023】猫娘方法持续讨论更新 [Ongoing discussion of catgirl prompting methods] (issue #12). GitHub. Character and response rules in the opening post. ↩

  6. 李孟聊AI. (2024, February 14, edited). OpenAI ChatGPT 记忆功能怎么实现? [How does OpenAI ChatGPT's memory work?]. Zhihu. The quotation is from the “Managing memory” paragraph under “Usage”. The RAG hypothesis is in the first paragraph of “Implementation.” For deleting chats versus deleting memories, see also OpenAI's February 13, 2024 test announcement. ↩

© 2025 borui. All rights reserved. This content may be freely reproduced, displayed, modified, or distributed with proper attribution to borui and a link to the article: borui (2025-02-24). Prompt engineering through a virtual catgirl librarian. https://caiborui.com/blog/2025-02-24-zh-prompt-engineering-basics-entrans

@misc{borui2025-45344310,
  author = {borui},
  title = {{Prompt engineering through a virtual catgirl librarian}},
  year = {2025},
  publisher = {borui's blog},
  url = {https://caiborui.com/blog/2025-02-24-zh-prompt-engineering-basics-entrans}
}