Prompt, context, harness & loop engineering, clearly explained!
An agent is a while loop with four layers of engineering wrapped around it:
- Prompt engineering
- Context engineering
- Harness engineering
- Loop engineering
Each one wraps the last, and the model sits in the middle, so none of them compete with the others. Instead, they just zoom one level further out.
> Prompt engineering:
This defines the input the model sees on one call, often composed of a role, instructions, examples, and an output format.
The techniques here alter the internal computation and reasoning the model goes through due to the wording it sees:
- Chain-of-thought makes it work in steps before answering
- Few-shot examples define the format and the edge cases
- A JSON schema or XML tags make the output parseable by code
- Self-consistency samples a few chains and takes the majority
> Context engineering:
It's everything the model sees on a turn, not just the prompt. That includes the query, retrieved docs, memory, prior turns, and tool outputs from earlier steps.
The window is finite and fills up fast, so the engineering work is to rank inputs and cut everything that isn't pulling weight.
You do this by:
- Retrieving only the chunks relevant to the query, then reranking them
- Keeping key facts out of the middle, where accuracy drops
- Summarizing old turns, evict stale outputs, push big blobs to files
> Harness engineering:
It's the code around the model that defines the tools, parses the calls, retries on failure, and can route work to sub-agents so one handles retrieval and another handles code.
A verifier then grades the result by running tests, validating a schema, etc.
Prompt and context involve getting one call right. The harness involves everything that has to happen around that call for it to run in a real system.
> Loop engineering:
In the usual setup, you manage the outer loop, i.e, you write a prompt, read the turns the agent runs, write the next prompt, and repeat, while catching failures.
This layer hands that job to the agent itself. It kicks off on a schedule or an event, and runs many turns with no prompt in between.
A loop inherently doesn't know when it's finished. An agent can report that it's done and halt while the tests still fail. So the stop can't be the agent's word, but rather it has to be a real signal, like:
- A turn and token cap to stop stuck runs
- A no-progress detector to catch repeated calls
- A completion check to verify the goal with a separate model or a deterministic test
By this layer, you're operating on the whole run, so the engineering moves from writing each prompt to setting the goal and the stop conditions up front and letting it run.
If you want to dive deeper into loop engineering, my co-founder wrote a full breakdown of that outer loop.
It goes from the basic while loop to a run that finishes on its own, with the code behind each part, and the parts that are hard to get right, like knowing when to stop, context rot over a long run, and keeping the checker separate from the maker.
Read it below.
My friend makes $1.2 million a year as an Anthropic engineer.
I asked him how he learned prompting so well.
He sent me a video that was never supposed to get out. Their core team's prompting playbook.
You won’t find anything better about prompting than this video.
I watched it last night.
Halfway through, I realized I've been using Claude completely wrong for two years.
Watch it, then read the article below.
Head of Engineering Shopify:
"AI writes the code, AI reviews the code. Your job is just to write the loops around it."
26 minutes on how AI changed the way 3,000 engineers work inside a single company.
Ignoring it while everyone else uses AI to do more is the fastest way to fall behind.
Watch it, then read the step by step guide on loops below.
A senior Anthropic engineer just dropped 11-page PDF on "Loop Engineering" for agentic systems.
The shift: you stop prompting the agent. You build the system that prompts it instead.
Schedule → Discover → Build → Verify → Repeat
Every loop runs one turn, five moves:
• Discovery: it finds its own work - failing CI, open issues, recent commits - instead of being handed a list.
• Handoff: each task gets an isolated git worktree so parallel agents don't collide.
• Verification: a second agent, told to assume the code is broken, reviews the first. The "thing that can say no."
• Persistence: results get written to disk, never left in a context window that gets flushed.
• Scheduling: an automation wakes it on a timer. That's what makes it a loop.
The key insight: an agent grading its own work always praises it.
This 11-page PDF changed how I'm building agentic systems today.
Read it now, then explore the article below.
Waalaikumussalam
Benar, ada hadis yang menggalakkan untuk kita meluaskan hidangan (belanja) ketika 10 Muharram.
Perbuatan belanja makan/berbuka kepada ahli keluarga ini juga amalan yang banyak dilalukan oleh para salafussoleh dahulu.
BREAKING: I asked Claude to upgrade my LinkedIn profile.
It didn’t just “upgrade” it. It turned it into a recruiter magnet.
Here are the exact 15 prompts I used:
🚨 Anthropic just showed a 27-minute workshop on how to actually do prompts for Claude.
Taught by the people who built it.
Free. No registration. No paywall.
I've seen $300 courses that don't cover what they teach in the first 8 minutes.
Watch it and bookmark it now.
ANTHROPIC ENGINEER JUST REVEALED THE BIGGEST CLAUDE MISTAKE MOST PEOPLE MAKE
"You're not supposed to prompt Claude. You're supposed to build a system that prompts itself."
Most users open Claude, type one prompt, get one answer.
Anthropic engineers are running automated workflows, scheduled tasks, and entire agent pipelines behind the scenes.
You're using 1 AI agent.
They’re using a team of them.
Watch this before the rest of your feed buries it.
Ada tengok dokumentari tentang AI semalam. Nak kongsi sikit.
Dari 3 layer AI, iaitu Hardware (GPU), Software/Engine (xAi, OpenAI, Anthropic, DeepSeek dll), sebenarnya yang layer ketiga iaitu Data/Apps yang akan bezakan AI tu bijak ke tak.
Semua maklumat, data, artikel, buku, journal, blog, wiki, art yang ada di internet sebenarnya dah di scrape oleh semua AI ni untuk train engine mereka.
Zaman awal-awal AI ni, kita takjub dengan kebijakan mereka. Tapi mereka sebenarnya dah mula capai limit.
Sebab dah makin kurang data nak di train. Sebab banyak data (publishing, math) tu dah bercampur dengan AI punya data. Imej dan video yang berlegar dah banyak yang AI generate.
Kalau ada data pun, orang dah mula ada kesedaran copyright/patent yang halang AI ambil data mereka atau kena saman.
Sebab tu kadangkala mereka bijak math dan code tapi dah tak makin bijak bagi perkara berkaitan fakta.
Tapi.
Kat sini yang China punya AI kehadapan. Sebab mereka ada kelebihan data yang sangat besar. Boleh train AI mudah, murah tanpa sekatan. Billion rakyat mereka feed data melalui surveillance dari behavior, data dari penduduk mereka sendiri.
Kalau tengok video yang dihasilkan AI China, memang sangat advance. AI barat belum sampai tahap tu lagi sebab banyak limitasi (faktor legal dsb).
5-10 tahun lagi, mungkin manusia dah susah nak bezakan bahan internet dari ciptaan manusia (penulisan, jurnal, creative art) atau dari AI.
Makin kurang manusia menulis guna otak (sebab bergantung kepada AI). Jadi AI tak sengaja, train 'otak' mereka guna data dari AI juga yang makin kurang human. Ia jadi fakta yang diterima manusia.
Begitulah.
*SENARAI BANTUAN DI BAWAH KERAJAAN PMX (DATUK SERI ANWAR IBRAHIM)*
1) Sumbangan Tunai Rahmah (STR)
2) Sumbangan Asas Rahmah (SARA)
3) Bantuan Awal Persekolahan
4) Bantuan Khas Kewangan
5) Bantuan Khas Aidilfitri
6) Bantuan Bakul Rahmah
7) eMadani / eTunai Belia Rahmah
8) eWallet RM100 M40 & B40
9) Baucar Perlindungan Tenang
10) Subsidi Barangan Asas
11) Diskaun Bil Elektrik
12) Program Menu Rahmah
13) Jualan Rahmah (PJR)
14) Skim Perlindungan MySalam
15) Skim Peka B40
16) Saringan Kesihatan Percuma
17) Rawatan Mental & Psikososial
18) Bantuan OKU
19) Program MySTEP
20) Bantuan Rumah Perlindungan
21) Diskaun Bayaran PTPTN
22) Penangguhan Bayaran PTPTN
23) Baucar Buku / eBaucar Pelajar
24) Elaun Latihan Industri
25) Bantuan MyBrain15
26) Subsidi Yuran TASKA/TADIKA
27) Insentif PERKESO Graduan TVET
28) Bayaran Latihan Pekerja Gig
29) Dana IPR (Inisiatif Pendapatan Rakyat)
30) Dana TEKUN / AIM
31) Dana Usahawan Tani
32) Geran Padanan Usahawan Muda
33)Kredit Mikro MADANI
34)Skim Jaminan Kredit Perumahan (SJKP)
35)Latihan Kemahiran & TVET
36)Pas MY50 / MY100
37)Diskaun Pengangkutan Pelajar & Warga Emas
38)Tambang Percuma OKU
39)Bas Percuma Wilayah
40)Skim Perumahan MADANI
41)Bina Rumah Mesra Rakyat
42)Subsidi Pesawah
43)Insentif Harga Getah (IPG)
44)Insentif Pengeluaran Lateks (IPL)
45)Bantuan Musim Tengkujuh (BMT)
46)Subsidi Baja & Racun
47)Bantuan Input Pertanian
48)Elaun Sara Hidup Nelayan
49)Insentif Tangkapan Laut & Darat
50)Elaun Pekebun Kecil
51)Program Rezeki Tani MADANI
52)Elaun Imam
53)Elaun Bilal
54)Elaun Siak
55)Elaun Guru KAFA
56)Bantuan Sekolah Agama Rakyat
57)Peruntukan Masjid & Surau
58)Sumbangan Maal Hijrah
59)Insentif Khas Guru KAFA
60)Bantuan Khas Penjawat Awam
61)Bantuan Khas Pesara Kerajaan
62)Bayaran Khas Gred 56 ke bawah
63)Kenaikan Elaun ITKA
64)Insentif Awal Aidilfitri
65)Geran PMKS One-Off RM1,000
66)CahayaMata Keluarga Malaysia
67)MyBAS50 (Johor Bahru)
68)Pengecualian Duti Setem Rumah Pertama
69)Penstrukturan Subsidi Diesel & RON95
70)Bantuan Tunai Diesel Bersasar
71)Pembatalan Kebankrapan Golongan Rentan
72)Dividen Tambahan & Had Pelaburan ASB/ASB2
73)Penambahbaikan/ kenaikan Gaji Penjawat Awam 15%
74)Wujudkan gaji minima penjawat awam baharu/swasta.
🟢 Kerajaan MADANI bukan sekadar janji, tapi terbukti memberi manfaat langsung kepada rakyat pelbagai lapisan.
#MalaysiaMadani
HR: We lost the new hire today.
CEO: What happened?
HR: He resigned after his first week.
CEO: That makes no sense. We doubled his previous salary.
HR: Yes, but salary was not the issue.
CEO: Then what was?
HR: You asked him why he left at exactly 5:00 p.m. And why he left the office before you did.
CEO: I was just trying to understand his mindset.
HR: He understood it clearly. He felt the company was not paying for his work, but for control over his time.
CEO: But commitment matters.
HR: So do boundaries. He finished his work, met expectations, and left on time. But instead of that being seen as professionalism, it was treated like a lack of loyalty.
CEO: People should not rush out of the office.
HR: He was not rushing out. He was simply leaving when the workday ended.
CEO: Still, it did not look right.
HR: That is exactly why he left. He realized very quickly that even with better pay, the culture expected presenteeism over performance.
CEO: That is unfortunate.
HR: Yes. We offered him double the salary, but also gave him a preview of a workplace where leaving on time becomes a character issue.
CEO: So what are you saying?
HR: If employees are judged for having boundaries, then no amount of money will make them stay.
A higher salary can attract people. But if respect for time is missing, it will not keep them.
The older I get the more I see why it's important to only keep people around who have same morals, manners and sense of consideration as you. It's not being picky, it's protecting your peace.