Liatrio
AI 101How AI Works
{{ dtitle }}·{{ dnum }} / {{ dcount }}
{{ p.t }}
The conversation is a list of messages
system prompt · this example
“You are ChefBot. Only discuss cooking; politely decline everything else.”
you
“What's a good pasta recipe?”
assistant
“Try cacio e pepe; three ingredients…”
you
“Make it vegetarian?”
↻ in this example, every send includes this context window
what gets sent on this turn
{{ b.label }}
{{ sentPhrase }}
Never just your latest message: in this stateless example, the current context window is sent from the top. Other products can store or cache conversation state.
Text becomes tokens becomes numbers
1 · your text
The spaghetti was unbelievably good.
2 · chopped into tokens
{{ tk.t }}
tokens are model-specific chunks: words, word parts, punctuation, or bytes
3 · each token is just a number (ids below are illustrative)
{{ tk.n }}
~4 characters
per token, on average
~750 words
≈ 1,000 tokens of English
$ / token
pricing and limits are counted in tokens
not all text is equal English prose is often about 4 characters per token. Code, JSON, and logs can use more, so count with the target model when precision matters.
The context window: working memory with a hard limit
oldest messages: pushed out of the boxstill saved in your app · just no longer sent
↑ overflow falls out here
…the chat keeps growing…
conversation history
system prompt
{{ tokCount }} tokens in the boxa common limit today: ~200,000 tokens
only what's inside the box is sent to the model; nothing else exists for it
the key idea
{{ d3note }}
This is a major cause of hallucinations and mistakes from the AI.
One stateless request: context sent to a sealed-off model
Your device
holds the conversation
system prompt + every message so far
this context window →
sent for this request
← the reply streams back,
token by token
copy of the whole window
{{ t.text }}
a datacenter, somewhere else
{{ preLabel }}
public web text + licensed data
up to a cut-off date
→
months of training
on huge GPU clusters
↓ baked in once, then sealed
The model
fixed weights for this request; a sealed box that reads the context and writes the next reply
{{ crunchLabel }}
✓ can see
only the messages you just sent
✕ cannot see
the live internet, your files, today's news
In this stateless example: no memory between turns, internet access, or fresh data without a tool.
Tool calls: when the model needs the outside world
on your computer
in the datacenter · the model
you
“What's today's date?”
sent across →
model · has no clock and no calendar, so it asks
← “please run get_current_time() and send me the result”
your computer runs the tool · the model just waits
reads your system clock → {{ nowIso }}
appended to the list as a message · whole conversation resent →
model · now with real data
← “Today is {{ nowLong }}.”
the date is the clearest case; nothing in training could contain today. Same shape for your files, live prices, your calendar.
Sub-agents: splitting a job too big for one context window
lead agent · the one you're talking to
“Research this 300-page report”
{{ l.text }}
{{ b.text }}
{{ u.text }}
{{ wireLabel }}
sub-task {{ sub.n }}
{{ sub.job }}
{{ sub.doing }}
{{ sub.used }}
↑ each sub-agent read tens of thousands of tokens; only these few lines climb back into the lead's window
…which is why the lead can still answer without ever holding the 300 pages
the key idea
This example gives helpers fresh windows and the lead only summaries. Other systems may pass filtered or inherited context.
Worth it when the pieces are genuinely independent. For small, tightly connected work one agent is clearer. The lead stays accountable either way.
Why it sometimes makes things up
“The capital of France is ”
TRAINING LEARNS WEIGHTS THAT SCORE NEXT TOKENS AT RUNTIME
{{ p.word }}
{{ p.pct }}
At runtime, the model picks a likely token, adds it to the text, and repeats one token at a time.
so what's a hallucination?
The model never knows anything. It only scores. When the pattern is rare, or the window is full of muddled context, the scores still pick a winner, so out comes a confident, fluent, wrong answer.
A model can say “I don't know,” but it does not reliably know when to abstain. Tools, source documents, and a clean context window ground the answer in something real.
DOCUMENT RETRIEVAL: SEARCHING LARGE FILES INSTEAD OF SENDING EVERYTHING
your insurance policy
300 pages: may be too big to send at once
you ask: “am I covered for a cracked phone screen?”
the agent calls a search tool against the file; grep “screen|handset|accidental”; reads the hits, and searches again if the first pass missed
what the tool returned
accidental damagep.41
handsets & screensp.88
excess & limitsp.212
…297 other pagesnever read
→
the context window
the tool result lands next to your question
Nothing was “trained on your data”. Three pages were added to the context window, read once, and will be forgotten after the current session. The model is answering from text you handed it a second ago.
Which explains the failure you'll actually hit: if the search picks the wrong pages, the model may hallucinate an answer based on this potentially relevant but ultimately inaccurate data, and the model has no idea it's missing anything.
Putting it together: one question, two crossings, then the next turn
your computer
holds the list · runs tools
{{ loopLact }}
{{ loopArrow }}
the message list{{ loopTok }} tokens sent so far
{{ m.label }}
it only ever gets longer; every crossing resends the current context window
the model
reads the list · replies once
{{ loopRact }}
{{ loopTrip }}
Every crossing resends the current context window, so the price of a turn is the size of everything in it.
When the box fills up: your three options
92% full · 40 turns of chat
slower · pricier · easier to distract
1 · Drop
drop the oldest messages, keep the newest
free and automatic, but early detail is simply gone
2 · Compact
ask the model to summarize the old part, keep the summary
30 turns → one paragraph
keeps the thread; costs one extra call; fine detail gets lost, especially after repeated compactions
3 · Hand Off
new chat, paste back only what matters
cheapest and sharpest; you decide what's worth carrying over
A clean context window that is intentionally constructed beats a big messy one that has evolved over many turns. Everything in the box competes for the model's attention, so irrelevant history actively makes answers worse.
Can it do math? Reliability vs. exact calculation
“1 + 1 = 2”
✓ right, but a correct answer does not prove reliable arithmetic.
“1 + 1 =” is followed by “2” countless times in training text, so “2” is a likely next token. This is pattern completion.
“4,391 × 7,208 = 31,648,528”
✕ a typical wrong answer. The true value is 31,650,328.
For exact arithmetic, generated digits can look plausible while still being wrong.
the fix is the same as always
model asks: calculate("4391*7208")
→
your computer computes it exactly
→
31,650,328
The rule of thumb: it's strong at language-shaped tasks it has seen patterns of and unreliable at anything needing exact computation or live facts. That is what tools are for.
Recap: the whole thing in four ideas
The list
A chat is a list of messages. Each turn gets the relevant context, either by resending it or by reusing stored state. That's why it seems to remember.
The box
The context window is a fixed box measured in tokens. Only what's inside exists; the overflow is genuinely gone.
The prediction
It only predicts the next token. Fluent and confident even when wrong, and incapable of native operations outside of text prediction.
The loop
look
→
act
→
check
↑
Everything else; tools, skills, harness, agents, sub-agents; is software running that loop around the box.
A frozen text predictor, handed a list of messages in a fixed box, run in a loop by ordinary software that does all the fetching.
Each piece explains something you'll encounter: confident wrong answers come from the predictor, missing context from information falling out of a box that filled up, and anything it appears to do in the world from the loop calling a tool.
A skill starts with instructions in SKILL.md
SKILL.md
---
name: monthly-report
description: Writes the monthly
  business report. Use when asked
  for the monthly report or a
  month-end summary.
---
# Monthly report
Always pull figures from the finance sheet, never from chat.
## Steps
1. Check last month's file for the format
2. Fill the four sections in order
3. Flag anything down more than 5%
## Done when
Every number has a source noted beside it.
This is a basic skill: instructions in a Markdown file. A skill can also include scripts, references, and assets. It adds no training or permissions; the host decides discovery and loading.
why bother
The judgment your best people carry in their heads becomes something the whole team can run; reviewable, correctable, and improving with every pass.
and you don't have to write it yourself
Talk through the job once and ask the AI to help you convert it to a skill. Most tools ship a skill for making skills, so your job is reviewing the draft, not authoring it.
Who actually does the work: one plugin, step by step
your computer · the harness
the model
you connect the calendar plugin. Your side stores the login, and tells the model only that a tool named list_events exists.
← all the model produces is a line of text: list_events(day: "tomorrow")
your side does everything real: signs in, calls the calendar service, handles errors and retries, scopes the results down to just tomorrow's events, and formats them as text →
← reads those six lines like any other message, and writes your summary
The model never held your password, never opened a connection, never saw the events beyond tomorrow. It asked, in text, and received text back.
This is a client-executed example. A failure can be in the integration, its permissions or data, the tool contract, or the model's request.
Start here
AI 101How AI WorksWhat actually happens between pressing Enter and reading the reply, and why AI behaves the way it does.
part one
What the model is
The model is a text predictor: it reads a list of messages in a fixed-size box and writes the next piece. It keeps nothing outside that box.
part two
What it can't do
AI is built around predicting the next token. It can solve many math problems, but unverified arithmetic can still be wrong.
part three
How it reaches the world
model
⇄
tool
→
files, web
It can't reach anything itself, so it asks the software around it to fetch things and perform actions.
part four
Agents at work
look
→
act
→
check
↑
An agent is that same model, run in a loop until the job is done.
The words you'll hear · 1 of 2 · the basics
{{ g.term }}
{{ g.def }}
The words you'll hear · 2 of 2 · the machinery around the model
{{ g.term }}
{{ g.def }}
The harness: the software wrapped around the model
the harness · the app, running on your side
{{ h.text }}
↕ sends text over the internet, gets text back
outside the harness · someone else's datacenter
the model
frozen · stateless · text in, text out. It does exactly one thing.
why the word matters
Almost everything you think of as “the AI” is the harness, not the model: ChatGPT, Claude.ai, Copilot and Codex are harnesses.
Same model, different harness → very different experience. It explains why one product can browse and another can't, why one remembers your files, and why “the AI can't do X” is usually the harness, not the model.
It's also what manages the context window: trimming, compacting, and choosing what to send are all harness decisions.
Three words people mix up; tools, skills, plugins
a capability
Tool · tool call
A tool is something the harness can do: read a file, search, perform a calculation. A tool call is the model asking for one and getting the result back as text.
gives it new abilities
instructions
Skill
A written playbook for a kind of work: “here's how we build a spreadsheet”. Just text, pulled into the window when it's relevant.
gives it know-how, no new powers
plumbing
Plugin · connector
A package you switch on that hands the harness a bundle of new tools: connect your email, and “search inbox” and “send draft” appear.
delivers more tools
Skills teach · plugins add · tool calls do.
And none of them change the model itself. The model is always based on its own static training data. Tools, Skills, and Plugins change what's in the context window and what the harness can run.
Products name these differently; “actions”, “connectors”, “extensions”, “MCP servers”. Ask which of the three it is and the confusion clears.
What is an “agent”, exactly?
a plain chatbot reply
you ask
→
it answers
■
one pass, answered from the current context without using tools; it reads exactly the same whether it knew or guessed.
an agent · same model, run in a loop
the job: “fix the broken link on the pricing page”
{{ a.name }}
{{ a.doing }}
↺ {{ agentNote }}
“acting” = calling a tool
read a file · run the tests · click through a web app in a real browser · change the file and commit it; each result comes back as text in the window
the price of looping
3 times round is 3 full resends of a list that grew on every pass; same model, same box, several times the tokens
Which is why an agent can work for twenty minutes on one instruction; and why that instruction has to say what done looks like.
Anything that must outlive the window has to be written down
the context window
temporary by design
the decision you made 30 turns ago was trimmed. As far as the model is concerned, it never happened.
write it out →
← read it back in
next session
durable artifacts · outside the window
a spec or design doc
source files
a commit or pull request
an issue / ticket
a project instructions file
test output, screenshots
a decision record
This is why “write the spec first” works so well with agents: the spec is a persistent artifact. It survives every trim, and it gives you and the agent one shared definition of “done”.
Rule of thumb: if losing it would hurt, it doesn't belong in the chat; it belongs in a file.
Three important levers you can influence
1 · Your prompt
everything it knows about the job arrives this way
the goal; what you want
the constraints; what it must respect
what “done” looks like
leave one out and it will cheerfully invent it
2 · Skills
reusable instruction packs, written once
“how we build a spreadsheet”
a playbook; steps, conventions, sometimes scripts
it gets pulled into the window when the work matches, so you don't re-explain the same process every time. It's instructions, not a smarter model.
3 · Which model
and you can switch partway
fast + cheap → sorting, drafting, bulk edits
strong reasoning → the tricky bug, the design call, deep analysis, complex reasoning
the catch: a new model reads the same window differently; so keep the plan and decisions written down, not implied.
Prompting and skills provide direct text guidance; model selection, tools, approvals, and budgets configure the runtime around it.
what we just covered
{{ dtitle }}
{{ r.n }}
{{ r.text }}
coming next
{{ nextTitle }}
{{ nextTeaches }}
ready to finish
Create your personal completion record
The record stays in this browser and is not a formal credential.
course finished
Completed:AI 101How AI Works
Personal completion record
AI 101How AI Works
Learner
{{ recordLearnerName }}
Completed locally
{{ recordCompletedAt }}
Local record ID
{{ recordId }}
Course version {{ courseVersion }} · Locally generated personal completion record; not independently verified or a formal credential.
{{ dnum }}.{{ dstep }}·{{ dtitle }}
teaches:{{ dteaches }}
{{ p.t }}