Day 2 of 760 minCipher Cadet

Day 2: Prompts for Logs, Code and Reports

Taught by Mr Elite Updated

By the end of today you can

  • Write a prompt using role, context, task and format
  • Get an AI to explain a failed login log line clearly
  • Get an AI to explain a short code snippet and flag risks
  • Improve a weak answer with targeted follow-ups

Warm-up

Answer from memory first, then tap to check. Recalling yesterday is what makes it stick.

What three things did we say make a prompt much clearer?

Role, task and format.

Why should you never paste private data into an AI chat?

You lose control of where it goes, and the model only needs the text of the question, not your private details.

Picture a line scrolling past in a file called auth.log. It is full of dates, numbers and short words you half recognise. Somebody tells you it matters. You stare at it and do not know where to start. That is the normal first experience of reading logs, and it is where an AI assistant can help a beginner a lot.

The catch is that a lazy prompt gets a lazy answer. Today I will show you a four-part pattern, role, context, task and format, and we will use it on a log line and a code snippet. Everything today runs on text I give you, so there is nothing to attack and nothing real to leak.

Why logs and code need more than a one-liner

Yesterday you wrote prompts with a role, task and format. That works well for explaining ideas. Logs and code are different because the model is looking at a specific piece of text, and it has to guess what system produced it and what you want to know.

If you paste a line and type only "what is this?", the model fills the gaps with guesses. Sometimes the guess is fine. Sometimes it describes the wrong kind of system, or answers at a level far too advanced for you. Context removes the guessing.

Think of handing a photo to a stranger and asking "what is this?". They need to know whether it is a holiday snap or evidence from a crime scene before the answer is useful. The model is that stranger. It knows a great deal, but it knows nothing about your situation until you say so.

Log
A record a system writes about events, such as someone trying to sign in.
Context
The background the model cannot see: what system, what you already know, what you are trying to decide.
Snippet
A short piece of code pasted on its own, away from the rest of the program.

The four parts: role, context, task, format

Here is the pattern I want you to use for the rest of the course. Each part has one job, and leaving one out gives the model one more thing to guess.

One more habit goes with the pattern. Put your instructions first and the pasted text last, with a blank line between them. That way the model can tell which words are your request and which words are the data to examine.

Quick check

You paste a log line and ask only "what is this?". Which part of the pattern would help most to stop the model guessing the system?

Watch me do it: explain a failed login line

We will use a sample line I made up. The address 203.0.113.45 is from a range reserved for documentation, so it points at nothing real. Use any free AI chat assistant in your browser. You do not need an account on a server, and nothing here touches a real system.

text
What is this?
May 12 10:41:07 web01 sshd[2214]: Failed password for invalid user admin from 203.0.113.45 port 52814 ssh2
The weak prompt. No role, no context, no format.
text
Act as a patient security analyst teaching a beginner.
Context: this is one line from the SSH log (auth.log) of a Linux server I own. I am new to logs.
Task: explain each part of the line, then say whether it looks suspicious and why.
Format: a two-column table (part, meaning), then three sentences of judgement. Say if you are guessing anything.

May 12 10:41:07 web01 sshd[2214]: Failed password for invalid user admin from 203.0.113.45 port 52814 ssh2
The strong prompt. All four parts are present, and the log line sits at the end.

Your exact wording will differ, because these models vary from one reply to the next. What matters is the content. A good answer covers the points in the table below.

text
Part                      Meaning
May 12 10:41:07           Date and time the event was recorded
web01                     Name of the machine that wrote the log
sshd[2214]                The SSH service, process number 2214
Failed password           A sign-in attempt that was rejected
invalid user admin        No account called admin exists on this machine
203.0.113.45 port 52814   Where the attempt came from
ssh2                      The protocol version used
Roughly what a good table looks like. Treat it as a checklist, not text to copy.

The judgement should say one failure alone is normal, since people mistype passwords all the time. Many failures in a row from one address, especially for names like admin, suggest someone guessing. If the answer claims the attacker got in, that is wrong. The line says Failed, and you should challenge it.

Your turn: explain a code snippet

Now you do the same with code. This snippet is Python and only builds a text string. You do not need to run it, and I would like you to understand it before you trust anything about it. If you do want to run it, it is harmless on your own machine, because it only prints text.

python
user = input("Name: ")
query = "SELECT * FROM users WHERE name = '" + user + "'"
print(query)
A tiny snippet that joins user input straight into a database query string.

For reference, a safe version keeps the input out of the query string. The question mark is a placeholder that the database library fills in as plain data, never as part of the command.

python
cursor.execute("SELECT * FROM users WHERE name = ?", (user,))
The idea behind a parameterised query. Your answer should describe something like this, not necessarily this exact line.

Quick check

Why do we put the pasted text at the end of the prompt, after our instructions?

Iterating on a weak answer

Even a good prompt sometimes gets a thin answer. Do not start over. Send a short follow-up that names the gap. Think of it as steering, not restarting. The model still has your earlier text in view, so you do not need to paste it again.

text
That is too general. Explain the risk using this exact code, show what input would break it, and keep it to five lines.
A follow-up that names what was missing and sets a limit.

After you send it, the answer should be shorter and tied to your three lines. It might show how a quote character in the name changes the query text. That is the sign the follow-up worked. If the reply is still vague, name the gap again in different words, for example "quote my own lines back to me".

Other useful follow-ups: "explain it for a ten-year-old", "what would you check next?", and "what could make you wrong here?". Save your best follow-up in day2.txt, because you will reuse it.

Check the answer against the text

A fluent answer is not always a correct one. Before you trust any reply, do a quick two-minute check. It takes little time and builds the habit that separates a careful analyst from someone repeating whatever a tool said.

Most mistakes come from over-reading. The line shows one failed attempt, not an attack campaign, and the model may jump ahead. Your job is to keep the story as large as the evidence and no larger.

If it did not work

Pasting a line with no context

Always say what system the text came from and your own level.

Accepting the first answer as correct

Check the claims against the line itself. If it says something the text does not show, challenge it.

Starting a new chat for every small fix

Use one short follow-up that names the gap.

Putting real private logs into the chat

Use sample lines like today's, or redact first.

Recap

  • Role, context, task and format give the model less to guess
  • Context is what the model cannot see, so you must supply it
  • Put your instructions first and the pasted data last
  • Ask the model to flag where it is guessing
  • Fix weak answers with short, specific follow-ups
  • Always compare the answer to the actual text

Cheat sheet

Role
Who the model should act as
Context
What the text is, where it came from, your level
Task
One clear instruction
Format
Shape and length of the answer
Follow-up
A short message that names what was missing
auth.log
A common Linux file recording sign-in events

Before the next day

Mission: Two prompts, one improvement

Write one prompt that explains a sample failed login line and one that explains a short code snippet. Then record how your second attempt at each improved on the first, so you can see the pattern working.

About 30 min

You are done when: A saved day2.txt with both prompts, their answers, a follow-up, and three lines of comparison

Want more? Invent your own harmless log line, such as a successful login at 3am, and ask the model to judge it, then check whether its reasoning holds.

Quiz

4 questions. Your score is saved with your progress.

1. What does the context part of a prompt do?

2. A model says a single failed login proves an attacker got in. What is the best response?

3. The answer to your snippet prompt is too general. What do you do?

4. Why ask the model to say when it is guessing?

Finish the day

Mark the day complete to save your progress.

Next: Day 3 covers keeping secrets out of prompts and checking AI answers for mistakes. You will redact real-looking details from logs before pasting, which builds directly on today's habit of using safe sample text. Unlocks 17 Nov.

Tell someone you are doing this:WhatsAppXLinkedIn

Your notes

Private to this device. Write what you want to remember from today.