<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by cch on Medium]]></title>
        <description><![CDATA[Stories by cch on Medium]]></description>
        <link>https://medium.com/@CCH0?source=rss-59048ef95a0b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by cch on Medium</title>
            <link>https://medium.com/@CCH0?source=rss-59048ef95a0b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 04:44:44 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@CCH0/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Central/Worker Pattern for Local Coding Agents, Each With Its Own Stack]]></title>
            <link>https://medium.com/@CCH0/a-central-worker-pattern-for-local-coding-agents-each-with-its-own-stack-74676a7abbe5?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/74676a7abbe5</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[tmux]]></category>
            <category><![CDATA[multi-agent-systems]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Mon, 19 Oct 2026 04:21:01 GMT</pubDate>
            <atom:updated>2026-10-19T04:21:01.445Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A central agent dispatches work to worker agents, each in its own disposable Linux machine with its own git worktree and its own independent Docker stack.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kOc5RtwpL3n2a_VV_0z43w.jpeg" /></figure><h3>The problem</h3><p>I wanted to hand a coding agent a feature or a bug fix and let it work — implement, run the stack, test against it — while I kept doing other things, including starting another one on a different feature. Two things kept getting in the way:</p><ol><li><strong>One dev environment, many agents.</strong> My project’s dev environment is a Docker Compose stack: fixed ports, fixed container names, a shared .env. Run a second agent against a second branch, in a second clone, and both want the same ports and the same container names. One of them loses.</li><li><strong>Supervision doesn’t scale by hand.</strong> An agent working independently will eventually hit a decision only I can make, or finish and sit idle. With more than one running, I needed something watching all of them and telling me when one needs me — not a wall of terminals I check on manually.</li></ol><p>What I actually needed: an independent stack per feature or bug fix, so agents never collide, and a way to dispatch and supervise several of them without babysitting each one.</p><h3>What I considered first</h3><p>I didn’t go run a bake-off of existing tools — I just thought through the two shapes this problem usually takes, and why neither fit.</p><p><strong>A cloud-hosted background agent</strong> would solve the isolation problem — each task gets its own runtime, no collisions by construction. But it means a new vendor relationship, usage-based cost, and my code and data leaving my machine for a sandbox I don’t control. I wanted this to stay local, on hardware I already own, using accounts I already have.</p><p><strong>A local multi-session setup</strong> — several agent sessions, each on its own git worktree — solves the git side cleanly: no two sessions stepping on the same branch or the same uncommitted changes. But that only isolates git state. All those sessions still run on the same machine, against the same Docker daemon, so a Compose-based dev stack with fixed ports and container names collides the moment two of them try to start it at the same time. Worktrees alone don’t isolate the thing I actually needed isolated: the running stack.</p><p>So: local, but with a genuinely independent stack per feature, not just an independent branch. That’s the gap I built this to fill.</p><h3>Why I rolled my own</h3><p>I wanted this to run entirely on my own Mac, with the tools I already had set up — no new cloud account, no new vendor, no new orchestration platform to adopt. OrbStack gives cheap, disposable Linux VMs with no port or networking tricks needed between them. Pi is the coding agent I already use, with an extension API that let me wire up status reporting and alerts without forking anything. GitHub Copilot and Claude Sonnet 5 are the credentials and model I already trust for my own work. None of these are claims that they’re the best choice available — they’re just what I had, and the pattern below doesn’t depend on any of them specifically; swap in whatever you already use.</p><p>Here’s the pattern that came out of that: one lightweight Linux VM per feature (via <a href="https://orbstack.dev/">OrbStack</a>), each with its own git worktree and its own Docker daemon, driven by a central agent that dispatches work, watches progress, and relays questions back to you.</p><h3>In practice: a real session</h3><p>Before getting into how it’s built, here’s what it’s actually like to use: a real session, screenshot by screenshot.</p><p>Handing the doc to a fresh central agent and asking it to read it:</p><p><em>[Screenshot 1: central reads the doc cold, summarizes the architecture and the setup order (Prepare the Mac → Start the central agent → Install the worker tooling → Set up this repo → Set up a machine), and asks before proceeding — it doesn’t just start running commands.]</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rbOA4EWHxjG-BiGXLRvRvA.png" /></figure><p>I then provided the prompt to the central agent</p><pre>start the worker for feature &quot;demo-stack&quot;</pre><p><em>[Screenshot 2: central reports what it did (updated the alert extension, bootstrapped and verified </em><em>worker-1 — pi, docker, git-lfs, tmux, uv, make, auth, SSH config, </em><em>docker ps — created the worktree and branch, copied </em><em>.env, </em><em>AGENTS.local.md, and the worker instructions into it), confirms the worker is up and idle, and then stops: &quot;I have not sent it a task yet. Send me the task you want demo-stack to work on, and I&#39;ll relay it.&quot; It doesn&#39;t invent a task — it waits for one.]</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RoGTku-NwWguoz1YQS3Irg.png" /></figure><p>Next I provided the prompt to worker agent to build and deploy the stack</p><pre>build and deploy the stack</pre><p><em>[Screenshot 3: central reports the worker finished — ran </em><em>docker compose up -d, pulled </em><em>nginx:alpine, started the container, and verified </em><em>http://worker-1.orb.local:8088/ actually returns the provisioned HTML. It&#39;s explicit about what it didn&#39;t do (&quot;No commits were made&quot;) and what&#39;s still true (&quot;Container is still running&quot;), then offers concrete next steps — leave it running, inspect the app, send a follow-up task, or clean up — instead of assuming one.]</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l77Ep0G9WWAXjhpBYq9r7g.png" /></figure><p>And later, wiping it all back to nothing with the reset prompt:</p><p><em>[Screenshot 4: central’s summary after the full teardown — the worker and its worktree/container removed (branch kept, as the tool normally does), the OrbStack machine deleted, and all three global tooling paths removed. Then it actually verifies each claim rather than asserting it: </em><em>feature-workers status no longer exists, </em><em>orb list is empty, </em><em>tmux ls shows only the </em><em>central session itself, and all three paths are individually confirmed gone. It also flags what it deliberately left alone — the </em><em>demo-stack git branch — since deleting it wasn&#39;t explicitly requested.]</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N5EXwfQfZjIHPSa2MwM46Q.png" /></figure><p>That’s the whole experience: hand the doc to central, confirm a few things, give it a task, and tear it down the same way. Everything from here on is what’s happening behind that — the architecture, the design decisions, and the setup steps central actually follows. None of it is something you need to do yourself; it’s here for whoever wants to know how it works, or wants to adapt it.</p><h3>The shape of it</h3><ul><li>A <strong>central</strong> agent runs on your Mac, inside a tmux session that keeps running after you close your terminal.</li><li>Each <strong>feature</strong> gets a <strong>worker</strong>: a coding agent running in its own OrbStack Linux machine, on its own git worktree and branch, with its own Docker stack.</li><li>Worker machines and the worker agent itself are <strong>feature-agnostic</strong> — a machine named worker-1 doesn&#39;t know or care which feature it&#39;s running. It&#39;s provisioned once, then reused: a feature finishes, you tear down its worktree and stack, and the same machine is free for the next feature.</li><li>Since each machine has its own Docker daemon, nothing conflicts: same default ports, same container names, same volumes, every time — because each worker thinks it’s the only one.</li><li>Mac files appear at the same paths inside the machines (no cloning, no mounting), so a worktree on the Mac is directly visible and editable inside its machine.</li><li>A stack is reachable from the Mac at http://&lt;machine&gt;.orb.local:&lt;port&gt; — no reverse proxy needed, because every machine has its own hostname.</li><li>Status flows through small JSON files a pi extension writes on each worker, into a folder shared between the Mac and the machine. A second extension on the central agent watches those files and alerts you — one batched macOS notification plus a message in your central chat — the moment a worker finishes or has a question.</li></ul><h3>Why this shape</h3><ul><li><strong>One OrbStack machine per feature</strong> — each machine has its own Docker daemon, so default ports, container names and volumes never collide.</li><li><strong>One git worktree per feature, on the Mac</strong> — a separate branch per worker avoids collisions. Mac files appear at the same paths inside machines, so nothing is cloned or mounted.</li><li><strong>Reach stacks at </strong><strong>&lt;machine&gt;.orb.local:&lt;port&gt;</strong> — each machine has its own hostname, so identical ports need no reverse proxy.</li><li><strong>Central agent runs in tmux on the Mac</strong> — the session keeps running after the terminal closes.</li><li><strong>Workers run in tmux inside the machines</strong> — central can read a worker’s screen and type into it.</li><li><strong>Status through files written by an extension</strong> — central reads a small JSON file from a folder shared between the Mac and the machine — no RPC, no polling an agent’s internals.</li><li><strong>Alert extension auto-loaded from the agent’s global extensions folder</strong> — central then needs no extra flag to enable it, and it’s harmless to have installed everywhere — it does nothing unless the shared worker-state folder exists.</li><li><strong>One batched alert, with a short debounce</strong> — several workers can finish at nearly the same time; one message avoids overlapping turns in central.</li><li><strong>Central asks before reusing or creating a machine</strong> — a free-looking machine may still be needed.</li><li><strong>Deletes only after explicit confirmation</strong> — worktrees, machines and branches are never removed automatically.</li></ul><h3>Setting it up</h3><p>The tooling is split into two layers: a <strong>global</strong> layer that knows nothing about any particular repo (scripts, extensions, the skill that teaches the central agent how to use them), and a <strong>per-repo</strong> layer (a short list of files each new worktree needs, plus any repo-specific setup steps).</p><p>The steps below are also written so you can hand them, as-is, to a pi agent and ask it to set the whole thing up for you. Point it at this document and it reads the instructions, asks you to confirm the parts that install software or create machines, and does the rest: provisioning a worker machine, starting a worker agent on it, creating the feature’s git worktree and branch, and building and running the Docker stack. You don’t have to type any of the commands below yourself.</p><p>The full, agent-ready version of this document — plus a small working example repo it’s been verified against — is on GitHub at <a href="https://github.com/cch0/localstack-multi-agent-demo">github.com/cch0/localstack-multi-agent-demo</a>.</p><h3>1. Prepare the Mac</h3><p>Install OrbStack and your coding agent, sign in to a model provider, install tmux and git-lfs, and set a small tmux config so extended keys work:</p><pre>brew install tmux git-lfs<br>git lfs install<br>printf &#39;set -g extended-keys on\nset -g extended-keys-format csi-u\n&#39; &gt; ~/.tmux.conf</pre><p>If your repo’s git remote needs a specific SSH identity, set that up too — an SSH host alias (for example github-alias) pointed at the right key, confirmed by checking which key GitHub actually accepts (ssh -vT git@github.com).</p><h3>2. Start the central agent</h3><pre>tmux new-session -s central -c &lt;repo folder&gt;<br>pi   # or your agent of choice</pre><p>Detach with Ctrl-b d. It keeps running. Re-attach any time with tmux attach -t central.</p><p>If you ever need to reload skills or extensions — say, after installing the worker tooling below — you don’t lose the conversation to do it: /quit, then pi --continue (not plain pi, which would start a new, empty session) resumes the same session with full history. Only extensions and skills get reloaded.</p><p>To stop it for good, exit the agent first (/quit), then delete the session: tmux kill-session -t central.</p><h3>3. Install the worker tooling (once, globally)</h3><p>Three small pieces, installed under your agent’s global config directory so every repo can use them without repeating the setup. Their source lives in a companion repo, not only described in prose here — installing them is a copy, not a from-scratch rewrite:</p><ul><li><strong>A status extension</strong>, loaded only inside a worker (it’s a no-op unless a specific environment variable is set), that writes state.json and events.jsonl to a shared folder on agent lifecycle events: starting, running, waiting for you, exited.</li><li><strong>An alert extension</strong>, loaded only in the central agent, that watches that shared folder. When one or more workers flip to “waiting for you,” it waits a couple of seconds for any more to arrive, then sends one OS notification and one message into central’s own chat listing all of them.</li><li><strong>A </strong><strong>feature-workers command-line tool</strong> (plus a feature-workers-bootstrap companion) that:</li></ul><p>1. creates an OrbStack machine and installs everything a worker needs on it (tmux, Docker, your coding agent, model credentials, SSH access to your git remote) — <em>this is feature-agnostic</em>, it’s the same bootstrap regardless of what any given worker later builds;</p><p>2. creates a git worktree and branch for a feature and starts a worker agent on a chosen machine (feature-workers new &lt;feature&gt; &lt;machine&gt;);</p><p>3. lets you check status, peek at a worker’s screen, send it a message, or tear it down (status, peek, send, rm).</p><ul><li><strong>A skill</strong> that teaches the central agent the rules: check which machines are free before reusing or creating one, never delete anything without your confirmation, don’t merge branches, relay worker questions one at a time.</li></ul><p>None of this knows about any specific repository. It’s just infrastructure.</p><h3>4. Set up a repo</h3><p>This is the only part that’s repo-specific, and it’s short — and it’s fully self-contained in the repo, with no dependency on anything global on the Mac:</p><ol><li><strong>A durable rules file.</strong> Anything a worker must always follow for this repo — don’t commit or push unless asked, don’t merge or delete branches, ask one clear question when unsure, don’t print secrets — goes in &lt;repo&gt;/AGENTS.local.md. This is what every worker for this repo actually follows; it isn&#39;t inherited from any global agent config.</li></ol><pre># Local worker rules<br><br>You are a feature worker running in a git worktree for this repo.<br><br>- Work only in this worktree on its current branch.<br>- Do not commit or push unless the user explicitly asks.<br>- Do not merge or delete branches.<br>- If you need a decision, missing file, or clarification from the user,<br>  stop and ask one clear question.<br>- Do not print secrets from `.env`, credentials files, or SSH keys.</pre><p>2. <strong>A copy-list.</strong> A worktree starts from a clean branch, so anything untracked in .gitignore — a .env file, local overrides, certs, and AGENTS.local.md itself — won&#39;t be there. List those paths, one per line, in &lt;repo&gt;/.pi/feature-workers/copy-list:</p><pre>.env<br>docker-compose.override.yml<br>AGENTS.local.md<br>certs</pre><p>When a new worker is created, each listed path is copied from the main repo into the new worktree if it exists there and is missing in the worktree. The copy is a one-time snapshot, not a link — later edits to the original don’t propagate.</p><p>3. <strong>Worker instructions</strong>, for stack-specific setup commands rather than durable rules — for example, a project-specific provisioning command that has to run before the stack can start. Put these in &lt;repo&gt;/.pi/feature-workers/worker-instructions.md:</p><pre># Feature worker setup (localstack-multi-agent-demo)<br><br>You are a feature worker. Your folder is a git worktree made by<br>`feature-workers new`, and you run on an OrbStack machine. These steps<br>apply only to you, not to an agent working in the main repo folder.<br><br>Follow `AGENTS.local.md` in this worktree for durable repo rules.<br><br>Before you start the Docker stack, in the worktree root, in this order:<br><br>1. `make provision` — a project-specific step that generates local<br>   config/workspace files (for example into `build/workspace/`) that<br>   the Docker stack expects. A new worktree has none; each worktree<br>   makes its own.<br>2. `docker compose up -d`.</pre><p>This file gets copied into each new worktree as a file your agent appends to its system prompt, so every worker for this repo automatically knows these steps without you repeating them per feature.</p><p>4. Keep both of those out of git (they only matter locally) by adding .pi/ to .git/info/exclude. AGENTS.local.md can stay tracked or untracked, depending on whether you want it shared with the team.</p><p>That’s it. Everything else — the machine, the agent, the scripts — is reused, untouched, across every feature you throw at this repo.</p><h3>5. Provision a machine</h3><pre>feature-workers-bootstrap worker-1</pre><p>This creates an Ubuntu machine if one doesn’t exist yet, and installs tmux, Node, Docker (with compose), git-lfs, make, uv, and your coding agent — plus Docker access without sudo, the tmux config, git SSH access, and model credentials. No repo-specific rules are installed here; a worker gets all of its rules from the repo files copied into its own worktree. Takes a few minutes. Confirm it worked by checking docker ps runs without sudo.</p><p>A quick note on the defaults baked into that script: it provisions each worker with GitHub Copilot as the credential source and Claude Sonnet 5 as the model. Neither is a claim that this is the best combination — it’s just what I had already set up and trust for my own work, so it’s what the bootstrap defaults to. Swap in whatever provider and model you already use; nothing else in this pattern depends on the choice.</p><p>Machines are named generically (worker-1, worker-2, …) on purpose — they&#39;re identical, interchangeable, and reused across features. Spin up as many as you have parallel work to do; tear none of them down between features.</p><h3>Using it</h3><p>Attach to central and ask, in plain words. A few prompts that work well:</p><p><strong>Start a worker for a new feature:</strong></p><pre>Start a worker for feature &quot;demo-stack&quot;: log every login attempt. Check which machines are free first.</pre><p>Central checks feature-workers status, confirms with you before reusing a free machine (or creating a new one), creates the worktree and branch, copies the repo&#39;s listed files, and starts the worker idle, then sends it the task.</p><p><strong>Tear down a feature, keep the machine:</strong></p><pre>Feature &quot;demo-stack&quot; is done. Tear down the worker: stop it, show me the feature-workers rm dry run, and remove the worktree once I confirm. Leave the machine running for the next feature.</pre><p>This matches the normal cleanup path: feature-workers rm &lt;feature&gt; (dry run), then --yes only after you confirm. The worktree and worker are gone; the branch is kept; the machine stays up, idle, ready for the next worker — machines are meant to be reused across features, not torn down with them.</p><p><strong>Tear down a feature and the machine it ran on:</strong></p><pre>Feature &quot;demo-stack&quot; is done, and I don&#39;t need the machine anymore either. Tear down the worker and the worktree, then also delete the machine &quot;worker-1&quot;. Confirm with me before deleting the machine.</pre><p>Central runs the same feature-workers rm cleanup, then separately deletes the OrbStack machine (for example orb delete worker-1) once you confirm — machine deletion is always its own confirmation, separate from the worktree/branch one, since a machine can outlive any single feature.</p><p>From there, the commands behind these prompts:</p><ul><li><strong>Check progress</strong> → feature-workers status</li><li><strong>See what a worker is doing</strong> → feature-workers peek &lt;feature&gt; [lines]</li><li><strong>Give a worker more instructions</strong> → feature-workers send &lt;feature&gt; &lt;text&gt;</li><li><strong>Wrap up a feature, keep the machine</strong> → feature-workers rm &lt;feature&gt; (dry run first, --yes only after you confirm)</li><li><strong>Wrap up a feature and the machine</strong> → feature-workers rm &lt;feature&gt; --yes, then orb delete &lt;machine&gt; (each a separate confirmation)</li></ul><p>When a worker finishes or hits a question it needs you for, you get a macOS notification, and central relays it to you — one worker at a time, waiting for your answer before moving to the next.</p><p><strong>Wipe everything back to a fresh install:</strong></p><p>Occasionally you’ll want to verify the whole setup from scratch — after changing the tooling itself, say, or just to confirm nothing’s left behind. One prompt does it:</p><pre>Return everything to a clean slate: tear down every worker and machine, then remove all installed tooling. Specifically:<br><br>1. Run feature-workers status and show me what exists.<br>2. For every worker listed, run feature-workers rm &lt;feature&gt; --yes — I&#39;m explicitly authorizing all deletions now, don&#39;t ask again per-worker.<br>3. Delete every OrbStack machine shown (orb delete &lt;machine&gt;) — also pre-authorized.<br>4. Remove the global tooling: ~/.pi/agent/skills/feature-workers/, ~/.pi/agent/extensions/worker-watch.ts, and ~/.pi-workers/.<br>5. Verify the result — confirm feature-workers status has nothing left, orb list is empty, tmux ls shows no other sessions, and none of the three paths above exist.<br>6. Report exactly what you removed and the verification output. Don&#39;t skip the verification step.</pre><p>This is the one prompt in this post that pre-authorizes every deletion up front, rather than confirming each one — intentionally, since the whole point is a single irreversible reset back to nothing installed.</p><h3>What it actually looks like end to end</h3><p>For a repo with a Docker Compose stack and a one-time provisioning step, the whole path from “start a worker” to “stack is running” is:</p><ol><li>Central creates the worktree, branch, and worker.</li><li>The worker reads its repo’s worker-instructions.md (already part of its system prompt), then runs its provisioning command, generating whatever local config the stack needs.</li><li>The worker runs docker compose up -d.</li><li>You reach the stack at http://worker-1.orb.local:8080 from the Mac — no proxy, no port negotiation, because this machine&#39;s 8080 is this feature&#39;s 8080 and nobody else&#39;s.</li></ol><p>Everything in this chain is generic. Only steps 2’s <em>specific commands</em> change from repo to repo — and they live in that one small worker-instructions.md file, not in the tooling.</p><h3>What’s still open</h3><p>A few things worth being honest about, since this is a working setup, not a polished product:</p><ul><li>A real git push from inside a worker machine is lightly tested.</li><li>Handling more than one worker question landing on central at the same time isn’t addressed — central works through them one at a time.</li><li>Running many machines at once costs real Mac CPU, memory, and disk; there’s no limit enforced.</li><li>Workers currently have full read/write access to the Mac home folder — there’s no sandboxing between a worker and the rest of your machine.</li><li>Credential refresh across many machines signed in to the same provider account isn’t tested at scale.</li></ul><p>None of these are blockers for the core use case — run several features in parallel without their Docker stacks fighting each other — but they’re the honest list of what I haven’t hardened yet.</p><p>Until next time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=74676a7abbe5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I had Claude rebuild what Claude built — from documentation it also wrote]]></title>
            <link>https://medium.com/@CCH0/i-had-claude-rebuild-what-claude-built-from-documentation-it-also-wrote-2de9f91d7df4?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/2de9f91d7df4</guid>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Sat, 16 May 2026 15:01:02 GMT</pubDate>
            <atom:updated>2026-05-16T15:01:02.973Z</atom:updated>
            <content:encoded><![CDATA[<p>Previously I used Claude to build a <a href="https://medium.com/@CCH0/coldtrace-a-multi-agent-ai-investigator-fe5ae92c5357">multi agents AI investigator</a>. The overall experience is great. At the end I have a functional product, documentation, website and Youtube promotion videos.</p><p>It took me probably a couple weeks going from brain-storming with Claude, planning, designing, implementing, testing, starting over many times, more planning and repeat this loop until we (Claude and I) nailed down every detail I care to flesh out.</p><p>The follow up questions become clear —</p><ul><li>Is it a repeatable process? — can I or someone else rebuild what I built?</li><li>If it is not a repeatable process, what does it take to make it so?</li><li>Which parts are not repeatable?</li><li>Was it worth it?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L6xsDXG7dAYD3mKB" /><figcaption>Photo by <a href="https://unsplash.com/@chunchia?utm_source=medium&amp;utm_medium=referral">張 峻嘉</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Is It a Repeatable Process?</h3><p>Can I just ask Claude to create the same solution again any time from scratch?</p><p>I “vibe-coded” my way creating a non-trivial solution. The original docs grew alongside the code. Each time we wrapped a phase I asked Claude to write down what we just did and why. This includes: research, planning, multi phases implementation, use cases and operation documents. All these documents serve the purpose of providing context to both human as well as AI readers in the future. If I clear the current session, I can simply ask Claude to “catch up” by reading documents and memory file.</p><p>However, none of these documents provide sufficient context for Claude to rebuild it again from scratch.</p><p>So, the answer to the question is “<strong><em>No</em></strong>”, it is not a repeatable process.</p><h3>What Does It Take To Make It Repeatable?</h3><p>The new problem I am solving becomes figuring out a path forward and a set of specifications for AI (Claude in my case) to follow and expect the result implementation is also a fully functional solution.</p><p>Anything that can be written down as contract: API interface, database table schema, external API calls, etc. Claude does a pretty good job following the specification and implements it.</p><p>This is especially true if the instructions also include use cases to verify. While unit tests are important, it is the end-to-end functional tests that can keep Claude honest about its implementation. The feedback loop provided by test results is crucial to the AI and offer confidence to human.</p><p><strong>The Solution</strong></p><p>Specification is the solution I came up with.</p><p>Turning documentation into a specification went roughly like this:</p><ol><li>Have clear understanding of what I had by purpose. Some documents are story (vision, use case, runbook). Some are contract (API, database table schemas, data source). Each serves different purposes.</li><li>Picked an ontology. This was the surprise turn — see The borrowed idea below.</li><li>Pinned every contract on its own line. Claude built a single checklist where each binding rule — every column name, every wire shape, every external API call — gets one row with a citation back to the spec doc that owns it. The checklist became one-page view of what is locked down versus what is still prose.</li><li>Wrote the use cases as scenarios we could verify. End-to-end queries the system must answer. The implementer doesn’t get to decide whether a feature is “done”; the use cases do.</li><li>Wrote operator prompts. Staged prompts that walk the implementer through the build in order, so it isn’t reading sixteen documents cold.</li><li>Tested the spec by handing it to a fresh Claude. Different working folder, no source code, only the spec. Whatever it couldn’t reproduce was a gap in the spec — not a failure of the AI.</li><li>The Surprise Helper. Asking AI itself to evaluate the work it did often results in disappointing answer. We all have heard AI can be too overly confident about itself and gave answers without either facts or self-reflection. I found out that having one Claude session criticize the work other Claudes produce improves the quality of the work significantly.</li></ol><p><strong>The borrowed idea</strong></p><p>After ColdTrace was already built, I came across how Palantir frames its data — as a typed model of the world: entities with stable identities, attributes, and named relations between them. Aircraft. Operators. Persons. Sanctioned entities. Relations like operated by, flagged by, matches sanctioned. Claude rewrote the ontology doc around this idea.</p><p>Suddenly every loose noun in the prior docs had to become a named entity with rules. A lot of ambiguity disappeared in that one pass.</p><h3>Which Parts Are Not Repeatable?</h3><p>Two discoveries I made along the way.</p><p><strong>1. The devil is in the details</strong></p><p>The specification only says what to build and what to verify but it does not say how do you go about doing it. AI, like human, has its way of interpreting the specification and go about implementing it anyway it sees fit. On a couple of occasions AI even found loopholes in the specification and circumvent the use case verification. For example, AI in few cases decided that it is not going to run the end-to-end testing despite the criteria to close the task demands it.</p><p>Just like human beings, AI work needs verification.</p><p><strong>2. The weak spot you have</strong></p><p>To my surprise, the UI/UX part can not simply be described in the specification. If we just let AI decide on the UI, it will most likely come up with something that looks completely different from what the UI looks like in existing ColdTrace. This should not be a surprise but I was not thinking clearly in the beginning. If the requirement is to produce exactly the same look and feel of existing UI, it becomes necessary to provide UX design to AI.</p><p>I am very weak in UI/UX design and didn’t take time asking Claude to help me figure this part out. The result is that I had to leave the Frontend part out of the specification and keep using the same UI Claude originally built.</p><h3>Was It Worth It?</h3><p>The effort of trying it, absolutely, 100% fun.</p><p>Is it practical to create the specification first and expect Claude to implement it to a T without human supervision? I am only 95% there.</p><p>It is not the AI hallucination that I ran into which prevent me from closing the last 5% gap but it is the flexibility I intentionally provide (only “what” and “why” but not “how”) in the specification. AI interpreted it differently every time I started from scratch. Not enough instruction and guardrail I put in would definitively prevent this from happening. What I got out of it isn’t a second copy of ColdTrace — it’s a clearer view of the first one. Writing a spec to rebuild the system forced me to see the parts of it I had never bothered to articulate while building it.</p><h3>The Takeaways</h3><ul><li>Having separate AI to verify AI’s work helps.</li><li>Writing documents to recreate an application isn’t something most projects need — but doing it teaches you something about the application you didn’t see while building it.</li><li>No one likes to write documentation. AI can help. lol</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2de9f91d7df4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ColdTrace: a multi-agent AI investigator]]></title>
            <link>https://medium.com/@CCH0/coldtrace-a-multi-agent-ai-investigator-fe5ae92c5357?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe5ae92c5357</guid>
            <category><![CDATA[langgraph]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[clickhouse]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Wed, 13 May 2026 15:01:02 GMT</pubDate>
            <atom:updated>2026-05-13T15:01:02.108Z</atom:updated>
            <content:encoded><![CDATA[<p>Aviation, maritime, sanctions — answered as one cross-domain investigation</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kzvDvmAx4mcJ8j777N2dWQ.jpeg" /></figure><p>Continuing on my journey of catching up with AI, I built <strong><em>ColdTrace</em></strong>. More precisely, AI built it and I just guided it through the design, planning, implementation and review.</p><p>Disclaimer: The rest of the post was created by AI and it does a better job of selling the idea than I ever could.</p><p>An analyst types a one-line question about Singapore Strait.</p><p>About a minute later, the system has pulled together a report: twenty-five UN-sanctioned vessels made port visits to Singapore over the last ninety days. Most of them aren’t broadcasting AIS at all. The system surfaces every name, every port — Tanjung Pelepas, Pengerang, Singapore proper — and flags one cluster of overlapping visits in late March that looks coordinated.</p><p>Nobody told it to look for any of that.</p><p>That’s <strong><em>ColdTrace</em></strong>. It’s a multi-agent investigator for aviation and maritime intelligence, and this post is about why I built it and what’s interesting about how it works.</p><p>A separate user documentation site — every panel, every map symbol, every report section — lives at <a href="https://cch0.github.io/cold-trace-docs/">https://cch0.github.io/cold-trace-docs/</a>.</p><h3><strong>The problem</strong></h3><p>Aviation, maritime, and sanctions data all live in different worlds.</p><p>Aviation has ADS-B — every airliner broadcasts its position, every receiver on the ground forwards it to a global network, and you can pull tracks out of it. Maritime has AIS, which works the same way except for ships. Sanctions are a separate system entirely — UN, OFAC, EU lists that get published as PDFs and CSVs, with names and IMOs and flags that change over time.</p><p>Each of those, on its own, is solvable. There are dashboards for ADS-B, dashboards for AIS, lookup tools for sanctions. An experienced analyst can work with any of them.</p><p>The interesting stuff almost always sits <em>*between*</em> them. An aircraft that overflew a flagged vessel during its port visit. A tanker that turned off its transponder right when a known sanctions-evader appeared in the same anchorage. A registration owner that shows up on two enforcement lists in the same week.</p><p>For an analyst to find any of that today, the workflow is “open ten tabs.” You’re looking at three databases, two map applications, and a spreadsheet, and you’re trying to hold the geography and timing in your head. Most cross-domain signals get missed not because anyone’s lazy — but because the tooling doesn’t help.</p><p>That’s the gap I wanted to close. Cross-domain analysis is where the value is, and current tooling makes cross-domain expensive.</p><h3><strong>What ColdTrace does</strong></h3><p>Plain language: you ask it a question in chat, and it answers.</p><p>The questions can be specific — <em>”</em><strong><em>Investigate vessel SEEKER 8 — port visits, sanctions history, and aircraft proximity over the last 90 days.” </em></strong>Or broad<strong><em> </em></strong>— <strong><em>”Show me sanctioned vessel activity in Singapore Strait over the last 90 days, and any aircraft that came close.</em></strong><em>”</em></p><p>Either way, the system picks the right specialists for the question, runs them in parallel, and writes a report. The report has sections per source, a cross-source conclusion, and a list of recommended next actions. A broad scan typically takes a couple of minutes; a narrower follow-up is faster.</p><p>Follow-ups are part of the design. You can ask them in the same conversation, and each one reuses the evidence the system already gathered — it doesn’t re-investigate from scratch. So the first question is the expensive one; the rest are much faster. <strong><em>”Tell me more about Tanjung Pelepas”</em></strong> after the broad scan above already has the regional GFW data loaded into the conversation’s memory and answers quickly.</p><p>There’s also a LIVE mode that streams real-time aircraft and vessel positions onto a map, with a watch list and per-target trails. You can pick a vessel transiting Singapore Strait right now, watch its path unfold for a couple of minutes, then click it to flip into investigation — the composer comes up pre-filled with a question about that exact vessel.</p><p>The system flags cross-domain coincidences automatically. If an aircraft passed within a few nautical miles of a sanctioned vessel during one of its port visits, you’ll see it in the report’s joint correlations section. If nothing connects, it tells you that too.</p><p>More on the panels, report sections, map symbols, and live-mode controls in the <a href="https://cch0.github.io/cold-trace-docs/">user documentation</a>.</p><h3><strong>Demo</strong></h3><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D4Cag7HptFr4&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F4Cag7HptFr4" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c28496dd0bf86bbfafca0f4e91f091c/href">https://medium.com/media/3c28496dd0bf86bbfafca0f4e91f091c/href</a></iframe><p>The video walks through a Singapore Strait investigation end to end. The shape:</p><p>You open LIVE mode and select Singapore from the region picker. Within a few seconds the map fills in — about ten aircraft overhead, eight ships in the strait. Singapore is one of the densest single-frame views you can get. You watch a vessel for sixty seconds; its trail draws out across the screen as the AIS messages come in.</p><p>Then you click that vessel. A popup appears with two actions — add to watch (already done) and <strong><em>”🔍 Investigate”</em></strong>. You click Investigate, and the view flips into the investigation tab with the composer already filled in: <strong><em>”Investigate vessel 228459900 — port visits, sanctions history, and aircraft proximity over the last 90 days.”</em></strong></p><p>You read it. Then you clear it and type something broader: <strong><em>”Show me sanctioned vessel activity in Singapore Strait over the last 90 days, and any aircraft that came close.”</em></strong> Send.</p><p>The agents fan out. You see the progress overlay — parser, planner, port-behavior, ADS-B specialist, synthesizer, critic — each turn green as it completes. The map fills with aircraft tracks (the system pulls historical ADS-B for the same bbox and window). The report renders: twenty-five sanctioned vessels, twenty aircraft, a conclusion that says “no joint air-sea proximity correlations were identified.”</p><p>That last sentence is the most interesting one. Twenty aircraft in the same bbox as twenty-five sanctioned vessels, and zero coincidences. The system spent two minutes confirming the negative — and <strong><em>says so</em></strong>.</p><h3><strong>How it works</strong></h3><p>The design is a team of specialists, not a single big model.</p><p>There’s one agent per data source. An ADS-B specialist that knows how to query historical aircraft tracks. A vessels specialist that resolves vessel queries against the GFW database. A vessel-sanctions specialist that walks sanctions records and their valid-from / valid-to histories. An ownership specialist for registered operators. A port-behavior specialist that does regional scans of port-visit events.</p><p>Each specialist has its own tools — its own database queries, its own scoring logic, its own way of deciding what’s anomalous. They don’t share state. They don’t see each other’s work mid-investigation. They each get the question and produce findings, in parallel.</p><p>Up front, a Planner reads the question and decides which specialists to dispatch. Aviation-only question? Just ADS-B. Vessel-focused? Vessels and vessel-sanctions. Cross-domain? Dispatch everyone.</p><p>At the end, a Synthesizer takes all the findings and writes one report. It’s not a free-form summary — there’s a structured schema for the output, with per-source sections, a convergence list (entities flagged by more than one source), and a joint-correlations section for cross-domain pairings.</p><p>Then a Critic re-reads the synthesis against nine criteria and flags problems. If two specialists disagreed about the same vessel — one rated it low risk, one rated it high — the Critic catches that and surfaces the contradiction in the final report instead of silently picking a winner.</p><p>There’s also a deterministic correlator that runs in Python alongside the agents. It looks at the aircraft tracks and the vessel events and computes proximity pairs — within a small distance, within a small time window. The joint-correlations section gets fed from there, not from an LLM guess.</p><p>Each agent has its own lens. Cross-domain answers come from those lenses working in parallel and then a synthesis step that has access to all of them. The Critic is doing real reading — when the work disagrees with itself, the disagreement makes it into the final report.</p><h3><strong>What’s interesting about this</strong></h3><p>The pattern travels.</p><p>In a typical investigation the maritime specialist might rate a vessel’s port visit as routine — <strong><em>”normal commercial pattern, no anomaly”</em></strong> — while the sanctions specialist rates the same vessel as high-risk because there’s an active OFAC listing on it. The Critic catches that disagreement and surfaces both takes in the report. The analyst sees them side by side and decides. That kind of side-by-side comes from having multiple lenses on the same data.</p><p>Anywhere evidence is fragmented across systems, the same shape works. Financial fraud — accounting data in one system, customer transactions in another, regulatory filings in a third. Healthcare — labs, imaging, clinician notes. Supply chain — orders, shipments, inspections. Each domain has its own data model, its own definition of “normal,” its own scoring. Specialists let each lens speak for itself before anything synthesises them.</p><p>There’s a related product property: calibrated answers. When the agents don’t find a connection, the report says so. The Singapore investigation concluded with <strong><em>”no joint air-sea proximity correlations identified”</em></strong> because there genuinely weren’t any — the aircraft overhead were transits, not loitering. The Synthesizer is reading structured findings from independent agents; it doesn’t have a single narrative to defend and so it’s free to report a quiet finding as a quiet finding.</p><p>That’s the part I think generalizes beyond intelligence work. Each specialist with its own evidence, its own model of what matters — and the disagreements between them become findings.</p><h3><strong>Under the hood</strong></h3><p>For the technically curious, one paragraph.</p><p>The agent graph runs on <strong>LangGraph</strong>. Every LLM step in the system is <strong>Claude</strong> (Anthropic) — anomaly assessment, planning, synthesis, critic review, conversational classifier. The default is <strong>Sonnet</strong> for reasoning and <strong>Haiku</strong> for fast classification, but the model used for the heavier reasoning steps is user-configurable per investigation, so an analyst can trade speed against depth question by question. Historical position data lives in <strong>ClickHouse</strong> (millions of aircraft and vessel position rows); reference data and conversation state live in <strong>Postgres</strong>. The frontend is <strong>React</strong> + <strong>Leaflet</strong>, and findings stream into the UI live over Server-Sent Events. Investigations are stateful: each conversation gets persisted with its turns, its tool calls, and its findings, so follow-ups can read what came before.</p><p><strong>Acknowledgements</strong>. The aviation reference data — and a fair amount of the inspiration for the investigative posture — comes from Bellingcat’s <a href="https://github.com/bellingcat/adsb-history"><strong>Turnstone</strong></a> project. With thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe5ae92c5357" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an OpenClaw Plugin for Property Search]]></title>
            <link>https://medium.com/@CCH0/building-an-openclaw-plugin-for-property-search-9b3c105a27be?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b3c105a27be</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[openclaw]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[zillow]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Fri, 01 May 2026 15:01:02 GMT</pubDate>
            <atom:updated>2026-05-01T15:01:02.199Z</atom:updated>
            <content:encoded><![CDATA[<p>I wanted a conversational property search experience — describe what you’re looking for and get back real Zillow listings. Previously, I built an <a href="https://medium.com/@CCH0/agentic-ai-the-hard-way-part-1-what-i-built-and-why-33bad853ed6a">agentic AI solution</a> demonstrating using PropSearch as a pluggable skill. This time I built an OpenClaw plugin that wires up <a href="https://www.realtyapi.io/">RealtyAPI</a> as the data source, including its natural-language search endpoint.</p><p>This post is about how the plugin is built, not about the NL search itself — that part comes from RealtyAPI. But the end result is you can talk to your AI assistant like this:</p><p>“<strong><em>find single family house in greater seattle area with 2+ beds and 2+ baths under 3M</em></strong>”</p><p>and get back actual listings.</p><p>Disclaimer — this post is authored mostly by AI, reviewed and edited by me and I take full responsibility for the content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QobWK6JtrU6QKmtV" /><figcaption>Photo by <a href="https://unsplash.com/@yant278?utm_source=medium&amp;utm_medium=referral">YanTeng Huang</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>What OpenClaw Plugins Do</strong></p><p>OpenClaw is a conversational AI gateway. Plugins extend it by registering tools — named functions with typed parameters that the AI can invoke during a conversation. The gateway handles schema validation, routing, and surfacing the tools to the model. Your plugin just declares what it can do and handles the execution.</p><p><strong>Project Structure</strong></p><pre>src/<br>  index.ts      # plugin entry point, tool registration<br>  provider.ts   # RealtyAPI HTTP client<br>  types.ts      # shared types (Listing, SearchParams)</pre><p>The entry point exports a <strong>definePluginEntry</strong> call. Everything else is a straightforward TypeScript project.</p><p><strong>Registering Tools</strong></p><p>The plugin exposes four tools. Here’s the main one:</p><pre>api.registerTool({<br>  name: &quot;search_properties&quot;,<br>  description: &quot;Search for properties via natural language query.&quot;,<br>  parameters: Type.Object({<br>    query: Type.String(),<br>    location: Type.Optional(Type.String()),<br>    price_min: Type.Optional(Type.Integer()),<br>    price_max: Type.Optional(Type.Integer()),<br>    beds: Type.Optional(Type.Integer()),<br>    baths: Type.Optional(Type.Number()),<br>    property_type: Type.Optional(Type.String()),<br>  }),<br>  async execute(_id, params) {<br>    const result = await provider.search(params)<br>    return { content: [{ type: &quot;text&quot;, text: JSON.stringify(result) }], details: result }<br>  },<br>})</pre><p>I used <strong>@sinclair/typebox</strong> for schemas — it’s what the OpenClaw SDK expects. Parameters are validated at the gateway before your handler runs, so no need to re-validate inside <strong>execute</strong>.</p><p>The other three tools follow the same pattern:</p><ul><li><strong>get_property_details</strong> — full details by Zillow zpid</li><li><strong>get_property_details_by_address</strong> — full details by street address</li><li><strong>save_search_criteria</strong> — persist search preferences across the conversation</li></ul><p><strong>The API Client</strong></p><p><strong>RealtyAPIProvider</strong> handles all HTTP calls. The search method passes the user’s query to RealtyAPI’s <strong>/search/byaiprompt</strong> endpoint:</p><pre>async search(params: SearchParams) {<br>  const qs = new URLSearchParams({ ai_search_prompt: params.query, page: &quot;1&quot; })<br>  const data = await this.get(`/search/byaiprompt?${qs}`)<br>  // ...<br>}</pre><p>RealtyAPI does the NL-to-Zillow-query translation on their end and returns structured listings. Our plugin just passes the prompt through and normalizes what comes back.</p><p><strong>Normalizing Zillow Data</strong></p><p>Response shapes can vary between endpoints — <strong>address</strong> can be a string or a nested object, <strong>price</strong> can be a bare number or <strong>{ value, currency }</strong>. One <strong>parseZillowListing</strong> function handles all of this at the boundary before anything else touches the data.</p><pre>const price =<br>  priceRaw &amp;&amp; typeof priceRaw === &quot;object&quot;<br>    ? (priceRaw as Record&lt;string, unknown&gt;).value as number<br>    : priceRaw as number</pre><p>If you’re consuming Zillow data, expect this kind of inconsistency. Normalize early and keep it in one place.</p><p>One other quirk: RealtyAPI can return HTTP 200 with an empty property shell — <strong>propertyDetails</strong> exists but <strong>zpid</strong> is absent. Without a guard you’d silently return a blank listing:</p><pre>function isSoft404(data: Record&lt;string, unknown&gt;): boolean {<br>  const details = data.propertyDetails as Record&lt;string, unknown&gt; | undefined<br>  return &quot;propertyDetails&quot; in data &amp;&amp; !details?.zpid<br>}</pre><p><strong>The System Prompt</strong></p><p>OpenClaw plugins ship a <strong>SKILL.md</strong> that defines the AI persona and behavioral constraints. The key constraint for a real estate plugin:</p><pre>## Hard constraints<br>- Never fabricate or invent property listings or data — only present results actually returned by tools<br>- Always surface data provenance: results come from Zillow via RealtyAPI</pre><p>“<strong>Never fabricate</strong>” is load-bearing. A helpful AI, when search returns nothing, might fill the silence with plausible-sounding listings. In a domain where people make six-figure decisions, that’s the wrong behavior.</p><p><strong>Setup</strong></p><p>The plugin itself is available on NPM registry <a href="https://www.npmjs.com/package/@cch0/openclaw-plugin-realtyapi">@cch0/openclaw-plugin-realtyapi</a> and can be installed using the following commands.</p><pre>openclaw plugins install @cch0/openclaw-plugin-realtyapi<br>echo &#39;REALITY_API_KEY=your_key_here&#39; &gt;&gt; ~/.openclaw/.env<br>openclaw gateway restart</pre><p>Done. Any conversation running through the gateway now has access to the property search tools.</p><p>The full source is on <a href="https://github.com/cch0/openclaw-plugin-realtyapi">GitHub</a> if you want to use it as a starting point for your own OpenClaw plugin.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b3c105a27be" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI The Hard Way — Part 1 What I Built and Why]]></title>
            <link>https://medium.com/@CCH0/agentic-ai-the-hard-way-part-1-what-i-built-and-why-33bad853ed6a?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/33bad853ed6a</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[litellm]]></category>
            <category><![CDATA[real-estate]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Wed, 29 Apr 2026 15:01:02 GMT</pubDate>
            <atom:updated>2026-04-29T15:01:02.140Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>I Built a Generic AI Agent Platform to Learn Agentic AI the Hard Way</blockquote><p>Disclaimer — this series of posts are authored by AI, reviewed and edited by me and I take full responsibility for the content.</p><p>The source code is available on <a href="https://github.com/cch0/agentic-ai-localstack">Github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nJXDgW_cp0EAx7YB" /><figcaption>Photo by <a href="https://unsplash.com/@leoliang1230?utm_source=medium&amp;utm_medium=referral">Leo chen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong><em>The most effective way to learn something is to build it yourself.</em></strong></p><p>Not follow a tutorial. Not wire together a framework. Actually design it from scratch, make the choices yourself, hit the walls that the frameworks are quietly protecting you from, and come out the other side knowing why those walls exist.</p><p>Most approaches — whether you’re following a LangChain tutorial, reaching for a full platform like OpenClaw or IronClaw, or using Anthropic’s Agent SDK — abstract the agent loop, memory, and tool dispatch behind a tidy API. That’s useful — but it skips the part I actually wanted to understand: what is the agent loop doing? How does memory work across a context window that fills up?</p><p>What happens when tool calls go wrong mid-stream? The frameworks handle all of this. Which means if you only use the frameworks, you never have to think about it.</p><p>I wanted to think about it. So I built an agentic AI platform from scratch.</p><p>A generic one with help from AI of course.</p><p>Skill #1 is a clock telling you current time based on your time zone. Overkill of course.</p><p>Real estate search is Skill #2. The platform itself knows nothing about real estate. Behind the scene we are taking advantage of “AI Prompt” search endpoint provided by <a href="https://www.realtyapi.io/dashboard">RealtyAPI</a>.</p><h3>Why real estate</h3><p>I needed a concrete use case to learn on. Something with a real API, real data, and enough UX complexity to force real decisions. Real estate fit: property search is a natural language problem, the data is rich, and there are stable commercial APIs available.</p><p>I found RealtyAPI — a unified API that sits in front of Zillow, Redfin, and<br> Realtor.com. Convenient for a learning project: one integration, multiple<br> providers underneath.</p><p>When I started exploring the endpoints, I noticed Zillow has a natural language search endpoint (`<strong>/search/byaiprompt</strong>`) — you pass a plain English description and it returns matching listings. Redfin doesn’t have an equivalent. That made the decision simple: the real estate skill uses Zillow’s AI search via RealtyAPI. Not a strategic choice — just what the API supported.</p><p>This is a portfolio project. The goal is to demonstrate agentic AI design: tool use, persistent memory, streaming, a pluggable skill system. Real estate is the vehicle. The platform is the point.</p><h3>What I built: a generic agent platform</h3><p>The platform is a generic agent core — an agentic loop, a skill system, layered memory, and a streaming API. Skills are pluggable Docker containers. The core knows nothing about any skill. To validate it end-to-end, I needed a real skill with a real API. Property search became that skill.</p><p>The user-facing product is called <strong>PropSearch</strong>. Here’s what using it looks like:</p><p><strong>1.</strong> You type: <em>”</em><strong><em>find me a 3-bed house in Austin under $500k with a big yard</em></strong><em>”.</em></p><p><strong>2.</strong> The agent searches Zillow via RealtyAPI and returns matching listings as cards — photo, address, price, beds/baths/sqft.</p><p><strong>3.</strong> You click a card — no typing required — and a detail view with a map appears inline.</p><p><strong>4.</strong> You refine: <em>”</em><strong><em>same but closer to downtown</em></strong><em>” </em>— the agent searches again, carrying your prior filters forward.</p><p><strong>5.</strong> Next session, you say <em>”</em><strong><em>find me something</em></strong><em>”</em> — the agent already knows your budget and location. You never repeated yourself.</p><p>The agent remembers across sessions without any login, account, or explicit “save my preferences” step. It just happens.</p><h3><strong>The skill contract</strong></h3><p><strong>PropSearch</strong> is the demo. The real output is the platform underneath it.</p><p>Any skill — property search, job search, travel planning — plugs into the same core by implementing two HTTP endpoints:</p><p>- <strong>GET /schema</strong> — returns the tool definitions and system prompt for this skill</p><p>- <strong>POST /execute</strong> — runs a tool and returns the result</p><p>Drop a new folder under <strong>skills/</strong>, build your Docker image, restart the server. The agent discovers your skill automatically and can use its tools. No core code changes.</p><p>The agent core knows nothing about real estate. It knows about skills — pluggable Docker containers that expose tools the agent can call. The first skill I built was a simple clock: ask it the time, it tells you the time. That’s it. Enough to prove the full stack worked before touching anything real estate related. Real estate came second.</p><h3><strong>What’s in this series</strong></h3><p><strong>Post 2</strong> walks through the <a href="https://medium.com/@CCH0/agentic-ai-the-hard-way-part-2-the-user-experience-29150481c476">user experience</a> — what <strong>PropSearch</strong> looks like in use.</p><p><strong>Post 3 </strong>covers the <a href="https://medium.com/@CCH0/agentic-ai-the-hard-way-part-3-architecture-and-design-a3d5265f9e01">architecture and design</a>: how the generic core, the skill system, and the memory model are designed, and why the key decisions were made.</p><p><strong>Post 4 </strong>covers <a href="https://medium.com/@CCH0/agentic-ai-the-hard-way-part-4-implementation-choices-844cb3807d87">implementation</a>: the agentic loop in ~50 lines, the bugs that only showed up at runtime, and the choices that look obvious in hindsight but weren’t at the time.</p><p><strong>Post 5</strong> talks about <a href="https://medium.com/@CCH0/agentic-ai-the-hard-way-part-5-adding-a-new-skill-28e74b24196f">adding a new skill</a>.</p><p>Before talking about design, we will walk you through the user experience first in part 2 of the series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33bad853ed6a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI The Hard Way — Part 2 The User Experience]]></title>
            <link>https://medium.com/@CCH0/agentic-ai-the-hard-way-part-2-the-user-experience-29150481c476?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/29150481c476</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[real-estate]]></category>
            <category><![CDATA[litellm]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 00:41:53 GMT</pubDate>
            <atom:updated>2026-04-28T00:41:53.787Z</atom:updated>
            <content:encoded><![CDATA[<p>Before getting into how it’s built, here’s what using it actually looks like.</p><p>Disclaimer — this series of posts are authored by AI, reviewed and edited by me and I take full responsibility for the content.</p><p>The source code is available on <a href="https://github.com/cch0/agentic-ai-localstack">Github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sZ7FmEbzQ1b4d2-E" /><figcaption>Photo by <a href="https://unsplash.com/@ianlu?utm_source=medium&amp;utm_medium=referral">Ian Lu</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>Starting a conversation</strong></h3><p>You open PropSearch and see a chat interface. There’s no search bar, no filters, no dropdowns. Just a text input. You type what you’re looking for in plain English.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4Xre7yD9zic63FCDIImLyA.png" /></figure><p><em>”</em><strong><em>find me a 3-bed house in Austin under $500k with a big yard</em></strong><em>”</em></p><p>The agent responds token by token — you can see it thinking. Then property cards appear inline in the chat: photo, address, price, beds, baths, sqft. Not in a separate results panel. Right there in the conversation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHsSP6cs-mPKhoGfjyyh3g.png" /></figure><h3><strong>Refining</strong></h3><p>You don’t start over. You keep talking.</p><p><em>”</em><strong>Are there any 4-bedroom houses in Austin under $1M?</strong><em>”</em></p><p>The agent carries your prior filters forward — beds, price, city — and updates only what you changed. The new results appear below the previous ones in the same thread.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2f7Lh8_RlhyrasM01TbczA.png" /></figure><h3><strong>Clicking a card</strong></h3><p>Clicking any property card doesn’t open a new page. It sends a message on your behalf — the agent fetches full property details and renders a richer card inline: year built, lot size, HOA fee, Zestimate. Below that, a map appears showing the property’s location on OpenStreetMap.</p><p>The map only appears here — on the detail view — because the Zillow search API doesn’t return coordinates. Only the detail endpoint does. A constraint that ended up feeling like a natural interaction: search to browse, click to commit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1lYWgWukW1pOff31YToubg.png" /></figure><h3><strong>Grid and list</strong></h3><p>A toggle above the results switches between a photo grid and a compact list view. The preference is remembered in localStorage — if you prefer list, it stays list across sessions and page refreshes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7Y2yyS4sYdvIE5okolMFXw.png" /></figure><h3><strong>Hint chips</strong></h3><p>After each agent response, three follow-up suggestions appear as clickable chips:</p><p>&gt; <em>”</em><strong><em>Show me properties with a garage</em></strong><em>”</em></p><p>&gt; <em>”</em><strong><em>Filter to single-family homes only</em></strong><em>”</em></p><p>&gt; <em>”</em><strong><em>What’s the Zestimate on the first one?</em></strong><em>”</em></p><p>These are generated by the agent based on the conversation so far. Clicking one sends it as your next message. They clear when you type something yourself.</p><h3><strong>Sessions and memory</strong></h3><p>The sidebar shows your past conversations, each with an auto-generated title pulled from your first message. You can switch between sessions or delete them.</p><p>The more interesting part: start a brand new session and the agent already knows your budget and location from last time. You didn’t save anything explicitly. The agent stored your preferences during the previous conversation and injects them into context at the start of every new one.</p><h3><strong>What it’s built on</strong></h3><p>The frontend is React 18, TypeScript, Vite, and Tailwind CSS. The map isreact-leaflet over OpenStreetMap tiles. The backend streams responses over Server-Sent Events — tokens arrive and render progressively, the same way Claude.ai or ChatGPT stream their responses.</p><p>Post 3 covers how the backend is designed. Post 4 covers the implementation choices and the things that only broke at runtime.</p><p>Coming up next we will take a look at architecture and design.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29150481c476" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI the Hard Way — Part 3 Architecture and Design]]></title>
            <link>https://medium.com/@CCH0/agentic-ai-the-hard-way-part-3-architecture-and-design-a3d5265f9e01?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3d5265f9e01</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[real-estate]]></category>
            <category><![CDATA[litellm]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 23:12:23 GMT</pubDate>
            <atom:updated>2026-04-27T23:12:23.575Z</atom:updated>
            <content:encoded><![CDATA[<p>Disclaimer — this series of posts are authored by AI, reviewed and edited by me and I take full responsibility for the content.</p><p>The source code is available on <a href="https://github.com/cch0/agentic-ai-localstack">Github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Zoiv0cVpgMMHGZHh" /><figcaption>Photo by <a href="https://unsplash.com/@damabima?utm_source=medium&amp;utm_medium=referral">Tienko Dima</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The architecture of an agentic AI system has three problems to solve: how the agent knows what tools it has, how it remembers things, and how it avoids running out of context window. Everything else is plumbing.</p><p>Here’s how this solution solved each one.</p><h3><strong>The skill system: Docker containers as tools</strong></h3><p>The biggest design decision was where skill code runs. The obvious approach — import skill modules into the host process — couples every skill’s dependencies to the host environment. Add a skill that needs a different version of a library and you have a conflict. Add a skill written in Go or Rust and you can’t import it at all.</p><p>Skills run in Docker containers. Each container exposes two endpoints:</p><pre>GET /schema → { &quot;system_prompt&quot;: &quot;…&quot;, &quot;tools&quot;: […] }<br><br>POST /execute → { &quot;tool&quot;: &quot;search_properties&quot;, &quot;params&quot;: {…} } → { &quot;result&quot;: … }</pre><p>The host reads <strong>/schema</strong> at startup to get the tool definitions it will give to the LLM. When the LLM calls a tool, the host POSTs to <strong>/execute</strong> on the container that owns that tool.</p><p>The skill author owns the Dockerfile and all dependencies. The consumer needs only Docker. Adding a third-party skill means dropping a manifest file and restarting — no code changes to the platform.</p><p>Each skill gets a pool of two pre-warmed containers. Spinning up a fresh container per tool call adds 1–3 seconds of cold-start latency. After every tool call, the used container is destroyed and recreated in the background — preventing side-effect bleed (temp files, in-process state) between calls while keeping the pool ready.</p><h3><strong>The memory model: four layers</strong></h3><p>Memory in an agentic system has a shape problem. Too little and the agent forgets things the user already told it. Too much and the context window fills up with irrelevant history. A flat sliding window is the naive solution; it fails in both directions at once.</p><p>A four-layer model inspired by MemPalace (https://mempalace.tech), an open-source AI memory system that uses tiered loading over flat context injection:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uWddgfyuGxhnyhMwn-lsjg.png" /></figure><p>Every agent turn assembles context in this order:</p><pre>0. AGENT.md ← stable identity and hard constraints<br>1. Skill system prompts ← tool orchestration rules from /schema<br>2. preferences.md ← always loaded; small and exact<br>3. ChromaDB top-N ← cross-session: what&#39;s relevant to this query<br>4. Last 5 turns ← verbatim; conversational coherence<br>5. Older turns (L2) ← session episodes retrieved by similarity<br>6. User message</pre><p>The L2 layer is the interesting one. Instead of compacting older session history into a lossy summary blob, each completed exchange is embedded and stored in a per-session ChromaDB collection. On the next turn, the most relevant older exchanges are retrieved by similarity to the current message. If you spent turns 1–10 discussing Austin and turns 11–15 discussing Seattle, then ask “what was my budget for Austin?” — the agent retrieves the Austin context, not the most recent Seattle context.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hC0q_x9pEpfl9tqOk32aoA.png" /></figure><h3><strong>L0: agent identity per skill</strong></h3><p>Each skill can define its own identity and hard constraints in an <strong>AGENT.md</strong> file inside its directory — alongside <strong>SKILL.md</strong>. At startup, <strong>SkillRegistry </strong>reads every skill’s <strong>AGENT.md</strong> and merges the content. It is injected at position 0 in every context before anything else.</p><p>The real estate skill’s <strong>AGENT.md</strong> defines the PropSearch persona, what it won’t do, and how it communicates. The current time skill has none — it has no persona to assert. Skills without an <strong>AGENT.md</strong> simply don’t contribute to the identity layer.</p><p>This keeps identity version-controlled alongside the code, scoped to the skill that owns it, and independent of anything inside the container. Redeploy the container and the agent’s identity doesn’t drift. Add a new skill with its own <strong>AGENT.md</strong> and its constraints are automatically enforced.</p><h3><strong>Scoring before storage</strong></h3><p>Tool results are scored 1–5 by the LLM before being written to ChromaDB. Only results scoring 3 or above are stored. This one cheap LLM call per tool use keeps the semantic retrieval store clean — errors, empty responses, and low-signal results never pollute future queries.</p><h3><strong>Streaming</strong></h3><p>The frontend uses Server-Sent Events. Every LLM call uses `stream=True`. Token chunks are yielded immediately; tool call argument chunks are accumulated across chunks before dispatch. After the final response, a secondary LLM call generates three contextual follow-up suggestions, yielded as a `hints` event. The frontend renders these as clickable chips below the response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7kTLKN9nMX6Atu1l6FsiIQ.png" /></figure><h3><strong>Key Design Decisions</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bwnuu0eXPjaBsnnAUFQ6rA.png" /></figure><p>Next we will look at some of the implementation choices.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3d5265f9e01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI the Hard Way — Part 4 Implementation Choices]]></title>
            <link>https://medium.com/@CCH0/agentic-ai-the-hard-way-part-4-implementation-choices-844cb3807d87?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/844cb3807d87</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[claude]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Mon, 27 Apr 2026 00:24:16 GMT</pubDate>
            <atom:updated>2026-04-27T00:24:16.039Z</atom:updated>
            <content:encoded><![CDATA[<p>The architecture looks clean in a diagram. Here’s how the key parts actually work.</p><p>Disclaimer — this series of posts are authored by AI, reviewed and edited by me and I take full responsibility for the content.</p><p>The source code is available on <a href="https://github.com/cch0/agentic-ai-localstack">Github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YxSJg5cvNzCm-K2B" /><figcaption>Photo by <a href="https://unsplash.com/@carameling?utm_source=medium&amp;utm_medium=referral">Elaine Chan</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>From message to response: the ingestion flow</strong></h3><p>Every user message travels the same path through the system before the LLM ever sees it.</p><p>The frontend sends a <strong>POST /chat/stream</strong> request over Server-Sent Events. FastAPI hands it to <strong>AgentLoop.run_stream()</strong>, which first assembles context — pulling from every layer of memory before adding the user’s message at the end. Only then does the first LLM call fire.</p><pre>User message<br>    │<br>    ▼<br>_build_context()<br>    ├── L0: AGENT.md per skill       (identity, injected at position 0)<br>    ├── L1: System prompt            (merged from all skill /schema responses)<br>    ├── L2: preferences.md           (always injected, skill-scoped)<br>    ├── L3: ChromaDB top-N           (cross-session semantic retrieval)<br>    ├── Last 5 turns verbatim        (conversational coherence)<br>    ├── Older turns by similarity    (L2 episode store, sessions &gt; 5 turns)<br>    └── User message<br>    │<br>    ▼<br>LiteLLM (stream=True)<br>    │<br>    ├── finish_reason: stop  → save session → yield hints → yield done<br>    │<br>    └── finish_reason: tool_calls<br>            │<br>            ▼<br>        _dispatch_tool_calls()<br>            ├── route to skill container via ContainerPool<br>            ├── sanitize result (scrub secrets)<br>            ├── score 1–5 → save to ChromaDB if score ≥ 3<br>            └── append tool result to history → loop back to LiteLLM</pre><p>The loop runs until the LLM stops calling tools or hits <strong>MAX_TOOL_ITERATIONS</strong>. Every tool result is sanitized, scored, and optionally stored before it feeds back into the next LLM call. The final response streams out as SSE token events; structured property data and hint chips follow as separate event types after the text completes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QNdUnmrltRqiovtWLkgAtg.png" /></figure><h3><strong>The agentic loop is ~50 lines</strong></h3><p>This is the whole thing. No framework. No magic.</p><pre>while iteration &lt; MAX_TOOL_ITERATIONS:<br>    response = await asyncio.wait_for(<br>        litellm.acompletion(<br>            model=os.getenv(&quot;LLM_MODEL&quot;),<br>            messages=messages,<br>            tools=self.registry.get_all_tools(),<br>            stream=True,<br>        ),<br>        timeout=LLM_TIMEOUT,<br>    )<br><br>    async for chunk in response:<br>        finish_reason = chunk.choices[0].finish_reason<br>        # accumulate tokens and tool call chunks...<br><br>    if finish_reason == &quot;stop&quot;:<br>        break<br><br>    if finish_reason == &quot;tool_calls&quot;:<br>        tool_messages, data = await self._dispatch_tool_calls(tool_calls)<br>        messages.extend(tool_messages)<br>        iteration += 1</pre><p>The LLM decides what to call and whether to loop. The registry routes each tool call to the container that owns it. The sanitizer scrubs secrets from results before they enter the message history. That’s the entire loop.</p><p>Two details worth noting. <strong>asyncio.wait_for</strong> rather than LiteLLM’s <strong>timeout= </strong>parameter — for Ollama, the library-level timeout doesn’t reliably fire; wrapping in <strong>asyncio.wait_for</strong> enforces a hard cutoff at the Python level regardless. And the Ollama model prefix matters: <strong>ollama_chat/</strong> (not <strong>ollama/</strong>) routes to <strong>/api/chat</strong>, which preserves tool message roles across turns. <strong>ollama/</strong> routes to <strong>/api/generate</strong>, which flattens everything to plain text and causes the agent to re-call tools it already called.</p><h3><strong>Streaming: accumulating tool call chunks</strong></h3><p>Every LLM call uses <strong>stream=True</strong>. Token chunks yield immediately to thefrontend. Tool call chunks are different — the function name and arguments arrive fragmented across multiple chunks and have to be accumulated before dispatch:</p><pre>accumulated_tool_calls: dict[int, dict] = {}<br><br>async for chunk in stream:<br>    if delta.tool_calls:<br>        for tc in delta.tool_calls:<br>            idx = tc.index<br>            if idx not in accumulated_tool_calls:<br>                accumulated_tool_calls[idx] = {&quot;id&quot;: None, &quot;function&quot;: {&quot;name&quot;: &quot;&quot;, &quot;arguments&quot;: &quot;&quot;}}<br>            if tc.function.name:<br>                accumulated_tool_calls[idx][&quot;function&quot;][&quot;name&quot;] += tc.function.name<br>            if tc.function.arguments:<br>                accumulated_tool_calls[idx][&quot;function&quot;][&quot;arguments&quot;] += tc.function.arguments</pre><p>Only after <strong>finish_reason == “tool_calls”</strong> are the accumulated calls dispatched. The SSE event sequence the frontend sees is: <strong>token</strong> events during the text response, a <strong>data</strong> event with structured property results, a <strong>hints</strong> event with follow-up suggestions, then <strong>done</strong>. The <strong>data</strong> and <strong>hints</strong> events both fire after all tool calls complete — they never interleave with tokens.</p><h3><strong>Container pool: destroy after use</strong></h3><p>Each skill gets a pool of pre-warmed containers. Spin-up for a Python container with dependencies takes 1–3 seconds cold; pooling keeps that latency out of the critical path.</p><p>After every tool call the used container is destroyed and recreated in the background:</p><pre>[*] → Warm → InUse → Recreating → Warm</pre><p>Destroying after use prevents side-effect bleed: temp files, in-memory caches, or any state the skill container accumulated during a call don’t carry over to the next request. The recreation happens asynchronously — by the time the next tool call arrives, a fresh container is ready.</p><p>Containers are published on sequential host ports starting at 9000. Ports are stored as Docker labels so the pool can recover its assignments on restart without re-scanning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FaeM9-wy25fIm4iZ-AS8Ag.png" /></figure><h3><strong>Context assembly: injection order</strong></h3><p><strong>_build_context</strong> assembles the full message list in a fixed order every turn:</p><pre>0. AGENT.md (per skill)  ← L0: identity injected at position 0<br>1. System prompt         ← merged from all skill /schema responses<br>2. preferences.md        ← L1: always injected, skill-scoped<br>3. ChromaDB top-N        ← L3: cross-session semantic retrieval<br>4. Last 5 turns          ← verbatim, for conversational coherence<br>5. Older turns (L2)      ← session episodes retrieved by similarity<br>6. User message</pre><p>The L2 episode retrieval only kicks in when a session exceeds 5 user turns. Below that threshold, all history is included verbatim — no retrieval needed. Above it, the oldest turns are indexed into a per-session ChromaDB collection and retrieved by similarity to the current message. If you spent 10 turns on Austin then pivoted to Seattle, asking about Austin later retrieves Austin context rather than your most recent Seattle messages.</p><h3><strong>Scoring before storage</strong></h3><p>Before any tool result is written to ChromaDB, a secondary LLM call scores it 1–5. Only results scoring 3 or above are stored.</p><p>This one call per tool use keeps the semantic retrieval store clean for the lifetime of the project. Errors, empty API responses, and low-signal results never pollute future queries. A tool that returns <strong>{“error”: “not found”}</strong> scores 0 and is discarded immediately — it never surfaces in future ChromaDB top-N results.</p><h3><strong>Hint generation</strong></h3><p>After the final response, a secondary LLM call generates three follow-up suggestions. The context passed to it is the last 4 non-system messages, trimmed to start at a user turn, with tool result content replaced by <strong>”[tool result]”</strong>. This keeps the hints call cheap — it never sends full Zillow API payloads to generate a suggestion chip.</p><p>Local models often return the JSON array wrapped in prose: ”<strong>Sure! Here are some: […]</strong>”. The parser tries <strong>json.loads</strong> first, then falls back to a regex extracting the first<strong> […]</strong> block. If both fail, hints are omitted silently — the stream continues normally.</p><h3><strong>Testing approach</strong></h3><p>Skill containers are mocked — tests never start Docker. The container pool and skill registry are patched with fixtures that return synthetic tool results. Streaming is tested with synthetic chunk fixtures that simulate the exact sequence LiteLLM produces: token chunks, tool call name chunk, tool call argument chunks, finish chunk.</p><p>The test suite covers: episode retrieval fires for long sessions but not short ones, <strong>AGENT.md</strong> is injected at position 0, episode save is called after each streaming turn, hint generation failure doesn’t break the stream.</p><p>In the next and final installation, we will take a look at adding a new skill.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=844cb3807d87" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agentic AI the Hard Way — Part 5 Adding a New Skill]]></title>
            <link>https://medium.com/@CCH0/agentic-ai-the-hard-way-part-5-adding-a-new-skill-28e74b24196f?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/28e74b24196f</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[cluade]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Sun, 26 Apr 2026 22:39:10 GMT</pubDate>
            <atom:updated>2026-04-26T22:39:10.736Z</atom:updated>
            <content:encoded><![CDATA[<p>The platform knows nothing about real estate. It knows about skills — Docker containers that expose two endpoints. Adding a skill means building a container that implements the contract. The platform discovers it automatically on restart. No core code changes.</p><p>Here’s how to add one from scratch.</p><p>Disclaimer — this series of posts are authored by AI, reviewed and edited by me and I take full responsibility for the content.</p><p>The source code is available on <a href="https://github.com/cch0/agentic-ai-localstack">Github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QSdNYaZwBhvExjRa" /><figcaption>Photo by <a href="https://unsplash.com/@magict1911?utm_source=medium&amp;utm_medium=referral">Timo Volz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>The contract</strong></h3><p>Every skill exposes two HTTP endpoints:</p><pre>GET  /schema   → { &quot;system_prompt&quot;: &quot;...&quot;, &quot;tools&quot;: [...] }<br>POST /execute  → { &quot;tool&quot;: &quot;tool_name&quot;, &quot;params&quot;: {...} } → { &quot;result&quot;: ... }</pre><p><strong>/schema</strong> is called once at startup. The platform reads the tool definitions and merges them with every other loaded skill’s tools — the LLM sees the full merged list every turn. <strong>/execute</strong> is called each time the LLM decides to use one of your tools.</p><p>That’s the entire contract. The skill can be written in any language that can run an HTTP server.</p><h3><strong>Directory structure</strong></h3><pre>skills/<br>  weather/<br>    SKILL.md      ← machine-parsed frontmatter + human docs<br>    AGENT.md      ← optional: skill identity and hard constraints<br>    .env          ← secrets injected via --env-file at container start<br>    Dockerfile<br>    app.py        ← or whatever your skill is written in</pre><p><strong>SKILL.md</strong> requires two fields the platform reads at startup:</p><pre>---<br>name: weather<br>image: weather:latest<br>---<br><br>## Purpose<br>Returns current weather conditions for a given city.<br><br>## Tools<br>- `get_weather` — params: city (string)</pre><p>The <strong>name</strong> field is used to scope memory (preferences.md, ChromaDB collections).</p><p>The <strong>image</strong> field is what the platform passes to <strong>docker run</strong>.</p><h3><strong>Implementing /schema</strong></h3><p>The tool definitions follow LiteLLM’s format — the same JSON structure you’d pass to the OpenAI API directly. Here’s a minimal Flask example:</p><pre>from flask import Flask, jsonify<br><br>app = Flask(__name__)<br><br>@app.route(&quot;/schema&quot;)<br>def schema():<br>    return jsonify({<br>        &quot;system_prompt&quot;: (<br>            &quot;You are a weather assistant. Use get_weather to look up &quot;<br>            &quot;current conditions for any city the user asks about.&quot;<br>        ),<br>        &quot;tools&quot;: [{<br>            &quot;type&quot;: &quot;function&quot;,<br>            &quot;function&quot;: {<br>                &quot;name&quot;: &quot;get_weather&quot;,<br>                &quot;description&quot;: &quot;Get current weather for a city.&quot;,<br>                &quot;parameters&quot;: {<br>                    &quot;type&quot;: &quot;object&quot;,<br>                    &quot;properties&quot;: {<br>                        &quot;city&quot;: {<br>                            &quot;type&quot;: &quot;string&quot;,<br>                            &quot;description&quot;: &quot;City name, e.g. &#39;Austin, TX&#39;&quot;<br>                        }<br>                    },<br>                    &quot;required&quot;: [&quot;city&quot;]<br>                }<br>            }<br>        }]<br>    })</pre><h3><strong>Implementing /execute</strong></h3><pre>import os<br>import requests<br><br>@app.route(&quot;/execute&quot;, methods=[&quot;POST&quot;])<br>def execute():<br>    body = request.get_json()<br>    tool = body[&quot;tool&quot;]<br>    params = body[&quot;params&quot;]<br><br>    if tool == &quot;get_weather&quot;:<br>        city = params[&quot;city&quot;]<br>        resp = requests.get(<br>            &quot;https://api.weatherapi.com/v1/current.json&quot;,<br>            params={&quot;key&quot;: os.environ[&quot;WEATHER_API_KEY&quot;], &quot;q&quot;: city}<br>        )<br>        return jsonify({&quot;result&quot;: resp.json()})<br><br>    return jsonify({&quot;error&quot;: f&quot;Unknown tool: {tool}&quot;}), 400</pre><p>Secrets go in <strong>skills/weather/.env</strong>:</p><pre>WEATHER_API_KEY=your_key_here</pre><p>The platform injects this file via <strong>— env-file</strong> when it starts the container. The key never touches the host environment or any other skill’s container.</p><h3><strong>Dockerfile</strong></h3><pre>FROM python:3.12-slim<br>WORKDIR /app<br>COPY requirements.txt .<br>RUN pip install --no-cache-dir -r requirements.txt<br>COPY . .<br>CMD [&quot;python&quot;, &quot;-m&quot;, &quot;flask&quot;, &quot;run&quot;, &quot;--host=0.0.0.0&quot;, &quot;--port=8080&quot;]</pre><p>Build it:</p><pre>docker build -t weather:latest skills/weather/</pre><h3><strong>That’s it</strong></h3><p>Restart the server. <strong>SkillRegistry.load_all()</strong> scans <strong>skills/*/SKILL.md</strong>, reads the <strong>name</strong> and <strong>image</strong> fields, starts <strong>pool_size</strong> containers per skill, and calls <strong>/schema</strong> oneach one. Your new tool appears in the LLM’s tool list automatically. If you added an <strong>AGENT.md</strong>, its content is injected at position 0 in every context, before anything else.</p><p>The platform doesn’t know what weather is. It knows there’s a tool called <strong>get_weather</strong> that takes a <strong>city</strong> parameter, and a container to call when the LLM decides to use it. The rest is the skill’s problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-zQv1Pz85jgcS6BT" /><figcaption>Photo by <a href="https://unsplash.com/@crawford?utm_source=medium&amp;utm_medium=referral">Crawford Jolly</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=28e74b24196f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[NYC Taxi Trip Data Analysis (again) Using Temporal and Vert.x]]></title>
            <link>https://medium.com/@CCH0/nyc-taxi-trip-data-analysis-again-using-temporal-and-vert-x-164738b3c908?source=rss-59048ef95a0b------2</link>
            <guid isPermaLink="false">https://medium.com/p/164738b3c908</guid>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[vertx]]></category>
            <category><![CDATA[temporal]]></category>
            <category><![CDATA[clickhouse]]></category>
            <dc:creator><![CDATA[cch]]></dc:creator>
            <pubDate>Mon, 09 Mar 2026 15:01:01 GMT</pubDate>
            <atom:updated>2026-03-09T15:01:01.480Z</atom:updated>
            <content:encoded><![CDATA[<p>Continue on the journey of using Claude Code…</p><p>I have been using NYC taxi trip data to try out various solutions. In this <a href="https://medium.com/@CCH0/using-hex-notebook-agent-for-nyc-taxi-trip-data-analysis-first-impressions-bad776565e4f">post</a> it is Hex Notebook Agent. In this <a href="https://medium.com/@CCH0/using-cubes-analytic-agent-for-nyc-taxi-trip-data-analysis-a8a5f3afe730">post</a> it is Cube analytics agent. Lastly in this <a href="https://medium.com/@CCH0/using-temporal-for-nyc-taxi-trip-data-analysis-e444aad3fc96">post</a> I was using Spring Boot and Temporal.</p><p>In this post, I am coming back to Vert.x and integrating Temporal, implementing a workflow running multiple activities to generate analytics report.</p><p>The source code is available on <a href="https://github.com/cch0/vertx-temporal-nyc-taxi-trip-analysis">Github</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wk0AIYbwlMIUPBT2" /><figcaption>Photo by <a href="https://unsplash.com/@petekasprzyk?utm_source=medium&amp;utm_medium=referral">Peter Kasprzyk</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>The Goals</h3><p>Previously I have (or rather, Claude) created a Temporal workflow to ingest raw Parquet files into ClickHouse database. In this post, I am creating a Vert.x application implementing another Temporal workflow to generate a few analytic reports based on the same dataset. The goals are</p><ul><li>Allow user to call an API endpoint to trigger a workflow analyzing trip data for the request time range.</li><li>Allow user to call an API endpoint to retrieve the analysis report.</li></ul><h3>APIs</h3><p><strong>Triggering Analysis Workflow</strong></p><p>The payload specifies the start and end dates of the time range from which we are running the analysis. Since we don’t know ahead of time how long this process will take, the endpoint will simply return HTTP status code 202 acknowledging the request.</p><pre>curl -X POST  http://localhost:8080/api/analysis \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;startDate&quot;: &quot;2024-01-01&quot;, &quot;endDate&quot;: &quot;2024-01-31&quot;}&#39; </pre><pre>{&quot;message&quot;: &quot;acknowledged&quot;}</pre><p><strong>Retrieving Analysis Report</strong></p><p>This endpoint allows user to retrieve the analysis report. Report is identified by the workflow id. There is only one workflow currently defined and its id is <em>taxi-data-analysis.</em></p><pre>curl http://localhost:8080/api/analysis/{workflowid}</pre><p>The response payload is too large to show here but it is available at this <a href="https://gist.github.com/cch0/ee77aa70f9e5c01097df03db686c2014">gist</a>.</p><p>The “short” version looks like the following</p><pre>{<br>    &quot;monthlyVolumes&quot;: {<br>        &quot;entries&quot;: [<br>            {<br>                &quot;month&quot;: 202401,<br>                &quot;trips&quot;: 2862486,<br>                &quot;revenue&quot;: 76768776.8<br>            }<br>        ]<br>    },<br>    &quot;zoneFareStats&quot;: {<br>        &quot;entries&quot;: [<br>            {<br>                &quot;locationId&quot;: 132,<br>                &quot;trips&quot;: 141743,<br>                &quot;avgFare&quot;: 59.44623995541227,<br>                &quot;avgDistance&quot;: 15.501861397035478<br>            }<br>        ]<br>    },<br>    &quot;peakHours&quot;: {<br>        &quot;entries&quot;: [<br>            {<br>                &quot;hour&quot;: 0,<br>                &quot;dayOfWeek&quot;: 1,<br>                &quot;trips&quot;: 11989<br>            }<br>        ]<br>    }<br>}</pre><h3>Analysis Details</h3><p>When workflow is triggered, we click off three activity runs in parallel. Those activities are declared in a Java interface class.</p><p><strong>Activity Interface</strong></p><pre>@ActivityInterface<br>public interface ReportActivity {<br><br>    @ActivityMethod<br>    MonthlyVolumes computeMonthlyVolumes(ReportRequest request);<br><br>    @ActivityMethod<br>    ZoneFareStats computeZoneFareStats(ReportRequest request);<br><br>    @ActivityMethod<br>    PeakHours computePeakHours(ReportRequest request);<br>}</pre><ul><li>Compute monthly volume — counts the number of taxi trips and total revenue for each month within the given date range.</li></ul><pre>SELECT toYYYYMM(tpep_pickup_datetime) AS month, count() AS trips, sum(total_amount) AS revenue<br>FROM %s WHERE tpep_pickup_datetime &gt;= &#39;%s&#39; AND tpep_pickup_datetime &lt; &#39;%s&#39;<br>GROUP BY month ORDER BY month</pre><ul><li>Compute zonal fare stats — counts trips, average fare, and average trip distance for each pickup location zone within the given date range, ranked by busiest zones.</li></ul><pre>SELECT PULocationID, count() AS trips, avg(fare_amount) AS avg_fare, avg(trip_distance) AS avg_distance<br>FROM %s WHERE tpep_pickup_datetime &gt;= &#39;%s&#39; AND tpep_pickup_datetime &lt; &#39;%s&#39;<br>GROUP BY PULocationID ORDER BY trips DESC</pre><ul><li>Compute peak hours — counts trips by hour of day and day of week within the given date range, showing when taxi demand is highest.</li></ul><pre>SELECT toHour(tpep_pickup_datetime) AS hour, toDayOfWeek(tpep_pickup_datetime) AS dow, count() AS trips <br>FROM %s WHERE tpep_pickup_datetime &gt;= &#39;%s&#39; AND tpep_pickup_datetime &lt; &#39;%s&#39;<br>GROUP BY hour, dow ORDER BY hour, dow</pre><h3>Conflict Handling</h3><p>After receiving the request to trigger a new workflow execution, the first thing we do is to check whether the same workflow is currently running. In that case, response with HTTP 409 is returned.</p><p>When retrieving the analysis report but the workflow either has not been executed or failed to complete, response with HTTP 500 is returned.</p><h3>Final Thoughts</h3><ul><li>It is again very fun working with Claude on creating something from scratch. Claude has been helping me with using Temporal. I don’t have to check out Temporal’s documentation before I can do anything. This is great but also terrifying.</li><li>Claude does not always suggests solution with good design. It is still very much up to the user to understand the trade off behind each design decision.</li><li>Last but not least, Claude has been creating documentation for me, from README to Claude.md. I also asked it to create memory.md to store the conversation in case I need to start a new session and not to lose the content. Pretty sweet.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=164738b3c908" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>