[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-732950-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-732950-en":130,"doc-similar-732950":162},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","building-an-agent-harness-how-to-build-your-own","Building an Agent Harness - How to Build Your Own","","A companion handout explaining how Claude Code works as an agent system, organized around a single agent loop and five harness components. It teaches readers what a harness is, how the loop generates task backlogs through a core operating rule, and how these ideas map to the practical features observed in Claude Code. The guide then provides a structured five-step method to build an equivalent harness, including a verification loop, tools and guardrails, failure reading, and loop self-construction, supported by reference materials.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/building-an-agent-harness-how-to-build-your-own/732950/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/building-an-agent-harness-how-to-build-your-own/732950.png","ImageObject",300,407,{"name":42,"@type":43},"miaandmiso","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-26","2026-11-22",true,{"@type":52,"interactionType":53,"userInteractionCount":26},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What is an agent harness and what purpose does it serve in Claude Code?","Question",{"text":62,"@type":63},"The handout defines a harness as the structure that controls how an agent reads context, plans work, acts, and verifies outcomes. Claude Code’s observed behavior is explained by mapping it to its harness components and operating rule.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"What are the five components of the harness?",{"text":67,"@type":63},"The contents identify five components that together implement the agent loop. Part A lists the components conceptually, while Part B maps each Claude Code feature to one of the five components.",{"name":69,"@type":60,"acceptedAnswer":70},"How can you build your own harness step by step?",{"text":71,"@type":63},"Part C provides five steps: write the system of record, build a verification loop, add tools and guardrails, read failures, and then build the loop yourself so it can run a real workflow unattended.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},732950,1795383050,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":26,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":79,"read_time":144,"preview_page_count":33,"preview_urls":145},7971478544854,"https://ap-avatar.wpscdn.com/davatar_994ba38a5ba835b3df7d355c54d3ed8d","Building an Agent Harness  \nHow Claude Code Works—and How to Build Your Own  \nA Companion Handout—one loop, five components  \nunderstand the loop you have been using · map Claude Code to its five components · configure it on purpose ·  \nwrite a harness of your own  \nY O U R I N S T R U C T O R S  \nMuhammad Arif Butt, PhD  \nAssistant Professor  \nDepartment of Data Science, FCIT University of the Punjab, Lahore  \nMuhammad Rauf Butt  \nAssistant Professor  \nDepartment of Computer Science  \nForman Christian College (A Chartered University), Lahore  \nCourse context: Generative and Agentic AI—MS Data Science · Companion to the Claude Code lectures  \nTable of Contents  \nHow to Use This Handout ..............................................................................................................................3  \nPart A · Foundations ......................................................................................................................................5  \n1. What a harness is ................................................................................................................................5  \n2. The agent loop.....................................................................................................................................6  \n3. The five components ...........................................................................................................................7  \n4. The one rule that generates your backlog ..........................................................................................8  \nPart B · Inside Claude Code ..........................................................................................................................9  \n5. The system of [record: CLAUDE.md....................................................................................................9](record: CLAUDE.md....................................................................................................9)  \n[6](6). Tools and permissions ...................................................................................................................... 10  \n7. Hooks: the feedback loop made deterministic .................................................................................. 12  \n8. Context, memory and observability ................................................................................................... 14  \nPart C · Build Your Own Harness ................................................................................................................ 16  \n9. Step 1—Write the system of record ................................................................................................ 16  \n10. Step 2—Build the verification loop ................................................................................................ 18  \n11. Step 3—Tools and guardrails ........................................................................................................20  \n12. Step 4—Read your failures ...........................................................................................................21  \n13. Step 5—Build the loop yourself .....................................................................................................23  \nPart D · Reference .......................................................................................................................................28  \n14. The four failure modes ....................................................................................................................28  \n15. Harness self-audit ...........................................................................................................................28  \n16. Reading list ......................................................................................................................................29  \n17. Glossary ...............................................................................................","cbCaicFhaAUbii27","https://ap.wps.com/l/cbCaicFhaAUbii27","pdf",564546,31,"English","# How to Use This Handout\n# Part A · Foundations\n## 1. What a harness is\n## 2. The agent loop\n## 3. The five components\n## 4. The one rule that generates your backlog\n# Part B · Inside Claude Code\n## 5. The system of record\n## 6. Tools and permissions\n## 7. Hooks: the feedback loop made deterministic\n## 8. Context, memory and observability\n# Part C · Build Your Own Harness\n## 9. Step 1—Write the system of record\n## 10. Step 2—Build the verification loop\n## 11. Step 3—Tools and guardrails\n## 12. Step 4—Read your failures\n## 13. Step 5—Build the loop yourself\n# Part D · Reference\n## 14. The four failure modes\n## 15. Harness self-audit\n## 16. Reading list\n## 17. Glossary","[{\"question\":\"What is an agent harness and what purpose does it serve in Claude Code?\",\"answer\":\"The handout defines a harness as the structure that controls how an agent reads context, plans work, acts, and verifies outcomes. Claude Code’s observed behavior is explained by mapping it to its harness components and operating rule.\"},{\"question\":\"What are the five components of the harness?\",\"answer\":\"The contents identify five components that together implement the agent loop. Part A lists the components conceptually, while Part B maps each Claude Code feature to one of the five components.\"},{\"question\":\"How can you build your own harness step by step?\",\"answer\":\"Part C provides five steps: write the system of record, build a verification loop, add tools and guardrails, read failures, and then build the loop yourself so it can run a real workflow unattended.\"}]","Building an Agent Harness - How to Build Your Own | PDF",78,[146,150,154,158],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/97dadb8bc4f11139c2a063afee49370e.webp",983,1272,{"page_no":26,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/68a740bed1341b10866a38508000f0ce.webp",982,1270,{"page_no":30,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/2b9d8156aa91c6018c41867984ab11d8.webp",981,1269,{"page_no":33,"url":159,"width":160,"height":161},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/627e994aedb56da4546a10e7cb487802.webp",980,1268,{"list":163,"token":11},[164,170,176,182,188,194,200,207,214,221],{"doc_id":165,"doc_title":166,"file_type":137,"home_preview_img_url":167,"slug":168,"view_count":96,"category_name":29,"create_tm":169},696836,"Harness Engineering - A Design Guide to Claude Code","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230009178486/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=D8VN7gbcI3kzIAsLWiyMKn%2BXbzU%3D","harness-engineering-a-design-guide-to-claude-code",1794435025,{"doc_id":171,"doc_title":172,"file_type":137,"home_preview_img_url":173,"slug":174,"view_count":30,"category_name":29,"create_tm":175},732947,"How to AI an AI for Almost Anything - Lecture 5 - Harness Engineering","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031781390/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=iHxrb4pU1dZ5itjc8AH5RDqZ0Lc%3D","how-to-ai-an-ai-for-almost-anything-lecture-5-harness-engineering",1795383041,{"doc_id":177,"doc_title":178,"file_type":137,"home_preview_img_url":179,"slug":180,"view_count":33,"category_name":29,"create_tm":181},733000,"Build AI Multi-Agent with Claude Code - Course Outline","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031415117/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=jdZGWfT06HjVkh5%2B%2FArJtO%2FfSbo%3D","build-ai-multi-agent-with-claude-code-course-outline",1795383252,{"doc_id":183,"doc_title":184,"file_type":137,"home_preview_img_url":185,"slug":186,"view_count":22,"category_name":29,"create_tm":187},759781,"Bring Your Own Model - GitHub Copilot with Microsoft Foundry, OpenRouter and Local LLMs","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044483876/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=JXAZLeQKbS7sccpTOQz8ewGZjTI%3D","bring-your-own-model-github-copilot-with-microsoft-foundry-openrouter-and-local-llms",1795894679,{"doc_id":189,"doc_title":190,"file_type":137,"home_preview_img_url":191,"slug":192,"view_count":30,"category_name":29,"create_tm":193},732978,"Opus 4.7 Trading Bot - Setup Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031781775/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=1z%2FziDgCt%2FIyaSZLLdG2LXhPvUs%3D","opus-47-trading-bot-setup-guide",1795383155,{"doc_id":195,"doc_title":196,"file_type":137,"home_preview_img_url":197,"slug":198,"view_count":123,"category_name":29,"create_tm":199},733005,"The Claude Code Playbook - Edition 2026","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031782331/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=VAC2ut0VjzFI9Fl01PzIC9OdIHc%3D","the-claude-code-playbook-edition-2026",1795383306,{"doc_id":201,"doc_title":202,"file_type":137,"home_preview_img_url":203,"slug":204,"view_count":205,"category_name":29,"create_tm":206},701270,"Claude-Code-Architect-Handbook-2026 - Foundations Handbook - Comprehensive Preparation Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012064908/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=%2F3myrFew5a4560UzJ14nVzyQzuA%3D","claude-code-architect-handbook-2026-foundations-handbook-comprehensive-preparation-guide",22,1794525282,{"doc_id":208,"doc_title":209,"file_type":137,"home_preview_img_url":210,"slug":211,"view_count":212,"category_name":29,"create_tm":213},115355,"Claude AI Bible - The Complete Guide to Mastering Claude, Claude Code, Claude Cowork, MCP, AI Agents, Automation & Advanced Prompting","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229831893665/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=qA5BEfTx%2BJ4oUK9xifiEhtxc4fU%3D","claude-ai-bible-the-complete-guide-to-mastering-claude-claude-code-claude-cowork-mcp-ai-agents-automation-advanced-prompting",912,1785472614,{"doc_id":215,"doc_title":216,"file_type":137,"home_preview_img_url":217,"slug":218,"view_count":219,"category_name":29,"create_tm":220},687614,"Working with Claude Field Guide - How to Put AI Agents to Work Across Your Organization","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230001262893/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=fisWifGmaZZDN8QiZzfu8Dqhl%2FI%3D","working-with-claude-field-guide-how-to-put-ai-agents-to-work-across-your-organization",17,1794084300,{"doc_id":222,"doc_title":223,"file_type":137,"home_preview_img_url":224,"slug":225,"view_count":96,"category_name":29,"create_tm":226},701274,"Ruflo Setup Guide - Ruflo Setup Guide - How to install and use","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230012064930/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109239&Signature=DTEY9jeFpvUooSsX9unFs9m%2FDPM%3D","ruflo-setup-guide-ruflo-setup-guide-how-to-install-and-use",1794525293]