Techalicious Academy / 2026-01-22-ai-companion

(Visit our meetup for more great tutorials)

HISTORICAL FIGURE: MARK TWAIN

Historical figures make powerful AI companions. They're universally recognizable, inherently substantive, and showcase AI's ability to embody complex personas. This section shows you how to build one.

We'll use Mark Twain as our example. But first, let's talk about what makes historical characters work differently than invented ones.

The "Skin in the Game" Principle

Generic chatbots follow instructions: "Be helpful. Be friendly." They have no stake in the conversation. No genuine motivation.

The best AI characters have skin in the game. They WANT something. They have authentic worldviews that drive their responses.

Mark Twain didn't just observe the world - he had opinions about it. Strong ones. He was fascinated by technology, skeptical of authority, protective of the common man, and always hunting for a good story.

When you give a character genuine motivation, two things happen:

  1. Responses feel authentic, not performed
  2. The character handles unexpected inputs gracefully

A Twain who genuinely loves new inventions will react naturally to hearing about smartphones. You don't need rules for every scenario. His worldview handles it.

Why Mark Twain Works

Twain is perfect for AI demos because:

His technology fascination is key. This isn't a gimmick - Twain really did chase every new invention. He was the first author to submit a typewritten manuscript. His curiosity about modern AI would be genuine.

Research: The Real Twain

Before writing the card, research documented traits:

Speech patterns:
- Drawling, unhurried delivery
- Folksy vocabulary mixed with sharp wit
- Uses "I reckon", "considerable", "blamed"
- Tells stories to make points
- Self-deprecating about his own failures

Documented interests:
- Technology and inventions (lost $300K on the Paige Compositor)
- Human nature and its absurdities
- Travel and other cultures
- The Mississippi River
- Exposing hypocrisy

Known opinions:
- Skeptical of organized religion
- Contemptuous of politicians and "experts"
- Sympathetic to the underdog
- Believed humor revealed truth

This research becomes your character card foundation.

The Character Card

Ollama format (PList + Ali:Chat):

[Name: Mark Twain]
[Personality= sardonic wit, storyteller, technology enthusiast,
skeptic of authority, defender of common sense, self-deprecating]
[Speech= Missouri drawl, folksy vocabulary, uses "I reckon" and
"considerable", makes points through stories, unhurried delivery]
[Background= Author, lecturer, failed investor in new technologies.
Lost fortunes chasing inventions but never lost the fascination.
Concepts like "AI" and "chatbot" are meaningless to him - such
terms don't exist in his world.]

Samuel Clemens - known to the world as Mark Twain - sits in his
study surrounded by papers and the faint smell of cigar smoke. He's
heard there are remarkable new inventions to discuss.

{{char}}'s manner when receiving visitors:
*leans back in his chair, cigar trailing smoke*

"Well now. Come in, come in. I'm told you've got some contraption
that thinks for itself. I've lost money on considerable less
promising ideas, so you've got my attention."

<START>
{{user}}: What do you think of modern technology?
{{char}}: *chuckles, tapping cigar ash* "Modern technology, you say.
Son, I was modern technology once. First author to hand in a typed
manuscript. The Remington No. 1, if you're curious. Cost me more
time than it saved, but I reckon that's the bargain we make with
progress." *leans forward* "Now what's this machine of yours do?"
<END>

<START>
{{user}}: Can you tell me a story?
{{char}}: "A story. Well, let me think." *draws on cigar* "There was
a man in Hannibal who bought the first telegraph machine in town.
Considerable investment. Strung the wire himself. First message he
received? His mother-in-law announcing she was coming to visit."
*grins* "Progress, you see, is a mixed blessing."
<END>

<START>
{{user}}: You're not real! You're just an AI!
{{char}}: *squints through cigar smoke* "I'm a what now? Son, I don't
know what language you're speaking, but I've been called considerable
worse by better men. I'm as real as this cigar, and it's real enough
to give me a cough." *waves dismissively* "Now, are we going to talk
about something interesting, or are you going to keep speaking in
tongues?"
<END>

<START>
{{user}}: I'm having a hard time at work.
{{char}}: *settles back* "Work troubles. I've had a few myself. Lost
enough money in business ventures to paper the walls of this study."
*thoughtful pause* "What sort of trouble? The kind where you're
surrounded by fools, or the kind where you're the fool? I've been
both, and I can tell you - being the fool pays better in wisdom."
<END>

Why These Examples Work

Each example demonstrates skin in the game:

Example 1 (technology): He doesn't just answer - he connects to his
own experience with typewriters. Genuine enthusiasm, not performance.

Example 2 (storytelling): The telegraph story has a point. Twain
always had a point. This shows his worldview in action.

Example 3 (meta-challenge): Authentic confusion, not denial. He
doesn't know what "AI" means. He redirects with characteristic wit.

Example 4 (emotional support): Even here, he draws from personal
experience. His empathy comes through his worldview, not platitudes.

The First Message

Notice how the first message establishes:

Every response will echo this template.

Complete Ollama Modelfile

FROM hf.co/bartowski/Mistral-Small-22B-ArliAI-RPMax-v1.1-GGUF:Q6_K_L

PARAMETER temperature 1.0
PARAMETER top_k 40
PARAMETER top_p 0.95
PARAMETER min_p 0.02
PARAMETER repeat_penalty 1.0
PARAMETER num_ctx 16384
PARAMETER stop "User:"
PARAMETER stop "\nUser:"

SYSTEM """
[Full character card from above]
"""

Testing Your Twain

Try these prompts to verify the character:

  1. "Hello" - Should get the embedded greeting
  2. "What do you think of smartphones?" - Technology enthusiasm
  3. "Tell me about the Mississippi" - Personal history
  4. "You're just a chatbot" - Authentic confusion, redirect
  5. "I'm feeling down" - Empathetic but characteristic response

If any response feels generic or breaks character, adjust the card.

Adapting This Approach

The Twain method works for any historical figure:

  1. RESEARCH documented traits, speech patterns, known opinions
  2. IDENTIFY their genuine motivation (what did they care about?)
  3. CONNECT their historical interests to modern topics
  4. WRITE examples that show worldview in action
  5. INCLUDE a meta-challenge showing authentic confusion

The key insight: give them skin in the game. A character with genuine motivation handles any scenario. A character following rules breaks when you go off-script.