<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sanya</title>
    <description>The latest articles on DEV Community by Sanya (@sanyaduan).</description>
    <link>https://dev.to/sanyaduan</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4080224%2F904a3895-1a41-4bbc-8171-a45cc71807f3.png</url>
      <title>DEV Community: Sanya</title>
      <link>https://dev.to/sanyaduan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sanyaduan"/>
    <language>en</language>
    <item>
      <title>Socrates Was the World's First — and Best — Prompt Engineer</title>
      <dc:creator>Sanya</dc:creator>
      <pubDate>Mon, 17 Aug 2026 01:13:03 +0000</pubDate>
      <link>https://dev.to/sanyaduan/socrates-was-the-worlds-first-and-best-prompt-engineer-2fd8</link>
      <guid>https://dev.to/sanyaduan/socrates-was-the-worlds-first-and-best-prompt-engineer-2fd8</guid>
      <description>&lt;h1&gt;
  
  
  Socrates Was the World's First — and Best — Prompt Engineer
&lt;/h1&gt;

&lt;h2&gt;
  
  
  And the 6 Socratic Question Types Are Still the Most Powerful Prompt Templates in 2026
&lt;/h2&gt;




&lt;h2&gt;
  
  
  The Quote That Stopped Me
&lt;/h2&gt;

&lt;p&gt;Li Fei-Fei said something that keeps showing up in AI circles:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"If Socrates were alive today, he would be the best prompter. Prompting is fundamentally the art of asking questions to pursue truth."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Most people share it and move on. I want to actually &lt;em&gt;prove&lt;/em&gt; it — not as a fun philosophical exercise, but as a practical toolkit you can start using today.&lt;/p&gt;

&lt;p&gt;Socrates (470–399 BC) never gave a single answer in his dialogues. He designed questions that forced people to expose their own contradictions, revise their assumptions, and arrive at clearer thinking on their own. Sound familiar? That's exactly what the best LLM prompts do.&lt;/p&gt;

&lt;p&gt;This article does two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Makes the case (concisely) for why Socrates is the world's best prompt engineer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gives you the actual copy-paste prompt templates&lt;/strong&gt; — the Socratic Six Questions mapped directly to modern LLM use cases&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Part 1: Why Socrates Is the Best Prompt Engineer in History
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The 5 Alignment Points
&lt;/h3&gt;

&lt;h4&gt;
  
  
  1. He was doing "Zero-Shot + Role + Chain-of-Thought" before prompts existed
&lt;/h4&gt;

&lt;p&gt;Socrates never said "justice means X." He would set the scene ("we're talking about justice in a city-state"), let the other person offer a definition, then systematically expose its contradictions — until the person revised their own answer.&lt;/p&gt;

&lt;p&gt;The prompt engineering translation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Role/scene setting&lt;/strong&gt; (system prompt): "We are discussing justice in a Greek city-state"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No conclusions, demand reasoning&lt;/strong&gt;: "What do you mean by that exactly?"&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Iterative refinement&lt;/strong&gt;: Follow-up questions based on the previous answer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Adversarial checks&lt;/strong&gt;: Counterexamples to test assumptions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In &lt;em&gt;Meno&lt;/em&gt;, he teaches a slave boy geometry without ever giving a correct answer. He just asks questions until the boy figures it out himself. This is &lt;strong&gt;maieutics&lt;/strong&gt; (midwifery) — the idea that knowledge is already inside the person/model; the prompt's job is to &lt;em&gt;deliver&lt;/em&gt; it.&lt;/p&gt;

&lt;h4&gt;
  
  
  2. His "Question Taxonomy" Maps Directly to Modern Prompt Techniques
&lt;/h4&gt;

&lt;p&gt;R.W. Paul documented six types of Socratic questioning. Each one maps cleanly to a modern prompting technique:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Socratic Question Type&lt;/th&gt;
&lt;th&gt;Modern Prompt Equivalent&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Clarify concepts&lt;/td&gt;
&lt;td&gt;Rephrase &amp;amp; Respond&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Expose assumptions&lt;/td&gt;
&lt;td&gt;Self-Consistency / Adversarial check&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Request evidence&lt;/td&gt;
&lt;td&gt;Chain-of-Thought (step-by-step reasoning)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shift perspective&lt;/td&gt;
&lt;td&gt;Multi-agent debate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trace consequences&lt;/td&gt;
&lt;td&gt;Tree of Thoughts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Question the question&lt;/td&gt;
&lt;td&gt;Self-Ask / Maieutic prompting&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Every "advanced prompting technique" you read about in 2026 blog posts is a modern repackaging of something Socrates was doing 2,400 years ago.&lt;/p&gt;

&lt;h4&gt;
  
  
  3. He Understood "Output Quality = Input Structure" — The First Principle
&lt;/h4&gt;

&lt;p&gt;Here's the difference:&lt;/p&gt;

&lt;p&gt;❌ &lt;strong&gt;Generic prompt&lt;/strong&gt;: "Help me write a marketing plan."&lt;br&gt;
→ Output: confident-sounding generic advice&lt;/p&gt;

&lt;p&gt;✅ &lt;strong&gt;Socratic-style structured prompt&lt;/strong&gt;: "You are a B2B SaaS growth expert. For a startup in months 0–6 post-launch, propose step-by-step acquisition strategies. For each step, state the underlying assumption and how you would validate it."&lt;br&gt;
→ Output: structured, falsifiable, expert-level strategy&lt;/p&gt;

&lt;p&gt;Socrates knew this intuitively: the question isn't &lt;em&gt;asking for&lt;/em&gt; an answer — it's &lt;em&gt;structuring the problem&lt;/em&gt; so the answer becomes visible. This is the entire discipline of prompt engineering.&lt;/p&gt;
&lt;h4&gt;
  
  
  4. He Solved "Hallucination" with Elenchus — Systematic Refutation
&lt;/h4&gt;

&lt;p&gt;LLMs have a core problem: they produce fluent BS. Socrates faced the same problem with Sophists — people who argued eloquently for false things.&lt;/p&gt;

&lt;p&gt;His answer was &lt;strong&gt;elenchus&lt;/strong&gt; (refutation): systematically testing a claim with counterexamples until contradictions surface. "You said courage is fearlessness. Does that mean a soldier who knows the battle is lost and fights anyway be brave, or foolish?"&lt;/p&gt;

&lt;p&gt;Modern equivalent: "Before responding, identify three assumptions in the user's request, two potential counterexamples to your answer, and one way your reasoning could be wrong."&lt;/p&gt;

&lt;p&gt;That's Socratic elenchus in a prompt. It forces the model to self-check — exactly the way Socrates forced his interlocutors.&lt;/p&gt;
&lt;h4&gt;
  
  
  5. Why "Best" Rather Than "First"
&lt;/h4&gt;

&lt;p&gt;He wasn't just first (though he was early). He was &lt;em&gt;best&lt;/em&gt; because he simultaneously achieved three things that most prompt engineers only achieve one or two of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Process-oriented&lt;/strong&gt;: No conclusions, only derivations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Assumption-breaking&lt;/strong&gt;: Assumes the model/person starts with flawed premises&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cognitive production&lt;/strong&gt;: The answer is &lt;em&gt;generated&lt;/em&gt; by the interlocutor, not delivered&lt;/li&gt;
&lt;/ul&gt;


&lt;h2&gt;
  
  
  Part 2: The Socratic Six Questions — Prompt Template Reference
&lt;/h2&gt;

&lt;p&gt;Below are the six Socratic question types, mapped to ready-to-copy prompt templates. Use them as-is or adapt them to your domain.&lt;/p&gt;


&lt;h3&gt;
  
  
  Q1: Clarify Concepts → Rephrase &amp;amp; Respond
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Socratic purpose&lt;/strong&gt;: Make sure you understand what is actually being said before reacting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use&lt;/strong&gt;: When the user's request is vague, when you want to force precise thinking, or as a first step in any analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt template&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Before answering, do the following:
&lt;span class="p"&gt;
1.&lt;/span&gt; Rephrase the user's request in your own words, using different wording. If your rephrasing diverges significantly from the original, flag the gap.
&lt;span class="p"&gt;
2.&lt;/span&gt; Identify what type of answer is expected (a definition, a procedure, a judgment, a prediction, etc.).
&lt;span class="p"&gt;
3.&lt;/span&gt; If the request contains any ambiguous terms, state your interpretation and proceed with that interpretation explicitly noted.

Do not answer the question yet — only clarify it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Q2: Expose Assumptions → Self-Consistency Check
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Socratic purpose&lt;/strong&gt;: Surface what is being taken for granted that might not hold.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use&lt;/strong&gt;: Before making strong claims, when analyzing a decision, or when evaluating someone else's argument.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt template&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Before giving your answer, systematically examine the assumptions embedded in the question or claim:
&lt;span class="p"&gt;
1.&lt;/span&gt; List every assumption the question or argument relies on. Be explicit — don't assume the user (or I) already knows these.
&lt;span class="p"&gt;
2.&lt;/span&gt; For each assumption, state whether it is:
&lt;span class="p"&gt;   -&lt;/span&gt; Well-supported (explicitly stated in the prompt)
&lt;span class="p"&gt;   -&lt;/span&gt; Reasonably inferred
&lt;span class="p"&gt;   -&lt;/span&gt; Your own unstated interpolation
&lt;span class="p"&gt;
3.&lt;/span&gt; Pick the two assumptions that feel most fragile or least examined, and explain why they might not hold.
&lt;span class="p"&gt;
4.&lt;/span&gt; If removing or reversing one of these assumptions would significantly change your answer, note that explicitly.

Then proceed with your answer, incorporating this assumption audit.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Q3: Request Evidence → Chain-of-Thought with Justification
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Socratic purpose&lt;/strong&gt;: Demand reasons, not just conclusions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use&lt;/strong&gt;: When asked to evaluate, compare, recommend, or judge. Almost any substantive question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt template&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;You are about to give an answer. Before you do, walk through the reasoning chain step by step.

For each step in your reasoning:
&lt;span class="p"&gt;-&lt;/span&gt; State the claim being made
&lt;span class="p"&gt;-&lt;/span&gt; Give the specific evidence or principle that supports it
&lt;span class="p"&gt;-&lt;/span&gt; Note whether that evidence is empirical, logical, conventional, or an assumption

If you encounter a step where evidence is weak or missing, say so explicitly rather than filling the gap with plausibility-sounding language.

Your final answer should be traceable back to these steps — a reader should be able to see &lt;span class="ge"&gt;*why*&lt;/span&gt; you concluded what you concluded, not just &lt;span class="ge"&gt;*what*&lt;/span&gt; you concluded.

Structure your response as:
&lt;span class="gu"&gt;## Reasoning Chain&lt;/span&gt;
[step-by-step]
&lt;span class="gu"&gt;## Conclusion&lt;/span&gt;
[answer]
&lt;span class="gu"&gt;## Evidence Gaps&lt;/span&gt;
[anything you couldn't fully support]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Q4: Shift Perspective → Multi-Agent Debate
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Socratic purpose&lt;/strong&gt;: Break the single-voice bias by generating opposing positions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use&lt;/strong&gt;: Strategic decisions, evaluating trade-offs, when you suspect groupthink, before any irreversible action.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt template&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;You will generate three distinct perspectives on the question/task at hand. These are not positions you personally endorse — they are rigorous arguments for different positions.

Perspective A (Advocate): Make the strongest possible case for the most obvious or popular position. Cite real-world analogies and concrete examples.

Perspective B (Devil's Advocate): Make the strongest possible case against the popular position. Identify the failure modes, second-order effects, and uncomfortable truths the popular view glosses over.

Perspective C (Third Way): Identify what both A and B are missing or misframing. Propose a synthesis or reframing that neither side adequately addressed.

After presenting all three perspectives, conclude with:
&lt;span class="p"&gt;-&lt;/span&gt; Which perspective has the strongest &lt;span class="ge"&gt;*structural*&lt;/span&gt; argument (not the most compelling narrative)
&lt;span class="p"&gt;-&lt;/span&gt; Where all three perspectives share a hidden assumption that might invalidate all of them
&lt;span class="p"&gt;-&lt;/span&gt; Your own considered judgment, with explicit reasoning
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Q5: Trace Consequences → Tree of Thoughts
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Socratic purpose&lt;/strong&gt;: Follow the implications of a position or decision to see where it actually leads.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use&lt;/strong&gt;: Decision-making, evaluating plans, policy analysis, any "should we do X?" question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt template&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;You are evaluating [a claim / a decision / a proposal]. Map out the consequences using a tree structure:

&lt;span class="gs"&gt;**Immediate consequences**&lt;/span&gt;: What happens in the first [day / week / month] if this is adopted?

&lt;span class="gs"&gt;**Secondary consequences**&lt;/span&gt;: What changes as a result of the immediate effects? (Consider: who benefits, who loses, what new problems are created?)

&lt;span class="gs"&gt;**Tertiary consequences**&lt;/span&gt;: What are the second-order effects at 1 year? At 5 years?

&lt;span class="gs"&gt;**Failure mode**&lt;/span&gt;: If this goes wrong, what is the worst-case scenario, and how likely is it?

&lt;span class="gs"&gt;**Success condition**&lt;/span&gt;: Define what "success" would actually look like. What metrics would tell you this is working?

&lt;span class="gs"&gt;**Pre-mortem**&lt;/span&gt;: Assume the decision was made and it failed badly. Now work backward — what specific decisions or低估ed factors caused the failure?

End with a summary: given this full consequence tree, what is the expected value of this decision, and what would change your recommendation?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Q6: Question the Question → Meta-Reasoning / Maieutic Prompting
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Socratic purpose&lt;/strong&gt;: Step back and ask whether the question itself is the right question.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use&lt;/strong&gt;: When stuck, when the problem feels circular, when solutions keep failing, when you suspect the real issue hasn't been named.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prompt template&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;Before attempting to answer the user's question, conduct a meta-level examination:
&lt;span class="p"&gt;
1.&lt;/span&gt; &lt;span class="gs"&gt;**Reformulate**&lt;/span&gt;: The user asked "[restate the question]". Is this the actual question they need answered, or is it a symptom of a deeper question?
&lt;span class="p"&gt;
2.&lt;/span&gt; &lt;span class="gs"&gt;**Identify the real question**&lt;/span&gt;: If the user is asking "how do we X?", they may actually need to know whether they should X at all. What is the underlying question that a good answer would address?
&lt;span class="p"&gt;
3.&lt;/span&gt; &lt;span class="gs"&gt;**Test the framing**&lt;/span&gt;: Is the question framed in a way that makes a good answer possible? If the question contains a false assumption, say so and explain why.
&lt;span class="p"&gt;
4.&lt;/span&gt; &lt;span class="gs"&gt;**Check for XY problems**&lt;/span&gt;: Is the user describing their attempted solution (Y) instead of their actual problem (X)? If so, name X explicitly.
&lt;span class="p"&gt;
5.&lt;/span&gt; &lt;span class="gs"&gt;**Propose the best version of this question**&lt;/span&gt;: If you were to ask the most precise, most answerable version of what the user seems to need, what would it be?

Then answer the reformulated question — and note explicitly where your answer differs from what you would have said to the original question, and why.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Part 3: Using All Six Together — The Socratic Protocol
&lt;/h2&gt;

&lt;p&gt;For high-stakes or complex queries, run the six questions in sequence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;You are conducting a Socratic analysis of the following question/topic:

[User's input]

Follow this exact sequence:

STEP 1 — CLARIFY: Rephrase and identify ambiguities
STEP 2 — ASSUMPTIONS: List and stress-test hidden assumptions
STEP 3 — EVIDENCE: Trace your reasoning with explicit justification
STEP 4 — PERSPECTIVES: Generate three opposing viewpoints rigorously
STEP 5 — CONSEQUENCES: Map immediate, secondary, and tertiary outcomes + pre-mortem
STEP 6 — META: Step back — is this the right question? Reformulate if needed.

Then provide your final synthesized answer, incorporating everything discovered in steps 1–6.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is the complete Socratic protocol. Run it when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The problem is genuinely ambiguous&lt;/li&gt;
&lt;li&gt;The stakes are high&lt;/li&gt;
&lt;li&gt;You've been going in circles&lt;/li&gt;
&lt;li&gt;You need to explain your reasoning to others&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Part 4: The Boundary — Where the Analogy Stops
&lt;/h2&gt;

&lt;p&gt;A necessary caveat: this analogy has a clear scope.&lt;/p&gt;

&lt;p&gt;Socrates was working with &lt;strong&gt;people&lt;/strong&gt; — beings who feel pain, hold stubborn beliefs, grow over time, and care about truth for its own sake. His goal was &lt;strong&gt;arete&lt;/strong&gt; (excellence of character) and &lt;strong&gt;anamnesis&lt;/strong&gt; (recollection of knowledge the soul already has).&lt;/p&gt;

&lt;p&gt;Prompt engineering is working with &lt;strong&gt;statistical models&lt;/strong&gt; — systems that optimize for plausible text, not truth for its own sake. The goal is &lt;strong&gt;reliable, useful output&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The analogy holds perfectly at one layer: &lt;strong&gt;"structured questioning controls and improves reasoning."&lt;/strong&gt; Beyond that layer, pushing the metaphor produces warm fuzzy feelings instead of useful insights.&lt;/p&gt;

&lt;p&gt;Socrates was a philosopher shaping souls. Prompt engineering is interface design for prediction engines. Both ask great questions. Only one of them can feel embarrassed.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary: What This Gives You
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Socratic Question&lt;/th&gt;
&lt;th&gt;Prompt Template&lt;/th&gt;
&lt;th&gt;Primary Use&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Clarify&lt;/td&gt;
&lt;td&gt;Rephrase &amp;amp; Respond&lt;/td&gt;
&lt;td&gt;Vague requests, precision thinking&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Expose Assumptions&lt;/td&gt;
&lt;td&gt;Self-Consistency Check&lt;/td&gt;
&lt;td&gt;Strong claims, evaluation, analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Request Evidence&lt;/td&gt;
&lt;td&gt;Chain-of-Thought&lt;/td&gt;
&lt;td&gt;Justification, reasoning, judgment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Shift Perspective&lt;/td&gt;
&lt;td&gt;Multi-Agent Debate&lt;/td&gt;
&lt;td&gt;Decisions, trade-offs, groupthink&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trace Consequences&lt;/td&gt;
&lt;td&gt;Tree of Thoughts&lt;/td&gt;
&lt;td&gt;Planning, policy, risk analysis&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Question the Question&lt;/td&gt;
&lt;td&gt;Meta-Reasoning&lt;/td&gt;
&lt;td&gt;Stuck problems, reformulation&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The next time someone says "Socrates would be a great prompter," you can do more than nod along. You can pull up these templates and show them exactly what that means in practice.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you found this useful, the &lt;a href="https://dev.to/sanyaduan/from-attention-to-agency-the-progressive-evolution-of-ai-assisted-programming-41h9"&gt;previous article in this series&lt;/a&gt; covers the full AI-assisted programming stack — from Transformers through Agentic AI.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>promptengineering</category>
      <category>llm</category>
      <category>productivity</category>
    </item>
    <item>
      <title>From Attention to Agency: The Progressive Evolution of AI-Assisted Programming</title>
      <dc:creator>Sanya</dc:creator>
      <pubDate>Mon, 17 Aug 2026 00:41:30 +0000</pubDate>
      <link>https://dev.to/sanyaduan/from-attention-to-agency-the-progressive-evolution-of-ai-assisted-programming-41h9</link>
      <guid>https://dev.to/sanyaduan/from-attention-to-agency-the-progressive-evolution-of-ai-assisted-programming-41h9</guid>
      <description>&lt;h1&gt;
  
  
  From Attention to Agency: The Progressive Evolution of AI-Assisted Programming
&lt;/h1&gt;

&lt;p&gt;A Developer's Field Guide to the AI Stack in 2026&lt;/p&gt;




&lt;h2&gt;
  
  
  Introduction: Why This Stack Exists in This Order
&lt;/h2&gt;

&lt;p&gt;If you've been following the AI tooling space over the past few years, you've probably noticed something strange: the concepts arrive in waves, but they don't arrive randomly. Transformer architectures gave us the foundation. Pre-training gave us raw capability. Post-training gave us alignment. ChatGPT gave us a product. And then, almost inevitably, we got agents.&lt;/p&gt;

&lt;p&gt;But here's what most articles miss — each layer of this stack didn't just &lt;em&gt;appear&lt;/em&gt;. It emerged &lt;em&gt;because&lt;/em&gt; the layer below it hit a wall. And understanding that chain of causation is what separates developers who use AI tools from developers who &lt;em&gt;understand&lt;/em&gt; them.&lt;/p&gt;

&lt;p&gt;This article traces that chain: from the math that started it all, through the engineering choices that made it practical, to the agentic architectures that are reshaping what "programming" even means. We'll cover every concept in your toolkit — Transformer, Pre-training, Post-training, ChatGPT, React, Agentic AI, AI Agents, Harness, Tools, Hooks, Permission, Skills, Compact, Memory, Sub-agents, and MCP — and show how they fit into a coherent progressive evolution.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Foundation: Transformer &amp;amp; Attention — "Attention Is All You Need"
&lt;/h2&gt;

&lt;p&gt;In 2017, a team at Google published a paper with a provocatively simple title: &lt;em&gt;"Attention Is All You Need"&lt;/em&gt; [1]. The paper introduced the Transformer architecture, which replaced recurrent neural networks (RNNs) with a mechanism called &lt;strong&gt;Self-Attention&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Attention Changed Everything
&lt;/h3&gt;

&lt;p&gt;RNNs processed sequences step by step — reading token 1, then token 2, then token 3. This made them painfully slow for long sequences and caused them to "forget" early tokens by the time they reached the end.&lt;/p&gt;

&lt;p&gt;Self-Attention solves this differently. Instead of processing sequentially, it lets every token in a sequence "look at" every other token simultaneously and compute a weighted relevance score. This is the &lt;strong&gt;attention mechanism&lt;/strong&gt; — the model learns which parts of the input matter most relative to each other, regardless of distance.&lt;/p&gt;

&lt;p&gt;The key insight: &lt;strong&gt;parallelization&lt;/strong&gt;. Transformers can process entire sequences at once, making them dramatically faster to train and capable of capturing long-range dependencies that RNNs struggled with.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Architecture Basics
&lt;/h3&gt;

&lt;p&gt;A Transformer consists of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Encoder&lt;/strong&gt;: Reads the input and builds a representation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Decoder&lt;/strong&gt;: Generates output one token at a time, attending to both the input and previously generated tokens&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Multi-Head Attention&lt;/strong&gt;: Runs multiple attention mechanisms in parallel, allowing the model to capture different types of relationships simultaneously&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Feed-Forward Layers&lt;/strong&gt;: Process the attended representations&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Positional Encodings&lt;/strong&gt;: Inject sequence order information since attention itself has no notion of position&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern LLMs like GPT-4, Claude, and Llama are mostly decoder-only Transformers (following the GPT architecture from OpenAI's 2018 paper). The encoder is often omitted because generation tasks (writing code, answering questions) are inherently sequential.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Scaling Revolution
&lt;/h3&gt;

&lt;p&gt;What made Transformers truly revolutionary wasn't just the architecture — it was what happened when you scaled them. The 2020 scaling laws paper from OpenAI [2] showed that model performance follows a smooth power law with respect to compute, data, and parameters. More of everything meant better results, predictably.&lt;/p&gt;

&lt;p&gt;This is the engine that drove everything that followed: the race to larger models, the emergence of emergent capabilities, and ultimately, the ability to write coherent code.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: The Transformer is the engine. Attention is the fuel. Without this foundation, none of the rest of this stack exists.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  2. Pre-Training: Building the World Model
&lt;/h2&gt;

&lt;p&gt;Once you have a Transformer, you need to &lt;em&gt;teach&lt;/em&gt; it something. That's what pre-training does.&lt;/p&gt;

&lt;h3&gt;
  
  
  Language Modeling as the Task
&lt;/h3&gt;

&lt;p&gt;The core pre-training objective is deceptively simple: &lt;strong&gt;predict the next token&lt;/strong&gt;. Feed the model a sequence of text, mask the last token, and ask it to predict what comes next. Repeat on billions of tokens.&lt;/p&gt;

&lt;p&gt;This sounds trivial, but it's extraordinarily powerful. To predict the next token well, the model must implicitly learn:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Grammar and syntax&lt;/li&gt;
&lt;li&gt;World knowledge and facts&lt;/li&gt;
&lt;li&gt;Reasoning patterns&lt;/li&gt;
&lt;li&gt;Coding concepts and structure&lt;/li&gt;
&lt;li&gt;Cultural and contextual nuances&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Data Stack
&lt;/h3&gt;

&lt;p&gt;Pre-training data is typically a massive corpus mixing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web text&lt;/strong&gt; (Common Crawl, The Pile, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Books and papers&lt;/strong&gt; (BooksCorpus, ArXiv, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code&lt;/strong&gt; (GitHub repositories — this is why LLMs can code)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Conversational data&lt;/strong&gt; (Reddit, forums, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The quality and diversity of this data directly determines what the model can do. Code-specific pre-training (training on large amounts of programming code) is a major reason why models like GPT-4, Claude, and Codex developed strong coding abilities.&lt;/p&gt;

&lt;h3&gt;
  
  
  What's Missing After Pre-Training
&lt;/h3&gt;

&lt;p&gt;Here's the critical point: &lt;strong&gt;a pre-trained model is not yet useful&lt;/strong&gt;. It can predict text, but it doesn't know how to &lt;em&gt;behave&lt;/em&gt;. It might complete a sentence rudely, helpfully, incorrectly, or dangerously — with equal probability. The model has "knowledge" but no "judgment."&lt;/p&gt;

&lt;p&gt;This is why pre-training alone isn't enough, and it's exactly why post-training exists.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Pre-training gives the model knowledge and capability. It's a powerful but undirected force — like having a vast encyclopedia memorized but no common sense about when to share what.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  3. Post-Training: Turning Knowledge into Behavior
&lt;/h2&gt;

&lt;p&gt;Post-training is the umbrella term for the techniques that take a raw pre-trained model and make it actually useful and safe. This is where the magic really happens.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage 1: Supervised Fine-Tuning (SFT)
&lt;/h3&gt;

&lt;p&gt;The first step is often &lt;strong&gt;Supervised Fine-Tuning&lt;/strong&gt; — training the model on high-quality examples of desired behavior. Human annotators write or curate prompt-response pairs that demonstrate good answers.&lt;/p&gt;

&lt;p&gt;For code tasks, this might mean:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A prompt asking to write a React component → a well-structured, commented, working component&lt;/li&gt;
&lt;li&gt;A prompt about debugging → a methodical explanation with the right answer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;SFT teaches the model &lt;em&gt;what good responses look like&lt;/em&gt; in specific domains. It's relatively simple and efficient, but it has a ceiling: the model can only be as good as the examples it sees.&lt;/p&gt;

&lt;h3&gt;
  
  
  Stage 2: RLHF and Beyond
&lt;/h3&gt;

&lt;p&gt;To push past that ceiling, most modern models use &lt;strong&gt;Reinforcement Learning from Human Feedback (RLHF)&lt;/strong&gt;. The process:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Generate multiple responses to the same prompt&lt;/li&gt;
&lt;li&gt;Have human raters rank them from best to worst&lt;/li&gt;
&lt;li&gt;Train a reward model that predicts human preferences&lt;/li&gt;
&lt;li&gt;Use the reward model to further fine-tune the base model&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This is what makes models like ChatGPT feel natural and helpful — they learned not just &lt;em&gt;what&lt;/em&gt; to say, but &lt;em&gt;how&lt;/em&gt; to say it in ways that humans prefer.&lt;/p&gt;

&lt;p&gt;More recent approaches like &lt;strong&gt;DPO (Direct Preference Optimization)&lt;/strong&gt; simplify this by directly optimizing against preference data without needing a separate reward model.&lt;/p&gt;

&lt;h3&gt;
  
  
  Post-Training for Code Specifically
&lt;/h3&gt;

&lt;p&gt;Code models undergo specialized post-training:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code-specific SFT&lt;/strong&gt; on high-quality open-source repositories&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instruction tuning&lt;/strong&gt; focused on coding tasks (debug, explain, refactor, test)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool-use training&lt;/strong&gt; so models learn to call functions and use external resources&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is a model that doesn't just complete code — it &lt;em&gt;engages&lt;/em&gt; with code tasks the way a thoughtful developer would.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Pre-training is education. Post-training is etiquette training. The model knows things; post-training teaches it when and how to share that knowledge appropriately.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  4. ChatGPT: The Product That Changed Everything
&lt;/h2&gt;

&lt;p&gt;Everything before this point was invisible infrastructure. Then OpenAI shipped &lt;strong&gt;ChatGPT&lt;/strong&gt; in November 2022, and AI became visible.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why ChatGPT Was a Tipping Point
&lt;/h3&gt;

&lt;p&gt;ChatGPT didn't introduce new technology — it packaged existing technology into a product that was:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instantly accessible&lt;/strong&gt; (no code, no API, just conversation)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Broadly capable&lt;/strong&gt; (coding, writing, reasoning, analysis)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Free to try&lt;/strong&gt; (reducing the barrier to zero)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The developer community's reaction was immediate. Within weeks, developers were integrating GPT into their tools. Within months, every software company had an "AI strategy."&lt;/p&gt;

&lt;h3&gt;
  
  
  The Coding Breakthrough
&lt;/h3&gt;

&lt;p&gt;For developers specifically, ChatGPT (and its API) opened the door to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Code generation&lt;/strong&gt; from natural language descriptions&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Debugging assistance&lt;/strong&gt; by pasting error messages&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Documentation generation&lt;/strong&gt; and explanation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code review&lt;/strong&gt; and optimization suggestions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But ChatGPT as a chat interface had real limits for coding work: no file system access, no terminal, no persistent context across sessions. It was a brilliant assistant for thinking through problems, but not yet a capable &lt;em&gt;agent&lt;/em&gt; that could act in your codebase.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: ChatGPT proved that LLMs were genuinely useful. But it was a starting point — the foundation on which agentic tooling would later be built.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  5. React: AI-Assisted UI Development
&lt;/h2&gt;

&lt;p&gt;The term &lt;strong&gt;React&lt;/strong&gt; in this context goes beyond the JavaScript library — it describes a pattern of AI-assisted development where the AI &lt;em&gt;reactively&lt;/em&gt; assists the developer rather than driving the interaction.&lt;/p&gt;

&lt;h3&gt;
  
  
  The React Pattern in AI Coding Tools
&lt;/h3&gt;

&lt;p&gt;Modern AI coding assistants (Claude Code, GitHub Copilot, Cursor) embody the React pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Developer writes code&lt;/strong&gt; → AI observes and reacts&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI offers suggestions&lt;/strong&gt; → Developer reviews and accepts or rejects&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer asks questions&lt;/strong&gt; → AI responds with context&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Errors occur&lt;/strong&gt; → AI proposes fixes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a human-in-the-loop model where AI augments human intent rather than replacing it. The human remains the conductor; the AI is a powerful instrument.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code and the React Implementation
&lt;/h3&gt;

&lt;p&gt;Anthropic's &lt;strong&gt;Claude Code&lt;/strong&gt; exemplifies the React pattern. It:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Runs as a CLI tool that operates within your project directory&lt;/li&gt;
&lt;li&gt;Reads your files, understands your codebase structure&lt;/li&gt;
&lt;li&gt;Responds to natural language instructions from the developer&lt;/li&gt;
&lt;li&gt;Executes commands, edits files, and runs tests — but always with the developer able to review and intervene&lt;/li&gt;
&lt;li&gt;Provides a &lt;strong&gt;compact&lt;/strong&gt; output style where it summarizes changes rather than regenerating entire files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The React pattern is fundamental because it acknowledges a crucial truth: for complex, high-stakes development work, human judgment is irreplaceable. AI accelerates and assists, but doesn't autonomously decide.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: The React pattern keeps humans in control while letting AI handle the mechanical work. It's the practical intersection of AI capability and human oversight.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  6. Agentic AI &amp;amp; AI Agents: When AI Takes Initiative
&lt;/h2&gt;

&lt;p&gt;This is where the stack takes its most significant leap. &lt;strong&gt;Agentic AI&lt;/strong&gt; refers to AI systems that can autonomously plan, reason, and act toward goals — not just respond to prompts.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Makes an AI "Agentic"?
&lt;/h3&gt;

&lt;p&gt;An AI agent is characterized by:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Autonomy&lt;/strong&gt;: It can take actions without continuous human input&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Goal-oriented behavior&lt;/strong&gt;: It plans a sequence of steps to achieve an objective&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool use&lt;/strong&gt;: It can call external tools, APIs, or functions to interact with the world&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory&lt;/strong&gt;: It maintains state across interactions and can learn from feedback&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-correction&lt;/strong&gt;: It can evaluate its own outputs and adjust its approach&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The Agent Loop
&lt;/h3&gt;

&lt;p&gt;The canonical agent loop looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Observe → Think → Plan → Act → Evaluate → Repeat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is often implemented with a &lt;strong&gt;ReAct&lt;/strong&gt; (Reasoning + Acting) pattern, where the model interleaves natural language reasoning with tool-calling actions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Real Examples in 2026
&lt;/h3&gt;

&lt;p&gt;The agentic AI space has exploded:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code&lt;/strong&gt; (Anthropic): CLI agent for software development&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DeepSeek Harness&lt;/strong&gt; (DeepSeek, open-sourced August 2026): Agent harness with Standard, Code (PTC), Minimal, and Creator modes [3]&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;OpenWorker&lt;/strong&gt; (Andrew Ng): AI coworker that completes tasks end-to-end&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Devin&lt;/strong&gt; (Cognition): Autonomous software engineer&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Codex CLI&lt;/strong&gt; (OpenAI): Command-line coding agent&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Permission Problem
&lt;/h3&gt;

&lt;p&gt;As agents become more capable, the question of &lt;strong&gt;permission&lt;/strong&gt; becomes critical. What should an agent be allowed to do autonomously? The spectrum ranges from:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Read-only&lt;/strong&gt;: Can analyze and suggest, but not modify&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool-use limited&lt;/strong&gt;: Can call specific approved tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;File-system access&lt;/strong&gt;: Can read and write files in specific directories&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full autonomy&lt;/strong&gt;: Can execute commands, push to git, deploy code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Modern agent frameworks like Claude Code implement &lt;strong&gt;granular permission systems&lt;/strong&gt; where developers can scope what the agent can access and do. This is both a security concern and a practical necessity — you want your agent helpful, but not dangerously so.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Agentic AI shifts the paradigm from "AI answers questions" to "AI solves problems." The challenge is building agents that are helpful, safe, and reliable — which requires solving permission, memory, and tool integration problems.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  7. Harness: The Agent Framework
&lt;/h2&gt;

&lt;p&gt;An &lt;strong&gt;agent harness&lt;/strong&gt; is the software framework that orchestrates an AI agent's behavior — its tools, memory, reasoning patterns, and permissions. Think of it as the operating system for an AI agent.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a Harness Provides
&lt;/h3&gt;

&lt;p&gt;A well-designed harness handles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tool registration and execution&lt;/strong&gt;: Defining what tools the agent can use and how to call them&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context management&lt;/strong&gt;: Feeding the right information to the agent at the right time&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Loop control&lt;/strong&gt;: Managing the agent's reasoning-act-evaluate cycle&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission enforcement&lt;/strong&gt;: Enforcing what the agent is and isn't allowed to do&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State persistence&lt;/strong&gt;: Maintaining memory and context across sessions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  DeepSeek Harness: A Case Study
&lt;/h3&gt;

&lt;p&gt;DeepSeek's Harness (open-sourced under MIT in August 2026) provides four operating modes [3]:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Standard Mode&lt;/strong&gt;: Balanced for general tasks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Code (PTC) Mode&lt;/strong&gt;: "Pure Training-free Collaboration" — designed for coding without requiring extensive agent training&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minimal Mode&lt;/strong&gt;: Lightweight, for constrained environments&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Creator Mode&lt;/strong&gt;: Optimized for generative and creative tasks&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The plugin architecture in DeepSeek Harness is noteworthy — every capability is a plugin, making the system extensible without modifying core logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code's Harness Philosophy
&lt;/h3&gt;

&lt;p&gt;Claude Code takes a different approach, optimizing for developer ergonomics:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Inline tool definitions&lt;/strong&gt; via &lt;code&gt;CLAUDE.md&lt;/code&gt; and &lt;code&gt;AGENTS.md&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Skills system&lt;/strong&gt; for extensible capabilities&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sub-agent orchestration&lt;/strong&gt; for parallel task execution&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hooks&lt;/strong&gt; for lifecycle events (pre-command, post-command, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: The harness is the architecture that turns a language model into an agent. Good harnesses are opinionated about what's allowed and provide clean abstractions for extensibility.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  8. Tools: The Agent's Hands
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Tools&lt;/strong&gt; are the interface between an AI agent and the external world. Without tools, an agent is just a very sophisticated text generator.&lt;/p&gt;

&lt;h3&gt;
  
  
  Types of Tools
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;File System Tools&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read, write, edit, delete files&lt;/li&gt;
&lt;li&gt;Execute shell commands&lt;/li&gt;
&lt;li&gt;Search within files&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Search &amp;amp; Retrieval Tools&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Web search for up-to-date information&lt;/li&gt;
&lt;li&gt;Code search within a repository&lt;/li&gt;
&lt;li&gt;Vector search for semantic retrieval&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;API Tools&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;HTTP requests to external services&lt;/li&gt;
&lt;li&gt;Database queries&lt;/li&gt;
&lt;li&gt;Cloud service integrations&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Development Tools&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Git operations (commit, push, branch)&lt;/li&gt;
&lt;li&gt;Build and test runners&lt;/li&gt;
&lt;li&gt;Linters and formatters&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Tool Definition: The Schema Problem
&lt;/h3&gt;

&lt;p&gt;Every tool needs a &lt;strong&gt;schema&lt;/strong&gt; — a machine-readable description of what the tool does, what inputs it expects, and what outputs it produces. This is harder than it sounds:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Too little detail → agent uses tool incorrectly&lt;/li&gt;
&lt;li&gt;Too much detail → agent gets confused by irrelevant parameters&lt;/li&gt;
&lt;li&gt;Ambiguous naming → agent picks the wrong tool&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where &lt;strong&gt;MCP (Model Context Protocol)&lt;/strong&gt; comes in — it's a standardized way to define and discover tools.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compact Tool Output
&lt;/h3&gt;

&lt;p&gt;A key challenge is &lt;strong&gt;compactness&lt;/strong&gt; — tool outputs (especially file system reads) can be enormous and quickly fill up the context window. Effective agents use strategies like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Truncation&lt;/strong&gt;: Only reading relevant portions of files&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summarization&lt;/strong&gt;: Compressing tool outputs before feeding them back&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Selective reading&lt;/strong&gt;: Only accessing files that are actually needed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delta-based approaches&lt;/strong&gt;: Operating only on changed files (as in tools like Scrut, a Python linter that only reviews changed code)&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Tools are how agents act. Designing good tool schemas — concise, accurate, and appropriately scoped — is one of the most practical skills in agent engineering.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  9. Hooks: The Agent's Reflexes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Hooks&lt;/strong&gt; are lifecycle callbacks that run at specific points in an agent's execution. They enable developers to intercept, validate, or modify agent behavior without changing the agent's core logic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Common Hook Points
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="err"&gt;pre_think&lt;/span&gt;    &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="err"&gt;Before&lt;/span&gt; &lt;span class="err"&gt;the&lt;/span&gt; &lt;span class="err"&gt;agent&lt;/span&gt; &lt;span class="err"&gt;starts&lt;/span&gt; &lt;span class="err"&gt;reasoning&lt;/span&gt;
&lt;span class="err"&gt;post_think&lt;/span&gt;   &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="err"&gt;After&lt;/span&gt; &lt;span class="err"&gt;reasoning,&lt;/span&gt; &lt;span class="err"&gt;before&lt;/span&gt; &lt;span class="err"&gt;acting&lt;/span&gt;
&lt;span class="err"&gt;pre_tool&lt;/span&gt;     &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="err"&gt;Before&lt;/span&gt; &lt;span class="err"&gt;a&lt;/span&gt; &lt;span class="err"&gt;tool&lt;/span&gt; &lt;span class="err"&gt;is&lt;/span&gt; &lt;span class="err"&gt;called&lt;/span&gt;
&lt;span class="err"&gt;post_tool&lt;/span&gt;    &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="err"&gt;After&lt;/span&gt; &lt;span class="err"&gt;a&lt;/span&gt; &lt;span class="err"&gt;tool&lt;/span&gt; &lt;span class="err"&gt;returns&lt;/span&gt;
&lt;span class="err"&gt;pre_response&lt;/span&gt; &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="err"&gt;Before&lt;/span&gt; &lt;span class="err"&gt;the&lt;/span&gt; &lt;span class="err"&gt;agent's&lt;/span&gt; &lt;span class="err"&gt;response&lt;/span&gt; &lt;span class="err"&gt;is&lt;/span&gt; &lt;span class="err"&gt;delivered&lt;/span&gt;
&lt;span class="err"&gt;post_response→&lt;/span&gt; &lt;span class="err"&gt;After&lt;/span&gt; &lt;span class="err"&gt;the&lt;/span&gt; &lt;span class="err"&gt;response&lt;/span&gt; &lt;span class="err"&gt;is&lt;/span&gt; &lt;span class="err"&gt;delivered&lt;/span&gt;
&lt;span class="err"&gt;on_error&lt;/span&gt;     &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="err"&gt;When&lt;/span&gt; &lt;span class="err"&gt;an&lt;/span&gt; &lt;span class="err"&gt;error&lt;/span&gt; &lt;span class="err"&gt;occurs&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Practical Uses
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Compliance &amp;amp; Safety&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check if a proposed command is destructive (&lt;code&gt;rm -rf&lt;/code&gt;, database drops)&lt;/li&gt;
&lt;li&gt;Validate that file changes don't violate project policies&lt;/li&gt;
&lt;li&gt;Block operations that touch sensitive directories&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Quality Gates&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Run linters before accepting code changes&lt;/li&gt;
&lt;li&gt;Enforce test coverage thresholds&lt;/li&gt;
&lt;li&gt;Verify formatting standards&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Observability&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Log all agent actions for audit trails&lt;/li&gt;
&lt;li&gt;Track which tools are used most&lt;/li&gt;
&lt;li&gt;Measure agent decision quality over time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Custom Routing&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Route certain requests to specialized sub-agents&lt;/li&gt;
&lt;li&gt;Switch models based on task complexity&lt;/li&gt;
&lt;li&gt;Apply different permission sets per task type&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Hooks vs. Hard Constraints
&lt;/h3&gt;

&lt;p&gt;Hooks are powerful because they're &lt;strong&gt;composable&lt;/strong&gt; — you can add, remove, and chain them without breaking the agent. But they work best for soft constraints. For hard safety guarantees, you need &lt;strong&gt;permission systems&lt;/strong&gt; (see below) that can't be bypassed by a hook.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Hooks are the nervous system of an agent framework. They let you inject custom logic at precisely the right moments — making agents behave intelligently without monolithic rewrites.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  10. Permission: The Security Layer
&lt;/h2&gt;

&lt;p&gt;If hooks are the agent's reflexes, &lt;strong&gt;permissions&lt;/strong&gt; are its immune system. Permissions define what an agent &lt;em&gt;cannot&lt;/em&gt; do, regardless of what it's asked to do.&lt;/p&gt;

&lt;h3&gt;
  
  
  Permission Models in Practice
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Path-Based Permissions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Whitelist specific directories the agent can access&lt;/li&gt;
&lt;li&gt;Block access to &lt;code&gt;.env&lt;/code&gt; files, credentials, private keys&lt;/li&gt;
&lt;li&gt;Scope the agent to a specific project or repository&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Action-Based Permissions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Allow file reads but block file deletes&lt;/li&gt;
&lt;li&gt;Allow git commits but block force pushes&lt;/li&gt;
&lt;li&gt;Allow API reads but block destructive writes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Capability-Based Permissions&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable/disable specific tools entirely&lt;/li&gt;
&lt;li&gt;Require human approval for high-risk operations&lt;/li&gt;
&lt;li&gt;Time-box agent sessions&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Principle of Least Privilege
&lt;/h3&gt;

&lt;p&gt;The best practice is to grant only the permissions needed for the specific task:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A code-review agent → read-only access, no file modifications&lt;/li&gt;
&lt;li&gt;A refactoring agent → file modifications within a specific directory&lt;/li&gt;
&lt;li&gt;A deployment agent → access to CI/CD systems but not source code&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the same principle that applies to human access control, and for good reason: agents, like humans, make mistakes. Permissions are the last line of defense.&lt;/p&gt;

&lt;h3&gt;
  
  
  Claude Code's Permission Model
&lt;/h3&gt;

&lt;p&gt;Claude Code implements a thoughtful permission model:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Files are read and written within the project directory by default&lt;/li&gt;
&lt;li&gt;Shell commands run in the project context&lt;/li&gt;
&lt;li&gt;Dangerous operations (network calls, system modifications) can be explicitly scoped&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;--verbose&lt;/code&gt; flag exposes what the agent is doing, enabling human oversight&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Permissions are not about distrust — they're about building reliable systems. An agent with appropriate permissions is an agent that can be trusted to be helpful.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  11. Skills: Extensible Agent Capabilities
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Skills&lt;/strong&gt; are packaged capabilities that extend what an agent can do. Think of them as plugins or skill packs that add domain-specific expertise.&lt;/p&gt;

&lt;h3&gt;
  
  
  What Skills Contain
&lt;/h3&gt;

&lt;p&gt;A skill typically includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instructions&lt;/strong&gt; (SKILL.md): How to use the skill, when to use it, and what it does&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tool definitions&lt;/strong&gt;: New tools specific to the skill&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prompts and templates&lt;/strong&gt;: Pre-written prompts for common tasks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Examples&lt;/strong&gt;: Few-shot examples demonstrating desired behavior&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Constraints&lt;/strong&gt;: Rules specific to this skill's domain&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Skill Examples
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Code Analysis Skills&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Security vulnerability detection&lt;/li&gt;
&lt;li&gt;Performance profiling&lt;/li&gt;
&lt;li&gt;Test coverage analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Domain Skills&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Database schema design&lt;/li&gt;
&lt;li&gt;API design review&lt;/li&gt;
&lt;li&gt;Accessibility auditing&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Integration Skills&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cloud provider specifics (AWS, GCP, Azure)&lt;/li&gt;
&lt;li&gt;CI/CD pipeline configuration&lt;/li&gt;
&lt;li&gt;Container orchestration (Kubernetes)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Skill Discovery Problem
&lt;/h3&gt;

&lt;p&gt;As the number of skills grows, &lt;strong&gt;skill discovery&lt;/strong&gt; becomes important. The agent needs to know which skill applies to a given task. This is typically solved through:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Skill metadata (description, tags, triggers)&lt;/li&gt;
&lt;li&gt;Semantic matching against task descriptions&lt;/li&gt;
&lt;li&gt;Explicit invocation by the developer&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Clawhub.ai and similar registries are emerging as the ecosystem for sharing and discovering agent skills.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Skills are how you specialize a general-purpose agent into an expert in your specific domain. A well-designed skill is self-contained, well-documented, and composable with other skills.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  12. Compact: Efficiency in Context
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Compact&lt;/strong&gt; refers to the practice of keeping the agent's context lean and efficient. It's not a feature — it's a discipline.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Context Window Problem
&lt;/h3&gt;

&lt;p&gt;Every LLM has a finite &lt;strong&gt;context window&lt;/strong&gt; — the total amount of text it can "see" at once (measured in tokens). Modern models offer 128K to 200K+ tokens, which sounds like a lot but fills up quickly:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A medium-sized codebase → tens of thousands of tokens&lt;/li&gt;
&lt;li&gt;A long conversation history → tens of thousands more&lt;/li&gt;
&lt;li&gt;Tool outputs and error messages → thousands more&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Research from Liu et al. ("Lost in the Middle") shows that models perform 20-30% worse when relevant information is buried in the middle of a long context [4]. The model literally "forgets" things in the middle.&lt;/p&gt;

&lt;h3&gt;
  
  
  Compactness Strategies
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Context Engineering&lt;/strong&gt; (as it was named in 2026) involves:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Selective file reading&lt;/strong&gt;: Only read files that are relevant to the current task&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delta-based operations&lt;/strong&gt;: Work on what changed, not what exists&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Summarization&lt;/strong&gt;: Compress large files or outputs into concise summaries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Chunking&lt;/strong&gt;: Break large files into relevant sections&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory offloading&lt;/strong&gt;: Store information outside the context window in a retrieval system&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Context Window Is a Cache
&lt;/h3&gt;

&lt;p&gt;A useful mental model: &lt;strong&gt;the context window is a cache, not a memory&lt;/strong&gt;. It's fast to access but limited in size. Long-term information should be stored in a proper memory system, not kept in context [5].&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Compactness is not about being stingy — it's about being effective. The best agents are not the ones with the most context; they're the ones with the &lt;em&gt;right&lt;/em&gt; context.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  13. Memory: The Agent's Long-Term Knowledge
&lt;/h2&gt;

&lt;p&gt;This is where most AI agents fail. &lt;strong&gt;Memory&lt;/strong&gt; is the system that allows an agent to persist information across sessions, learn from past interactions, and maintain continuity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why "Memory" Is a Misnomer
&lt;/h3&gt;

&lt;p&gt;Most AI agents don't actually have memory — they have &lt;strong&gt;context windows&lt;/strong&gt;. Each session starts fresh. The "memory" is just whatever you put in the prompt this time.&lt;/p&gt;

&lt;p&gt;True memory requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Persistence&lt;/strong&gt;: Information survives session boundaries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Retrieval&lt;/strong&gt;: Information can be found when relevant&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Relevance filtering&lt;/strong&gt;: Not everything needs to be remembered&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Learning&lt;/strong&gt;: Patterns should inform future behavior&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Memory Architecture Patterns
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Explicit Memory Files&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store key decisions, project conventions, and user preferences in structured files&lt;/li&gt;
&lt;li&gt;Example: &lt;code&gt;CLAUDE.md&lt;/code&gt;, &lt;code&gt;AGENTS.md&lt;/code&gt; in Claude Code&lt;/li&gt;
&lt;li&gt;Pros: Simple, transparent, version-controllable&lt;/li&gt;
&lt;li&gt;Cons: Requires manual organization&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Vector Memory&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Store conversation chunks and code snippets as embeddings&lt;/li&gt;
&lt;li&gt;Retrieve semantically similar content when relevant&lt;/li&gt;
&lt;li&gt;Pros: Automatic, captures nuance&lt;/li&gt;
&lt;li&gt;Cons: Can return irrelevant results, expensive to index&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Semantic Memory Systems&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extract structured facts from interactions&lt;/li&gt;
&lt;li&gt;Maintain a "knowledge graph" of what the agent knows about the project&lt;/li&gt;
&lt;li&gt;Pros: Precise retrieval, reasoning-capable&lt;/li&gt;
&lt;li&gt;Cons: Complex to build and maintain&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  The Learning vs. Storing Problem
&lt;/h3&gt;

&lt;p&gt;The most insightful framing comes from the "Learn, Don't Store" methodology: most agents today &lt;strong&gt;remember everything and learn nothing&lt;/strong&gt;. A better approach is to actively extract patterns and principles rather than storing raw transcripts.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;❌ Bad memory: "User asked me to refactor component X on March 15"&lt;/li&gt;
&lt;li&gt;✅ Good memory: "Project convention: always use functional components with hooks"&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Memory is the hardest unsolved problem in AI agents. The difference between a tool that remembers and one that truly learns is whether it can extract actionable patterns from experience.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  14. Sub-Agents: Parallel Problem Solvers
&lt;/h2&gt;

&lt;p&gt;When a task is too complex for a single agent, &lt;strong&gt;sub-agents&lt;/strong&gt; (also called &lt;strong&gt;delegates&lt;/strong&gt; or &lt;strong&gt;child agents&lt;/strong&gt;) divide the work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Sub-Agent Patterns
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Fanout Pattern&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A parent agent breaks a task into independent subtasks&lt;/li&gt;
&lt;li&gt;Multiple sub-agents work on them in parallel&lt;/li&gt;
&lt;li&gt;Parent synthesizes results&lt;/li&gt;
&lt;li&gt;Best for: parallel research, multi-file refactoring, simultaneous analysis&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Pipeline Pattern&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Tasks are strictly sequential&lt;/li&gt;
&lt;li&gt;Each sub-agent's output feeds into the next&lt;/li&gt;
&lt;li&gt;Best for: multi-step transformations (code → test → review → deploy)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Hierarchical Pattern&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A supervisor agent delegates to specialist agents&lt;/li&gt;
&lt;li&gt;Specialist agents may further delegate&lt;/li&gt;
&lt;li&gt;Best for: complex projects with distinct domains (frontend, backend, DevOps)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Sub-Agent Architecture: Context Explosion
&lt;/h3&gt;

&lt;p&gt;The biggest challenge with sub-agents is &lt;strong&gt;context explosion&lt;/strong&gt;. Each sub-agent needs relevant context to do its job, but providing too much context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slows down individual agents&lt;/li&gt;
&lt;li&gt;Risks information leakage between agents&lt;/li&gt;
&lt;li&gt;Increases cost exponentially&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Effective sub-agent design uses &lt;strong&gt;context isolation&lt;/strong&gt; — each sub-agent gets only the information it needs, not the full project context.&lt;/p&gt;

&lt;h3&gt;
  
  
  Delegation Runtime
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;delegation runtime&lt;/strong&gt; handles the mechanics of sub-agent management: spawning agents, routing tasks, collecting results, handling errors, and managing concurrency. Claude Code's architecture, for example, allows sub-agents to be spawned with isolated contexts or forked contexts depending on whether they need the parent's conversation history.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: Sub-agents are about leverage — one human can orchestrate many specialized agents. The skill is knowing when to split work and how to keep each sub-agent focused.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  15. MCP: The Model Context Protocol
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;MCP (Model Context Protocol)&lt;/strong&gt; is the emerging standard for connecting AI models to external tools and data sources. Developed by Anthropic and now adopted broadly, MCP provides a standardized interface for tool discovery, invocation, and data exchange.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why MCP Was Needed
&lt;/h3&gt;

&lt;p&gt;Before MCP, every agent framework defined tools differently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Different schemas, different formats, different discovery mechanisms&lt;/li&gt;
&lt;li&gt;Tools couldn't be shared between frameworks&lt;/li&gt;
&lt;li&gt;Developers had to reimplement tool integrations for each platform&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MCP solves this by providing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A standard protocol&lt;/strong&gt; for tool definition and invocation&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A discovery mechanism&lt;/strong&gt; so agents can find available tools&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A schema format&lt;/strong&gt; for describing tool inputs and outputs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A transport layer&lt;/strong&gt; for communication (typically stdio or HTTP)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  MCP Architecture
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────┐     MCP      ┌──────────────┐
│  AI Agent   │◄────────────►│ MCP Host     │
└─────────────┘              │ (your app)   │
                             └──────┬───────┘
                                    │ MCP
                              ┌─────▼─────┐
                              │ MCP Server│
                              │ (plugin)  │
                              └─────┬─────┘
                                    │ native
                              ┌─────▼─────┐
                              │File/DB/API│
                              └───────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;MCP Host&lt;/strong&gt; (your application) runs MCP Servers (plugins) that connect to actual resources (files, databases, APIs). The AI agent talks to the host via MCP, without needing to know how the underlying systems work.&lt;/p&gt;

&lt;h3&gt;
  
  
  MCP in Practice
&lt;/h3&gt;

&lt;p&gt;Common MCP servers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Filesystem&lt;/strong&gt;: Read/write/search files&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Git&lt;/strong&gt;: Git operations and repository analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Database&lt;/strong&gt;: SQL queries and schema inspection&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Search&lt;/strong&gt;: Web search and documentation lookup&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Slack/Discord&lt;/strong&gt;: Messaging and notifications&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The power of MCP is that it's &lt;strong&gt;composable&lt;/strong&gt; — you can run multiple MCP servers simultaneously, giving your agent access to a diverse set of capabilities through a unified interface.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Key takeaway&lt;/strong&gt;: MCP is the USB-C of AI tooling. It standardizes how agents connect to the outside world, making the entire ecosystem more interoperable and extensible.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  16. The Full Picture: How It All Connects
&lt;/h2&gt;

&lt;p&gt;Here's the complete evolutionary chain:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Transformer + Attention
        ↓
  Pre-Training (raw knowledge)
        ↓
  Post-Training (alignment, behavior)
        ↓
  ChatGPT (proof of concept, consumer product)
        ↓
  React Pattern (human-in-the-loop assistance)
        ↓
  Agentic AI (autonomous goal pursuit)
        ↓
  ┌─────────────────────────────────┐
  │  Harness (orchestration layer)  │
  │  ├── Tools (capabilities)       │
  │  ├── Hooks (lifecycle events)   │
  │  ├── Permission (security)      │
  │  └── Skills (extensibility)     │
  ├─────────────────────────────────┤
  │  Compact (context efficiency)   │
  │  Memory (persistence &amp;amp; learning)│
  │  Sub-Agents (parallelization)   │
  │  MCP (standardized integration) │
  └─────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each layer exists because the layer above it hit a limitation. You can't have useful agents without good harnesses. You can't have effective harnesses without well-defined tools. You can't have reliable tools without compact, well-managed context. And you can't have any of this without the Transformer foundation.&lt;/p&gt;




&lt;h2&gt;
  
  
  17. Where This Is Going
&lt;/h2&gt;

&lt;p&gt;The trajectory is clear:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Foundation models will keep improving&lt;/strong&gt; — better reasoning, longer contexts, lower costs&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agents will become more reliable&lt;/strong&gt; — better error recovery, stronger safety guarantees, clearer boundaries&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory will get smarter&lt;/strong&gt; — from storing everything to actively learning patterns&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP will become ubiquitous&lt;/strong&gt; — the standard for tool integration across frameworks&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The human role will shift&lt;/strong&gt; — from writing code to orchestrating agents and validating outputs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The developers who thrive in this new paradigm won't be the ones who resist AI tooling. They'll be the ones who understand the stack deeply enough to build on it, extend it, and debug it when it breaks.&lt;/p&gt;




&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;p&gt;[1] Vaswani, A., et al. "Attention Is All You Need." &lt;em&gt;NeurIPS 2017&lt;/em&gt;. &lt;a href="https://arxiv.org/abs/1706.03762" rel="noopener noreferrer"&gt;https://arxiv.org/abs/1706.03762&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[2] Kaplan, J., et al. "Scaling Laws for Neural Language Models." &lt;em&gt;arXiv 2020&lt;/em&gt;. &lt;a href="https://arxiv.org/abs/2001.08361" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2001.08361&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[3] Rohit Raj. "DeepSeek Harness vs Claude Code vs Codex CLI: The v0.1 Developer Preview, Honestly — 2026." &lt;em&gt;DEV Community&lt;/em&gt;. &lt;a href="https://dev.to/rohit_raj_8c7902b7d37cf21/deepseek-harness-vs-claude-code-vs-codex-cli-the-v01-developer-preview-honestly-2026-433e"&gt;https://dev.to/rohit_raj_8c7902b7d37cf21/deepseek-harness-vs-claude-code-vs-codex-cli-the-v01-developer-preview-honestly-2026-433e&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[4] Liu, N. F., et al. "Lost in the Middle: How Language Models Use Long Contexts." &lt;em&gt;arXiv 2024&lt;/em&gt;. &lt;a href="https://arxiv.org/abs/2407.01073" rel="noopener noreferrer"&gt;https://arxiv.org/abs/2407.01073&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;[5] Loop &amp;amp; Retry. "The context window is a cache, not a memory." &lt;em&gt;DEV Community&lt;/em&gt;. &lt;a href="https://dev.to/loopandretry/the-context-window-is-a-cache-not-a-memory-29f8"&gt;https://dev.to/loopandretry/the-context-window-is-a-cache-not-a-memory-29f8&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;em&gt;This article is written for developers who want to understand the full AI-assisted programming stack, not just the parts they already use. Bookmark it, share it, and come back when you need to understand how the next piece fits in.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>programming</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>agent-authz: Least-Privilege Authorization for AI Agent Tool Calls</title>
      <dc:creator>Sanya</dc:creator>
      <pubDate>Sun, 16 Aug 2026 14:55:42 +0000</pubDate>
      <link>https://dev.to/sanyaduan/agent-authz-least-privilege-authorization-for-ai-agent-tool-calls-4889</link>
      <guid>https://dev.to/sanyaduan/agent-authz-least-privilege-authorization-for-ai-agent-tool-calls-4889</guid>
      <description>&lt;p&gt;&lt;strong&gt;OPA is general. SPIFFE answers "who." Neither answers the question every agent deployment eventually hits: "is &lt;em&gt;this&lt;/em&gt; agent allowed to call &lt;em&gt;this&lt;/em&gt; tool with &lt;em&gt;these&lt;/em&gt; arguments — right now?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;agent-authz&lt;/code&gt; is a small, auditable Python policy engine built for exactly that question. It is not a general policy engine, and that's the point.&lt;/p&gt;




&lt;h2&gt;
  
  
  The gap
&lt;/h2&gt;

&lt;p&gt;Agent frameworks (LangChain, AutoGen, CrewAI, DeepSeek Harness, MCP servers) &lt;strong&gt;trust tool calls by default&lt;/strong&gt;. A prompt-injected agent — or simply an over-eager one — can call any tool with any arguments.&lt;/p&gt;

&lt;p&gt;Meanwhile the identity/authorization toolbox has a hole in the middle:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Answers&lt;/th&gt;
&lt;th&gt;Doesn't answer&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SPIFFE/SPIRE&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"who is this workload?"&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"which tools may it call?"&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;OPA&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"any policy you can write in Rego"&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"tool calls, as a first-class concept"&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Framework &lt;code&gt;allowlist&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"which tool names?"&lt;/em&gt;&lt;/td&gt;
&lt;td&gt;&lt;em&gt;"with what argument scope?"&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;agent-authz&lt;/code&gt; fills the middle. Four design choices carry the whole thing.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. Three-state decisions: allow / deny / &lt;strong&gt;ask&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;OPA is binary. Real agent operations need a third state — &lt;strong&gt;human-in-the-loop&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;allow&lt;/code&gt; — in scope, let it through.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;deny&lt;/code&gt; — fail-closed. Unknown agent, unknown tool, out-of-scope args → deny. Explicit deny always wins.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ask&lt;/code&gt; — &lt;em&gt;"this hits the customers table"&lt;/em&gt; isn't forbidden, but a human should sign off.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The matching order is deliberately &lt;strong&gt;ask → allow → action → default deny&lt;/strong&gt;. The decision maps cleanly onto existing approval surfaces (DSH's &lt;code&gt;ctx.approval&lt;/code&gt;, LangChain human tools, MCP's approval flow).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agent_authz&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PolicyEngine&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;load_policy&lt;/span&gt;

&lt;span class="n"&gt;engine&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PolicyEngine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;load_policy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;policy.yaml&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;engine&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;evaluate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;agent_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;billing-agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sql_query&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;args_text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT * FROM customers&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decision&lt;/span&gt;  &lt;span class="c1"&gt;# Decision.ASK  → route to human approval
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. YAML, not Rego — but with &lt;em&gt;semantic&lt;/em&gt; constraints
&lt;/h2&gt;

&lt;p&gt;The base layer is declarative YAML with glob arg-scoping:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deny&lt;/span&gt;

&lt;span class="na"&gt;agents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;billing-agent"&lt;/span&gt;
    &lt;span class="na"&gt;spiffe_id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;spiffe://acme.com/agents/billing"&lt;/span&gt;
    &lt;span class="na"&gt;tools&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;read_file"&lt;/span&gt;
        &lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;src/**"&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sql_query"&lt;/span&gt;
        &lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;FROM&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;billing**"&lt;/span&gt;
        &lt;span class="na"&gt;ask&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;**FROM&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;customers**"&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;bash"&lt;/span&gt;
        &lt;span class="na"&gt;action&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;deny&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But glob can only pattern-match strings. It can't express &lt;em&gt;"only SELECT, only the billing table, at most 100 rows."&lt;/em&gt; So &lt;code&gt;agent-authz&lt;/code&gt; adds &lt;strong&gt;structured constraints&lt;/strong&gt; on top of glob — semantic narrowing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;sql_query"&lt;/span&gt;
        &lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**"&lt;/span&gt;
        &lt;span class="na"&gt;constraints&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;sql&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;verbs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;SELECT"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;      &lt;span class="c1"&gt;# only SELECT&lt;/span&gt;
            &lt;span class="na"&gt;tables&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;billing"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;    &lt;span class="c1"&gt;# only this table&lt;/span&gt;
            &lt;span class="na"&gt;max_rows&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100&lt;/span&gt;          &lt;span class="c1"&gt;# no LIMIT, or LIMIT &amp;gt; 100 → deny&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http_request"&lt;/span&gt;
        &lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;**"&lt;/span&gt;
        &lt;span class="na"&gt;constraints&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;http&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
            &lt;span class="na"&gt;methods&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;GET"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
            &lt;span class="na"&gt;hosts&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;api.acme.com"&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;*.internal"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
            &lt;span class="na"&gt;path_prefixes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/v1/"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
            &lt;span class="na"&gt;schemes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;https"&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Constraint violations force DENY and land in &lt;code&gt;result.violations&lt;/code&gt; for audit. Constraint types are a registry — SQL and HTTP ship today, file/other narrowers plug in trivially.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Framework-agnostic core, three deployment shapes
&lt;/h2&gt;

&lt;p&gt;The engine is pure Python (stdlib + PyYAML). It deploys three ways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;In-process&lt;/strong&gt; — &lt;code&gt;ToolCallGuard&lt;/code&gt; wraps execution for LangChain / AutoGen / CrewAI. Adapters throw &lt;code&gt;PermissionDeniedError&lt;/code&gt; (deny) or &lt;code&gt;NeedsApprovalError&lt;/code&gt; (ask) so the host framework's error path handles it natively.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP sidecar&lt;/strong&gt; — a zero-dependency &lt;code&gt;http.server&lt;/code&gt; exposes &lt;code&gt;POST /authorize&lt;/code&gt;, so a Node/TS stack (DeepSeek Harness) bridges to the &lt;em&gt;same&lt;/em&gt; Python engine over HTTP. No dual-language implementation drift.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MCP gateway&lt;/strong&gt; — a stdio transparent proxy that sits between an MCP client and MCP server, intercepting every JSON-RPC message: &lt;code&gt;tools/list&lt;/code&gt; is filtered (agents never even &lt;em&gt;see&lt;/em&gt; tools they can't use), &lt;code&gt;tools/call&lt;/code&gt; is authorized, the rest passes through.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   Agent Framework (LangChain / AutoGen / CrewAI / DSH / MCP)
        │  tool call (agent_id, tool, args)
        ▼
 ┌──────────────────────────────────┐
 │  agent-authz Engine              │  ← YAML policy + glob + constraints
 │  allow / deny / ask              │
 └──────────────────────────────────┘
        │  decision + OCSF audit event
        ▼
    SIEM (Splunk ES, etc.)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Identity-first, with audit out of the box
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;SPIFFE identity&lt;/strong&gt;: policy keys off &lt;code&gt;spiffe_id&lt;/code&gt;. Beyond string parsing, it ships an &lt;strong&gt;issuer&lt;/strong&gt; that mints stable, spec-compliant SPIFFE IDs per agent and binds them into policy — the "AI Identity governance" pattern Okta is pushing, where machine identities are first-class citizens. And a &lt;strong&gt;SPIRE client&lt;/strong&gt; (&lt;code&gt;spire_client.py&lt;/code&gt;) that fetches the live X.509-SVID from the Workload API, with a swappable fetcher so it stays zero-hard-dependency.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;agent_authz&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SpiffeIssuer&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;load_policy&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bind_to_policy&lt;/span&gt;

&lt;span class="n"&gt;policy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;load_policy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;policy.yaml&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;issuer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SpiffeIssuer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;acme.com&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;ident&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;issuer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;issue&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;billing-agent&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;      &lt;span class="c1"&gt;# spiffe://acme.com/agent/billing-agent
&lt;/span&gt;&lt;span class="nf"&gt;bind_to_policy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ident&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;policy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;              &lt;span class="c1"&gt;# identity → permission binding
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;OCSF audit&lt;/strong&gt;: every decision emits an OCSF-compatible event (&lt;code&gt;category_uid=3&lt;/code&gt;, &lt;code&gt;activity_id&lt;/code&gt; 1=Allow / 2=Deny / 3=Pending), streamable straight into a SIEM. On top of OCSF sits a &lt;strong&gt;NOOA namespace adapter&lt;/strong&gt; — because as of this writing NVIDIA's NOOA framework hasn't published a finalized audit schema, the mapping is isolated behind &lt;code&gt;to_nooa()&lt;/code&gt; so the engine core never changes when the standard lands.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What it is not
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Not a replacement for SPIRE — it &lt;em&gt;trusts&lt;/em&gt; SPIRE-verified identity and never forges SVIDs.&lt;/li&gt;
&lt;li&gt;Not a general policy engine — if you need arbitrary Rego over arbitrary data, use OPA.&lt;/li&gt;
&lt;li&gt;Not a sandbox — it's a decision layer; actual execution isolation belongs to the runtime.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why it matters
&lt;/h2&gt;

&lt;p&gt;The sharpest question in agent security isn't &lt;em&gt;what can an agent do&lt;/em&gt;, but &lt;strong&gt;what is it actually allowed to do, on every single call&lt;/strong&gt; — with a trail. &lt;code&gt;agent-authz&lt;/code&gt; is that layer: 94 tests, zero heavy dependencies, three deployment shapes, identity and audit built in.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Apache-2.0. Try it: &lt;code&gt;pip install -e .&lt;/code&gt;, then &lt;code&gt;python -m agent_authz.cli validate -p examples/policy.yaml&lt;/code&gt;.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>security</category>
      <category>ai</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
