<?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 Sam Gallagher on Medium]]></title>
        <description><![CDATA[Stories by Sam Gallagher on Medium]]></description>
        <link>https://medium.com/@gallaghersam95?source=rss-94d7e8f6238c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*wGZOkNpIM37wr1LXjcJ0Jg.jpeg</url>
            <title>Stories by Sam Gallagher on Medium</title>
            <link>https://medium.com/@gallaghersam95?source=rss-94d7e8f6238c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 21:52:42 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gallaghersam95/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[Dispatch. The Loop is Code]]></title>
            <link>https://medium.com/@gallaghersam95/dispatch-the-loop-is-code-aa614975e8cd?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa614975e8cd</guid>
            <category><![CDATA[agentic-ai]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[coding-agents]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[loop-engineering]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Sat, 29 Aug 2026 01:10:03 GMT</pubDate>
            <atom:updated>2026-08-29T01:10:03.846Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WjTgmyWZXRC49vwrJQ6jSw.png" /><figcaption>Loops and stuff</figcaption></figure><p>I’m tired of claude code stopping midway through a task because it believes it’s “done”. I get that the concept of done is subjective, but typically for me while using a CC session it’s defined by a working feature or enhancement I likely can directly test.</p><p>I’ve also been out on paternity leave for a few weeks, so my time spent at my desk babysitting these sessions have gotten much shorter and less frequent.</p><p>Introducing <a href="https://github.com/GallagherSam/dispatch">Dispatch</a>, a tool that manages the loops required for more autonomous engineering a bit more elegantly.</p><h3>The Idea</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SVcorp1MyTuzDMvk0mQFA.png" /><figcaption>Look, a board!</figcaption></figure><p>Let’s make the loop code, and automate the mildly tedious process I was doing while babysitting different coding agent sessions. The main goal, take the opinion-ness out of the “is it done yet?” question and build a proper system that can more explicitly decide if a thing is actually done or not.</p><p>Dispatch is essentially a kanban board that drives a fleet of coding agents.</p><pre>card -&gt; stage gates -&gt; agent runs in its own worktree<br>     -&gt; completion gates -&gt; next stage -&gt; ... -&gt; merge to base</pre><p>A card moves through a pipeline. Each stage names the agent that executes and the required gates it must pass. When the pipeline is exhausted for a given card it’s rebased, re-verified, and fast-forwarded onto your base branch.</p><p>This solves the new classification of problem I’ve seen as agents tell me “but it worked on my feature branch” without checking main.</p><h3>System Architecture</h3><p>It kinda works, actually surprisingly well. Lots of tools I’ve investigated turn out to be really thin wrappers around LLMs making decisions and judgements on what’s next, what’s working, and what done looks like. I’d rather enforce it in a deterministic loop.</p><p><strong>Gates have four verdicts.</strong> Pass, defer, fail, and escalate. Sometimes a card can’t be completed until later, sometimes a card needs a human to step in with judgement, let’s design for those. Simple pass/fail boolean isn’t nuanced enough to capture card states, and I’m sure these will be expanded later on.</p><p><strong>Agents probably shouldn’t write directly to the board. </strong>Sounds like a recursive mess of my LLM spend waiting to happen. New work arrives as proposals that are reviewed by humans. I also occasionally have a claude code session directly use the dispatch cli to create cards as well.</p><p><strong>Containment that works. </strong>I might have some trust issues, but work is isolated in git worktrees, defined file glob patterns, and confined via Seatbelt or bubblewrap (windows is out of luck).</p><p><strong>Merges are serialized. </strong>Conflicts drive me crazy, given the throughput agents already provide for code generation I think we can overlook this efficiency loss vs. parallel merges.</p><h3>dispatch intent</h3><p>Have you ever wanted to just tell Jira the work you wanted to happen? Now you can. dispatch intent is a command that takes plain text language and routes it straight to a planning agent to figure out the work required.</p><pre>dispatch intent &quot;Rate limiting on the public API.<br>Per API key, not per IP, we have customers behind<br>shared NAT. Existing endpoints must keep their<br>latency budget.&quot;</pre><p>It’s pretty cool, I recommend trying it.</p><h3>Implementation Details</h3><p>Dispatch is written in Python 3.9+ using standard library only. No external services, no daemons, no dependencies. It has tests, gates, and I personally use it on a number of projects now. I tend to route it through Tailscale so I can monitor from my phone as I live my life.</p><p>It currently only drives Claude Code. If you want it to drive another agent CLI, please open an PR that would be great.</p><p>It’s not a hosted service or platform, and I don’t intend to turn it into one. It’s a useful tool that is supposed to remove a bit more of the friction that comes from using coding agents.</p><h3>Conclusion</h3><p>If you’re building something similar, and probably you are if you’re reading this, I’d love to hear about it. Dispatch is available as a v0.1.0 release to start using today.</p><pre>pipx install git+https://github.com/GallagherSam/dispatch<br>dispatch docs</pre><p>I just watched 7 cards clear my board while writing this, 2 were rejected initially with failing tests and file scope, and I didn’t have to do anything directly to manage it.</p><p>It’s not perfect, but a good place to start.</p><p>Repo: <a href="https://github.com/GallagherSam/dispatch">https://github.com/GallagherSam/dispatch</a></p><p>— Sam</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa614975e8cd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Before you build an agent, design the job]]></title>
            <link>https://medium.com/@gallaghersam95/before-you-build-an-agent-design-the-job-05388c0cbdfb?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/05388c0cbdfb</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 02:45:02 GMT</pubDate>
            <atom:updated>2026-04-13T02:53:17.373Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZFKio6Pwy49YzvMEtOtfHQ.png" /></figure><p>Every week I talk to leaders who are working on AI adoption. They’re evaluating frameworks, comparing models, reading articles on autonomous agents, and asking similar questions: which tool should we bet on?</p><p>I don’t think that’s the right question, the bottleneck isn’t the tooling. The bottleneck is that nobody in the room has done the work of understanding their own problems well enough to give an AI something useful to do.</p><p>I run a sizeable AI/ML practice. Over the past few months I’ve built and deployed what I’ve started calling agent jobs, automated workflows where an LLM does the real reasoning work on a schedule, against known systems, and produces output people rely on. Some run daily, some run on events. The choices I made around which model and framework were important, but not nearly as important as the time I spent understanding the problem, scoping the reasoning, and designing the job before the LLM ever saw a prompt.</p><p>That design work is the skill I don’t hear people talking about.</p><h3>The anatomy of an Agent Job</h3><p>An agent job has five parts, and four of them are deterministic code.</p><p>A <strong>trigger</strong> starts the job: a schedule, a webhook, cloud event, incoming Slack message, etc. Something that isn’t a human typing into a chat box.</p><p><strong>Context packing</strong> gathers everything the LLM will need to reason. Data from systems, files from code repos, state from databases, notes in documents, all filtered and formatted and assembled into a coherent bundle before the LLM ever sees it. This is code, not the LLM. You decide what goes in.</p><p>The <strong>reasoning</strong> step is where the LLM does its work. It receives the packed context and a clearly scoped mandate: here’s what you’re looking at, here’s what I need you to figure out, here’s the shape of the answer I expect. This is the only non-deterministic part of the pipeline. This is the part where it feels like magic when it comes out right.</p><p>An <strong>output contract </strong>defines what the reasoning step must produce. A structured schema that downstream systems can validate and consume. If the output doesn’t conform, the job fails and you know why.</p><p><strong>Side-effect dispatch</strong> takes the validated output and does something with it. Writes a row to a sheet, posts to Slack, opens a PR, updates a record, maybe sends a GIF. The workflow handles this, not the LLM.</p><p><strong>Trigger</strong>, <strong>pack</strong>, <strong>reason</strong>, <strong>validate</strong>, <strong>dispatch</strong>. Four deterministic steps wrapped around one flexible middle.</p><h4>A brief example</h4><p>I manage a professional services practice. Engineers are assigned to client engagements with target end dates and part of my role is to know who’s rolling off when, what’s coming next, where the gaps are, and overall bandwidth. The data that answers these questions lives in several disconnected systems that don’t talk to each other, including my notes. Before I built a job for this I spent several hours every week copying data across different tabs to assemble a picture that was already stale by the time I finished. Maddening.</p><p>Now a job runs every weekday morning. The outer loop queries the different systems (including my notes), packs the results into a structured context bundle, and hands it to the LLM with a specific ask: for each person, reconcile these data sources, compute the key dates, produce a triage status, and bake in context from my notes. Does this person need action, watching, or are they stable? The output contract is a row per person with defined columns. The dispatch writes it to a shared sheet.</p><p>The LLM is doing real reasoning in the middle. It’s reconciling names across different systems that don’t use the same identifiers, it’s pulling context from my notes that likely aren’t in the system yet, and it’s applying judgement to the triage column to direct my focus on what’s important at that moment. This can’t be a SQL query, it requires reading comprehension and inference.</p><p>But the LLM isn’t driving. It doesn’t decide which systems to query, what columns to produce, the questions to ask, or where the outputs land. I made all of those decisions when I designed the job. The LLM’s mandate is scoped, and it’s scoped because I understand the problem well enough to scope it.</p><p>I look at the output during my morning coffee. By 8:30 I’ve already had two conversations that wouldn’t have happened otherwise.</p><h3>Context strategy</h3><p>When you’re designing a job, because you should, the most consequential choice you’ll make is how to handle context.</p><p><strong>Eager context packing </strong>means you gather everything before the reasoning step starts. The LLM works with a static bundle, it sees what you gave it and nothing else. This is the default, and I’d recommend starting here. It’s fully reproducible: same input, comparable output. When something goes wrong, you can inspect exactly what the LLM saw.</p><p><strong>Lazy context packing</strong> means you give the LLM bounded, read-only access to additional systems during the reasoning step. You pack the core context, but you also hand it constrained tools and let it decide whether it needs more information to complete its analysis.</p><p>This is not a spectrum to slide along casually, it’s an explicit design choice with real consequences.</p><p>Lazy packing is the right call when the context space is too large or too conditional to assemble eagerly. Maybe there are fifteen systems the LLM might need, but for any given run it only needs three, and which three depends on what it finds in the first one. Eagerly packing all fifteen is wasteful, noisy, and might blow your context window. Letting the LLM pull what it needs is genuinely more capable.</p><p>But lazy packing introduces failure modes that eager packing doesn’t have. Did the LLM query the right system? Did it find the right information? Did it find all of the information it needed, or did it stop too early and reason over an incomplete picture? These aren’t hypothetical. They’re the challenges that make the difference between a job you trust and a job you babysit.</p><p>Default to eager. Choose lazy when you have a specific reason, and when you’re prepared to invest in the observability to make the LLM’s runtime data access properly auditable.</p><h3>Job design as a skill</h3><p>As we have started to provide skills to the agents to do things, I think we also need to provide skills to humans to build agentic systems properly.</p><p>The hard part is understanding your own systems well enough to know what data matters, and where it is. It’s knowing where judgement is genuinely required versus where a SQL query handles it. Ultimately, it’s about drawing the line between what code should do deterministically and what the LLM should reason about.</p><p>I’ve started calling this <strong>job design</strong>, and it requires deep domain knowledge. Not knowledge of the model or framework, but knowledge of the problem. The person who designs the job needs to understand the systems, the data, the stakeholders, the output, and the failure modes. They need to know what questions they’re actually asking, and they need to know it precisely enough to scope the LLM’s mandate around it.</p><p>The current AI adoption conversation conveniently skips this step. It jumps from “we should use AI” to “which framework” to “let’s build an agent” without stopping to understand the problems deeply enough first. When the agent doesn’t work, the conclusion is often that the technology isn’t ready, when the actual issue is that nobody the design work is lacking.</p><p>I think the technology is ready, by a mile. The frameworks are fine, the models are good enough for most purposes, what I’ve found missing is the discipline to thoroughly decompose a problem before automating</p><h3>How to fit this into the nonstop chaos of AI adoption</h3><p>If you’re a leader trying to figure out where AI fits, I’d suggest starting with a discovery question: “who on my team understands our operational problems well enough to decompose them?”</p><p>The people who will get real value from this are the ones who can look at a recurring process, something that happens weekly or daily, that touches multiple systems, to produce meaningful output for others. These processes can be broken into the parts that are deterministic, and the parts that require judgement. Then they scope the judgement tightly, pack the context deliberately, define the output precisely, and let the LLM handle the one thing it’s genuinely good at: reasoning over information that’s too messy or too contextual for a rule to handle.</p><p>That’s a big job, and it’s the human’s job to solve it.</p><p>I’ve built a handful of these so far, and I expect to be running dozens within a few more weeks. Every time I build one, I understand the operational problem more deeply than I did before I started. The automation is the output, and the deep operational and process knowledge is of real value.</p><p>If you’ve built something like this, or you’re thinking about it, I’d like to compare notes. The pattern works, and I think the conversation about it is just getting started.</p><p>— Sam</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05388c0cbdfb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building an Autonomous Research Agent with Google ADK]]></title>
            <link>https://medium.com/@gallaghersam95/building-an-autonomous-research-agent-with-google-adk-faf9e1dbd8a1?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/faf9e1dbd8a1</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Sun, 04 Jan 2026 21:15:45 GMT</pubDate>
            <atom:updated>2026-01-04T21:15:45.362Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8p6aJ_7lr3KJPDxchF2Vsg.png" /></figure><p>I built an AI agent that searches ArXiv, reads academic papers, and writes research summaries. Completely autonomous, no human in the loop.</p><p>Then I hit the real problem: where does the output actually go? This question led me to build <a href="https://surfacedocs.dev/">SurfaceDocs</a>.</p><h3>The Output Problem</h3><p>Here’s what I’ve done on past projects to get LLM-generated content out of a pipeline:</p><ul><li>Dumped JSON to GCS buckets and hoped someone would find it</li><li>Hacked together Apps Script bridges to push content into Google Docs</li><li>Built one-off React apps just to display results</li><li>Copied from terminal logs</li></ul><p>Every AI project eventually generates something valuable. A report, an analysis, a summary. And every project reinvents the wheel figuring out where to put it.</p><p>For this project, I wanted a clean solution. Something an autonomous agent could call as a tool that would produce a shareable, readable document without me building custom infrastructure.</p><h3>What I Built</h3><p>The goal: an agent that takes a research query, searches ArXiv for relevant papers, reads the promising ones, and produces a summary document. All triggered by a single API call.</p><p>Here’s what the end-to-end flow looks like:</p><pre>POST /research<br>{<br>  &quot;query&quot;: &quot;recent advances in AI agent architectures&quot;,<br>  &quot;days_back&quot;: 7,<br>  &quot;max_papers&quot;: 10<br>}<br><br>Response:<br>{<br>  &quot;status&quot;: &quot;success&quot;,<br>  &quot;document_url&quot;: &quot;https://app.surfacedocs.dev/d/abc123&quot;,<br>  &quot;papers_analyzed&quot;: 4,<br>  &quot;arxiv_calls_used&quot;: 2<br>}</pre><p>The agent runs in the background. When it’s done, you get a URL to a formatted research document. No logs to parse, no files to download. Just a link you can share.</p><p><a href="https://app.surfacedocs.dev/public/d/doc_oznjR4Sw7ca2">View an example output document.</a></p><h3>The Agent Architecture</h3><p>I used Google’s Agent Development Kit (ADK), which provides a clean abstraction for building tool-using agents. The agent has three tools:</p><ol><li><strong>search_arxiv — </strong>Search for papers by query and date range</li><li><strong>fetch_paper_content — </strong>Read the full text of a specific paper</li><li><strong>save_document</strong> — Save the final summary to SurfaceDocs</li></ol><p>The agent is goal-oriented, not step-by-step. I give it a goal and constraints, and it figures out how to use the tools.</p><pre>from google.adk.agents import Agent<br><br>research_agent = Agent(<br>    name=&quot;research_agent&quot;,<br>    model=&quot;gemini-3-pro-preview&quot;,<br>    instruction=&quot;&quot;&quot;You are a research assistant that finds and summarizes<br>    academic papers from arXiv.<br><br>    Your goal: Given a research query, search for relevant papers, read<br>    the most promising ones, and produce a comprehensive research document.<br><br>    Tools available:<br>    - search_arxiv: Find papers by topic (max 5 searches)<br>    - fetch_paper_content: Read full paper text<br>    - save_document: Save your final summary<br><br>    Be selective. Focus on the most relevant papers. Always save a<br>    document at the end.&quot;&quot;&quot;,<br>    tools=[search_arxiv, fetch_paper_content, save_document],<br>)</pre><p>The agent decides how many searches to run, which papers to read in full, and when it has enough information to synthesize. I set a cap of 5 ArXiv API calls to keep it bounded, but within that constraint it’s autonomous.</p><h4>Running Headlessly</h4><p>Most ADK examples show chat interfaces. This agent runs in the background, triggered by an API call. The `Runner` class handles this:</p><pre>from google.adk.runners import Runner<br>from google.adk.sessions import InMemorySessionService<br><br>session_service = InMemorySessionService()<br>await session_service.create_session(app_name=&quot;research&quot;, user_id=&quot;api&quot;, session_id=session_id)<br><br>runner = Runner(agent=research_agent, app_name=&quot;research&quot;, session_service=session_service)<br><br>events = runner.run_async(user_id=&quot;api&quot;, session_id=session_id, new_message=content)<br>async for event in events:<br>    if event.is_final_response():<br>        # Agent completed<br>        pass</pre><p>Each API request gets a fresh session. The agent runs, calls tools as needed, and terminates. No persistent conversation, no chat history. Task in, result out.</p><h3>The Output Layer</h3><p>Here’s where the output problem gets solved. The <em>save_document</em> tool is surprisingly simple:</p><pre>from surfacedocs import SurfaceDocs<br><br>async def save_document(document: dict) -&gt; dict:<br>    &quot;&quot;&quot;Save the research document to SurfaceDocs.&quot;&quot;&quot;<br>    client = SurfaceDocs(api_key=settings.surfacedocs_api_key)<br><br>    result = client.save(document, folder_id=settings.surfacedocs_folder_id)<br><br>    return {<br>        &quot;status&quot;: &quot;success&quot;,<br>        &quot;url&quot;: result.url,<br>    }</pre><p>The agent generates structured content (headings, paragraphs, lists) following a schema. One API call later, it’s a hosted document with a shareable URL.</p><p>SurfaceDocs provides a <em>SYSTEM_PROMPT</em> that teaches the LLM the document format, so I include it in the agent’s instructions. The agent writes directly in the expected structure. No post-processing needed.</p><p>What I like about this pattern:</p><ul><li>The agent treats “publish output” as just another tool</li><li>No infrastructure to maintain on my side</li><li>Documents are immediately shareable (useful for n8n webhooks, Slack notifications, etc.)</li><li>The output looks professional without any custom UI work</li></ul><h3>Try It Yourself</h3><p>The full code is available here: <a href="https://github.com/GallagherSam/research-agent-surfacedocs">https://github.com/GallagherSam/research-agent-surfacedocs</a>. To run it locally:</p><pre># Clone and install<br>git clone https://github.com/GallagherSam/research-agent-surfacedocs<br>cd research-agent-surfacedocs<br>uv sync<br><br># Add your API keys<br>cp .env.example .env<br># Edit .env with your GOOGLE_API_KEY and SURFACEDOCS_API_KEY<br><br># Run the server<br>uv run uvicorn api.main:app --reload<br><br># Trigger a research run<br>curl -X POST http://localhost:8000/research \<br>  -H &quot;Content-Type: application/json&quot; \<br>  -d &#39;{&quot;query&quot;: &quot;advances in AI agents&quot;, &quot;days_back&quot;: 7}&#39;</pre><p>The agent takes 30–60 seconds to complete depending on how many papers it decides to read.</p><h3>What’s Next</h3><p>This pattern of autonomous agents that can publish their work opens up some interesting possibilities:</p><ul><li><strong>Scheduled research digests</strong> — Cron job triggers the agent weekly, results land in a shared folder</li><li><strong>Orchestrator integration</strong> — n8n or Temporal kicks off research tasks, documents appear automatically</li><li><strong>Multi-agent workflows</strong>— One agent researches, another reviews, a third publishes</li></ul><p>Background agents are only valuable if their output is accessible. Giving agents a “publish” tool makes the whole system more useful.</p><p>That’s what SurfaceDocs is for. The output layer for AI pipelines.</p><p><em>Built with </em><a href="https://google.github.io/adk-docs/"><em>Google ADK</em></a><em> and </em><a href="https://surfacedocs.dev/"><em>SurfaceDocs</em></a></p><p>Let me know if you have any questions!</p><p>— Sam</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=faf9e1dbd8a1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using LLMs as a Second Brain: From Notes to Knowledge Graphs]]></title>
            <link>https://medium.com/@gallaghersam95/using-llms-as-a-second-brain-from-notes-to-knowledge-graphs-e7912f3a1428?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7912f3a1428</guid>
            <category><![CDATA[graph]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Tue, 14 Oct 2025 00:00:32 GMT</pubDate>
            <atom:updated>2025-10-14T00:00:32.154Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d2_bEW07_3H0c46cp5o4Hg.png" /><figcaption>Knowledge graphs can be pretty… right?</figcaption></figure><p>This article talks about the <a href="https://github.com/GallagherSam/Knowledge-Graph-Kit">Knowledge Graph Kit</a>, which is an open sourced tool for quickly experimenting with a graph based MCP state layer.</p><h3>Introduction</h3><p>Like many in tech, I have spent many years using and chasing different productivity tools. From elaborate workflows in Notion and Clickup, to basic structures in Obsidian, I’ve tried them all.</p><p>Building a complex productivity tool and workflow can be great at first, but it can quickly start to break down when it comes into contact with reality. Existing structures no longer make sense, table views need to be changed with shifting priorities, and the overhead of management becomes too much.</p><p>I wanted a system that could be <em>intelligent </em>without me needing to necessarily design every detail. A tool I could throw some text and thoughts into and the system would construct itself.</p><h3>The Experiment</h3><p>My first serious attempt at an intelligent notes interface began (and continues), with <strong>gemini-cli</strong>. It offered a lightweight way to interact with local files through an LLM, able to read, write, summarize, and connect ideas across a subset of my Obsidian vault.</p><p>At first it was easy, fun even. Task were being created, notes tracked, it became a conversational interface to my information, freeing me from designing rigid system or maintaining complex structure.</p><p>But after a few days, cracks started to show. Concepts spread across too many files were difficult to recall and connect. I grew tired of typing prompts like “take all unfinished tasks from today and move them to tomorrow”. The very structure I had hoped to avoid became necessary again, but now it existed in a loose, imprecise LLM-shaped format.</p><p>This breakdown revealed something extremely important, an intelligent knowledge system can’t just manipulate text, it must understand structure. I needed to move beyond a flat (or endlessly nested) directory structure of markdown files and give my information a more expressive storage layer.</p><h3>The Knowledge Graph Kit</h3><p>The next phase began with a question: what if my notes weren’t files, but nodes in a graph?</p><p>Instead of folders and markdown files, I wanted a living, dynamic, network. Where every note, task, and project could connect through explicit relationships. Something that provided an organic structure with real dimensionality.</p><p>This led to the creation of the <a href="https://github.com/GallagherSam/Knowledge-Graph-Kit"><strong>Knowledge Graph Kit</strong></a>, a lightweight MCP server that acts as a storage layer for graph-style operations. I developed four primitive node types, Task, Note, Person, and Project, and a few relationship labels like part_of, mentions, and related_to. The design goal was minimalism, simple enough for even a small-parameter LLM to reason over, yet expressive enough to model how ideas can interlink.</p><p>In the current version, all nodes and edges are stored in a SQLite database locally and vectorized into ChromaDB to enable semantic search. This allows the system to surface connections that never shared a keyword.</p><p>This design solved the limitations of using gemini-cli directly with markdown files. It gave my data a shape to live, a structure that could evolve naturally as new relationships formed. New node types can be introduced, connections can deepen, and the interface remains simple.</p><h4>A couple of examples</h4><p>Here are a couple of interaction examples I have using this MCP server with gemini-cli:</p><p>Adding a new note about my dogs health (she’s undergoing physical therapy for a neurological condition).</p><pre>User: Add a new log for Octavias health journal. Evening PT went well, <br>did the 16 minute walk.<br><br>Gemini: <br>&lt;search_nodes {node_type: &quot;Project&quot;, query: &quot;Octavia Recovery&quot;}<br>Returns: { project info... }<br>&lt;create_note {&quot;title&quot;: ... note info }<br>Returns: { new note info... }<br>&lt;create_edge {&quot;label&quot;: &quot;documents&quot;, ... node info }<br>I have added a new note title &quot;Octavia PT Update 10/13/25&quot; and connected it <br>to the &quot;Octavia Recovery&quot; project.</pre><p>Retrieving all personal tasks in progress.</p><pre>User: Show me all personal tasks I have to do.<br><br>Gemini:<br>&lt;get_tasks {status: &quot;todo&quot;,  tag: [&quot;personal&quot;]}<br>Returns: { all personal tagged tasks with status of &quot;todo&quot; }<br>Personal Tasks TODO:<br>- Clean kitchen<br>- Schedule vet checkin<br>...</pre><h3>Iterative Development</h3><p>Just because the current interface is a conversation with an LLM doesn’t mean it has to stay that way. The data layer and structure is really the important bit. With a strongly modeled state layer holding every note, task, and relationship, new interfaces can emerge.</p><p>From here I can generate simple todo lists filtered by status or tags, or export related notes into other systems for review. Because the underlying structure noe exists, the presentation layer can be flexible. Direct chat with an LLM is only one possible view of the graph.</p><p>Each small iteration builds on the last, layering new utilities on top of the graph. Over time, these refinements move the system closer to what I originally wanted. Not a static vault of notes, but a living, adaptive knowledge environment that can grow.</p><h3>Conclusion</h3><p>The <a href="https://github.com/GallagherSam/Knowledge-Graph-Kit">Knowledge Graph Kit</a> is a personal experiment. An attempt to bridge my note taking tendencies with an LLM infused interface to build the system that holds it all together. But this experiment is also meant to be shared. The <a href="https://github.com/GallagherSam/Knowledge-Graph-Kit">Knowledge Graph Kit</a> is open-source, available for anyone to explore, modify, and extend.</p><p>If you’re building your own second brain, experimenting with agent frameworks, or just curious about structured cognition, you can use it as a foundation. Add your own node types, connect it to new interfaces, or wire it into your daily tools. The goal isn’t to create my perfect system, but to start experimenting and see what is quickly possible with the given set of tools we have.</p><p>The pursuit of a second brain is about outsourcing thought, it’s more about understanding how we think and designing systems that can adapt and grow with us.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7912f3a1428" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transmission Bandwidth Scheduler]]></title>
            <link>https://medium.com/@gallaghersam95/transmission-bandwidth-scheduler-80948600b4a5?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/80948600b4a5</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[transmission]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[automation]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Tue, 05 Aug 2025 23:09:52 GMT</pubDate>
            <atom:updated>2025-08-05T23:09:52.802Z</atom:updated>
            <content:encoded><![CDATA[<p>A quick freebie for folks.</p><p>I was recently in need of a way to schedule the allowed bandwidth for a Transmission service based on time of day, so I developed a quick CLI to solve this problem.</p><p>Here is the repository: <a href="https://github.com/GallagherSam/transmission-bandwidth-scheduler">https://github.com/GallagherSam/transmission-bandwidth-scheduler</a> <br>Detailed instructions are included in the README.md</p><p>Here’s a quick example of what a configuration file for this tool looks like:</p><pre>timezone: &quot;America/Chicago&quot;<br>profiles:<br>  day:<br>    speed_up: 2000   # KB/s<br>    speed_down: 8000<br>  night:<br>    speed_up: 1000<br>    speed_down: 1000<br><br>schedules:<br>  - profile: night<br>    start: &quot;23:00&quot;<br>    end: &quot;7:00&quot;    # wraps past midnight<br>  - profile: day<br>    start: &quot;7:00&quot;<br>    end: &quot;23:00&quot;<br><br># Optional: Transmission connection (env can override)<br>transmission:<br>  host: 192.168.1.50<br>  port: 9091<br>  username: transmission<br>  password: secret<br>  path: /transmission/rpc<br>  timeout: 5.0</pre><p>Let me know if you have any questions!</p><p>— Sam</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80948600b4a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Contain your Agents: Running MCP Servers in Docker for safer, and reproducible, LLM Workflows]]></title>
            <link>https://medium.com/@gallaghersam95/contain-your-agents-running-mcp-servers-in-docker-for-safer-and-reproducible-llm-workflows-dbda5afe2804?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbda5afe2804</guid>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[agents]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Mon, 28 Jul 2025 15:28:08 GMT</pubDate>
            <atom:updated>2025-07-28T15:28:08.990Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kB2Svqa4sy755JUy9RueFw.png" /></figure><h3>Introduction</h3><p>Large language models are no longer confined to chat windows, they want to <em>d</em>o things now. <strong>The Model Context Protocol (MCP)</strong> standard emerged to give those agents a uniform way to act. MCP defines a common way for an agent to discover and invoke external tools, whether that tool is a shell command on your laptop or hitting a SaaS API in the cloud.</p><p>But convenience cuts both ways. Setting up an MCP server on your machine effectively hands a third-party process read/write access to every directory or network resource you expose. That server, or the model driving it, can overwrite source files, scrape SSH keys, or exfiltrate client documents. Even Docker’s default runc runtime isn’t an ironclad boundary, a container escape drops an attacker on the host kernel.</p><p>Despite the risk, adoption is exploding. Docker’s <a href="https://www.docker.com/blog/announcing-docker-mcp-catalog-and-toolkit-beta/">MCP Catalog and Toolkit</a> launched this spring with more than 100 one-click containerized servers. It contains everything from code-refactor assistants to PDF crawlers, making it trivial for developers and hobbyists alike to add “tools mode” to their local workflows. Microsoft is baking MCP support <a href="https://www.theverge.com/news/669298/microsoft-windows-ai-foundry-mcp-support">directly into Windows</a>, signaling that agent-driven automation is headed for the mainstream desktop.</p><p>This article shows you how to keep that velocity without losing (too much) sleep. We’ll look at why running MCP services inside a locked-down Docker container is a pragmatic middle ground: quick to set up, reproducible across machines, and (with some hardening flags) far safer than running an MCP service bare-metal. By the end you should have a copy-paste walkthrough plus a mental checklist for evaluating the trust you place in AI workflows.</p><h3>Threat model: What could go wrong?</h3><p>When you launch an MCP service locally you’re giving a third-party process two powers that normally belong to <em>y</em>ou. The ability to touch your files and the freedom to connect to external services. Those are the two surfaces we’ll model.</p><h4>Filesystem danger</h4><ul><li><strong>Unwanted rewrites and deletes</strong>. A refactor assistant that incorrectly parses a directory tree can trash configs or pin dependency versions you never wanted.</li><li><strong>Sneaky supply-chain installs</strong>. If the agent is allowed to install packages via pip or npm, a malicious or typo-squatted package can slide in and execute at import time. Security firm Sonatype <a href="https://www.itpro.com/security/malware/developers-face-a-torrent-of-malware-threats-as-malicious-open-source-packages-surge-188-percent">just reported</a> a 188% YoY jump in malware hidden inside PyPI/NPM packages, with 55% aimed squarely at stealing data.</li><li><strong>Secrets on display.</strong> SSH keys, .env files, and cloud credentials often sit in the same $HOME you mount for convenience. Once read, they’re only a POST request away from the attacker.</li></ul><h4>Network exfiltration</h4><ul><li><strong>Silent callbacks.</strong> Many MCP tools “helpfully” leverage external APIs. A misconfigured server was <a href="https://www.csoonline.com/article/4012712/misconfigured-mcp-servers-expose-ai-agent-systems-to-compromise.html">recently shown</a> to accept arbitrary shell commands that could exfiltrate proprietary datasets to pastebins.</li><li><strong>Key theft.</strong> A fresh LangSmith vulnerability, <a href="https://noma.security/blog/how-an-ai-agent-vulnerability-in-langsmith-could-lead-to-stolen-api-keys-and-hijacked-llm-responses/">AgentSmith</a>, let attackers siphon OpenAI keys out of agent logs to hijack responses.</li><li><strong>Leaky repos</strong>. <a href="https://www.wiz.io/blog/leaking-ai-secrets-in-public-code">Scans of public GitHub repos</a> found that four of the five most leaked secrets in 2025 were AI related keys, often committed by agents running unattended scripts.</li></ul><p>Running the server in Docker can help, but know that the default runc runtime shares the host kernel. <a href="https://nvd.nist.gov/vuln/detail/cve-2024-21626">CVE-2024–21626</a> showed how a file descriptor leak let an attacker pivot from the container’s root to the host filesystem. Isolation is necessary but not sufficient, we still need to lock down mounts and egress, which we’ll do in the next section.</p><h3>Containerization</h3><p>Spinning up MCP services inside of a container is a pragmatic middle ground. You still get a one command launch, but the agent is boxed into its own filesystem, user, and (optionally) network namespace.</p><h4>Why Containers</h4><p>Docker, Podman, and similar runtimes provide mature isolation primitives ‘for free’:</p><ul><li><strong>Namespaces and cgroups</strong> fence container processes from the host’s PID tree, mounts, and CPU/RAM.</li><li><strong>Read-only roots + targeted bind mounts</strong> let you expose <em>exactly</em> the project folder the agent needs, nothing more.</li><li><strong>Seccomp/AppArmor profiles</strong> strip dangerous syscalls, while<em> — cap-drop all</em> removes kernel privileges.</li><li><a href="https://docs.docker.com/engine/swarm/secrets/"><strong>Secrets injection</strong></a> (Docker Desktop / Compose secrets) keeps API keys out of images and <em>docker inspect</em> output.</li><li>Runs identically on macOS, Windows, WSL, or Linux, so you can share a working image with others easily.</li></ul><h4>Immediate upsides</h4><ol><li><strong>Filesystem blast radius shrink.</strong> A bad prompt can only clobber the directory you mounted.</li><li><strong>Reproducibility.</strong> The server and dependencies are pinned to the image. No more “works on my machine” debugging.</li><li><strong>Disposable dev loops.</strong> <em>docker rm -f</em> nukes the entire runtime, enabling you to start fresh for the next experiment.</li><li><strong>Easy distribution.</strong> Push to existing image registries like GHCR or Docker Hub, others can pull and run without environment-setup documentation.</li><li><strong>Resource governance.</strong> Flags like <em>— memory 2g — pids-limit 256</em> stop a runaway MCP service from hogging your laptop’s resources.</li></ol><h4>Concerns and Tradeoffs</h4><p><strong>Kernel sharing</strong></p><ul><li><em>Default runc</em>: Shares the host kernal, a breakout (see CVE-2024–21626) gives the attacker host-level access</li><li><em>Stronger</em>: <strong>gVisor</strong> inserts a user-space kernel — about 10–15% syscall overhead, but a much firmer boundary</li></ul><p><strong>VM-Grade isolation</strong></p><ul><li><em>Default runc</em>: Not provided.</li><li><em>Stronger</em>: <strong>Kata Containers </strong>or <strong>Firecracker MicroVMs </strong>wrap each container in a stripped-down KVM instance. Adds ~ 100mb RAM and a slower cold start, but almost eliminates kernel escape risk.</li></ul><p><strong>Complexity</strong></p><ul><li><em>Default runc:</em><strong><em> </em></strong>One CLI flag, familiar Docker UX.</li><li><em>Stronger</em>: New runtimes mean extra installs and tuning. Not yet as cross platform.</li></ul><p><strong>Performance</strong></p><ul><li><em>Default runc</em>: Near native.</li><li><em>Stronger</em>: gVisor incurs syscall latency, microVMs cost more RAM/CPU cycles.</li></ul><p><strong>False sense of security</strong></p><ul><li><em>Default runc: </em>Mounting <em>/var/run/docker.sock</em> or running <em>— privileged </em>defeats isolation</li><li><em>Stronger</em>: Same danger. Privileged containers are privileged, not matter the runtime.</li></ul><h4>“Good Enough” for most local cases</h4><p>A non-root <em>runc</em> container with a read-only rootfs, a single read-write bind-mount to your project folder,<em> — network none</em> (or an egress-whitelist network), and capability drops eliminates most risk while keeping startup time fast. If you plan to run truly untrusted code, or share a host with other uses, it may be worth stepping up to gVisor or microVMs.</p><p>In short, containers don’t magically solve security, but a hardened Docker setup minimizes the blast radius so you can enjoy the MCP velocity without handing the agent the keys.</p><h3>Hands-on Example</h3><p>Let’s spin up the <a href="https://hub.docker.com/r/mcp/wikipedia-mcp">Wikipedia-MCP Service</a> with hardened settings.</p><p>For reference — This is the stock configuration and command published to Docker Hub:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;wikipedia-mcp&quot;: {<br>      &quot;command&quot;: &quot;docker&quot;,<br>      &quot;args&quot;: [<br>        &quot;run&quot;,<br>        &quot;-i&quot;,<br>        &quot;--rm&quot;,<br>        &quot;mcp/wikipedia-mcp&quot;<br>      ]<br>    }<br>  }<br>} </pre><p>It works for a quick test, but it runs as root, with a writable root filesystem and unrestricted network access. Let’s add the hardening flags.</p><pre>docker run --rm \<br> --name wiki-mcp \<br> --read-only \<br> --tmpfs /tmp:rw,size=64m \<br> --cap-drop ALL \<br> --security-opt no-new-privileges \<br> --pids-limit 128 \<br> --memory 512m \<br> --user $(id -u):$(id -g) \<br> -p 8000:8000 \<br> mcp/wikipedia-mcp --transport sse</pre><p>A quick breakdown of those flags:</p><ul><li><em>— read-only</em> mounts the container’s root filesystem as read only, and writes only go to <em>/tmp</em> (<a href="https://docs.docker.com/engine/storage/tmpfs/">we give it an in-memory tmpfs</a>)</li><li><em>— cap-drop ALL</em> and<a href="https://raesene.github.io/blog/2019/06/01/docker-capabilities-and-no-new-privs/"><em> — security-opt no-new-privileges</em></a> remove every kernel capability, even <em>sudo</em> inside the container can’t elevate</li><li><em>— user $(id -u):$(id -g)</em> runs the process as your normal UID, not root. This works for Docker on macOS, on Linux you can use <em>— userns=keep-id</em></li><li>Publishing only port 8000 lets the server answer HTTP/SSE calls but nothing else.</li></ul><h4>Connecting it</h4><p>I have been using <a href="https://anythingllm.com/">AnythingLLM</a> for local MCP use. All I needed to do was edit the MCP configuration JSON file with this information:</p><pre>{<br> &quot;mcpServers&quot;: {<br>  &quot;Wikipedia&quot;: {<br>   &quot;type&quot;: &quot;sse&quot;,<br>   &quot;url&quot;: &quot;http://localhost:8000/sse&quot;<br>  }<br> }<br>}</pre><p>This tells AnythingLLM to use the existing URL to access the service. A quick smoke test using the Gemini 2.5 model tells me that it’s working.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZZEgbKATLE_KLz7NQwR9ug.png" /><figcaption>Gemini 2.5 using Wikipedia MCP server</figcaption></figure><p>In this case I used the prompt “@agent using wikipedia, tell me about the Transformer AI architecture”. We can see the MCP tool use in the expanded section.</p><h3>Extra Wins</h3><p>After you’ve seen one hardened container work, the next step is to make this setup repeatable for yourself and potentially portable for others. Here are a few extra wins you gain by standardizing on Docker based MCP servers.</p><h4>Docker Compose — start multiple MCP Servers at once</h4><p>A <em>docker-compose.yml</em> lets you launch an entire toolbox of MCP servers in a single command.</p><pre>version: &quot;3.9&quot;<br>services:<br>  wikipedia:<br>    image: mcp/wikipedia-mcp:latest<br>    command: [&quot;--transport&quot;, &quot;sse&quot;]<br>    read_only: true<br>    tmpfs: [&quot;/tmp:rw,size=64m&quot;]<br>    networks: [&quot;mcp_net&quot;]<br>    ports: [&quot;8000:8000&quot;]<br>    cap_drop: [&quot;ALL&quot;]<br>    security_opt: [&quot;no-new-privileges&quot;]<br>    mem_limit: 512m<br>    pids_limit: 128<br><br>  eleven-labs:<br>    image: mcp/elevenlabs:latest<br>    command: [&quot;--transport&quot;, &quot;sse&quot;]<br>    read_only: true<br>    tmpfs: [&quot;/tmp:rw,size=64m&quot;]<br>    networks: [&quot;mcp_net&quot;]<br>    ports: [&quot;8001:8000&quot;]<br>    cap_drop: [&quot;ALL&quot;]<br>    security_opt: [&quot;no-new-privileges&quot;]<br>    mem_limit: 512m<br>    pids_limit: 128<br><br>    # Mount local directory for audio output<br>    volumes:<br>      - ./samples:/workdir/in:ro<br><br>    # Provide the elevenlabs API key from Docker secrets<br>    secrets:<br>      - elevenlabs_api_key<br><br>    # Map the api key<br>    environment:<br>      ELEVENLABS_API_KEY_FILE: /run/secrets/elevenlabs_api_key<br><br>networks:<br>  mcp_net:<br>    driver: bridge<br><br># Ensure this file exists with just the elevenlabs API key<br>secrets:<br>  elevenlabs_api_key:<br>    file: ./secrets/elevenlabs_api_key</pre><p>One <em>docker compose up -d</em> and every server appears on its dedicated port with the hardened configuration. This example will run both the Wikipedia and ElevenLabs MCP Servers. Additionally we mount a local directory for ElevenLabs output, and inject the ElevenLabs API key via <a href="https://docs.docker.com/compose/how-tos/use-secrets/">Docker Secrets</a>.</p><h4>Other Wins</h4><ol><li><strong>Secrets stay secret.</strong> Compose can mount Docker secrets or an env file, keeping API keys off disk and out of <em>docker inspect</em>.</li><li><strong>Per-service resource budgets.</strong> mem_limit, cpus, and pids_limit caps any one service’s resource footprint.</li><li><strong>Network egress filters.</strong> Isolate untrusted servers in their own bridge network with zero outbound routes while whitelisted servers can live on another.</li><li><strong>CI/dev-container reuse.</strong> The same images can run in GitHub Actions for tests or as a VS Code Dev Container on others machines.</li><li><strong>Instant tear-down.</strong> <em>docker compose down -v</em> clears every tool and cache, so experiments don’t pollute the next session.</li></ol><h3>Degrees of Trust</h3><p>Not every MCP workflow deserves the same security limitations. Think of trust as a dial you increase when the payoff justifies it.</p><p><strong>Read Only</strong></p><ul><li><em>Agent Actions</em>: List files, fetch content, suggest diffs</li><li><em>Guard Rails</em>: <em>— read-only, </em>no write mounts, outbound network allowed only to known API endpoints.</li><li><em>Typical use-case</em>: First pass code reviews, external data lookups</li></ul><p><strong>Sandboxed Writes</strong></p><ul><li><em>Agent Actions: </em>Write to a sandboxed copy of your repo or documents</li><li><em>Guard Rails</em>: Bind-mount a git repository or temp folder, including pre-commit hooks or CI tests auto-run, human merges the PR back to the repository.</li><li><em>Typical use-case</em>: Refactors, bulk content rewrites</li></ul><p><strong>Full Autopilot</strong></p><ul><li><em>Agent Actions</em>: Direct commits, package installs, shell commands</li><li><em>Guard Rails</em>: Container stays hardened, use CI/CD to gate promotions, enable detailed audit logs, alerts on sensitive file access.</li><li><em>Typical use-case</em>: Nightly dependency update bot in a low-risk repo.</li></ul><p><strong>No Trust</strong></p><ul><li><em>Agent Actions</em>: Execute arbitrary code you haven’t read.</li><li><em>Guard Rails</em>: Switch runtime to gVisor or Kata, block outbound network access, tighten memory and CPU.</li><li><em>Typical use-case</em>: Testing community MCP servers, hack-day experiments.</li></ul><h4>Human-in-the-loop layering</h4><ul><li><strong>Diff previews.</strong> Require the agent to output a unified diff you approve before it writes.</li><li><strong>Approval queues.</strong> AnythingLLM and Claude Desktop both let you pause execution at each tool call. Enable this for potentially destructive operations.</li><li><strong>Audit transcripts.</strong> Log every request/response pair and keep them versioned. Useful in the case of post-mortems.</li><li><strong>Secrets scope.</strong> Inject only the API keys needed for the task via Docker secrets. Leave out the entire <em>.env</em> when possible.</li></ul><p>A good rule of thumb is to start at <em>read-only</em> and climb the ladder one rung at a time. Stop turning the dial when the extra productivity no longer outweighs the added blast radius.</p><h3>Conclusion</h3><p>MCP servers can unlock powerful, automated workflows, from code refactors to ad-hoc knowledge bases. But they also inherit the privileges of whatever environment you run them in. By placing each server inside a hardened Docker container you:</p><ol><li>Shrink its filesystem reach to the exact directories it needs.</li><li>Fence outbound traffic or whitelist only the domains you trust.</li><li>Reproduce the setup across laptops and CI runners with a single image tag.</li><li>Share a ready-to-use toolbox with your team via Compose snippets.</li></ol><p>We walked through a quick example with Wikipedia-MCP using read-only roots, dropped capabilities, user-namespace mapping, discussed optional gVisor/Kata runtimes, and wired that container into AnythingLLM in under five minutes. Layering these basics with a clear “degrees of trust” policy lets you dial security up and down per task while maintaining the velocity that makes MCP appealing.</p><p>Feel free to re-use that Docker command or Compose file, swap in the MCP servers you’re using today, and keep experimenting.</p><h3>Further Reading</h3><p>Here are the reference links for the articles, and the (some) links contained within the article.</p><ul><li><a href="https://www.docker.com/blog/the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker/">https://www.docker.com/blog/the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker/</a></li><li><a href="https://www.docker.com/blog/announcing-docker-mcp-catalog-and-toolkit-beta/">https://www.docker.com/blog/announcing-docker-mcp-catalog-and-toolkit-beta/</a></li><li><a href="https://www.docker.com/blog/build-to-prod-mcp-servers-with-docker/">https://www.docker.com/blog/build-to-prod-mcp-servers-with-docker/</a></li><li><a href="https://amirmalik.net/2025/03/07/code-sandboxes-for-llm-ai-agents">https://amirmalik.net/2025/03/07/code-sandboxes-for-llm-ai-agents</a></li><li><a href="https://dida.do/blog/setting-up-a-secure-python-sandbox-for-llm-agents">https://dida.do/blog/setting-up-a-secure-python-sandbox-for-llm-agents</a></li><li><a href="https://northflank.com/blog/your-containers-arent-isolated-heres-why-thats-a-problem-micro-vms-vmms-and-container-isolation">https://northflank.com/blog/your-containers-arent-isolated-heres-why-thats-a-problem-micro-vms-vmms-and-container-isolation</a></li><li><a href="https://medium.com/%40seahorse.technologies.sl/langchain-on-docker-a-quickstart-guide-to-running-llm-apps-in-containers-245c583ea960">https://medium.com/%40seahorse.technologies.sl/langchain-on-docker-a-quickstart-guide-to-running-llm-apps-in-containers-245c583ea960</a></li><li><a href="https://www.theverge.com/news/669298/microsoft-windows-ai-foundry-mcp-support">https://www.theverge.com/news/669298/microsoft-windows-ai-foundry-mcp-support</a></li><li><a href="https://www.itpro.com/security/malware/developers-face-a-torrent-of-malware-threats-as-malicious-open-source-packages-surge-188-percent">https://www.itpro.com/security/malware/developers-face-a-torrent-of-malware-threats-as-malicious-open-source-packages-surge-188-percent</a></li><li><a href="https://www.csoonline.com/article/4012712/misconfigured-mcp-servers-expose-ai-agent-systems-to-compromise.html">https://www.csoonline.com/article/4012712/misconfigured-mcp-servers-expose-ai-agent-systems-to-compromise.html</a></li><li><a href="https://noma.security/blog/how-an-ai-agent-vulnerability-in-langsmith-could-lead-to-stolen-api-keys-and-hijacked-llm-responses/">https://noma.security/blog/how-an-ai-agent-vulnerability-in-langsmith-could-lead-to-stolen-api-keys-and-hijacked-llm-responses/</a></li><li><a href="https://www.wiz.io/blog/leaking-ai-secrets-in-public-code">https://www.wiz.io/blog/leaking-ai-secrets-in-public-code</a></li><li><a href="https://nvd.nist.gov/vuln/detail/cve-2024-21626">https://nvd.nist.gov/vuln/detail/cve-2024-21626</a></li><li><a href="https://aws.amazon.com/blogs/containers/enhancing-kubernetes-workload-isolation-and-security-using-kata-containers/">https://aws.amazon.com/blogs/containers/enhancing-kubernetes-workload-isolation-and-security-using-kata-containers/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbda5afe2804" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating an AI Podcast Generator, and it’s surprisingly good]]></title>
            <link>https://medium.com/@gallaghersam95/creating-an-ai-podcast-generator-and-its-surprisingly-good-d622d46d469e?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/d622d46d469e</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[generated-content]]></category>
            <category><![CDATA[genai]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Fri, 13 Dec 2024 21:51:00 GMT</pubDate>
            <atom:updated>2024-12-13T21:51:00.963Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pKm933J8MhQgaUNJF0fS0A.png" /></figure><p>Imagine wanting a very specific podcast to listen to, so specific and targeted to a problem that it’s never been recorded, and likely never will be.</p><p>With this idea in mind, I developed a tool that leverages various AI and LLM APIs to generate these highly personalized podcasts. These podcasts can feature hosts with distinct personalities, music breaks, and much more.</p><p>For a super-meta example, here’s an output from the topic: <em>“The Ethics of Creating Podcasts with AI.”</em></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fw.soundcloud.com%2Fplayer%2F%3Furl%3Dhttps%253A%252F%252Fapi.soundcloud.com%252Ftracks%252F1983726275%26show_artwork%3Dtrue&amp;display_name=SoundCloud&amp;url=https%3A%2F%2Fsoundcloud.com%2Fsam-gallagher-11%2Fethics-of-content-creation-with-ai-ai-generated&amp;image=https%3A%2F%2Fi1.sndcdn.com%2Fartworks-FcQ2Y13eHLW1U7UJ-tnGd5g-t500x500.jpg&amp;type=text%2Fhtml&amp;schema=soundcloud" width="800" height="166" frameborder="0" scrolling="no"><a href="https://medium.com/media/9ac3a9af45c9a3192df669f77250039b/href">https://medium.com/media/9ac3a9af45c9a3192df669f77250039b/href</a></iframe><p>Given a podcast topic, this tool performs the following steps:</p><ul><li><strong>Generates a podcast outline</strong> for the user to review, approve, or regenerate with an updated prompt. This outline includes elements like the podcast title, description, and hosts with specific personalities.</li><li><strong>Creates a podcast structure</strong> with distinct sections, inter-titles, and primary topics to be covered.</li><li><strong>Develops the dialog</strong> for a natural, back-and-forth conversational style, incorporating the hosts’ personalities and the topics as input.</li><li><strong>Uses a text-to-speech model</strong> to generate audio files for each segment of the conversation as separate files.</li><li><strong>Stitches the podcast together</strong>, adding music cues at the beginning and between sections.</li></ul><p>With this process, the tool can generate an entire podcast in just a matter of minutes, as demonstrated in the output shared above.</p><h3>LLM Interaction Styles</h3><p>This project was born out of a desire to rethink the current, limited interaction styles we have with Large Language Models (LLMs). Consider how we typically use tools like ChatGPT to solve problems, generate document outlines, or perform ad-hoc tasks requiring LLM input, these interactions generally occur within a basic chat window.</p><p>I wanted to explore alternative interaction styles that more closely resemble the content we consume recreationally or intentionally. A podcast became the first draft of this exploration.</p><h3>Taking this idea further</h3><p>I’ll be releasing a detailed article outlining the architecture, prompts, and other components involved in generating these podcasts. I might even share the source code and instructions so others can generate their own podcasts.</p><p>I’d love to hear your thoughts on using AI to generate content in this way. In the meantime, I’m off to listen to a podcast about that very niche technical concept and system I’ve been meaning to learn more about.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d622d46d469e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OpenAI Structured Data in Practice]]></title>
            <link>https://medium.com/@gallaghersam95/openai-structured-data-in-practice-01af5abddaa5?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/01af5abddaa5</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[genai]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Fri, 25 Oct 2024 22:34:07 GMT</pubDate>
            <atom:updated>2024-10-25T22:34:07.451Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k6TtRJNHAHQmi4kxREzUiQ.png" /><figcaption>Non-deterministic robots trying to create structure</figcaption></figure><h3>Introduction</h3><p>Generative AI is the current coolest kid on the block, but working with large language models (LLMs) from an application perspective can be challenging due to their inherently non-deterministic nature.</p><p>These models excel at producing human-like text, making them ideal for tasks like document summarization, question answering, and creative writing. However, this flexibility often becomes a limitation when developing applications that require structured data to fit predefined formats.</p><p>To bridge this gap, OpenAI has released <a href="https://platform.openai.com/docs/guides/structured-outputs">Structured Ouputs</a>, allowing developers to define a data model alongside their generative queries. This approach ensures that the model’s output adheres to the specified structure, returning a well-formed JSON object that aligns with application needs.</p><p>In this article, we’ll explore a simple example of how this feature works in practice and provide an overview of integrating structured outputs into a TypeScript application.</p><h3>Structured Data Example</h3><h4>Product Design</h4><p>Let’s quickly define the use case for our example application.</p><p>Image a hypothetical user group, <em>group A</em>, who struggle to find relevant Wikipedia articles when they have specific questions in mind. Rather than receiving direct answers, they prefer to have starting points that allow them to dive deeper into their own research.</p><p>To address this need, we’ll design an application where users can submit a query and receive four top Wikipedia articles related to their topic. Each result will include a brief summary of the article and an explanation of <em>why</em> it’s relevant to the user query.</p><h4>Let’s Build</h4><p><a href="https://github.com/GallagherSam/openai-structured-json">All of this code is available in a public GitHub repository</a>.</p><p><strong>Note: </strong>This example application is developed using Svelte as a front-end application only. In a production environment, it’s best practice to have all API calls to OpenAI brokered through a back-end service acting as a proxy. <em>Do not</em> use this pattern directly in production, as it exposes your OpenAI API key.</p><p>First things first, <a href="https://platform.openai.com/docs/quickstart/create-and-export-an-api-key">get yourself an OpenAI API key</a>.</p><p>Once you have that, we can define the structure of the JSON object we want for returning Wikipedia results. Here’s an example of the desired JSON structure:</p><pre>{<br>  &quot;title&quot;: &quot;Page Title&quot;,<br>  &quot;summary&quot;: &quot;Page Summary&quot;,<br>  &quot;relevance&quot;: &quot;Why is this page relevant?&quot;,<br>  &quot;link&quot;: &quot;Link to Wikipedia page&quot;<br>}</pre><p>This is a very simple schema, but it suits our needs perfectly. Now, how do we define this schema in a way that OpenAI can understand?</p><p>OpenAI uses the library<a href="https://www.npmjs.com/package/zod"> Zod</a> to handle schema definitions. Zod allows us to define a schema that validates the structure of the JSON object returned by the model. Here’s how we can define the schema for the example above:</p><pre>import { z } from &quot;zod&quot;;<br><br>// Define the models<br>const WikipediaResultModel = z.object({<br>    title: z.string(),<br>    summary: z.string(),<br>    relevance: z.string(),<br>    link: z.string()<br>})<br><br>const ResultsModel = z.object({<br>    results: z.array(WikipediaResultModel)<br>})</pre><p>This schema creates both a WikipediaResultModel, which defines each individual result, and a ResultsModel, which aggregates multiple results into a structured format.</p><p>Now, let’s tie this schema into an API call to OpenAI, aiming to retrieve four relevant Wikipedia results based on a provided user query:</p><pre>import OpenAI from &quot;openai&quot;<br>import { zodResponseFormat } from &#39;openai/helpers/zod&#39;;<br>import { z } from &quot;zod&quot;;<br><br>// Init the OpenAI client<br>const client = new OpenAI({<br>    apiKey: &quot;&lt;GET YOUR OWN KEY&gt;&quot;,<br>    dangerouslyAllowBrowser: true<br>})<br><br>// Define the models<br>const WikipediaResultModel = z.object({<br>    title: z.string(),<br>    summary: z.string(),<br>    relevance: z.string(),<br>    link: z.string()<br>})<br><br>const ResultsModel = z.object({<br>    results: z.array(WikipediaResultModel)<br>})<br><br>async function fetchResults(query: string) {<br>    const completion = await client.beta.chat.completions.parse({<br>        model: &quot;gpt-4o-2024-08-06&quot;,<br>        messages: [<br>            { role: &quot;system&quot;, content: &quot;Build 4 results with wikipedia pages that will help the user find the information they are looking for. Describe why the result is relevant in the relevance field.&quot; },<br>            { role: &quot;user&quot;, content: query }<br>        ],<br>        response_format: zodResponseFormat(ResultsModel, &quot;result&quot;)<br>    })<br>    return completion.choices[0].message.parsed<br>}</pre><p><a href="https://github.com/GallagherSam/openai-structured-json/blob/main/example-app/src/lib/index.ts">Here is a link to the file in the repo.</a></p><p>There are quite a few things happening here.</p><p>First, we import the OpenAI library in the usual way and instantiate our client. We set dangerouslyAllowBrowser to true because this is a front-end example of using this capability. <em>Again, do not use this pattern in production</em>—exposing your API key in a front-end environment is a significant security risk.</p><p>After defining the models, we create a simple fetchResults function that fetches the chat completion from OpenAI. This function uses the client.beta.chat.completions.parse endpoint, where we pass ResultsModel as the desired response_format and refer to it as result in our query.</p><p>The query itself is straightforward: it asks the model to provide four relevant Wikipedia pages for the given user query. It also clearly defines the relevance field, making sure the model understands how to populate it.</p><blockquote>In my experience with this pattern, I have found it extremely beneficial to describe ambiguous fields to the model as part of the system prompt.</blockquote><h4>Data Example</h4><p>At this point, let’s look at an example response to a sample query.</p><p>For this example, I wanted to explore some of the influences behind the works of David Weber (because I’m a sci-fi nerd). The query I used was simply, <em>“influences of David Weber.”</em> The model responded with the following data:</p><pre>{<br>  &quot;results&quot;: [<br>    {<br>      &quot;title&quot;: &quot;David Weber&quot;,<br>      &quot;summary&quot;: &quot;David Mark Weber is an American science fiction and fantasy author. He is best known for his Honor Harrington series, which follows the adventures of the titular character, a high-ranking officer in the Royal Manticoran Navy. Weber&#39;s works often incorporate strong themes of honor, duty, and the struggles of individuals within vast interstellar bureaucracies and military organizations.&quot;,<br>      &quot;relevance&quot;: &quot;This page provides an overview of David Weber’s life and works, which is essential to understanding his influences and the themes prevalent in his books.&quot;,<br>      &quot;link&quot;: &quot;https://en.wikipedia.org/wiki/David_Weber&quot;<br>    },<br>    {<br>      &quot;title&quot;: &quot;Honorverse&quot;,<br>      &quot;summary&quot;: &quot;The &#39;Honorverse&#39; refers to the setting of the Honor Harrington series of books written by David Weber, which includes multiple novels, anthologies, and its own specific universe rules. The series has been developed into a complex storyline exploring naval combat, politics, and tactics within science fiction.&quot;,<br>      &quot;relevance&quot;: &quot;Understanding the Honorverse is crucial to grasping the specific influences on Weber&#39;s most famous work, as well as the historical, tactical, and political inspirations behind it.&quot;,<br>      &quot;link&quot;: &quot;https://en.wikipedia.org/wiki/Honorverse&quot;<br>    },<br>    {<br>      &quot;title&quot;: &quot;Military science fiction&quot;,<br>      &quot;summary&quot;: &quot;Military science fiction is a subgenre of both science fiction and military fiction, chiefly involving the use of science and technology in the context of warfare. The protagonist is typically a soldier or someone involved with a form of military service, and stories may depict battles in space or on alien planets.&quot;,<br>      &quot;relevance&quot;: &quot;As a prominent writer of military science fiction, exploring this genre provides context into the thematic and stylistic influences on David Weber&#39;s work, offering insights into his writing style and content choices.&quot;,<br>      &quot;link&quot;: &quot;https://en.wikipedia.org/wiki/Military_science_fiction&quot;<br>    },<br>    {<br>      &quot;title&quot;: &quot;Space opera&quot;,<br>      &quot;summary&quot;: &quot;Space opera is a subgenre of science fiction that emphasizes space warfare, melodramatic adventure, and often includes a conflict between good versus evil. It frequently occurs in settings with advanced technology such as space travel and interplanetary colonization.&quot;,<br>      &quot;relevance&quot;: &quot;Identifying space opera as a genre that influences Weber&#39;s storytelling helps comprehend the narrative scope and adventure elements prevalent in his series, particularly evident in the expansive and detailed universes he creates.&quot;,<br>      &quot;link&quot;: &quot;https://en.wikipedia.org/wiki/Space_opera&quot;<br>    }<br>  ]<br>}</pre><p>Nice! Looks like we can read up on the author themselves, with links to relevant genre pages.</p><h4>Give it a Face</h4><p>Users aren’t going to interact with this application without it having at least a somewhat polished appearance. The <a href="https://github.com/GallagherSam/openai-structured-json">GitHub repository</a> contains the complete Svelte code developed for this article, which I won’t dive into here. Instead, here’s what the application would look like to a user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*Rb68ubTzVYOZ0pQZ-2dWnw.png" /><figcaption>Snapshot from the basic UI</figcaption></figure><h3>Thinking Ahead</h3><p>The use case described here is simple, almost silly, but it demonstrates just how easy it is to get structured output from OpenAI’s models. This capability can extend to a wide range of consumer-oriented applications as well as internal enterprise tools.</p><p>As the technology evolves, we’re likely moving away from the classic chat interface being the primary entry point for interacting with LLMs. Instead, we’re heading toward a future where these models are seamlessly integrated into robust applications. This shift can bring a new level of personalization, sophistication, and nuance to experiences that might otherwise feel mundane.</p><h3>Conclusion</h3><p>As always, let me know if you found this helpful or have any questions. If you make something interesting using OpenAI structured AI, let me know! I’d love to see it used in the wild.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=01af5abddaa5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing Embedding Vectors]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@gallaghersam95/visualizing-embedding-vectors-99cac1d164c4?source=rss-94d7e8f6238c------2"><img src="https://cdn-images-1.medium.com/max/1024/1*41TBnhPPt4CJhX6rBT6W0w.jpeg" width="1024"></a></p><p class="medium-feed-snippet">How can we visualize embedding vectors with hundreds of dimensions?</p><p class="medium-feed-link"><a href="https://medium.com/@gallaghersam95/visualizing-embedding-vectors-99cac1d164c4?source=rss-94d7e8f6238c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@gallaghersam95/visualizing-embedding-vectors-99cac1d164c4?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/99cac1d164c4</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[genai]]></category>
            <category><![CDATA[jupyter-notebook]]></category>
            <category><![CDATA[visualization]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Fri, 26 Apr 2024 22:44:03 GMT</pubDate>
            <atom:updated>2024-04-26T23:50:49.049Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Generative AI, Fantasy Data, and the Temperature on Pluto]]></title>
            <link>https://medium.com/@gallaghersam95/generative-ai-fantasy-data-and-the-temperature-on-pluto-dc76eaf4c8a5?source=rss-94d7e8f6238c------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc76eaf4c8a5</guid>
            <category><![CDATA[space]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Sam Gallagher]]></dc:creator>
            <pubDate>Mon, 08 Apr 2024 00:48:02 GMT</pubDate>
            <atom:updated>2024-04-08T00:48:02.341Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EdBsWG3EdWBNAAxl6C3hnA.png" /><figcaption>Pluto Weather App</figcaption></figure><h3>Preamble</h3><p>There are a lot of use cases for Generative AI in the business world. From summarizing large batches of documents for easier consumption, providing faster customer support with RAG based systems, to accelerating developers with tools like Copilot.</p><p>However, I want to spend some time and look at Gen AI as a creative tool to build interesting thought experiments and applications. How would an engineer “play” with Generative AI to build novel things.</p><p>In simple terms, Generative AI is a tool for creating non-deterministic output given curated inputs. This can be used for countless numbers of creative ideas.</p><h3>Starting Simple</h3><p>I rely on my weather app all of the time. I use it to plan weekend events, when to walk the dogs during my day, and planning for raining gaming sessions in the evenings. This led me to this experiment.</p><blockquote>“What is the weather like on Pluto?”</blockquote><p>That’s a mildly outlandish question unless you happen to be an astronomer. Space agencies have collected general data on the weather conditions on Pluto, but none of them provide up-to-date weather information for surface locations. But what if we did?</p><p>What if we had a weather/data collector stationed on the surface of Pluto sending back readings on a regular interval? That would be sweet, and we would be able to develop a simple weather app for the surface of Pluto!</p><p>We don’t have that information today, but we could create a system utilizing Generative AI to <em>simulate</em> data readings from this hypothetical collector, seeded in some grounded data. I like to call this “Fantasy Data”.</p><h3>Fantasy Data</h3><p>We live in a world where any desired data can be generated and served like any other “real” data. This data can be seeded intelligently, thoroughly validated for schema correctness, and stored in familiar ways. It behaves like all other data, besides the fact that it is made up.</p><p>Writing prompts to provide Fantasy Data is not difficult (heck, ChatGPT will do it for you with enough information). I tend to provide descriptions of the scenario and the JSON string of the past reading. This works very well.</p><p>Fantasy Data can be used to power all sorts of creative and fantastical applications. Let’s walk through a brief build of one of these for illustrative purposes.</p><p>So, what is the temperature on the surface of Pluto?</p><h3>The Build</h3><p>I found that question not to be specific enough. We need a strong <em>where</em> on the surface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7BReBJRVGzopcrYsvtmkfw.jpeg" /><figcaption>Picked location for the weather collector</figcaption></figure><p>I picked a region between the <a href="https://en.wikipedia.org/wiki/Belton_Regio">Belton Regio</a> and <a href="https://en.wikipedia.org/wiki/Sputnik_Planitia">Sputnik Planitia</a>, as the crater seemed easy to visually identify. There is also existing temperature, wind, and pressure information for this area to start with.</p><h4>System Architecture</h4><p>The system is very straightforward and uses native Firebase tools along with API calls to OpenAI services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/904/1*2KCm7MvOo9fNZBGI-P7CLA.png" /><figcaption>System Architecture</figcaption></figure><p><strong>Hosting</strong> — A simple React app written with integrations to Firestore and Storage for pulling latest weather data and background image.</p><p><strong>Firestore </strong>— NoSQL document store for holding the weather data that came from our hypothetical weather station.</p><p><strong>Storage</strong> — Object storage for the generated images for the background.</p><p><strong>Functions</strong> — CRON scheduled functions to “fetch” new weather data and images, pushing the data to Firestore and Storage.</p><p><strong>OpenAI</strong> — Generating the weather data objects and background images.</p><h4>Outcome</h4><p>It works!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EdBsWG3EdWBNAAxl6C3hnA.png" /><figcaption>Screenshot from Pluto weather app</figcaption></figure><p>I’m not a designer by any means, but this turned out better than I expected given the short development time.</p><p>This application will update every few hours with another reading and snapshot of the conditions. This app is live at <a href="https://pluto.genai.smgallagher.com/">https://pluto.genai.smgallagher.com</a> if you want to stay updated on weather conditions. Looks best on a mobile device.</p><h3>Future</h3><p>This small idea can be immediately extended to other locations. Think of The Shire, Westeros, Baldurs Gate, or even Arrakis.</p><p>There are also a plethora of new ideas outside of just weather collection. Let me know if you build anything exciting!</p><h3>Nerd Corner — Time on Pluto</h3><p>If you notice, I have a “Pluto Time” field on the weather app. It was a treat to figure out and it’s <em>fairly </em>accurate, if you’re content with some hand wavy math.</p><p>Pluto has a rotational period of <strong>6.387</strong> Earth days. I decided to map the local Pluto time to the same 24hr clock Earth has, but extend it to fit that 6.387 days.</p><p>This means that it takes roughly <strong>6.384 </strong>Earth hours for a single local Pluto hour to pass. Time moves much slower, almost like island time (but on a frozen rock with no amenities).</p><p>Using <a href="https://science.nasa.gov/dwarf-planets/pluto/">Nasa’s Pluto tool</a> I was able to approximate a “Midnight” for the location I selected. With that reference point, I can easily translate Earth time to Pluto time.</p><p>Only a single hour passed on Pluto while I developed this system, kinda neat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc76eaf4c8a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>