{"id":17307,"date":"2026-02-23T01:15:13","date_gmt":"2026-02-23T01:15:13","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=17307"},"modified":"2026-02-23T01:15:14","modified_gmt":"2026-02-23T01:15:14","slug":"implementation-of-all-five-canonical-agentic-workflow-patterns-in-mshell","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2026\/02\/23\/implementation-of-all-five-canonical-agentic-workflow-patterns-in-mshell\/","title":{"rendered":"Implementation of all five canonical agentic workflow patterns in mshell"},"content":{"rendered":"\n<p>This diagram illustrates the complete implementation of all five canonical agentic workflow patterns in mshell, a polyglot AI-and-mathematics powered shell environment that combines: 7 programming languages (Bash, Python, C, C++, Rust, Go, Lua), 3 LLM vendor backends (Ollama, Claude, OpenAI or connecting throw llm linux evaluation framework), up to 3 different models active simultaneously within a single workflow, direct execution of pre-written code blocks in any supported language, and native mshell commands \u2014 all orchestrated from plain Markdown documents.<br>Pattern 1 \u2014 Prompt Chaining shows a sequential pipeline where language blocks and LLM calls alternate, each step consuming the previous output via &lt;var and producing the next via >var. Different models (@1, @2, @3) can be assigned to different steps in the same chain.<br>Pattern 2 \u2014 Routing demonstrates LLM-driven conditional branching: a router model classifies the task and emits a single keyword; the if=var:value fence attribute gates execution so only the matching language branch runs.<br>Pattern 3 \u2014 Parallelization is the newest addition: the async fence attribute triggers a fork(), launching the block in a child process. Results are written to uniquely named temp files (keyed by parent\/child PID pair) and collected at an await=var1,var2 barrier via waitpid(). Writes to the shared session context (\/tmp\/mshell_ctx_&lt;pid>\/) are protected by flock().<br>Pattern 4 \u2014 Evaluator-Optimizer implements iterative refinement via &lt;!&#8211;@loop max=N until=var:value&#8211;> \/ &lt;!&#8211;@end_loop&#8211;>. A generator model produces output, an evaluator model scores it, and the loop continues until the verdict matches the expected value or the safety cap is reached.<br>Pattern 5 \u2014 Orchestrator uses &lt;!&#8211;@Nx_md&#8211;> to have an LLM generate a complete Markdown document at runtime, which is then executed recursively by parse_and_execute_markdown(). The subtask structure is entirely dynamic \u2014 unknown at authoring time.<br>The Full Pipeline at the bottom shows all five patterns composing naturally in a single .md document, sharing session state through the context directory.<br>Because mshell supports all five patterns natively in plain Markdown \u2014 across seven programming languages, multiple LLM vendors and models, executable code blocks, and native shell commands \u2014 it serves as a universal agentic execution environment requiring no external orchestration framework and supporting all five canonical agentic workflow patterns.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"565\" src=\"https:\/\/www.appservgrid.com\/paw92\/wp-content\/uploads\/2026\/02\/mshell-all-five-agentic-patterns-1024x565.jpg\" alt=\"\" class=\"wp-image-17308\" srcset=\"https:\/\/www.appservgrid.com\/paw92\/wp-content\/uploads\/2026\/02\/mshell-all-five-agentic-patterns-1024x565.jpg 1024w, https:\/\/www.appservgrid.com\/paw92\/wp-content\/uploads\/2026\/02\/mshell-all-five-agentic-patterns-300x165.jpg 300w, https:\/\/www.appservgrid.com\/paw92\/wp-content\/uploads\/2026\/02\/mshell-all-five-agentic-patterns-768x424.jpg 768w, https:\/\/www.appservgrid.com\/paw92\/wp-content\/uploads\/2026\/02\/mshell-all-five-agentic-patterns.jpg 1289w\" sizes=\"auto, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>This diagram illustrates the complete implementation of all five canonical agentic workflow patterns in mshell, a polyglot AI-and-mathematics powered shell environment that combines: 7 programming languages (Bash, Python, C, C++, Rust, Go, Lua), 3 LLM vendor backends (Ollama, Claude, OpenAI or connecting throw llm linux evaluation framework), up to 3 different models active simultaneously within &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2026\/02\/23\/implementation-of-all-five-canonical-agentic-workflow-patterns-in-mshell\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Implementation of all five canonical agentic workflow patterns in mshell&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-17307","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/17307","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=17307"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/17307\/revisions"}],"predecessor-version":[{"id":17309,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/17307\/revisions\/17309"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=17307"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=17307"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=17307"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}