<?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 Khalid Rizvi on Medium]]></title>
        <description><![CDATA[Stories by Khalid Rizvi on Medium]]></description>
        <link>https://medium.com/@krizvi?source=rss-e6dee335e65c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VsXHvcIru4Xke8ve</url>
            <title>Stories by Khalid Rizvi on Medium</title>
            <link>https://medium.com/@krizvi?source=rss-e6dee335e65c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 06:52:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@krizvi/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[Inside Claude]]></title>
            <link>https://medium.com/@krizvi/inside-claude-e0dce922f0c8?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0dce922f0c8</guid>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Fri, 09 Oct 2026 18:19:13 GMT</pubDate>
            <atom:updated>2026-10-09T19:03:54.364Z</atom:updated>
            <content:encoded><![CDATA[<h4>Thirty seats. Two guests. One last spot. Follow Claude Code from your Mac to the cloud as it plans, builds, and checks an event-planner feature.</h4><p>The workshop has thirty seats. Twenty-nine are taken. Maya and Daniel both open the event page, see one place left, and click “Reserve my seat.”</p><p>Who gets it?</p><p>If your application answers “both,” you have a problem that a nicer button will not fix.</p><p>This is a good place to meet Claude Code. Not in an abstract conversation about artificial intelligence, but at your Mac, with an ordinary feature to build and a small mistake waiting to become an awkward conversation at the door.</p><p>Let’s call the project event_planner. It already lets an organizer create an event, and guests can sign in and view its page. Today, you want to add reservations. We will follow that feature from the first prompt to a reviewed change, watching what happens locally, what travels to the cloud, and why planning needs more than a promising paragraph.</p><p>This is an illustrative working session, not a claim that the example application or its tests were run for this article.</p><h3>Put the right folder on the desk</h3><p>You open Terminal and move into the project:</p><pre>cd event_planner<br>pwd</pre><p>The second command prints your location, perhaps a path ending in /projects/event_planner. That is where Claude Code will start looking when you launch it. You have selected the workbench; you have not built a security fence around it.</p><p>Now you start Claude Code:</p><pre>claude --model fable</pre><p>Here we use Fable, the model named in the diagram below, with a direct connection to Anthropic’s cloud. This assumes your account and installed version support it. You can use claude with your configured default instead, or inspect available models with /model. The mechanics we are about to follow do not depend on one model name. <a href="https://code.claude.com/docs/en/model-config">Model configuration</a></p><p>The command starts a program on your Mac. It does not put the cloud model inside your laptop.</p><h3>Follow the arrows</h3><figure><img alt="Diagram showing Claude Code running on a Mac, exchanging prompts and tool requests with a cloud model, and reading local project files. Lower panels explain /init and a project-explanation request." src="https://cdn-images-1.medium.com/max/1024/0*zyEx5I654e-oVgUE.png" /></figure><p><em>The Mac-to-cloud workflow. Read </em><em>my-project as </em><em>event_planner in our example. </em><a href="https://khalidrizvi.com/images/claude-code-mac-to-cloud.png"><em>Open the original diagram at full size</em></a><em> to inspect the labels.</em></p><p>Start at the left of the picture. You type a request. Claude Code sends it, with relevant context, to the model. The model can answer, or request a tool operation. Claude Code handles that request under the permissions you have configured, then returns the result. Another request may follow.</p><p>The orange box is the local program. The green box is your project. The blue cloud is the model. Keeping those three apart explains most of what otherwise feels mysterious.</p><p>Suppose you ask, “Where does this application save an event?” The model does not reach across the internet and rummage through your Mac. It can request a search. Claude Code runs the permitted local search, returns the matches, and may then read the relevant file. The answer develops from those results.</p><p>One press of Enter can therefore produce several tool calls: search, read, inspect, and answer. A <strong>turn</strong> is your request and the work that follows it; a <strong>tool call</strong> is one operation within that work. The diagram’s returning arrow represents responses and tool requests, not a promise that you see the model’s complete private reasoning. <a href="https://code.claude.com/docs/en/how-claude-code-works">How Claude Code works</a></p><p>There is an important catch in the outward arrow. Your original files remain on disk, but contents read for the task and command results can become part of the context sent to the cloud. “Runs locally” does not mean “all data stays local.” Use sample guests for development, keep secrets out of prompts and logs, and check the terms and controls for your provider and account. <a href="https://code.claude.com/docs/en/data-usage">Data usage</a></p><h3>Leave instructions for the next visit</h3><p>Before adding reservations, you want Claude to understand the project. If it lacks a useful project guide, you enter:</p><pre>/init</pre><p>Look at panel 5A of the diagram. Claude inspects the project and helps create or improve CLAUDE.md, a guide for future sessions. It might examine the README, build scripts, source directories, and test setup. It is not installing the application or initializing Git.</p><p>For event_planner, useful instructions might identify the existing event service, record the commands that actually run the tests, and say that all reservation changes need a capacity test. You review those instructions before trusting them. A guessed build command is still a guessed build command, even in a tidy Markdown file.</p><p>Applicable CLAUDE.md files in the working directory and its parents load when the session starts; more specific instructions can load as Claude reaches subdirectories. These are working instructions, not an access-control system. <a href="https://code.claude.com/docs/en/memory">Project memory and </a><a href="https://code.claude.com/docs/en/memory">/init</a></p><p>Now panel 5B becomes practical. You ask Claude to explain the existing event flow. It reads the relevant files and reports what is already there. Only then do you ask it to extend that flow.</p><h3>Ask for a plan before asking for code</h3><p>“Add RSVPs” sounds clear until someone asks whether guests can reserve twice, whether a full event has a waiting list, or whether a reservation sends an email.</p><p>For this round, you decide: one reservation per signed-in guest, a fixed capacity of thirty, no waiting list, no cancellation, and no email. A successful reservation must survive a page refresh. A full event must say so plainly. Two simultaneous requests must never create a thirty-first reservation.</p><p>Those decisions do more for the feature than a longer prompt full of adjectives.</p><p>Now bring in /sequential-thinking. There are two pieces to distinguish. A <strong>skill</strong> is a reusable set of instructions for Claude. An <strong>MCP server</strong> is a connected program exposing tools Claude Code can call; MCP stands for Model Context Protocol. A skill can tell Claude when and how to use such a tool. It is not the tool itself.</p><p>For this example, assume you have installed a skill exposed as /sequential-thinking and connected the Sequential Thinking MCP server. The slash command is not a universal built-in command, and installing the server alone does not create that skill. Plugin commands may also have a namespace; use the name shown in your installed skill list. Check /mcp for the server connection. <a href="https://code.claude.com/docs/en/skills">Claude Code skills</a> and <a href="https://code.claude.com/docs/en/mcp">MCP connections</a> describe the two mechanisms.</p><p>With that setup, your request can be quite direct:</p><pre>/sequential-thinking<br>Plan RSVP reservations for event_planner.<br>Use the existing event pages and sign-in flow.<br>One reservation per guest; never exceed event capacity.<br>Exclude waiting lists, cancellations, and email for now.<br>Break the work into milestones and vertical slices.<br>Define the evidence required to pass each gate.<br>Save the agreed plan in docs/rsvp-plan.md.<br>Do not implement until I approve the plan.</pre><p>That last sentence establishes a review point. It is an instruction to follow, not a technical lock; permission settings provide a separate control over what tools may do.</p><h3>What Sequential Thinking adds — and what it does not</h3><p>The <a href="https://github.com/modelcontextprotocol/servers/tree/main/src/sequentialthinking">Sequential Thinking MCP server</a> supports numbered steps, revisions, branches, and an adjustable estimate of how many steps remain. Claude can use it to break up a problem, reconsider an assumption, or compare alternatives before presenting a plan.</p><p>It is not another model thinking independently beside Claude. The model supplies the step content; the server records structured entries and returns bookkeeping information. Nor does the server create milestones, enforce gates, or run your tests for you. Those are parts of the working method you have requested. The <a href="https://github.com/modelcontextprotocol/servers/blob/main/src/sequentialthinking/lib.ts">implementation</a> makes that boundary worth noticing.</p><p>In our session, the useful result is not a performance of thinking aloud. It is a short plan you can challenge: what behavior will change, which assumptions need checking, what could fail, and how you will know the work is ready. Here is the kind of planning summary you should expect, rather than a transcript of private reasoning.</p><p>Claude first inspects the existing event and sign-in code. It identifies where reservations should fit. It calls out the last-seat race and compares ways to protect the write. It then proposes a small sequence of changes, with tests attached to each one.</p><p>If inspection reveals that the project already has a safe reservation mechanism, the plan should use it. If it reveals no suitable mechanism, the plan must include one. The value lies in revising the proposal when evidence changes, not in insisting on the first answer.</p><h3>Milestones give the work a destination</h3><p>A <strong>milestone</strong> is a meaningful result you can review. “Write some backend code” is activity. “A signed-in guest can reserve one available seat without overbooking” is a result.</p><p>For our feature, three milestones are enough.</p><p><strong>Milestone 1: Agree on the reservation contract.</strong> The plan names the guest journey, the excluded features, the files likely to change, and the failure cases. Its gate is your review: do these rules describe the feature you want? No implementation begins until the answer is yes.</p><p><strong>Milestone 2: Make the complete RSVP journey work.</strong> A guest reserves a seat, sees confirmation, and still sees that reservation after refreshing. Duplicate requests and full events behave correctly. Its gate requires automated checks of those rules, including simultaneous attempts at the last seat, plus a working browser demonstration.</p><p><strong>Milestone 3: Make the change ready to release.</strong> The existing checks pass, the change is reviewed, and the release notes explain any storage change and how to recover if deployment fails. Its gate includes the designated reviewer’s approval. A successful local demonstration is not permission to publish to production.</p><p>The milestones keep the destination visible. Gates stop “nearly finished” from quietly becoming “finished.”</p><h3>A gate asks for proof</h3><p>A <strong>gate</strong> is a condition that must be satisfied before work moves forward. A useful gate names both the evidence and who or what evaluates it.</p><p>For the last-seat rule, “Claude says it is safe” is not evidence. A test that starts two reservation attempts with twenty-nine seats taken and verifies exactly one new reservation is much better. A review of the write path matters too: a passing test can miss an unsafe design if it never exercises the dangerous timing.</p><p>Write the rule in the plan, then put the automated checks in the project’s test and continuous-integration workflow. Configure required checks and review controls where the team needs an enforced stop. A heading called “Gate” in a Markdown file cannot block a merge by itself.</p><p>Not every gate is a test. You decide whether “Event full” is an acceptable experience without a waiting list. A reviewer decides whether the change is understandable and appropriately scoped. The machine can supply evidence without inheriting every decision.</p><h3>Slices make the next step small enough to finish</h3><p>A milestone can still be too large for one comfortable change. That is where a <strong>slice</strong> helps: a small piece of behavior that runs through the relevant layers and can be demonstrated.</p><p>A database table alone is not a guest experience. Neither is a button that calls an unfinished endpoint. A <em>vertical slice</em> connects the interface, server behavior, storage, and checks needed for one useful result.</p><p>Within Milestone 2, we choose three slices:</p><ol><li><strong>Reserve an available seat.</strong> A signed-in guest clicks, the server records the reservation, and the page shows confirmation that survives refresh.</li><li><strong>Handle a repeat request.</strong> Clicking twice or retrying after a slow response leaves one reservation, not two, and returns a clear result.</li><li><strong>Protect the final seat.</strong> Competing requests cannot exceed capacity; the unsuccessful guest sees “Event full.”</li></ol><p>Each slice includes its own tests and review. The early slices are development checkpoints, not permission to release an incomplete booking system. Milestone 2 stays behind its gate until all three work together.</p><p>The relationship is simple: <strong>a milestone defines the outcome; slices divide the work; a gate defines the evidence needed to proceed.</strong></p><h3>One round: build it, break it, repair it</h3><p>You approve the plan. Claude Code writes the agreed decisions to docs/rsvp-plan.md, and you ask it to implement the first slice. That file is an ordinary project artifact, not permanent memory supplied by the MCP server. In a later session, ask Claude to read it again.</p><p>Now the same arrows in the diagram carry a different kind of work. The model requests the event-page code and the server handler. Local tools read them. The model proposes edits. Claude Code applies permitted changes to real files on your Mac, then runs the project’s actual test commands.</p><p>Maya clicks “Reserve my seat” in the development app. Confirmation appears. You refresh. It remains. The first slice has something to show, not merely something to describe.</p><p>The next slice handles a second click and a network retry. Those requests must resolve to the same guest’s reservation without consuming another seat. Claude adds the behavior and checks that it also works when the requests arrive together. Disabling a button is helpful presentation, but the server still has to protect the rule.</p><p>Then comes the third slice. There are twenty-nine reservations. Maya and Daniel each ask for the remaining seat.</p><p>Suppose the first implementation checks the count and then saves a reservation as two unprotected operations. Both requests can read twenty-nine before either saves. Each concludes there is room. Both succeed.</p><p>The test exposes the problem. An illustrative result might read:</p><pre>FAIL: concurrent requests for the final seat<br>Expected confirmed reservations: 30<br>Actual confirmed reservations:   31<br>Milestone 2 gate: blocked</pre><p>This is where planning earns its place. Claude must not remove the test, weaken the expectation, or call the extra reservation an edge case to fix later. It should report the failed gate, inspect the write path, and revise the implementation plan if necessary.</p><p>Sequential Thinking can help organize that revision: the earlier assumption about separate count-and-save operations was insufficient. The updated design must protect the capacity decision and reservation write as one coordinated operation. Exactly how depends on the storage system; a transaction alone is not enough unless its locking or isolation behavior actually protects this rule. Uniqueness for a guest and event is a separate requirement from capacity.</p><p>Claude Code makes the permitted repair locally and runs the checks again. This time, one guest gets the seat and the other gets “Event full.” The repeated-request test still leaves one reservation per guest. The ordinary booking and refresh checks still pass.</p><p>Return to the picture for a moment. The failing output traveled to the model. The revised edit traveled back as a tool request. The next test ran on your Mac. What looked like one assistant fixing a bug was a series of exchanges, each informed by the result of the last.</p><h3>Finish with evidence, not applause</h3><p>A useful completion report says what changed, which checks ran, what passed, and what remains untested. It links the changed files and identifies anything that still needs a human decision.</p><p>For this example, you want to see evidence for ordinary booking, persistence after refresh, repeated requests, a full event, and competing requests for the last seat. You also want the existing project checks, not just the new tests. The report should distinguish “ready for review” from “released.”</p><p>If the test database was unavailable, the honest report says the test was not run. If a browser check was skipped, it stays open. A gate does not pass because an explanation sounds confident.</p><p>Only after the release gate is satisfied does the authorized deployment workflow take over. Planning, implementation, verification, and release belong in the same story, but they are not interchangeable achievements.</p><h3>Your Mac is still your Mac</h3><p>All this activity uses real files and tools. A skill does not grant unlimited access, and a thoughtful plan does not make a destructive command harmless.</p><p>Use /permissions to inspect Claude Code’s controls. Allow rules permit matching operations without manual approval, ask rules require confirmation, and deny rules block them. The active permission mode and managed settings also affect what happens. <a href="https://code.claude.com/docs/en/permissions">Permission rules</a></p><p>Sandboxing is a different question: what can a command reach once it runs? Claude Code supports a sandbox for shell commands on macOS, configurable with /sandbox. It can restrict filesystem and network access, but it does not turn your project into a disposable pretend computer. Permitted edits still change real files. Built-in file tools and connected MCP integrations have separate access considerations. <a href="https://code.claude.com/docs/en/sandboxing">Sandbox scope</a></p><p>In this walkthrough, the model runs in the cloud and the project tools run on your Mac. An MCP server can be local or remote depending on its configuration. Wherever you put it, check its access rather than assuming it shares every boundary of the shell sandbox.</p><h3>Back at the workshop door</h3><p>The feature began as “add RSVPs.” It became an agreed set of rules, three milestones, a handful of slices, and gates backed by evidence. One of those gates caught a bug before a guest had to discover it for you.</p><p>That is the useful way to understand Claude Code. It is not a model living inside your project folder, and a planning skill is not a guarantee of sound engineering. It is a local program coordinating a conversation with a model and carrying out permitted work through tools. You supply the purpose, the boundaries, and the standard of proof.</p><p>The diagram gives you the map. The reservation gives the arrows a job.</p><p>At the end, there are thirty guests and thirty chairs. The important result is not that Claude wrote code quickly. It is that you can explain why the thirty-first reservation was refused — and point to the checks that support the answer.</p><p><em>For the next part of the picture — what a session keeps, what context contains, and what carries into a later conversation — see </em><a href="https://khalidrizvi.com/blog/claude-code-filing-cabinet"><em>Claude Code Sessions vs. Context</em></a><em>.</em></p><p><em>Originally published at </em><a href="https://khalidrizvi.com/blog/inside-claude"><em>khalidrizvi.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0dce922f0c8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Ollama Is Not the Application]]></title>
            <link>https://medium.com/@krizvi/ollama-isnt-the-application-the-architecture-most-local-ai-tutorials-never-teach-you-3c19462e5957?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/3c19462e5957</guid>
            <category><![CDATA[ai-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[localai]]></category>
            <category><![CDATA[ollama]]></category>
            <category><![CDATA[rags]]></category>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Sun, 20 Sep 2026 20:22:04 GMT</pubDate>
            <atom:updated>2026-09-20T21:14:36.446Z</atom:updated>
            <content:encoded><![CDATA[<p>Most people meet Ollama in the simplest possible way. They install it, pull a model, type a prompt, and get a response. The experience is immediate and satisfying. A local language model is suddenly running on their own machine.</p><p>It also creates a false sense of completion.</p><p>Running a model is not the same as building an AI application.</p><p>A real application must know who the user is, what data the user is allowed to see, where private information lives, which model should answer a request, whether external systems need to be consulted, whether the model may call a tool, and how the result should be delivered and audited.</p><p>Ollama sits inside that system, but it is not the system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JjjAYMz_5OOqXW2DqMDLhg.png" /><figcaption>A practical view of a local-AI application: the browser handles the user experience, the AI Gateway controls the workflow, Ollama runs the models, RAG supplies evidence, and tools connect the model to live systems.</figcaption></figure><p>The easiest way to understand this is to imagine a user asking a simple question:</p><blockquote><em>“What is our production deployment policy?”</em></blockquote><p>The browser receives the question, but it should not normally send it directly to Ollama. Instead, it sends the request to your own backend service, which may be written in Go, FastAPI, or another framework.</p><p>That backend is the real center of the application.</p><p>It authenticates the user, checks permissions, decides what kind of work is required, retrieves supporting information, selects a model, controls access to tools, and records what happened. We can call this layer the AI Gateway.</p><p>The Gateway then uses Ollama for what Ollama does best: running models.</p><p>That distinction is worth keeping in mind from the beginning:</p><p><strong>Your application controls the workflow. Ollama performs the inference.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F01h5rD86OWQL48sE80Axg.png" /><figcaption>This illustration captures the core truth of local AI: your application provides direction, structure, and control, while Ollama supplies the inference layer.</figcaption></figure><p>This separation becomes especially important when the answer is not already inside the model.</p><p>Suppose the deployment policy belongs to your company and was written only a few months ago. The model was never trained on it. Asking the model directly would force it either to admit that it does not know or, worse, produce something that sounds reasonable but is not your actual policy.</p><p>This is where retrieval enters the picture.</p><p>Your company documents are first broken into smaller sections. Each section is passed through an embedding model, which turns text into a numerical representation called a vector. The numbers themselves are not meaningful to a person, but they capture enough semantic structure that passages with similar meanings tend to appear close together mathematically.</p><p>For example, these two sentences use different words:</p><blockquote><em>“Production deployment requires management approval.”</em></blockquote><blockquote><em>“A manager must authorize a production release.”</em></blockquote><p>An embedding model can recognize that they express nearly the same idea.</p><p>This makes semantic search possible.</p><p>When the user asks about deployment approval, the application converts the question into an embedding, searches the document store for nearby vectors, and retrieves the most relevant passages. Those passages are then supplied to the chat or reasoning model together with the original question.</p><p>The model is no longer being asked to remember company policy.</p><p>It is being asked to interpret evidence.</p><p>That is the essence of Retrieval-Augmented Generation, or RAG.</p><p>RAG is often made to sound more mysterious than it is. In practical terms, it means:</p><p><strong>Find the right information first. Then ask the model to reason over it.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jhUVAuH8oG51YWFPtXFNLQ.png" /><figcaption>A simple view of Retrieval-Augmented Generation: first retrieve the most relevant information from your data, then let the model reason over that evidence to produce a grounded answer.</figcaption></figure><p>This changes the role of the model in a useful way. Your documents remain the source of truth. The model becomes the reader, interpreter, and writer.</p><p>The vector store also deserves to be understood correctly. It is not the company’s knowledge itself. It is a search index built from that knowledge.</p><p>If the vector database disappears, the original documents should still exist. You rebuild the index.</p><p>This matters because embeddings change, chunking strategies improve, documents are revised, and newer models appear. A mature system therefore keeps track of where every retrieved chunk came from, which document version produced it, when it was indexed, and which embedding model was used.</p><p>At this point, the application can answer questions about documents. But many useful questions depend on live information.</p><p>Consider:</p><blockquote><em>“What is the current status of deployment 842?”</em></blockquote><p>That information probably does not live in a PDF. It may exist in a deployment system, database, monitoring platform, or internal API.</p><p>Now the model needs more than knowledge. It needs access to tools.</p><p>Your application might expose a function such as:</p><pre>get_deployment_status(deployment_id)</pre><p>The model can decide that this function would help answer the question and return a structured request asking for it.</p><p>But the model should not execute the function itself.</p><p>That responsibility stays with the application.</p><p>The Gateway checks whether the requested tool exists, whether the user is allowed to use it, whether the arguments are valid, and whether the action is safe. Only then does the Tool Executor call the real system.</p><p>This distinction is one of the most important in agentic AI:</p><p><strong>The model may suggest an action. The application decides whether the action is allowed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DshalXhHGG-mozcNfJeHzg.png" /><figcaption>This is one of the most important boundaries in practical AI systems: the model may propose an action, but the application must enforce authority, verify permissions, and decide whether that action is actually allowed.</figcaption></figure><p>A language model is not an authorization system.</p><p>If the user says:</p><blockquote><em>“Delete Project Alpha.”</em></blockquote><p>the model may conclude that a deletion tool should be called. That conclusion does not grant permission. Your application still has to determine who the user is, whether the user owns the project, whether deletion is allowed, whether confirmation is required, and whether the action should be logged or approved by another person.</p><p>The same principle applies whether you use Ollama, OpenAI, Anthropic, or any other model provider.</p><p>The model interprets intent.</p><p>The application enforces authority.</p><p>Once retrieval and tools are in place, the system begins to look less like a chatbot and more like ordinary software architecture with an LLM inside it.</p><p>That is exactly the right way to think about it.</p><p>The model should also not be used for every task in the same way.</p><p>A small, fast model may be perfectly adequate for classification or simple conversation. A stronger reasoning model may be more appropriate for complex design problems. An embedding model handles semantic retrieval. A coding model may be better suited to software tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q5UHPD46ptARPFQSFo7INg.png" /><figcaption>Different AI tasks require different strengths. A well-designed application identifies the capability a request needs — conversation, reasoning, retrieval, or coding — and routes it to the appropriate model instead of forcing one model to handle everything.</figcaption></figure><p>Instead of scattering specific model names throughout the codebase, the Gateway can route requests by capability.</p><p>The application asks for “reasoning,” “embedding,” or “chat,” and configuration determines which model currently provides that capability.</p><p>This creates a much cleaner design because models can change without forcing the rest of the application to change with them.</p><p>The same principle applies to context.</p><p>A large context window does not mean the application should send everything it can find.</p><p>If three paragraphs answer the question, sending three hundred pages is not sophistication. It is failed retrieval.</p><p>Good context should be relevant, authoritative, current, permission-safe, and traceable.</p><p>The goal is not to fill the model’s context window.</p><p>The goal is to fill it with the right information.</p><p>The final part of the architecture is the user experience.</p><p>Language models generate text gradually. If the application waits until the entire response is complete before displaying anything, the system may feel slow even when the model is working normally.</p><p>Streaming solves this.</p><p>Instead of waiting for a complete paragraph, the server begins returning pieces of the response as they are generated.</p><p>The user might see:</p><blockquote><em>“The production policy requires…”</em></blockquote><p>while the model is still generating the next sentence.</p><p>Streaming does not necessarily make the model faster. It makes the work visible sooner.</p><p>For browser applications, one simple way to implement this is Server-Sent Events, or SSE. The browser opens an HTTP connection, and the server keeps it open while sending new events over time.</p><p>In an Ollama application, there may actually be two streams.</p><p>Ollama streams generated output to the Gateway. The Gateway then streams appropriate output to the browser.</p><p>This small architectural detail is useful because the Gateway remains in control. It can add citations, emit progress messages, record metrics, suppress internal information, or stop generation if the client disconnects.</p><p>WebSockets can also be used, but they are better suited to applications where communication flows continuously in both directions. Real-time voice applications are a good example: the client sends audio while the server simultaneously returns transcripts, events, and generated speech.</p><p>For ordinary text-based AI chat, SSE is often enough.</p><p>By now, the architecture becomes much easier to see.</p><p>The browser handles the human interaction.</p><p>The Gateway controls the workflow.</p><p>Ollama runs the models.</p><p>The document and vector layer provides evidence.</p><p>The tool layer provides access to live systems.</p><p>The model connects these pieces through language and reasoning.</p><p>Consider a final example.</p><p>An engineer asks:</p><blockquote><em>“Why did the payment service fail last night, and does our runbook describe the problem?”</em></blockquote><p>The Gateway authenticates the engineer and searches the company’s technical documentation. It finds a runbook entry explaining that database connection-pool exhaustion can cause request timeouts.</p><p>The model then requests a permitted tool that retrieves the payment service logs from the previous night.</p><p>The Gateway authorizes the request and executes the tool.</p><p>The logs show:</p><pre>23:42 connection pool exhausted<br>23:42 database connection timeout<br>23:43 payment requests failed</pre><p>The model now has two forms of evidence: the documented failure pattern and the actual production logs.</p><p>It can produce a grounded answer explaining that the payment service appears to have failed after exhausting its database connection pool, and it can point to the runbook section that describes the same condition.</p><p>The answer then streams back to the browser.</p><p>To the user, it feels like one intelligent conversation.</p><p>Behind that conversation, several systems worked together: the UI, the Gateway, Ollama, the knowledge store, and the tool layer.</p><p>That is the larger lesson.</p><p>Ollama is valuable because it gives an application a clean way to run models locally. But the real engineering begins around the model.</p><p>RAG lets the model read your world.</p><p>Tools let the model interact with your world.</p><p>Streaming lets the user see the work as it happens.</p><p>And the application remains in control of all of it.</p><p>Once that distinction becomes clear, Ollama stops looking like the application.</p><p>It becomes what it should be: a powerful inference layer inside a well-designed software system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3c19462e5957" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Filing Cabinet in Claude’s Head]]></title>
            <link>https://medium.com/@krizvi/the-filing-cabinet-in-claudes-head-5a1f32c3a012?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/5a1f32c3a012</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[ai-memory]]></category>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Wed, 19 Aug 2026 23:43:23 GMT</pubDate>
            <atom:updated>2026-08-19T23:43:23.707Z</atom:updated>
            <content:encoded><![CDATA[<p>A while back I noticed my Claude Code project folder had quietly grown to about <strong>111 saved sessions eating roughly 660 MB</strong> of disk. So I cleaned them up. Deleted the lot, kept the current one, moved on with my life.</p><p>Then, a few days later, a brand-new session casually referenced a defect from a conversation I had deleted. Something like:</p><blockquote><em>DEF-2210 was previously related to…</em></blockquote><p>Hold on. This was a <em>fresh</em> session. The transcript that discussed that bug was gone. How did it know?</p><p>That little moment of suspicion sent me down a rabbit hole, and what I found is the most useful mental model I’ve built about Claude Code so far: <strong>a saved session and the active context of a new conversation are not the same thing.</strong> Old sessions may sit on disk so /resume can reopen them, but that doesn&#39;t mean Claude reads all those old transcripts every time you start fresh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wy0HcPCoRjTxS8N41O2-hA.png" /><figcaption><em>The three layers of Claude Code: saved conversation history sits on disk like folders in a filing cabinet (not auto-loaded, reachable via </em><em>/resume); persistent project knowledge — memory, </em><em>CLAUDE.md, hooks — shapes every session; and the active context is what Claude is actually working with right now.</em></figcaption></figure><p>Think of it like an office. You might have 111 old case folders sitting in a filing cabinet. Starting a new meeting doesn’t mean somebody dumps all 111 folders onto the conference table. The folders still exist, and /resume lets you pick one and reopen it, but they are not automatically part of the new conversation.</p><p>Let me walk through what’s actually going on.</p><h3>What a saved session actually is</h3><p>Every conversation gets stored under a project-specific directory, something like:</p><p>Inside that directory, each conversation has a UUID, something like:</p><p>The main conversation is stored as a .jsonl file:</p><p>JSONL means <strong>JSON Lines</strong>. Instead of storing the whole conversation as one enormous JSON object, the file contains a sequence of records. Those records represent my messages, Claude’s responses, tool calls, tool results, and other session events.</p><p>A simplified transcript conceptually looks like this:</p><p>Some sessions also have a directory associated with the UUID. That directory can hold supporting material such as attachments, tool artifacts, or subagent conversation data.</p><p>So when I had about 111 sessions consuming roughly 660 MB, most of that space was historical conversation records and their associated data, kept around so Claude Code could restore those conversations later.</p><h3>What /resume is doing</h3><p>The /resume command is essentially a way of saying:</p><blockquote><em>Show me previously saved Claude Code conversations that I could continue.</em></blockquote><p>Claude Code looks at the saved session files and presents them for selection. Pick one, and it reconstructs that earlier conversation. So /resume is directly tied to the transcript files on disk.</p><p>Before my cleanup, the situation was approximately:</p><p>After the cleanup, the old session transcripts were removed while the current session and memory remained:</p><p>Which is why /resume no longer shows me those 110 deleted conversations.</p><h3>But why did a brand-new session still know old things?</h3><p>This is the part that triggered my original suspicion, and it turns out the distinction really matters.</p><p>There are two very different mechanisms at play:</p><p>Deleting the left side does not delete the right side.</p><p>The key player here is memory/MEMORY.md. It holds distilled facts accumulated from previous work - past defects, incidents, project decisions, preferences. That&#39;s how a completely new conversation can still say:</p><blockquote><em>DEF-2210 was previously related to…</em></blockquote><p>My first reaction was, “How does it know that? This is a new session.” But it never needed to read the old conversation. A fact extracted from that conversation had been saved into persistent memory long before I deleted the transcript.</p><h3>Transcript versus memory</h3><p>An example makes the difference obvious.</p><p>Suppose an earlier session contained 40,000 words discussing a production outage. Somewhere in that conversation, the important conclusion emerged:</p><pre>Production outage: Missing database migration caused authenticated requests to fail.</pre><p>The entire 40,000-word transcript sits in:</p><p>But memory only keeps the compressed fact:</p><pre>NimbusCRM production incident: authentication failure caused by unapplied database migration.</pre><p>A new conversation does <strong>not</strong> need the full 40,000-word transcript to know that fact. It only needs the small memory entry.</p><p>This is why deleting transcripts and deleting memory accomplish two different things.</p><p>Deleting transcripts says:</p><p>Deleting memory says:</p><p>I chose the first operation and deliberately did <strong>not</strong> choose the second.</p><h3>CLAUDE.md is another source of apparent memory</h3><p>Claude Code also reads instruction files like CLAUDE.md. These are not conversation transcripts. They&#39;re closer to an employee handbook Claude receives whenever it works in a particular environment.</p><p>A project might contain instructions conceptually like:</p><p>You could delete every conversation Claude has ever had about that repository, and it would still know those facts in a fresh session, because they’re written down in CLAUDE.md.</p><p>Again, that’s not old conversation leakage. It’s deliberate project initialization.</p><h3>SessionStart hooks can add still more information</h3><p>The third mechanism is the <strong>SessionStart hook</strong>.</p><p>A hook is something that runs automatically when a particular event occurs. A SessionStart hook runs when Claude Code begins a session and can inject additional instructions or information.</p><p>Conceptually:</p><p>So even though the conversation itself is new, the environment surrounding it can carry quite a lot of project knowledge.</p><h3>What is the active context, then?</h3><p>There’s another word worth separating from <strong>session</strong>: <strong>context</strong>.</p><p>The session is the continuing conversation and its saved history. The context is the information available to the model while producing a particular answer.</p><p>A simplified model:</p><p>That bundle is what Claude reasons over.</p><p>So asking “Is this a new session?” and asking “Does Claude have previous project knowledge?” are not contradictory questions. Both answers can be <strong>yes</strong>.</p><h3>What my cleanup actually accomplished</h3><p>My cleanup command deleted all the old .jsonl conversation transcripts except the active session. It also removed the associated session directories while explicitly protecting the memory directory.</p><p>The critical protection was conceptually:</p><p>That exclusion mattered. Without it, a careless recursive deletion of the whole project-state directory would have destroyed persistent project memory as well.</p><p>After the operation: roughly <strong>110 old sessions removed, about 660 MB freed</strong>, current session and memory intact.</p><p>So I ended up with:</p><pre>Historical /resume conversations mostly gone Persistent project memory retained CLAUDE.md retained Hooks retained Current conversation retained</pre><h3>What cleanupPeriodDays: 7 changes</h3><p>To keep this from happening again, I added a setting to:</p><p>with:</p><p>The purpose of that setting is to stop old resumable sessions from accumulating indefinitely. Claude Code periodically prunes session history older than the configured retention period.</p><p>The important point: this is a <strong>session-retention policy</strong>, not a command to erase the project’s persistent memory.</p><p>Conceptually:</p><p>So instead of eventually crawling back to another pile of 111 historical sessions, my /resume history should stay manageable on its own.</p><h3>The mental model to remember</h3><p>The cleanest way I’ve found to think about Claude Code is three layers.</p><p>The bottom box is what I cleaned. The middle box is what I deliberately kept. The top box is constructed fresh every time Claude actually works.</p><p>So my original suspicion was partly right, just not for the reason I assumed. A new Claude Code session really can appear to carry knowledge from old work. But that knowledge travels through persistent memory, CLAUDE.md, hooks, and other startup context - not because Claude stuffs all 111 old .jsonl transcripts into every fresh context window.</p><p>That distinction is the whole takeaway: <strong>deleting </strong><strong>/resume history makes conversations non-resumable; it does not make Claude forget the project.</strong></p><p><em>Originally published at </em><a href="https://khalidrizvi.com/blog/claude-code-filing-cabinet"><em>https://khalidrizvi.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5a1f32c3a012" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stop Prompting. Start Engineering.]]></title>
            <link>https://medium.com/@krizvi/stop-prompting-start-engineering-1c788cd45db5?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/1c788cd45db5</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[developer-tools]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[claude-code]]></category>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Thu, 09 Apr 2026 14:43:41 GMT</pubDate>
            <atom:updated>2026-04-09T14:56:41.564Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Most developers use AI coding tools the same way they use a search engine. Boris Cherny’s systematic framework replaces that guesswork with environment design, context isolation, and automated verification.</blockquote><p>Most people still use AI coding tools the way they use a search box: type a request, hit Enter, and hope something useful comes back. Boris Cherny has a blunt name for that habit: “prompt and pray.” His system starts from a different idea. Instead of relying on luck, you build the conditions that make good results more likely — a clear plan, a clean memory, isolated context, and a feedback loop that catches mistakes before they become yours.</p><p>What follows is a walkthrough of that system in twelve sketches. Each one explains a different piece of the same larger shift, from casually prompting a model to deliberately engineering the environment around it. Read together, they point to one simple conclusion: the AI may write the code, but you are the one designing the machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PvO2V2czNw-95f9V4yfPHQ.png" /></figure><h4><strong>The Core Idea</strong></h4><p>The image captures the central shift in Boris Cherny’s approach to AI: moving from “prompt and pray” to designing a system the model can work inside. Instead of tossing a vague request at AI and hoping it lands somewhere useful, the goal is to create the right conditions upfront through planning, structure, and clear feedback. In other words, strong results do not come from finding magical prompt words. They come from building an environment where good output is the natural outcome, not a lucky accident</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*akcpU3f6s2mSd5Xl-4hAjg.png" /></figure><h4><strong>The Four Differences Between Typical AI Coding and the Boris System</strong></h4><p>Most people think the breakthrough in AI coding is better prompting. Boris’s system argues the real breakthrough is better orchestration.</p><p>That difference shows up immediately at the start. In the typical workflow, the user writes a prompt, hits Enter, and lets the model run. Boris does the opposite. He starts in Plan Mode, uses a short pre-build interview to expose weak assumptions, and does not let the AI write code until the plan is clear. The goal is not to slow the process down. It is to make sure the model is solving the right problem before it starts generating the wrong solution at high speed.</p><p>The second difference is the instruction layer. For most users, claude.md quietly turns into a junk drawer stuffed with old rules, repeated reminders, and leftover preferences from past sessions. Boris treats it as disposable. Keep it short. Trim it often. Delete it when it becomes bloated. Start fresh when needed. That sounds counterintuitive, but the logic is sharp: once the instruction file becomes crowded, it stops helping the model focus and starts making it drift.</p><p>The third difference is quality control. In the standard setup, the human is still the cleanup crew, checking the output by hand, catching mistakes late, and debugging whatever the model misunderstood. Boris pushes verification into the workflow itself. He gives the model tools to inspect what it built, test it, and confirm whether it actually works. In the version shown here, that means tool-based verification like Playwright MCP. The result is a subtle but important shift: the human is no longer the only guardrail standing between “done” and “actually correct.”</p><p>The final difference is architectural. Most people stay inside one long chat thread, dragging every prompt, mistake, and revision forward until the context becomes heavy and noisy. Boris breaks work into partitioned sessions with isolated subagents, each carrying only the context needed for one task. That keeps each thread cleaner, sharper, and less likely to wander. Put together, these four shifts amount to more than workflow advice. They point to a different way of working with AI altogether: less prompting for miracles, more designing for reliable outcomes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ol6QlwTRaTfXWNQc5tLSFg.png" /></figure><h4><strong>Strategic Friction: Why the Hard Part Should Come First</strong></h4><p>There is an old military saying that fits this chart perfectly: the more you sweat in peace, the less you bleed in war. That is exactly what Boris Cherny is doing with AI. Most users try to move fast by skipping the planning step. They type a prompt, hit Enter, and let the model start building right away. It feels quick in the moment, but that early speed is misleading. The real cost shows up later, when the output drifts, the assumptions are wrong, and the human has to step in to debug, rewrite, and clean up the mess.</p><p>The systematic approach looks slower only at the beginning. In the chart, that is the sharp spike during the planning phase. Boris says 80% of his sessions start in Plan Mode, where he makes the AI slow down and think before it writes any code. He uses a short pre-build interview to force clarity: What problem are we solving? Who is this for? What does success look like? What should this not do? Then he asks the model to summarize the plan back before anything gets built. That small amount of friction up front is what makes the rest of the workflow smoother.</p><p>The typical user avoids that effort early, so their workload stays low at the start. But the bill arrives later. During execution and verification, their effort climbs and stays high because they are now fixing problems that should have been caught before the build began. The systematic user pays that cost once, at the beginning, and then moves through the rest of the process with far less drama.</p><p>That is the lesson in the image: planning feels slower only to people who ignore the cost of rework. Spend your effort before the build, and you spend a lot less of your life cleaning up after it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KfO0ZohEBUA07aOtXJzabg.png" /></figure><h4><strong>The Minimalist Memory Rule</strong></h4><p>Most people assume better AI results come from giving the model more instructions. Boris’s system makes the opposite bet: give it less, but make that less count.</p><p>The rule in the image says it plainly: do the minimal possible thing to get the model on track. In practice, that starts with initialization. Run /init, let Claude scan the codebase, and generate a structured Claude.md roadmap. That gives the model a basic map of the territory without burying it in noise from day one.</p><p>The next step is guidance. Add only the rules the model cannot reliably infer on its own, such as framework versions, naming conventions, or project-specific constraints. This is where most people go wrong. They keep stuffing Claude.md with every reminder, preference, and edge case they can think of, until the file stops acting like useful memory and starts acting like a cluttered junk drawer.</p><p>That is why the third step matters most: purge. When the file gets bloated and the AI starts drifting, delete it and start fresh. For most engineers, this feels wrong. We are trained to preserve documentation, add more detail, and keep every rule just in case. But a model working from a short, clear set of instructions is often far more reliable than one trying to obey a long file full of overlap, leftovers, and contradictions.</p><p>That is the real lesson here: memory is only helpful when it stays clean. Once your instruction file becomes clutter, the smartest move is not to add one more rule. It is to pick up the broom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OVr0d9dcCHpkGs_Ks4ql8w.png" /></figure><h4>Context Contamination: When the AI Starts Carrying Too Much Baggage</h4><p>A big context window sounds impressive on paper. In real use, it fills up much faster than people think, and once it does, the AI starts carrying around a lot of mental clutter that has nothing to do with the job in front of it.</p><p>That is what this image shows. The session begins with the real task: building a shopping cart feature. Then the work drifts. A side trip into button UI eats up a huge part of the context window. After that comes more debugging on button colors. By the time you return to the original shopping cart problem, most of the AI’s attention is no longer on the thing you actually care about. It is stuck dragging along old code, old replies, and old detours. Boris calls this the baggage effect. The more irrelevant context the model carries, the worse it gets at thinking clearly about the current task.</p><p>This is the part many users miss. They assume staying in one long chat is efficient because everything is in one place. But that convenience has a cost. The AI does not just remember the useful parts. It remembers the junk too. And once too much junk piles up, accuracy starts to slip.</p><p>The fix is simple, even if it feels unnatural at first: isolate the work. Start a fresh session for a new task. Keep unrelated problems separate. Let each thread carry only the context it actually needs. Boris’s rule is that two context windows that do not know about each other often produce better results. In plain English, the AI works better when you stop making it haul yesterday’s baggage into today’s job.</p><p>That is the real lesson here: a long chat can feel productive, but beyond a point it becomes a crowded room. When the task changes, open a new door.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fVIjX3nFV36Kt_dW0gCAdA.png" /></figure><h4><strong>Context Weight Management: </strong>A Good AI Session Is Not Something You Use Up — It Is Something You Clean.</h4><p>Most people treat an AI chat like a running conversation that should keep going forever. This image makes the opposite case: context is not free, and if you do not manage it, it turns into clutter.</p><p>Once you understand that, the fixes become straightforward. When one task is finished and you are moving to a completely new feature, the right move is to leave the session behind and start fresh with /exit.That gives you a clean brain instead of dragging old assumptions into new work. When the current task still matters but the session has become heavy, /compact helps by having the AI summarize the history, free up space, and keep the work moving in the same direction.</p><p>There is also the situation every developer knows too well: you disappear into a debugging rabbit hole, chase the wrong idea, and realize twenty minutes later that the detour was useless. That is where Escape x2 matters. It rewinds the chat and removes the tangent from memory, so the session is no longer polluted by a bad path. And when the task is done but you still want to keep your core project setup, /clear wipes the chat history while keeping files like Claude.md loaded. In plain terms, it lets you clean the room without throwing out the furniture.</p><p>That is why these commands matter. They are not little convenience tricks. They are basic hygiene for working with AI.</p><blockquote>The people who get the best results are usually not the ones with the cleverest prompts. They are the ones who know when to reset, when to compress, and when to stop carrying yesterday’s mess into today’s work.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C88uoRNBqqfh9kRYXLoVeg.png" /></figure><h4><strong>The 2–3x Quality Multiplier: </strong>AI gets a lot better the moment it can check its own homework.</h4><p>That is the big idea in this image, and it is surprisingly simple. Boris’s method has three parts: give Claude a tool that can see the result of its work, tell Claude that the tool exists, and let it use that feedback to improve the output. Instead of writing code once and stopping there, the model goes through a loop: build something, run it, look at what happened, and fix what is off. That is not magic. It is just feedback. And feedback is where quality comes from.</p><p>This matters because most people still use AI like a one-shot machine. They ask for a component, get an answer, and then manually inspect it themselves. Boris changes the setup so the model can do some of that checking on its own. If the tool can open the browser, inspect the page, run the output, or verify the result in a terminal, Claude is no longer working blind. It can see whether the thing it built actually behaves the way it was supposed to behave.</p><p>That also changes how you ask. Instead of saying, “Build this component,” you say, “Build this component, then review it against the brand guidelines using your tools and verify it matches expectations before confirming.” That sounds like a small wording change, but it creates a completely different job. You are no longer asking for a draft. You are asking for a checked result.</p><p>That is why Boris calls it a quality multiplier. The jump does not come from better prompting tricks. It comes from giving the AI a way to see, test, and correct its own work before it hands it back to you. In plain English, the smartest AI is not the one that answers fastest. It is the one that knows how to look twice.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zgCJXNdly2NyHtPc9SthEQ.png" /></figure><h4>Breaking the Sandbox: When AI Stops Guessing and Starts Checking</h4><p>An AI working alone inside a sandbox is like a mechanic trying to fix a car with no manual and no test drive.</p><p>That is the point of this image. By default, Claude Code works inside a local box. It can read and write code, but it cannot naturally reach out to the live web, open a browser, or confirm that what it built actually works in the real world. MCP servers change that. They give the model controlled ways to step outside its box and interact with the tools it needs.</p><p>In this setup, Context 7 acts like a live knowledge feed. It pulls in current documentation so the model is not relying on stale memory or making things up when frameworks change. If you want Claude to check the latest Tailwind docs before configuring variables, Context 7 gives it that ability. Instead of guessing from old training, it can look at the source of truth.</p><p>Playwright does the other half of the job. It gives Claude eyes and hands in the browser. The model can open pages, click buttons, take screenshots, and test how the layout behaves at different screen sizes. That matters because a lot of software problems are not really code problems until you see them on the screen. With Playwright, Claude no longer has to assume the interface looks right. It can actually check.</p><p>That is why “breaking the sandbox” matters so much. One tool helps the model know what is current. The other helps it verify what is real. Put together, they turn AI from a smart guesser into something much closer to a worker who can read the manual and test the result before calling the job done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8YIxwucoduBg2SsUk3RIbg.png" /></figure><h4>Automating the Inner Loop: Turn Repetition Into a Button Press</h4><p>The fastest way to speed up AI work is not to type better prompts every time. It is to stop repeating the same setup work in the first place.</p><p>That is what this image is really about. In any real project, there are small jobs that come up again and again: create a new UI component, add the test file, register it on the preview page, follow the same naming rules, and keep the same structure every time. None of that work is hard, but it is repetitive, and repetition is exactly where good systems save time. Instead of re-explaining the same task to Claude over and over, Boris’s approach is to turn that routine into a custom command.</p><p>The command file shown here has three simple parts. First, the front matter tells Claude how the command should appear in the terminal. Second, the argument section lets you pass in changing details, like the name of the component or a short summary of what it should do. Third, the execution rules hold the project-specific instructions that should happen every time, such as using PascalCase, creating a test file, and adding the component to the preview page. In plain English, you are not just giving the AI a prompt. You are giving it a repeatable playbook.</p><p>That is why a command like /ui-component Modal | A semi-transparent backdrop matters. With one line, the model can scaffold the component, generate the related test file, and wire it into the project the same way every time. What used to be a handful of repeated instructions becomes a single action.</p><p>The bigger lesson is simple: whenever you catch yourself doing the same thing again and again, that is not a habit to tolerate. That is a process waiting to be turned into a tool. Write it down once, and let the system carry it from there.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PinPzZKvFFYpNtFiN8cRg.png" /></figure><h4>The Autonomous Review Pipeline: Let One Brain Build, and Another Brain Check</h4><p>A lot of AI mistakes happen for a simple reason: the same session is trying to do everything at once.</p><p>That is what this image is trying to fix. The user starts by running a custom command in the main session, but the main session does not carry the whole burden by itself. Instead, it hands off the visual review work to a separate subagent, a kind of specialist whose only job is to look at the interface and judge what is actually happening on the screen. That subagent uses Playwright MCP to open the local development server, inspect the component, take screenshots, and send visual feedback back to the main session. Then the main session uses that feedback to improve the code.</p><p>The important idea here is separation of duties, also called “Separation of Concern (SOC)”. The main thread stays clean, light, and focused on structure, logic, and code decisions. The subagent handles the heavier review work, where lots of visual details, screenshots, and browser interactions can quickly clutter the context. By keeping those jobs apart, each part of the system stays better at its own role.</p><p>You can think of it like a builder and an inspector. The builder keeps building. The inspector checks the work and reports back. They help each other, but they do not need to live in the same crowded room. That separation is what keeps the process sharp.</p><p>That is the real lesson in the pipeline: AI gets more reliable when you stop forcing one conversation to be the worker, the reviewer, and the memory dump all at the same time. Keep the builder clean, keep the reviewer separate, and the whole system starts acting a lot more like a team than a chat.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C1Nz3zC_-wJX9q0zS9A0NQ.png" /></figure><h4>The Bitter Lesson: Stop Polishing Prompts for a World That Is Moving Past Them</h4><p>One of the easiest ways to waste time in AI is to obsess over prompt tricks that the next model will make irrelevant.</p><p>That is the point of this image. As base models get stronger, the value of hyper-specific prompt tuning goes down. Boris Cherny puts it bluntly: never bet against the model. In plain English, do not build your workflow around the assumption that today’s model needs endless hand-holding forever. What feels like a clever prompt hack right now may look useless six months from now, simply because the underlying model will have improved.</p><p>The smarter investment is in the system around the model. Instead of spending your energy squeezing out tiny gains from wording, spend it on the parts that will still matter after the next upgrade: better context, cleaner information, reusable skills, isolated subagents, and stronger verification. Those things do not disappear when the model gets better. They become even more valuable.</p><p>That is the bitter lesson here: prompts are rented, but systems are owned. Build the part that lasts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r-73gLeTq0P6uX_cz7m-qA.png" /></figure><h4>The Orchestration Network</h4><p>The Boris system is not really a bag of tricks. It is a way of thinking. Its core claim is that the quality of AI-assisted work depends less on finding the perfect prompt and more on building the right environment around the model.</p><p>That means planning before building. It means keeping memory light instead of stuffing it with instructions. It means isolating tasks so one problem does not poison the next. It means giving the model tools to verify its own work instead of making the human catch everything by hand. And it means using specialized subagents when a job needs a separate set of eyes.</p><p>That is the real takeaway. Do not treat AI like a magic box that needs better words. Treat it like a system that needs better design.</p><p>In the long run, the people who win with AI will not be the ones who write the cleverest prompts. They will be the ones who build the cleanest machines around the model.</p><blockquote>This piece began with a YouTube video I watched the day before yesterday and then replayed three more times because it genuinely mesmerized me. Wanting to sit with the ideas more carefully, I sent the video to NotebookLM and asked it to turn the talk into a slide deck. The quality of those slides, several of which shaped this article, completely changed the way I think about Claude Code and pushed me to write down my own reflections. So what you are reading here is not a transcript, and not a claim of original ownership over the core ideas, but my attempt to understand them in public. And fittingly for the moment we live in, the final English on this page was polished with help from ChatGPT, Claude, and Gemini. That feels like the real lesson too: we are living in the age of AI, but the advantage still belongs to the person willing to slow down, think clearly, and build with intention before moving fast.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c788cd45db5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Build a Real-Time Job Search Agent Using Strands-Agent, Ollama, and the Dice MCP Server]]></title>
            <link>https://medium.com/@krizvi/how-to-build-a-real-time-job-search-agent-using-strands-agent-ollama-and-the-dice-mcp-server-e865a648c302?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e865a648c302</guid>
            <category><![CDATA[guides-and-tutorials]]></category>
            <category><![CDATA[dice-mcp-server]]></category>
            <category><![CDATA[strands-agents]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai-development]]></category>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Sat, 17 Jan 2026 03:00:02 GMT</pubDate>
            <atom:updated>2026-01-17T03:00:02.939Z</atom:updated>
            <content:encoded><![CDATA[<p>The release of the <strong>Dice MCP Server</strong> marks a significant shift in how we can use AI for career growth. Most AI models are “offline” — they know what was in their training data, but they can’t tell you what was posted on a job board five minutes ago.</p><p>By using the <strong>Model Context Protocol (MCP)</strong>, we can bridge this gap. MCP allows an AI agent to “discover” and use external tools in real-time. In this guide, we will build a “Job Scout” agent that uses a local <strong>Ollama</strong> model to reason, but reaches out to <strong>Dice.com</strong> to find actual, live job listings.</p><h3>The Tech Stack</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*afpdQDiCi2UiSQsvxE7b9w.png" /></figure><ul><li><strong>Ollama (Local LLM):</strong> Runs the llama3.2:1b model on your machine for privacy and zero cost.</li><li><strong>Dice MCP Server:</strong> A live socket at https://mcp.dice.com/mcp that exposes job search tools.</li><li><strong>Strands-Agent:</strong> A Python framework that orchestrates the “brain” (Ollama) and the “hands” (Dice MCP tools).</li><li><strong>uv:</strong> A high-speed Python package manager used to build our environment.</li></ul><h3>Step 1: Environment Setup with uv</h3><p>We will use uv for its speed and reliability in managing dependencies. Start by initializing your project and adding the required libraries.</p><pre># Initialize a new project<br>uv init job-scout<br>cd job-scout<br><br># Add specific versions of the Strands ecosystem<br>uv add &quot;strands-agents[ollama]&gt;=1.22.0&quot; &quot;strands-agents-tools&gt;=0.2.19&quot; <br><br># Ensure your environment is synced<br>uv sync</pre><h3>Step 2: Preparing the Local “Brain” (Ollama)</h3><p>Before we run the code, your local model needs to be active.</p><ol><li><strong>Pull the model:</strong> Open your terminal and run ollama pull llama3.2:1b. This model is lightweight and highly efficient at following instructions for tool use.</li><li><strong>Start the server:</strong> Run ollama serve. This ensures your Python script can communicate with the model at <a href="http://localhost:11434.">http://localhost:11434.</a></li></ol><h3>Step 3: The Implementation</h3><p>This script establishes a connection to the remote Dice server. Once connected, the agent “discovers” that it now has the power to search for jobs.</p><p>create a file `dice_mcp_client.py` and enter following code</p><pre># dice_mcp_client.py<br>from mcp.client.streamable_http import streamable_http_client<br>from strands import Agent<br>from strands.models.ollama import OllamaModel<br>from strands.tools.mcp.mcp_client import MCPClient<br><br># 1. Initialize the local model (The Brain)<br>ollama_model = OllamaModel(<br>    host=&quot;http://localhost:11434&quot;,<br>    model_id=&quot;llama3.2:1b&quot;,<br>    temperature=0.7<br>)<br><br># 2. Setup the MCP connection (The Bridge)<br># We use the official Dice MCP server endpoint<br>def create_dice_transport():<br>    return streamable_http_client(&quot;https://mcp.dice.com/mcp&quot;)<br><br>dice_mcp_client = MCPClient(create_dice_transport)<br><br># 3. Create and run the Agent<br>with dice_mcp_client:<br>    # Discover tools available on the Dice server<br>    dice_tools = dice_mcp_client.list_tools_sync()<br><br>    # Create the agent with our model and the new tools<br>    job_scout_agent = Agent(model=ollama_model, tools=[dice_tools])<br><br>    print(&quot;\nAgent Ready! Ask for Python jobs in NYC or &#39;exit&#39; to quit.\n&quot;)<br>    while True:<br>        user_input = input(&quot;User: &quot;)<br>        if user_input.lower() in [&quot;exit&quot;, &quot;quit&quot;]:<br>            break<br><br>        print(&quot;\nThinking...&quot;)<br>        response = job_scout_agent(user_input)<br>        print(f&quot;Agent: {response}\n&quot;)</pre><h3>How it Works: The CLI in Action</h3><p>When you run this app in your terminal, it transforms your shell into a specialized job-search environment. Using uv run, you can launch the script instantly:</p><pre>$ uv run dice_mcp_client.py <br><br>Dice Job Ready! Type &#39;exit&#39; to quit.<br><br>Question: golang developers in vienna, va posted in last 3 days<br><br>Thinking...<br><br>Tool #1: search_jobs<br>Based on the tool call response, here are some job openings for Golang developers in Vienna, VA:<br><br>1. Golang Integration Developer (Hybrid) - Harrisburg, PA<br>2. Golang Developer - Sharpedge Solutions (Remote)<br>3. Sr FullStack Developer With Golang || Remote - Value Spectrum Technologies LLC (Remote)<br><br>Answer: [Summarized results from the tool call]</pre><p>When you ask the agent a question, it doesn’t just guess. It follows a structured “handshake” process:</p><ol><li><strong>Discovery:</strong> The MCPClient connects to Dice and receives a list of capabilities. It learns that it can call a tool named search_jobs with parameters like location, skills, and salary.</li><li><strong>Tool Selection:</strong> The Llama model reads your request. It realizes it needs external info and prepares a specific call to the Dice tool.</li><li><strong>Real-Time Execution:</strong> The request travels through the MCP bridge to Dice. Dice searches its database and returns raw job data.</li><li><strong>Natural Response:</strong> Your local model takes that raw data and explains it to you in plain English.</li></ol><p>By using MCP, we’ve skipped hours of API integration work. We simply “plugged” our agent into the Dice “socket.”</p><p>For developers who want to explore the full potential of the Dice ecosystem — you should refer to the official documentation:</p><ol><li><strong>Official Documentation:</strong> <a href="https://www.dice.com/career-advice/how-to-connect-the-dice-mcp-server-to-your-ai-assistant">How to Connect the Dice MCP Server to Your AI Assistant</a></li><li><strong>Announcement:</strong> <a href="https://insights.dice.com/career-advice/dice-launches-mcp-server-for-ai-powered-job-search">Dice Launches MCP Server for AI-Powered Job Search</a></li><li><strong>Technical Endpoint:</strong> <a href="https://mcp.dice.com/mcp">https://mcp.dice.com/mcp</a></li></ol><blockquote>The landscape of AI and software development is evolving rapidly, and this is just one example of what’s possible. If you found this guide helpful and want to explore more about emerging technology, coding experiments, and other interesting trends, I invite you to visit my profile at <strong>khalidrizvi.com</strong>. There, you can see more of my work, browse my portfolio, and read my latest articles and thoughts on the tech industry.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e865a648c302" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Secret Sauce of the AI Boom: A Simple Guide to the Paper That Changed Everything]]></title>
            <link>https://medium.com/@krizvi/the-secret-sauce-of-the-ai-boom-a-simple-guide-to-the-paper-that-changed-everything-95fd600124a9?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/95fd600124a9</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[transformers]]></category>
            <category><![CDATA[generative-ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Wed, 14 Jan 2026 13:13:23 GMT</pubDate>
            <atom:updated>2026-01-14T13:13:23.026Z</atom:updated>
            <content:encoded><![CDATA[<h4>How a 2017 Google idea called “Attention” fixed AI’s memory problem and gave us ChatGPT.</h4><p>If you’ve been amazed by tools like ChatGPT or Midjourney over the last couple of years, you might wonder: <em>What changed?</em> Why did AI suddenly get so much smarter so fast?</p><p>It wasn’t magic. It was a specific blueprint created by Google researchers in a 2017 paper titled <strong>“</strong><a href="https://arxiv.org/pdf/1706.03762"><strong>Attention Is All You Need</strong></a><strong>”</strong>. They invented a new AI engine called the “Transformer”.</p><p>Before this paper, AI was stuck in the slow lane. Here is a simple, visual breakdown of how this one idea changed the world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h37eq8lpWNvrKxi_McvECA.png" /><figcaption>Discover how the “Attention” mechanism revolutionized AI by switching from slow word-by-word reading to seeing the whole picture at once.</figcaption></figure><h3>The Old Way: Reading Through a Tube</h3><p>Before 2017, the standard way AI handled language was using something called an RNN (Recurrent Neural Network).</p><p>Imagine trying to read a book while looking through a long, thin telescope or tube. You can only see one word at a time. You read the first word, remember it, move to the second, remember it, and so on.</p><p>This approach had two major problems, as shown in the top-left of the sketchnote:</p><ol><li><strong>It was painfully slow:</strong> Because it had to process things sequentially (one after another), it couldn’t use the full power of modern supercomputers.</li><li><strong>It had a bad memory:</strong> By the time the AI got to the end of a long sentence, it often forgot what happened at the start.</li></ol><h3>The New Way: “Attention” (Seeing the Big Picture)</h3><p>The Google researchers proposed a radical shift. What if the computer didn’t need to read step-by-step? What if it could look at the <strong>whole sentence at once</strong>?</p><p>This is the concept of “Attention.”</p><p>Instead of getting stuck on individual words, the AI looks at the entire phrase and learns which parts to focus on to understand the meaning.</p><p>Look at the example in the top-right of the image. In the sentence fragment containing “DOG,” “CHASED,” and “IT,” the AI needs to know what “IT” refers to. The new method allows it to draw instant connections, realizing that “IT” connects back to the “DOG” that did the chasing.</p><h3>The Engine: How the “Transformer” Works</h3><p>To make this “look at everything at once” idea work, they built an engine with three smart components:</p><p><strong>1. Self-Attention (The “Group Chat”)</strong> Imagine every word in a sentence enters a giant group chat with every other word instantly. They talk to each other to figure out the context. For example, the word “BANK” talks to nearby words to figure out if it means a river bank or a money bank.</p><p><strong>2. Multi-Head Attention (Different Angles)</strong> The AI doesn’t just look at the sentence once. It analyzes it in parallel from “different angles.” Think of it like viewing the sentence through different colored lenses simultaneously — one lens looks at grammar, another at word roles, and another at deeper meaning.</p><p><strong>3. Positional Encoding (The “Sticker System”)</strong> Because the AI is looking at all the words at the same time, it loses track of the natural order of the sentence. To fix this, it uses a “sticker system,” slapping a number (Word #1, Word #2, Word #3) on each piece so it knows where it originally belonged.</p><h3>Why This Changed the Game</h3><p>This shift from sequential reading to “Attention” was a massive game-changer.</p><p>As the bottom-right of the visual shows, it unlocked two things:</p><ul><li><strong>Massive Speed:</strong> Because the computer could process everything in parallel instead of one at a time, it became incredibly fast.</li><li><strong>Smarter AI:</strong> The ability to focus on the relationships between distant words gave the AI a much better understanding of language.</li></ul><p>This Transformer engine is the foundation that enabled the massive AI models we use today, including ChatGPT and Midjourney. It turns out, “Attention” really was all we needed.</p><blockquote>If you found this simple breakdown helpful, I’d love for you to visit my profile at <strong>khalidrizvi.com</strong>. You can find more articles there explaining complex tech in plain English. If you’re interested in how we can work together to solve bigger, real-world issues using powerful tools like Transformer technology, please don’t hesitate to reach out — let’s connect!</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=95fd600124a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Farmer’s Guide to Programming: Why Your Tomatoes Are Actually Dictionaries]]></title>
            <link>https://medium.com/@krizvi/the-farmers-guide-to-programming-why-your-tomatoes-are-actually-dictionaries-c14713f5da8a?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c14713f5da8a</guid>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Wed, 15 Oct 2025 11:22:59 GMT</pubDate>
            <atom:updated>2025-10-15T12:12:32.865Z</atom:updated>
            <content:encoded><![CDATA[<h3>How organizing your barn makes you a better programmer</h3><p>You’re a farmer. You have 50 bushels of tomatoes, 30 sacks of potatoes, and 20 crates of apples in your barn. This is your inventory — real, physical stuff you can touch.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yMPz2anqxtenaG8JJAxwQ.png" /></figure><p>Now, the market calls and asks what you have. You can’t shove the barn through the phone, so you write it down:</p><ul><li><strong>Tomatoes:</strong> 50 bushels</li><li><strong>Potatoes:</strong> 30 sacks</li><li><strong>Apples:</strong> 20 crates</li></ul><p>This list isn’t the produce itself; it’s a <strong>representation</strong> of it.</p><p>Congratulations. You just understood the difference between a data structure and serialization, a concept that trips up programmers daily.</p><h3>Your Barn is a Dictionary, Your List is JSON</h3><p>In the world of Python, that barn full of organized inventory is called a <strong>dictionary</strong> (dict). It lives in the computer&#39;s memory.</p><pre># Your barn (in computer memory)<br>barn = {<br>    &quot;tomatoes&quot;: 50,<br>    &quot;potatoes&quot;: 30,<br>    &quot;apples&quot;: 20<br>}</pre><p>The written list you send to the market? That’s <strong>JSON</strong> (JavaScript Object Notation). It’s just plain text, perfect for sending over the internet.</p><pre>{<br>  &quot;tomatoes&quot;: 50,<br>  &quot;potatoes&quot;: 30,<br>  &quot;apples&quot;: 20<br>}</pre><p>One is the real thing in your barn (a dict in memory); the other is the paperwork that lets you talk about it (a JSON text string). When you need to save your inventory, send an order, or store records, you must convert your barn&#39;s dict into a written JSON list.</p><h3>The Great Terminology War</h3><p>Here’s where programmers make things more complicated than they need to be. Different programming languages have different names for this simple process.</p><ul><li><strong>The Barn:</strong> An in-memory data structure.</li><li><strong>Writing it Down:</strong> The act of serializing or marshaling.</li><li><strong>Reading the List:</strong> The act of deserializing or unmarshaling.</li></ul><p>It’s the same exact process. Don’t let the different words fool you. It’s like calling it “harvest” in one county and “reaping” in the next. You’re still just cutting down crops.</p><h3>Why Some Barns Have Stricter Rules</h3><p>Now, imagine your farm runs on Python. Your barn has relaxed rules. You can store anything, anywhere, anytime.Python</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_3ot-amkWn24xr40dkyq4Q.png" /></figure><pre># Python is flexible<br>barn = {&quot;tomatoes&quot;: 50}<br>barn[&#39;chickens&#39;] = 12      # Added chickens? Sure!<br>barn[&#39;tomatoes&#39;] = &quot;lots&quot;  # Changed a number to a word? No problem!</pre><p>This flexibility is powerful. But your cousin, who runs their farm on a language like Go, has a much stricter system. Every type of produce must be defined beforehand.Go</p><pre>// Go requires a predefined structure<br>type Barn struct {<br>    Tomatoes int `json:&quot;tomatoes&quot;`<br>    Potatoes int `json:&quot;potatoes&quot;`<br>}<br>// Trying to add chickens would cause an error!<br>// Trying to say you have &quot;lots&quot; of tomatoes would also fail.</pre><p>When your cousin receives an inventory list (JSON), their system validates it instantly. If the paperwork says &quot;potatoes&quot;: &quot;thirty&quot;, the whole shipment is rejected because &quot;thirty&quot; is not a number.</p><ul><li><strong>Python’s approach:</strong> “I’ll accept anything and figure it out later.”</li><li><strong>Go’s approach:</strong> “Your paperwork better be perfect, or I’m not unloading this truck.”</li></ul><p>Neither is better; they are just different philosophies for managing a barn.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*vBUY9-_kErP_xa2yDdlryA.png" /></figure><h3>The Takeaway</h3><p>Most programming tutorials skip the farming metaphor and say, “JSON is a lightweight data-interchange format,” and our eyes glaze over.</p><p>But you get it now. The confusion comes from mixing up the concepts. Programmers say “send me the JSON” when they really mean “send me the written text so my program can read it into its own barn.”</p><p>Next time you see this code, you’ll know exactly what it means:</p><pre>import json<br><br># Your barn&#39;s data<br>data = {&quot;tomatoes&quot;: 45, &quot;corn&quot;: 100}<br><br># `dumps` = Writing down your barn inventory for travel<br>json_string = json.dumps(data)<br><br># `loads` = Reading a written list into your barn<br>new_data = json.loads(json_string)</pre><p>It’s just moving produce between barns. But instead of trucks, we use text.</p><h3>Your Turn</h3><p>That’s it. You now understand a core programming concept that takes most developers months to grasp. Open a Python terminal and try it:</p><pre>import json<br><br>my_farm = {<br>    &quot;chickens&quot;: 20,<br>    &quot;cows&quot;: 5,<br>    &quot;acres&quot;: 40,<br>    &quot;favorite_crop&quot;: &quot;corn&quot;<br>}<br><br># 1. Write your inventory down<br>inventory_text = json.dumps(my_farm, indent=2)<br>print(&quot;--- My Written Ledger ---&quot;)<br>print(inventory_text)<br><br># 2. Read it back into a new variable<br>farm_copy = json.loads(inventory_text)<br>print(&quot;\n--- Copied to a New Barn ---&quot;)<br>print(f&quot;The favorite crop is: {farm_copy[&#39;favorite_crop&#39;]}&quot;)</pre><p>Run it. Change it. Break it. That’s how you learn. Happy farming, and happy coding.</p><blockquote>If this straightforward approach to technology resonates with you, I invite you to explore more of my work at khalidrizvi.com.</blockquote><blockquote>As a consultant, I help organizations navigate critical technology transitions. My expertise lies in architecting and executing strategies for AI and Generative AI adoption, large-scale application modernization, and integrating intelligent solutions into core business processes (AIfication). If your team needs to solve a complex problem that requires deep strategic thinking, please connect with me through my site to discuss how I can help.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c14713f5da8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Simple Guide to the 10 Types of AI “Brains” You’ll Meet Online]]></title>
            <link>https://medium.com/@krizvi/a-simple-guide-to-the-10-types-of-ai-brains-youll-meet-online-c604d947ad8e?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/c604d947ad8e</guid>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Sun, 14 Sep 2025 17:00:29 GMT</pubDate>
            <atom:updated>2025-09-14T17:12:37.491Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2J727pgnmeTPh7oU_VaskQ.png" /></figure><p>Ever feel like “AI” is one big, confusing buzzword? You’re not wrong. People use it to describe everything from your phone’s camera to super-smart robots. But here’s the secret: <strong>not all AI is the same</strong>.</p><p>Think of AI like a toolbox. You wouldn’t use a hammer to turn a screw, right? In the same way, there are different types of AI brains, each built for a specific job. Let’s break down the 10 most common types you’ll encounter, using simple language and everyday examples.</p><h3>1. The Thinker (Reasoning LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PxNMHY5F_hbXu7QDLAx7UQ.png" /></figure><p>Imagine a brilliant detective or a master chess player. This type of AI doesn’t just guess the answer; it <strong>thinks it through step-by-step</strong>. It breaks down complex problems into smaller, manageable chunks and solves them in a logical order. This makes it perfect for solving tricky math homework, planning a multi-stop road trip, or figuring out the most efficient way to schedule a team’s week. Prominent examples of this technology include OpenAI’s o1 and open-source projects like DeepSeek-R1.</p><h3>2. The Conversationalist (Chat LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rw6VY2iPPpOwXJzEj_29Tw.png" /></figure><p>This AI is like a friendly shopkeeper who remembers you and what you talked about last time. As the AI most of us know and use, its main job is to hold a natural, flowing conversation. It remembers the context of your chat so you don’t have to repeat yourself, making it a helpful, easy-to-talk-to partner. You’ll find it powering customer service bots, acting as a personal assistant on your phone, or serving as a go-to brainstorming buddy. The most famous example is ChatGPT, with open-source alternatives like LLaMA 3 also widely available.</p><h3>3. The Code Wizard (Coding LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wtdaFWVW5fl1SZTO9M_-zQ.png" /></figure><p>Think of this AI as a master bike mechanic who can spot a loose bolt or build a new frame from scratch in minutes. These AIs are fluent in the languages of computers (like Python and JavaScript). They can write new code, find and fix bugs in existing code, and even explain what a complicated piece of software does. This makes them invaluable for helping professional developers work faster, teaching beginners how to program, and automating repetitive coding tasks. Well-known tools in this space include GitHub Copilot and open-source models like StarCoder or CodeLLaMA.</p><h3>4. The Super-Librarian (Knowledge/Retrieval LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AMJlVDfbsKOPNFQE3g7A5w.png" /></figure><p>Picture a librarian who has read every book in the library and can instantly find and summarize the exact paragraph you need. This AI is designed to sift through massive mountains of information — like legal documents, research papers, or company reports — and pull out the key insights. It saves you from having to read hundreds of pages yourself, which is why it’s heavily used by legal teams searching for case precedents and doctors reviewing medical research. This technology is often built into specialized enterprise services for data analysis.</p><h3>5. The Multi-Talented Artist (Multimodal LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TqDMLOa12IQka3CMOG5_Pw.png" /></figure><p>This AI is like an artist who can not only talk about a painting but also see it, hear the story behind it, and describe the music it inspires. “Multimodal” simply means it can understand more than just text; it can also <strong>see images, hear audio, and watch videos</strong>. This allows it to do amazing things, like describing the contents of a photo to someone who is visually impaired or analyzing charts and graphs from an image you upload. GPT-4o is a famous example, while LLaVA is a popular open-source one.</p><h3>6. The Specialist (Domain-Specialized LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lrrcMmPxPeZNmiRmY70J2A.png" /></figure><p>This AI is comparable to a local doctor who doesn’t know about car repair but is an absolute expert on medicine. Instead of trying to know a little bit about everything, this AI is trained to be an expert in <strong>one specific field</strong>, like medicine, law, or finance. This deep focus makes its analysis far more accurate and reliable within its niche, which is why it’s used for assisting doctors with diagnoses (like Med-PaLM) or powering financial trading bots. Because they’re often trained on sensitive, proprietary data, most of these are closed-source products.</p><h3>7. The Pocket Brain (Small/Edge LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BoqnZ2FRZKQFbw49mvg2yQ.png" /></figure><p>Think of this AI as a self-contained food cart — it’s small and can serve you right where you are without needing a giant kitchen. These AIs are efficient enough to run directly on your phone or laptop, without connecting to a powerful server in the cloud. This makes them faster, more private, and usable even when you’re offline. They are ideal for private chatbots that don’t send your data away, instant language translation apps, and smart assistants on devices like smart glasses. Open-source models like Mistral and Microsoft’s Phi-3-mini are leading this trend.</p><h3>8. The Doer (Reason + Action LLMs, or “Agents”)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*njePfsL_IiVBQb85_3Xb_A.png" /></figure><p>This AI is like a courier who doesn’t just plan the best route (reasoning) but actually gets on the bike and delivers the package (action). This is the next big step for AI. Most models just <em>talk</em>; these AIs can <em>do</em>. After thinking about a request, they can take action by connecting to other apps or websites to complete a task. This enables automated assistants to book flights, send emails, or order groceries for you from a single command, like “Find and book me a flight to Miami for next Tuesday under $300.” This is still an early-stage technology, mostly in closed pilot programs.</p><h3>9. The Good Listener (Instruction-Tuned LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TAUSKJmhPrLbiovDywGBfA.png" /></figure><p>Imagine a great waiter who listens carefully to your order — “no onions, extra spicy, dressing on the side” — and gets it exactly right. These AIs are specifically trained to follow directions with precision. While a standard chat AI might get creative, an instruction-tuned model focuses on sticking to the script you provide. This is useful for automating tasks that require a specific format, like writing a polite follow-up email in exactly 50 words or reformatting a block of text into a bulleted list. Falcon-Instruct and older versions of GPT are good examples.</p><h3>10. The Creator (Creative/Generative LLMs)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2boLKhuVxiCCufwSEHoo-g.png" /></figure><p>This AI is the street poet who can whip up a beautiful verse on the spot or an improv artist who creates a scene out of thin air. While all these models “generate” text, this category focuses purely on creativity and originality. Their goal is to produce new content — like stories, poems, marketing slogans, or fresh ideas. They are perfect for brainstorming ad campaigns, helping writers overcome creative blocks, or generating scripts for social media. Anthropic’s Claude is known for its creative writing skills, alongside open-source models like StableLM.</p><h3>The Final Word</h3><p>So, there you have it. The world of AI isn’t one-size-fits-all. It’s a diverse ecosystem of specialized “workers.” Some <strong>think</strong>, some <strong>chat</strong>, some <strong>create</strong>, and some are learning to <strong>act</strong>.</p><p>The reason to care? These tools are becoming a bigger part of our daily lives every day. Understanding the difference isn’t just for tech geeks anymore — it’s about knowing which AI worker to “hire” for your next project, question, or big idea.</p><blockquote>If you enjoyed this breakdown, you’ll find more articles demystifying technology at my personal blog, <strong>khalidrizvi.com</strong>. Beyond writing, my professional focus is on applying deep strategic thinking to solve challenging, high-fidelity problems for organizations. If your team is facing a complex issue that requires a specialist’s perspective, I am available for consulting engagements. Feel free to connect with me through my site to learn more about my specializations and how I can help.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c604d947ad8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RAG Chatbot: Let Your PDF Documents Answer Questions with LangChain]]></title>
            <link>https://medium.com/@krizvi/rag-chatbot-let-your-pdf-documents-answer-questions-with-langchain-04f7f77dd6d3?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/04f7f77dd6d3</guid>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Thu, 07 Aug 2025 16:37:07 GMT</pubDate>
            <atom:updated>2025-08-07T17:27:10.061Z</atom:updated>
            <content:encoded><![CDATA[<p>Want to ask questions about a document and get meaningful answers instantly — even if the AI hasn’t seen it before? This tutorial shows you how to build a Retrieval-Augmented Generation (RAG) chatbot using LangChain that can process PDFs and respond with contextually accurate answers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kFp1LY1lfIhYw8TayFMwhQ.png" /></figure><p>Whether you’re working with medical letters, research reports, or internal business documents, this guide walks you through a real-world chatbot system that grounds answers in the actual content you upload.</p><h3>Why RAG? LLMs Alone Aren’t Enough</h3><p>You could pass a document directly into a large language model (LLM). But what if it’s too long? Or was written after the model’s training data cutoff? That’s where RAG shines.</p><p>RAG combines retrieval and generation. Instead of relying on what the model already “knows,” it retrieves relevant parts of your document and uses that to generate responses. This allows you to:</p><ul><li>Ask questions about private, recent, or domain-specific documents</li><li>Keep token usage low</li><li>Get focused, grounded, and transparent responses</li></ul><h3>Office Hour Analogy: Ask Better, Get Better</h3><p>Think of two students visiting a professor:</p><ul><li><strong>Student A</strong> hands over a full textbook and says, “Can you help me understand this?”</li><li><strong>Student B</strong> comes with highlighted pages and specific questions.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k85IKOEACJT1_wQMD0TM8Q.png" /></figure><p>Who gets the better answer? Student B. They’re focused, prepared, and efficient.</p><p>That’s what RAG does for your AI. It highlights only the most relevant parts of a document and pairs them with your question.</p><h3>High-Level Architecture</h3><p>This chatbot uses three components:</p><blockquote><strong>DocumentProcessor</strong>: Handles PDF parsing, chunking, embedding, and retrieval</blockquote><blockquote><strong>ChatEngine</strong>: Talks to the LLM using user input and matched context</blockquote><blockquote><strong>RAGChatbot</strong>: Coordinates document ingestion and conversation</blockquote><p>This design follows the <em>Separation of Concerns</em> principle — each component has a focused role, making the system easier to scale and maintain.</p><h3>Step 1: Parse and Split Your Document</h3><p>We’ll use LangChain’s PyPDFLoader to load the document and RecursiveCharacterTextSplitter to split it into manageable chunks.</p><pre>class DocumentProcessor:<br>    def __init__(self):<br>        self.chunk_size = 1000<br>        self.chunk_overlap = 100<br>        self.embedding_model = OpenAIEmbeddings()<br>        self.vectorstore = None<br><br>    def load_document(self, file_path):<br>        if file_path.endswith(&#39;.pdf&#39;):<br>            loader = PyPDFLoader(file_path)<br>            return loader.load()<br>        else:<br>            raise ValueError(&quot;Unsupported file format&quot;)<br><br>    def process_document(self, file_path):<br>        docs = self.load_document(file_path)<br>        text_splitter = RecursiveCharacterTextSplitter(<br>            chunk_size=self.chunk_size,<br>            chunk_overlap=self.chunk_overlap<br>        )<br>        split_docs = text_splitter.split_documents(docs)<br><br>        if self.vectorstore is None:<br>            self.vectorstore = FAISS.from_documents(split_docs, self.embedding_model)<br>        else:<br>            self.vectorstore.add_documents(split_docs)</pre><blockquote><strong><em>Pro Tip:</em></strong><em> Use chunking to keep relevant context intact across paragraphs.</em></blockquote><h3>Step 2: Query Processing Pipeline</h3><p>The chatbot:</p><ul><li>Embeds your question</li><li>Searches the vector store for related chunks</li><li>Sends both the question and matched content to the LLM</li></ul><pre>def send_message(self, message):<br>    relevant_docs = self.document_processor.retrieve_relevant_context(message)<br>    context = &quot;&quot;<br>    for doc in relevant_docs:<br>        source = doc.metadata.get(&#39;source&#39;, &#39;unknown&#39;)<br>        context += f&quot;Source: {source}\n{doc.page_content}\n\n&quot;<br>    return self.chat_engine.send_message(message, context)</pre><blockquote><strong><em>Simple Explanation:</em></strong><em> You’re handing the LLM only the “highlighted” bits of your document to focus the answer.</em></blockquote><h3>Step 3: A Medical Use Case</h3><h4>Example PDF: medical_lab_result.pdf</h4><pre>Dear Mr. Clark,<br><br>Your recent blood panel shows elevated creatinine levels, <br>which may suggest impaired kidney function.<br><br>We recommend a nephrologist referral. Please discontinue <br>NSAIDs until further notice.</pre><p>Now the user asks:</p><blockquote><em>“What do abnormal kidney markers usually indicate?”</em></blockquote><p>Even if the LLM has never seen this file, RAG retrieves the relevant text and gives a grounded answer:</p><blockquote>Abnormal kidney markers such as elevated creatinine levels can indicate impaired kidney function. These results are typically evaluated by a nephrologist.</blockquote><p>That’s the power of RAG: it makes models answer based on your data.</p><h3>Step 4: Try It Out</h3><pre>from rag_chatbot import RAGChatbot<br><br>chatbot = RAGChatbot()<br>chatbot.upload_document(&quot;medical_lab_result.pdf&quot;)<br><br>query = &quot;What is this letter about and what should I do next?&quot;<br>response = chatbot.send_message(query)<br>print(response)</pre><p>Want to reset everything?</p><pre>chatbot.reset_all()</pre><h3>Final Thoughts</h3><p>RAG is not just a neat trick. It’s a practical design pattern for real-world LLM applications:</p><ul><li>Reduce cost and tokens</li><li>Improve precision and transparency</li><li>Answer questions about documents written <strong>after</strong> model training</li></ul><p>If you’re working in healthcare, law, education, or internal tooling — this approach is invaluable.</p><h3>What’s Next</h3><p>In the next article, we’ll add:</p><ul><li>Metadata filtering</li><li>Streaming long responses</li><li>Structured outputs (tables, citations, etc.)</li></ul><h3>Code Availability</h3><p>The full source code for this project is available on GitHub: <a href="https://github.com/krizvi/RagChatbot">https://github.com/krizvi/RagChatbot</a></p><p>You’re welcome to explore, fork, or contribute.</p><blockquote>If you enjoyed this article and want to explore more hands-on guides on GenAI, LLMs, and real-world applications, you’re invited to visit my blog at <a href="https://khalidrizvi.com/"><strong>khalidrizvi.com</strong></a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=04f7f77dd6d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Controlled Feed vs. Push Feed: What Makes Your Rifle Tick?]]></title>
            <link>https://medium.com/@krizvi/controlled-feed-vs-push-feed-what-makes-your-rifle-tick-7f0ef997d7c0?source=rss-e6dee335e65c------2</link>
            <guid isPermaLink="false">https://medium.com/p/7f0ef997d7c0</guid>
            <dc:creator><![CDATA[Khalid Rizvi]]></dc:creator>
            <pubDate>Sun, 03 Aug 2025 19:31:44 GMT</pubDate>
            <atom:updated>2025-08-03T21:37:24.863Z</atom:updated>
            <content:encoded><![CDATA[<p>A simple explanation of the two main bolt-action systems, controlled feed and push feed, with videos to show you how they work.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/987/1*rlbNoFdIFcLX-YUCQ604Nw.jpeg" /></figure><p>Ever heard shooters talk about “controlled feed” versus “push feed” and wondered what they meant? It sounds complicated, but it’s actually a pretty simple idea. It all comes down to how the rifle moves a bullet from the magazine into the chamber.</p><p>Understanding the difference can help you choose the right rifle for you, whether you’re hunting deer or just enjoying a day at the range. Let’s break it down in simple terms.</p><h3>What’s a Bolt-Action Rifle?</h3><p>First, a quick refresher. In a <a href="https://youtu.be/GvtBNpc_xY8?si=eXFSw7jow7bJs12g">bolt-action rifle</a>, you manually load each bullet by lifting a handle, pulling a metal tube (the “bolt”) backward, pushing it forward, and locking it down. That simple motion does three things:</p><ol><li><strong><em>Ejects</em></strong> the empty shell from the last shot.</li><li><strong><em>Picks up</em></strong> a new bullet from the magazine.</li><li><strong><em>Loads</em></strong> the new bullet into the chamber, ready to fire.</li></ol><p>The difference between controlled feed and push feed is all in how the bolt picks up and holds onto that new bullet.</p><p>This quick video shows you the basic mechanics of how a bolt-action works. It’s the foundation for everything we’re about to discuss!</p><h3>Controlled Feed: The Old-School Grabber</h3><p>Imagine the bolt has a big claw on its side. This is the <strong>extractor</strong></p><p>In a <strong>controlled-feed</strong> system, as the new bullet rises from the magazine, the rim of the bullet casing slides right up under that claw. From that moment on, the bolt has full control of the bullet. It holds it tight against the bolt face as it shoves it into the chamber.</p><p>Think of it like carrying a plate: you’ve got your hand securely under it the whole time.</p><p>The most famous controlled-feed action is the <a href="https://www.mauser.com/us/MAUSER-98-STD-Diplomat/80112512"><strong><em>Mauser 98</em></strong></a>, a legendary design known for its incredible reliability.</p><p><strong>Pros of Controlled Feed:</strong></p><ul><li>Unbeatable Reliability: Because the bolt has a firm grip, it’s almost impossible for the bullet to get misaligned or stuck. This is why hunters who face dangerous game (like bears or lions) swear by it. A jam is not an option!</li><li>Controlled Ejection: You can pull the bolt back slowly to drop the empty shell right beside you, or yank it back fast to fling it far away. You’re in control.</li></ul><p><strong>Cons of Controlled Feed:</strong></p><ul><li>Slower, More Deliberate Action: You can’t just drop a loose round into the chamber and close the bolt. It has to be fed from the magazine for the claw to grab it.</li><li>More Expensive: It’s a more complex mechanism to manufacture, so these rifles often cost more.</li></ul><h3>Push Feed: The Modern Pusher</h3><p>Now, imagine a bolt with a much smaller, spring-loaded clip on its face.</p><p>In a push-feed system, as you push the bolt forward, it simply pushes the bullet out of the magazine and shoves it into the chamber. The extractor claw only snaps over the rim of the bullet casing at the very last moment when the bolt is locked.</p><p>Think of this like sliding a plate across a table. You’re just pushing it from behind.</p><p>The <a href="https://www.remarms.com/rifles/bolt-action/model-700/model-700-cdl"><strong>Remington 700</strong></a> is a classic example of a push-feed rifle, praised for its accuracy.</p><p><strong>Pros of Push Feed:</strong></p><ul><li>Simpler &amp; Cheaper: It’s easier and less expensive to make, which means the rifles are often more affordable.</li><li>Potentially More Accurate: Because the bolt face is simpler, some argue it allows for a more consistent lock-up, which can lead to better accuracy. This is a topic of endless debate!</li><li>Convenience: You can easily drop a single round directly into the chamber and close the bolt on it — a handy feature for a quick follow-up shot.</li></ul><p><strong>Cons of Push Feed:</strong></p><p>Less Reliable Under Duress: If you operate the bolt quickly and sloppily (something that can happen under stress), it’s possible to create a “double-feed” jam where two bullets get stuck. The bullet is not held securely until the very end.</p><p>So, Which is Better?</p><p>Honestly, for 99% of shooters, <strong>both systems work great.</strong></p><p>Modern push-feed rifles are incredibly reliable, and the odds of a jam are very low with good-quality firearms and ammunition. They are often more accurate out of the box and more affordable.</p><p>However, if your life might depend on your rifle working flawlessly every single time, no matter what — like in a dangerous game hunt — the proven, old-school reliability of a controlled-feed action provides peace of mind that is hard to beat.</p><p>Ultimately, the choice comes down to personal preference, budget, and what you plan to do with your rifle. Now you know the difference!</p><blockquote>I am an avid rifle shooter and spend considerable time at the range. I have been trying to plan a trip to South Africa for a plains game hunting safari, but haven’t been able to make it happen due to work commitments — hopefully I’ll finally make the trip this October. If you want to read more blogs from me and explore this topic in greater detail, please visit my website at khalidrizvi.com.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7f0ef997d7c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>