<?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 Thahmidul Islam Nafi on Medium]]></title>
        <description><![CDATA[Stories by Thahmidul Islam Nafi on Medium]]></description>
        <link>https://medium.com/@nafieee?source=rss-f6f124a4c37e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*J3RYghwAIiM43hdR</url>
            <title>Stories by Thahmidul Islam Nafi on Medium</title>
            <link>https://medium.com/@nafieee?source=rss-f6f124a4c37e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 04:10:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nafieee/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[I Ran COSMIC Desktop for a Month. Here’s Everything That Still Breaks.]]></title>
            <link>https://medium.com/@nafieee/i-ran-cosmic-desktop-for-a-month-heres-everything-that-still-breaks-3cb85d76906e?source=rss-f6f124a4c37e------2</link>
            <guid isPermaLink="false">https://medium.com/p/3cb85d76906e</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[compositor]]></category>
            <category><![CDATA[popos]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[cosmic-desktop]]></category>
            <dc:creator><![CDATA[Thahmidul Islam Nafi]]></dc:creator>
            <pubDate>Fri, 19 Jun 2026 14:08:40 GMT</pubDate>
            <atom:updated>2026-06-19T14:08:40.959Z</atom:updated>
            <content:encoded><![CDATA[<h3>System76’s Rust-based desktop environment is genuinely exciting — and genuinely not done yet. Here’s the honest list of what trips people up in 2026.</h3><p>If you read my last post on X11 vs Wayland, you already know every modern desktop environment is really just a Wayland compositor wearing a UI. GNOME’s compositor is Mutter. KDE’s is KWin. And System76’s brand-new one — written from scratch, in Rust, for Pop!_OS — is called COSMIC.</p><p>It’s one of the most interesting things to happen to the Linux desktop in years. It’s also, as of mid-2026, still very much a beta-flavored experience wearing a 1.0 version number. Here’s what that actually means day to day.</p><h3>What COSMIC Is, Quickly</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lXlxJKOJxbn8SOhng5vUYA.jpeg" /></figure><p>COSMIC (Computer Operating System Main Interface Components) is System76’s homegrown desktop environment, built to replace the GNOME setup Pop!_OS used for most of its history. It was originally derived from GNOME, and side by side you can see GNOME’s influence on some of the design choices — but once you dig in, it’s a genuinely different desktop, and the headline technical decision is that it’s written in Rust rather than C.</p><p>That choice matters for the story below. Rust gives you strong memory-safety guarantees, but it does not give you a finished application ecosystem, a mature applet framework, or years of edge-case bug squashing. COSMIC is trading “battle-tested” for “built right from day one,” and right now you’re paying part of that trade in rough edges.</p><p>To be fair to the project: it brings things GNOME and KDE still don’t have built-in — easy toggling between floating and tiling window management per workspace, window stacking into tabs, and per-window screenshot/pin actions right from the title bar. This isn’t a “skip it” post. It’s a “know what you’re getting into” post.</p><h3>Problem 1: Random UI Unresponsiveness</h3><p>This is the complaint that shows up most consistently across independent testers, and it’s frustrating precisely because it’s inconsistent.</p><p>Applets that mesh nicely with the interface will frequently have buttons that simply don’t respond — you can click a dozen times and nothing happens, and a restart is usually the only fix. Right-click can be unreliable too — one reviewer needed several right-clicks before a context menu would even appear when trying to pin Discord to the dock, and occasionally a context menu opens, you click an option, and the menu itself just refuses to disappear afterward.</p><p>A separate independent test of COSMIC found the same general pattern in a different component: the Cosmic Terminal will semi-frequently hang for 30+ seconds at a time. Same flavor of bug, different app.</p><p>What this means for you: if a click does nothing, the desktop usually isn’t actually frozen — try waiting, try the same action again, or as a last resort, restart the session. It’s a real annoyance, not data corruption.</p><h3>Problem 2: New App Icons Going Missing</h3><p>A smaller papercut, but a common one: icons for newly installed software will frequently not show up until you restart the desktop entirely, though a single restart resolves it and it’s not an issue afterward.</p><p>If you install something and the dock or launcher shows a generic placeholder instead of the real icon, that’s this bug. It’s cosmetic, not functional, but it’s the kind of thing that quietly chips away at the feeling that the desktop is “done.”</p><h3>Problem 3: Screen Sharing and Portal Bugs</h3><p>This one connects directly back to the Wayland security model from my last post. COSMIC, like every Wayland compositor, needs its own implementation of xdg-desktop-portal to let apps request screen-sharing or file-access permissions properly. That implementation — xdg-desktop-portal-cosmic — is its own actively developed project, and as of mid-2026 it has a steady stream of open issues being filed and triaged on a near-daily basis.</p><p>In practice this is the same category of pain X11-era users feel when an app can’t share their screen on Wayland at all — except here it’s the portal implementation itself still catching up, rather than a third-party app needing to be updated.</p><p>What this means for you: if screen sharing, screenshots, or file picker dialogs behave oddly under COSMIC specifically, check whether it’s a known xdg-desktop-portal-cosmic issue before assuming your app or your settings are at fault.</p><h3>Problem 4: COSMIC Atomic-Specific Breakage (Fedora)</h3><p>If you’re trying COSMIC through Fedora’s atomic/immutable spin rather than Pop!_OS directly, there’s a distinct failure mode worth knowing about. COSMIC Atomic uses an immutable base OS updated atomically via rpm-ostree, and the trouble shows up when your user-space config in ~/.config/cosmic falls out of sync with a newly updated atomic base. Reported symptoms have included an Applications menu that randomly becomes unresponsive and printer failures appearing right after a Fedora update.</p><p>What makes this one tricky to pin down is the hardware variance: one user with an Intel Arc GPU reported the menu bug but no printer issues, while another with NVIDIA hardware hit both at once — suggesting the underlying cause sits somewhere in the intersection of config-state drift and GPU driver behavior, not a single isolated bug.</p><p>What this means for you: if you’re hitting this, the fastest recovery is usually rpm-ostree rollback to the previous known-good deployment, then re-applying updates more cautiously. If you need a rock-solid setup right now rather than the bleeding edge, Fedora Silverblue (GNOME Atomic) or Kinoite (KDE Atomic) are the more mature atomic alternatives while COSMIC Atomic continues stabilizing.</p><h3>Problem 5: General “Not Quite Finished” Polish Issues</h3><p>Beyond specific bugs, the recurring theme across independent reviews months apart is the same word: unfinished. Even after several months of updates, COSMIC’s launcher can still feel somewhat lifeless or slow, and one extended GitHub issue tracker for the core cosmic-epoch repository shows a steady cadence of newly filed bug reports arriving multiple times a day as of June 2026 — which tells you the project is both actively worked on and still actively breaking in new ways.</p><p>That’s not necessarily a bad sign for COSMIC’s future — it’s a normal sign for software at this stage. But it’s the honest signal for <em>you</em>: this is still pre-1.0-feeling software wearing a stable-sounding version number.</p><h3>So Should You Use It?</h3><p>Your situationRecommendationYou want a daily driver you can trust not to fight youNot yet — give it more release cycles, or stick with GNOME/KDEYou’re curious and have a spare machine or VMAbsolutely — it’s one of the more interesting desktop projects in yearsYou’re on Fedora and want an atomic/immutable setupUse Silverblue or Kinoite for now; revisit COSMIC Atomic laterYou rely on screen sharing, remote tools, or portal-dependent apps dailyWait — this is the rough edge most likely to interrupt actual workYou like tiling window management and want it built-in without extensionsCOSMIC’s tiling-toggle is genuinely ahead of GNOME/KDE here — worth testing on a non-critical machine</p><h3>The Pattern, Again</h3><p>Same lesson as the GRUB post and the X11/Wayland post: when something in your Linux desktop misbehaves, the fix usually isn’t “reinstall everything” — it’s “figure out which specific layer is actually responsible.” With COSMIC in 2026, that layer is frequently one of: the applet/UI event loop hanging, the portal implementation still maturing, or atomic-update config drift on Fedora specifically. None of those are “Linux is broken.” They’re a young desktop environment’s growing pains, documented in public, being fixed in public, one GitHub issue at a time.</p><p><em>Next up: I’ll be digging into what it’s actually like running COSMIC’s tiling mode for embedded development workflows — multiple terminals, a datasheet PDF, and a serial monitor all fighting for screen space. Stay tuned.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3cb85d76906e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[X11, Wayland, and XWayland: The Display Server Decision Nobody Tells You You’re Making]]></title>
            <link>https://medium.com/@nafieee/x11-wayland-and-xwayland-the-display-server-decision-nobody-tells-you-youre-making-414ab0282558?source=rss-f6f124a4c37e------2</link>
            <guid isPermaLink="false">https://medium.com/p/414ab0282558</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[wayland]]></category>
            <category><![CDATA[compositor]]></category>
            <category><![CDATA[xwayland]]></category>
            <category><![CDATA[x11]]></category>
            <dc:creator><![CDATA[Thahmidul Islam Nafi]]></dc:creator>
            <pubDate>Thu, 18 Jun 2026 11:54:58 GMT</pubDate>
            <atom:updated>2026-06-18T11:54:58.891Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why your screenshot tool randomly stopped working, why KiCad still avoids Wayland, and what’s actually happening between your GPU and your screen</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9rcM8hFVvJSSh9p3XIx7mg.jpeg" /></figure><p>Open a terminal right now and run this:</p><pre>echo $XDG_SESSION_TYPE</pre><p>You’ll get back either wayland or x11. Most people have never run this command in their life — and yet it&#39;s quietly deciding whether half their tools work correctly today.</p><p>I found this out the hard way mid-project, when a screen-capture tool I’d used for years suddenly refused to share my full screen, only individual windows. Nothing in <em>my</em> setup had changed. My distro had just switched the default underneath me.</p><p>If you’ve ever hit a Linux GUI bug that made no sense — drag-and-drop quietly failing, a screen recorder going black, a CAD tool refusing to launch — there’s a real chance the display server is the actual culprit, not the app. Here’s the whole picture, in the order it actually matters.</p><h3>The Short Version</h3><ul><li><strong>X11</strong> is the 40-year-old protocol that’s been drawing your Linux desktop since 1984.</li><li><strong>Wayland</strong> is its modern replacement — fewer moving parts, better security, better performance.</li><li><strong>XWayland</strong> is the bridge that lets old X11 apps run <em>inside</em> a Wayland session without being rewritten.</li></ul><p>You are very likely on Wayland right now without having chosen it. Ubuntu, Fedora, and most major distros made it the default years ago. The question isn’t really “which one should I pick” anymore — it’s “what do I do when something breaks because of this.”</p><h3>X11: Built for a World That No Longer Exists</h3><p>X11 was designed to let a graphics terminal display an application that was <em>running on a completely different computer</em>. That was the entire point in 1984 — university labs had one expensive computer in a back room, and a building full of cheap terminals that just needed to render pixels.</p><p>To do that, X11 splits drawing across <strong>three separate programs</strong> that all have to talk to each other:</p><pre>X Server → Window Manager → Compositor → Your Screen</pre><p>Every frame gets copied between these layers. That architecture is flexible — it’s <em>why</em> X11 has survived four decades — but it’s also the source of almost every structural complaint leveled at it today.</p><p><strong>The part that actually matters in 2026:</strong> X11 has no real concept of one application being isolated from another. Any X11 app can, by design, read another app’s window contents, inject keystrokes into another window, or grab the entire screen — no permission dialog, no sandboxing, nothing stopping it. X11’s buffer system uses simple integer handles as identifiers, and any application that can guess or enumerate these handles can access the corresponding graphics memory. That’s not a bug that got missed — it’s a structural property of the 1984 design, and attempts to retrofit a security layer onto it were never widely adopted and are now considered dead ends.</p><p>This is also exactly why every keylogger demo, every “screenshot any window without permission” trick, and every global hotkey tool from the X11 era works the way it does. Convenient for tooling, genuinely bad for isolation.</p><h3>Wayland: One Job, Done Properly</h3><p>Wayland’s design philosophy is almost the opposite of X11’s. Instead of three separate programs passing frames around, the <strong>compositor does the whole job</strong> — it <em>is</em> the display server. GNOME’s Mutter and KDE’s KWin aren’t “talking to” a display server anymore; they <em>are</em> the display server.</p><p>What that buys you:</p><ul><li><strong>No intermediate frame copies.</strong> Wayland renders directly to the buffer your GPU is going to display — X11’s multi-hop architecture requires copying every rendered frame between layers, and removing those copies is most of where Wayland’s latency and battery-life wins come from.</li><li><strong>Permission boundaries that are actually structural</strong>, not optional. An app can’t read another app’s window or screen contents unless the compositor explicitly hands it that buffer.</li><li><strong>Fractional scaling that doesn’t look like a hack.</strong> If you’ve ever set 125% or 150% scaling on X11 and watched some apps render blurry while others ignore it entirely, that’s an X11 limitation Wayland was specifically designed to avoid.</li></ul><p>This isn’t a marginal security upgrade — it changes what’s <em>possible</em>, which is exactly why some long-standing X11-era tools can’t be ported over unchanged. More on that below.</p><h3>XWayland: The Bridge That’s Doing More Work Than You Realize</h3><p>Here’s the part most explainers skip: <strong>almost nobody runs a “pure” Wayland session.</strong> The moment you launch even one application that was built for X11 — and there are <em>thousands</em> of these still in active use — your Wayland compositor quietly spins up XWayland to handle it.</p><p>XWayland is, functionally, a full X11 server running as a Wayland client. Your X11 app thinks it’s talking to a normal X server. It has no idea it’s actually inside a translation layer feeding frames into a Wayland compositor.</p><pre># See it running right now<br>ps aux | grep Xwayland<br># /usr/bin/Xwayland :0 -rootless -noreset</pre><p>For the vast majority of apps, this is invisible — most users will never notice it is running; their X11 applications simply work inside their Wayland session without any configuration required. You launch the app, it draws, you forget XWayland exists.</p><p>But XWayland is a <em>translation</em> layer, not a <em>transformation</em> layer — it can’t grant an old X11 app permissions that Wayland’s security model doesn’t allow. Which is exactly where things start breaking.</p><h3>Where This Actually Bites You</h3><p>This is the part that matters if you’ve ever wondered why a specific tool misbehaves on one setup and not another.</p><h3>Screen sharing and recording</h3><p>This is the single most common complaint, and it’s a direct consequence of Wayland’s security model doing its job. Wayland requires explicit user permission through xdg-desktop-portal for screen sharing, where X11 let any application capture the screen freely. Tools have to specifically integrate with that portal system and PipeWire — if they don’t, they either fail outright or fall back to capturing a single window instead of your full desktop. This is almost certainly what happened to my screenshot tool.</p><h3>Remote access tools (VNC, RealVNC, etc.)</h3><p>Classic remote-desktop tools were built around X11’s “anyone can grab the framebuffer” assumption. One widely shared account: a RealVNC setup on a Raspberry Pi simply didn’t work under Wayland — the tool’s file transfers failed outright because of Wayland’s stricter security model, requiring a switch back to X11 via raspi-config to get full functionality working again.</p><h3>Professional and CAD tools</h3><p>Worth knowing if you’re anywhere near EDA or embedded work: KiCad has stated it will no longer attempt to work around the volume of Wayland-related bugs it’s hit, and primarily sticks to X11 for now. That’s not a fringe complaint — that’s a major open-source EDA tool’s maintainers making a deliberate call to deprioritize Wayland support.</p><h3>GPU-driver-dependent failures</h3><p>Some of the strangest bugs are hardware-specific rather than Wayland-specific in any deep sense. Vulkan driver problems have caused applications to render as empty boxes specifically on Wayland systems, while X11 users on the same hardware were unaffected because their apps relied on OpenGL rendering paths instead. Same machine, same app, different result, purely because of which rendering path got exercised.</p><h3>Accessibility tooling and global automation</h3><p>Screen readers, global hotkey daemons, and GUI automation scripts often relied on the same unrestricted access that made X11 a security liability in the first place. Removing that access for security reasons has a real cost here, and it’s a category of complaint that comes up repeatedly in community discussion — accessibility tooling needs a level of cross-application access that Wayland’s permission model is specifically designed to prevent without explicit portal support.</p><h3>So Which One Should You Actually Use?</h3><p>Treat this as a decision tree, not a tribal allegiance:</p><p>Your situation Recommendation General desktop use, browsing, office work, most modern apps Wayland — it’s the default for a reason, and for typical workflows the security and performance wins are real You depend on a specific tool that’s known to fight Wayland (KiCad, certain VNC stacks, older automation scripts) Stay on X11, or switch per-session when you need that tool You’re doing remote display forwarding over SSH (ssh -X) X11 — this is a use case Wayland deliberately doesn&#39;t replicate, by design You&#39;re on an NVIDIA card Check your driver version — Wayland sessions became stable on NVIDIA hardware starting with driver series 495 and later, so update before troubleshooting further Something that worked yesterday just broke after an update Switch sessions at the login screen (the gear icon next to your username) and see if the problem follows you — if it vanishes, you&#39;ve found your culprit in ten seconds</p><h3>How to Actually Check and Switch</h3><p><strong>Check what you’re currently running:</strong></p><pre>echo $XDG_SESSION_TYPE        # &quot;wayland&quot; or &quot;x11&quot;<br>echo $WAYLAND_DISPLAY         # &quot;wayland-0&quot; if on Wayland, empty if on X11<br>ps aux | grep Xwayland        # confirms XWayland is bridging X11 apps in</pre><p><strong>Switch sessions (most distros):</strong> log out, and at the login screen look for a small gear or settings icon near the password field — that’s where the session-type picker usually lives. The choice is normally remembered for next time.</p><p><strong>Force X11 system-wide if you need a stable fallback (GDM-based systems):</strong></p><pre>sudo nano /etc/gdm3/custom.conf<br># uncomment: WaylandEnable=false<br>sudo systemctl restart gdm3</pre><h3>The Honest Takeaway</h3><p>This still is a live, sometimes heated debate in the Linux community — not a settled one. Some long-time users maintain detailed lists of Wayland-era regressions (drag-and-drop, window positioning, global menus) that simply haven’t found 1:1 replacements years into the transition. Others point out that most of those gaps are closing fast, and that the structural security argument alone is worth the migration pain. Both display servers are expected to coexist for several more years — this isn’t a problem you need to “solve” by picking a side permanently.</p><p>What’s actually useful is just knowing the layer exists. The next time a Linux GUI tool does something inexplicable — refuses to share your screen, renders as a black box, or won’t launch at all — check $XDG_SESSION_TYPE before you spend an hour debugging the app itself. Half the time, the app isn&#39;t broken. It&#39;s just having an argument with a security model it was never designed for.</p><p><em>If you found this useful, you might also like my deep dive into GRUB boot recovery — same idea: the “broken” layer is usually a handoff between two systems that both work fine on their own.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=414ab0282558" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Your STM32 Crash Logs Need a Pipeline, Not a Serial Monitor]]></title>
            <link>https://medium.com/@nafieee/why-your-stm32-crash-logs-need-a-pipeline-not-a-serial-monitor-35c88e69d61e?source=rss-f6f124a4c37e------2</link>
            <guid isPermaLink="false">https://medium.com/p/35c88e69d61e</guid>
            <category><![CDATA[electronics]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[stm32]]></category>
            <category><![CDATA[microcontrollers]]></category>
            <dc:creator><![CDATA[Thahmidul Islam Nafi]]></dc:creator>
            <pubDate>Thu, 18 Jun 2026 11:46:06 GMT</pubDate>
            <atom:updated>2026-06-18T11:46:06.869Z</atom:updated>
            <content:encoded><![CDATA[<p><em>You spent three days tracking down a HardFault. The answer was in the log the whole time. Nobody was watching.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FAOqWp6f1eRB7hXNpLElGg.png" /></figure><h3>The Serial Monitor Is a Lie You Tell Yourself</h3><p>Every embedded engineer has the same workflow. The board crashes. You pull up a serial terminal, hit reset, stare at the UART output, and hope the fault handler printed something useful before the stack unwound into garbage. If you’re lucky, you get a register dump. If you’re unlucky — and you usually are — you get a partial print, or nothing, because the fault happened in an interrupt context that killed UART DMA mid-transfer.</p><p>This workflow has a name in other engineering disciplines: it’s called manual inspection of ephemeral logs. Every other domain abandoned it decades ago. Web backends ship structured logs to centralized aggregators. Kernel developers have crash dump analysis tools. Mobile platforms capture symbolicated stack traces automatically. Embedded systems, with some exceptions, are still relying on a human to be watching a terminal window at the exact moment the fault occurs.</p><p>This post is about what a real firmware crash analysis pipeline looks like and why the gap between embedded practice and the rest of software engineering is both embarrassing and fixable.</p><h3>What Actually Happens During a HardFault</h3><p>Before talking about the pipeline, it helps to be precise about what a HardFault is and why it’s hard to catch.</p><p>On ARM Cortex-M, a HardFault is the catch-all exception that fires when a fault cannot be handled by a more specific handler — or when there is no handler registered. The CPU pushes a subset of its register state onto the stack (R0–R3, R12, LR, PC, xPSR) and jumps to the HardFault handler. From that handler, you have a narrow window to do something useful before the system either resets or hangs.</p><p>The register dump that matters most is the stacked PC — the program counter at the time of the fault. Combined with the CFSR (Configurable Fault Status Register), you can identify the fault class: IACCVIOL (instruction access violation), DACCVIOL (data access violation), UNDEFINSTR (undefined instruction), UNALIGNED, DIVBYZERO, and so on. MMFAR and BFAR give you the memory address that triggered the fault, when the address is valid.</p><p>The problem with the serial terminal approach is not that the data is unavailable — it’s that getting it out reliably is harder than it looks. Writing to UART from a HardFault handler is dangerous if DMA is involved, if the UART clock was gated, or if the fault occurred inside a critical section with interrupts disabled. Naive printf in a fault handler is not reliable. A properly implemented fault logger uses a polling UART write with a timeout, or — better — writes the fault record to a dedicated region of non-volatile RAM before resetting, where it can be read on the next boot cleanly.</p><p>This distinction matters for pipeline design: the safest place to capture a fault record is after reset, not during the fault handler itself.</p><h3>The Anatomy of a Firmware Crash Log</h3><p>A useful crash log is not a register dump. A register dump is a starting point. A useful crash log is a structured record that contains:</p><p>Identity fields: firmware version, hardware revision, build hash, device serial number. Without these, you cannot correlate a crash to a specific firmware build or device unit. This sounds obvious; it is consistently missing.</p><p>Fault classification: the exception type, the CFSR/HFSR contents, the faulting address where available. Structured, not free-text.</p><p>Stack trace or PC history: the stacked PC gives you one frame. A backtrace reconstructor — walking the stack manually using frame pointer conventions, or using a dedicated trace buffer — gives you the call chain. This is the difference between knowing <em>where</em> the crash landed and knowing <em>how it got there</em>.</p><p>System state at fault time: heap usage, stack high-water marks, RTOS task state (if applicable), peripheral states. A NULL pointer dereference means something different when the heap is 98% exhausted versus when it’s empty.</p><p>Pre-fault event log: a circular buffer of application events written continuously in RAM, capturing the last N state transitions before the fault. This is the single highest-value addition to most embedded debug setups and the most consistently absent. If you know the last 32 events before a crash, root cause analysis time drops by an order of magnitude.</p><p>All of this fits in well under 512 bytes of structured data. There is no excuse for not capturing it.</p><h3>From Capture to Pipeline</h3><p>Once you have reliable crash record capture, the next question is what you do with it. For a device sitting on a bench, “read it over UART on the next boot” is fine. For a fleet of devices in the field, you need a pipeline.</p><p>The minimal viable pipeline has four stages:</p><p>Ingestion: crash records arrive from devices via whatever channel they have — MQTT over cellular, HTTP over WiFi, extracted manually over USB. The format should be binary (compact, no serialization overhead on the device) or minimal JSON. The ingestion endpoint should be tolerant of duplicates (a device may retry on reconnect) and versioned (firmware version X may produce a different record schema than firmware version Y).</p><p>Parsing and enrichment: raw records are decoded against the matching firmware version’s schema. This is where the build hash earns its keep — you look up the correct ELF file, run the PC through addr2line, and resolve the faulting address to a source file and line number. CFSR bits are decoded to human-readable fault classes. Stack traces are symbolicated. This stage transforms a binary blob into something a developer can read.</p><p>Classification: not all crashes are equally interesting. A NULL pointer dereference at the same location in the same firmware version, reported from 47 devices, is one bug. An access violation at a novel address on a single device is a different investigation. Automated grouping by fault class, faulting PC, and stack signature — similar to how Sentry works for application crashes — lets you triage at scale rather than reading each record individually.</p><p>Storage and analysis: structured crash records in a queryable store enable questions that a serial terminal can never answer: What is the crash rate for firmware 2.3.1 versus 2.3.0? Which task is faulting most frequently across the fleet? Is there a correlation between heap exhaustion and the NULL pointer crashes we’re seeing? These are fleet-level insights that only emerge when you have the data in aggregate.</p><h3>The Docker and Kubernetes Angle</h3><p>The parsing and enrichment stage has an interesting deployment problem: it needs access to your ELF files, which change with every firmware build.</p><p>The clean solution is to containerize the analysis worker and bind-mount (or fetch from artifact storage) the ELF corresponding to each crash record’s build hash. Your CI pipeline produces a firmware image and an ELF, stores both tagged with the build hash, and the analysis worker pulls the correct ELF at parse time. Docker makes this straightforward: the worker image contains arm-none-eabi-addr2line, your parsing logic, and your database client. The ELF files live in artifact storage (S3, Artifactory, whatever), fetched on demand.</p><p>If you’re running this at any real scale, Kubernetes (or K3s if you’re self-hosting) lets you run multiple parser workers in parallel, autoscale during high-ingestion periods (firmware rollouts often produce a burst of crashes), and keep the ingestion endpoint and the analysis workers as separate deployments with independent scaling. For a small fleet this is overkill. For anything above a few thousand devices, the separation pays for itself.</p><p>The ingestion side can be a simple FastAPI or Go HTTP service behind a load balancer, writing raw records to a queue (Redis, NATS, or Kafka depending on your scale requirements). The parser workers consume from the queue, enrich, and write to PostgreSQL or ClickHouse. ClickHouse in particular is worth considering for crash analytics — it handles time-series aggregations over structured records extremely well and is dramatically faster than PostgreSQL for the “show me all crashes of this type over the last 30 days” queries that make fleet analysis useful.</p><h3>AI as a Layer, Not a Replacement for Fundamentals</h3><p>There is a natural place for ML in this pipeline: automated root cause suggestion. Given a classified, symbolicated crash record with system state and a pre-fault event log, a language model can propose likely root causes, link to relevant code patterns, and suggest investigation steps. This is not the same as diagnosing the bug — it’s reducing the time a developer spends getting oriented before they start the real analysis.</p><p>The key constraint is that the AI layer only works well when the upstream data quality is high. A model given a raw register dump and no context will hallucinate plausible-sounding but wrong explanations. A model given a structured record with a symbolicated stack trace, decoded CFSR, heap state, and a 32-event pre-fault log has enough signal to be genuinely useful.</p><p>This is why the pipeline fundamentals matter more than the AI layer. Get the capture right. Get the enrichment right. Get the classification right. The intelligence you add on top of good structured data will be proportionally more valuable.</p><h3>Conclusion</h3><p>The serial monitor is not a debugging strategy. It’s a debugging reflex, inherited from a time when embedded devices were not connected and fleet management was not a problem anyone had.</p><p>The data needed to diagnose most firmware faults is already present in the device — register state, stack contents, system telemetry, pre-fault events. The gap is not in the hardware; it’s in the capture, transport, parsing, and analysis infrastructure around it.</p><p>Building that infrastructure is not an embedded problem. It’s a software engineering problem with well-understood solutions: structured logging, containerized analysis workers, a time-series datastore, and an enrichment pipeline that turns build hashes into source locations. The embedded part is the fault handler and the non-volatile capture buffer. Everything downstream is backend work.</p><p>The engineers who figure out how to bridge these two disciplines — who can write a reliable Cortex-M fault handler <em>and</em> design the pipeline that makes the resulting data queryable — are the ones who will turn embedded observability from an afterthought into a product.</p><p>That product is long overdue.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35c88e69d61e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Running AI Inference at the Edge: Containers on Bare Metal vs. Kubernetes on Embedded Linux]]></title>
            <link>https://medium.com/@nafieee/why-your-stm32-crash-logs-need-a-pipeline-not-a-serial-monitor-b95d64d3fdcb?source=rss-f6f124a4c37e------2</link>
            <guid isPermaLink="false">https://medium.com/p/b95d64d3fdcb</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[microcontrollers]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Thahmidul Islam Nafi]]></dc:creator>
            <pubDate>Mon, 15 Jun 2026 08:31:10 GMT</pubDate>
            <atom:updated>2026-06-15T08:41:20.322Z</atom:updated>
            <content:encoded><![CDATA[<p><em>The stack that made sense in the cloud will betray you when your CPU has four cores and your RAM is measured in megabytes.</em></p><h3>The Promise and the Rude Awakening</h3><p>The pitch sounds clean: containerize your AI model, ship it anywhere, scale horizontally. It works beautifully in a data center. Then someone asks you to run inference on a gateway board bolted inside an industrial enclosure, and the whole mental model starts to crack.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*03BS17dEewvMVcghupE0Qg.png" /></figure><p>Edge AI is genuinely different. Not just “cloud with less RAM” — structurally different in ways that force you to rethink every assumption you carried over from your backend work. Latency budgets are measured in milliseconds, not seconds. Connectivity is intermittent. There is no on-call engineer standing next to the device. And the hardware — whether it’s an i.MX8, a Jetson Orin NX, or a custom Cortex-A board running Yocto — is not a generic x86 server that Docker was designed around.</p><p>This post is about where containers genuinely help at the edge, where Kubernetes becomes an expensive distraction, and how to think about the tradeoff before you commit to an architecture.</p><h3>Why Containers at the Edge Make Sense at All</h3><p>The case for containerization on embedded Linux isn’t about DevOps fashion. It’s about a specific, real problem: dependency hell across a heterogeneous fleet.</p><p>If you’re deploying an ONNX Runtime inference server across devices running different kernel versions, different library versions, different distros — and you’re doing it without containers — you are writing custom deployment scripts for every combination. That path leads somewhere painful. A container image packages the runtime, the model, and the dependencies together. What runs on your dev machine runs on the device, assuming you’ve handled the architecture correctly.</p><p>Docker on embedded Linux — specifically on ARMv8 boards running a reasonably modern kernel (5.10+) — works. Not perfectly, but well enough that the pain is manageable. The container overhead on a Cortex-A53 is real but small: a few hundred milliseconds of startup time, a few percent of memory overhead for the container runtime. For most inference workloads running at sensor poll frequencies, this is noise.</p><p>The more interesting question is what you containerize. There’s a strong argument for keeping the inference runtime itself bare metal — compiled directly against your board’s acceleration libraries, talking directly to the NPU or GPU driver — and containerizing only the application logic around it. This gives you reproducible application builds without paying the abstraction tax on the hot path.</p><h3>The Kubernetes Trap</h3><p>Here’s where a lot of edge AI projects go wrong: they see “containerized workloads” and reach for Kubernetes because that’s what you use to orchestrate containers.</p><p>Kubernetes was designed for stateless web services running on homogeneous cloud infrastructure with reliable networking between nodes. Edge deployments are almost the exact opposite. Your nodes are physically remote, often behind NAT, sometimes running on cellular connections that disappear for minutes at a time. Your workloads are often stateful — they need access to local hardware, specific GPIO pins, a particular camera sensor, a CAN bus. And your fleet might consist of ten devices, not ten thousand.</p><p>Running a full K8s control plane on an edge device is not just wasteful — it actively works against you. etcd alone has memory requirements that will crowd out your inference process on a 2GB board. The scheduler overhead assumes nodes are fungible; edge nodes are not fungible. And the networking model (kube-proxy, CNI plugins, load balancing) adds latency and complexity to what should be a simple local process.</p><p>The right question is not “how do I run Kubernetes at the edge?” but “what problem am I actually solving, and is Kubernetes the right tool for it?”</p><p>If your problem is fleet management and remote deployment, something like Balena, Flotta, or even a well-designed Ansible pipeline will serve you better than K3s with half the operational complexity.</p><p>If your problem is running multiple isolated workloads on a single powerful edge node (say, a Jetson AGX with 64GB RAM), then a lightweight container runtime with systemd service management gets you 90% of the value without the orchestration overhead.</p><p>If your problem is coordinating inference across a cluster of edge nodes, that’s where a stripped-down Kubernetes distribution like K3s or MicroK8s starts making sense — but only once you’ve validated that the coordination complexity is genuinely the bottleneck.</p><h3>What a Sane Edge AI Stack Actually Looks Like</h3><p>Based on what works in production, not what looks good in architecture diagrams:</p><p>Hardware acceleration first. If your board has an NPU, a GPU, or even SIMD extensions — use them directly. TensorFlow Lite with the XNNPACK delegate, ONNX Runtime with the TensorRT execution provider, or a vendor-specific SDK (Hailo, Rockchip NPU, etc.) will give you 5–20x throughput improvement over a generic CPU inference path. No container abstraction should sit between your model and the accelerator driver.</p><p>Minimal container runtime. If you’re containerizing, use containerd directly rather than the full Docker engine. It has a smaller footprint, faster startup, and is what Kubernetes uses under the hood anyway. Pair it with nerdctl for a Docker-compatible CLI without the daemon overhead.</p><p>systemd as your orchestrator. For most edge deployments, systemd unit files with Restart=on-failure and MemoryMax= cgroup limits give you container lifecycle management, resource constraints, and automatic recovery. This is not a compromise — it&#39;s the right tool for single-node workloads.</p><p>Immutable OS image. This is the underrated one. Tools like OSTree (used by Fedora IoT and Automotive Grade Linux) or a custom Yocto image with read-only rootfs give you atomic updates and rollback without needing a container orchestrator. The device boots into a known-good state, always.</p><p>K3s only when you have multiple nodes to coordinate. And even then, run the control plane off-device on a machine that has reliable power and connectivity.</p><h3>The Real Constraint Nobody Talks About</h3><p>All the container and orchestration discussion assumes your bottleneck is software deployment. Often it isn’t.</p><p>Edge AI inference is frequently limited by three things that no amount of Kubernetes configuration will fix:</p><p>Memory bandwidth. Transformer-based models are memory-bandwidth bound, not compute-bound, on most edge hardware. A quantized model (INT8 or INT4) isn’t just smaller — it fits in cache, which changes the performance profile entirely. Quantization should happen before you think about containers.</p><p>Thermal throttling. A board running sustained inference in an enclosure without active cooling will throttle. The software stack you see in benchmarks was not running thermally throttled. Build in thermal headroom or add a fan, because throttled inference at 60% clock speed breaks latency budgets in ways that are annoying to debug.</p><p>The I/O bottleneck upstream of inference. Camera capture, pre-processing, and memory copies are frequently the real bottleneck. If you’re doing image classification at 30 fps, the neural network is often not the slow part — the sensor driver and the OpenCV pipeline are. Profile before you optimize.</p><h3>Conclusion</h3><p>The embedded Linux + AI + containers story is real and it works, but the default cloud-native playbook needs heavy revision at the edge. Containers give you reproducibility; use them for that. Kubernetes gives you cluster orchestration; skip it unless you have a cluster worth orchestrating. The hardware acceleration and OS-level fundamentals will determine your actual performance far more than your choice of container runtime.</p><p>The most durable edge AI stacks are boring: a well-built Yocto image, a quantized model talking directly to hardware acceleration, a containerd runtime for the application layer, and systemd keeping it alive. The interesting work is in the model, the data pipeline, and the hardware integration — not in the orchestration layer.</p><p>Build the boring stack first. Add complexity only when you have evidence that the boring stack is the bottleneck.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b95d64d3fdcb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Your STM32 Just Crashed. Now What? A Beginner’s Guide to HardFault Errors]]></title>
            <link>https://medium.com/@nafieee/your-stm32-just-crashed-now-what-a-beginners-guide-to-hardfault-errors-dbb2e7756067?source=rss-f6f124a4c37e------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbb2e7756067</guid>
            <category><![CDATA[embedded-systems]]></category>
            <category><![CDATA[microcontrollers]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[c]]></category>
            <category><![CDATA[hardware]]></category>
            <dc:creator><![CDATA[Thahmidul Islam Nafi]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 09:21:04 GMT</pubDate>
            <atom:updated>2026-06-14T09:21:54.268Z</atom:updated>
            <content:encoded><![CDATA[<p><em>That blinking red LED is trying to tell you something.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xVpdfDSdjy3Bcfat6O1dfQ.jpeg" /></figure><p>If you’ve spent any time programming a microcontroller, you’ve probably hit a wall where your firmware just… stops. No output. No response. Just a frozen chip — or worse, a crash loop that resets every few seconds.</p><p>Welcome to your first <strong>HardFault</strong>.</p><p>It sounds scary. And when you’re a beginner staring at a hex dump you don’t understand, it feels like the firmware swallowed your bug and gave nothing back.</p><p>But HardFaults are actually one of the most <em>informative</em> kinds of crashes you can get. Once you know how to read them, they’ll tell you exactly what went wrong and where.</p><p>Let’s break it down.</p><h3>What Is a HardFault?</h3><p>ARM Cortex-M processors (the core inside most STM32 chips) have a built-in exception system. When the processor encounters an error it can’t recover from — like accessing an invalid memory address, executing an illegal instruction, or dividing by zero — it triggers a <strong>HardFault exception</strong>.</p><p>Think of it like a hardware-level panic. The CPU stops what it was doing, saves its state to the stack, and jumps to the HardFault_Handler function in your code.</p><p>By default, most bare-metal projects just loop forever inside that handler:</p><pre>void HardFault_Handler(void) {<br>    while (1) {<br>        // The firmware is stuck here. Good luck.<br>    }<br>}</pre><p>Not very helpful. But we can do much better.</p><h3>The Most Common Causes of HardFault</h3><p>Before we look at debugging, it helps to know what usually causes them:</p><h3>1. Null Pointer Dereference</h3><pre>uint8_t *ptr = NULL;<br>*ptr = 42;  // HardFault! You can&#39;t write to address 0x00000000</pre><h3>2. Stack Overflow</h3><p>Your stack is a fixed-size region of RAM. If your function calls go too deep (deep recursion, large local arrays), you overflow the stack into other memory regions and corrupt everything.</p><pre>void recursive(void) {<br>    uint8_t big_buffer[512];  // 512 bytes eaten from stack every call<br>    recursive();              // infinite recursion → stack overflow<br>}</pre><h3>3. Unaligned Memory Access</h3><p>ARM Cortex-M0 and M0+ cores (used in some STM32 families) require memory accesses to be aligned. Casting a uint8_t* to a uint32_t* and dereferencing it can cause a fault.</p><pre>uint8_t data[5] = {0};<br>uint32_t *bad = (uint32_t *)&amp;data[1];  // Misaligned! Fault on M0.<br>uint32_t val = *bad;</pre><h3>4. Executing Code From Invalid Memory</h3><p>Jumping to a function pointer that’s NULL or corrupted will immediately trigger a HardFault.</p><h3>How to Actually Debug It</h3><p>Here’s where it gets useful. The ARM Cortex-M architecture saves CPU register values to the stack automatically when a fault occurs. We can read those registers inside the handler to find out <em>exactly</em> where the crash happened.</p><h3>Step 1: Capture the Registers</h3><p>Replace the default HardFault_Handler with this:</p><pre>void HardFault_Handler(void) {<br>    __asm volatile (<br>        &quot;TST LR, #4        \n&quot;<br>        &quot;ITE EQ            \n&quot;<br>        &quot;MRSEQ R0, MSP     \n&quot;<br>        &quot;MRSNE R0, PSP     \n&quot;<br>        &quot;B hard_fault_handler_c \n&quot;<br>    );<br>}</pre><pre>void hard_fault_handler_c(uint32_t *stack) {<br>    volatile uint32_t r0  = stack[0];<br>    volatile uint32_t r1  = stack[1];<br>    volatile uint32_t r2  = stack[2];<br>    volatile uint32_t r3  = stack[3];<br>    volatile uint32_t r12 = stack[4];<br>    volatile uint32_t lr  = stack[5];  // Link Register<br>    volatile uint32_t pc  = stack[6];  // Program Counter ← THE CRASH ADDRESS<br>    volatile uint32_t psr = stack[7];</pre><pre>    (void)r0; (void)r1; (void)r2; (void)r3;<br>    (void)r12; (void)lr; (void)psr;</pre><pre>    while (1);  // Breakpoint here, then inspect &#39;pc&#39; in the debugger<br>}</pre><p>The <strong>PC (Program Counter)</strong> value tells you the address of the instruction that caused the crash.</p><h3>Step 2: Find the Function in Your Map File</h3><p>Every build with GCC produces a .map file. Search for the address from pc in that file, and you&#39;ll find exactly which function was executing when the fault occurred.</p><p>Or, if you’re using a debugger like GDB:</p><pre>(gdb) info symbol 0x08002A34</pre><p>This will tell you the function name at that address.</p><h3>A Simple Rule: Always Check Pointers</h3><p>A huge percentage of HardFaults in beginner firmware come down to this:</p><pre>// Always check before dereferencing<br>if (ptr != NULL) {<br>    *ptr = value;<br>}</pre><p>It feels obvious. But under pressure, in a callback, in an interrupt handler — it’s easy to forget. Make it a habit.</p><h3>Pro Tip: Enable Fault Status Registers</h3><p>The STM32 has dedicated registers that describe the <em>type</em> of fault:</p><pre>// Read these in your fault handler for extra detail<br>uint32_t cfsr = SCB-&gt;CFSR;   // Configurable Fault Status Register<br>uint32_t hfsr = SCB-&gt;HFSR;   // HardFault Status Register<br>uint32_t mmfar = SCB-&gt;MMFAR; // Memory Management Fault Address Register<br>uint32_t bfar = SCB-&gt;BFAR;   // BusFault Address Register</pre><p>MMFAR and BFAR can give you the <em>exact address</em> that caused the fault — which makes finding a bad pointer trivial.</p><h3>Final Thoughts</h3><p>HardFaults feel like dead ends, but they’re really the hardware equivalent of a helpful error message — if you know how to read them. Once you’ve debugged your first crash using register dumps and map files, the whole process stops being terrifying and starts feeling like detective work.</p><p>That’s one of the things that makes embedded development so rewarding: the hardware never lies. The fault is always there, in the registers, waiting to be found.</p><p><em>I write beginner-friendly guides on embedded systems, C/C++, and firmware debugging. Follow along if you want to go deeper into the world of microcontrollers.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbb2e7756067" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CodeWhale: The $5/Month AI Coding Agent That Destroys $20 Subscriptions]]></title>
            <link>https://medium.com/@nafieee/codewhale-the-5-month-ai-coding-agent-that-destroys-20-subscriptions-0bc51655c18f?source=rss-f6f124a4c37e------2</link>
            <guid isPermaLink="false">https://medium.com/p/0bc51655c18f</guid>
            <category><![CDATA[devtools]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Thahmidul Islam Nafi]]></dc:creator>
            <pubDate>Sun, 14 Jun 2026 06:06:20 GMT</pubDate>
            <atom:updated>2026-06-14T06:10:58.362Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Stop paying flat-rate subscriptions for AI tools you only use three times a week.</em></p><p>If you are a developer in 2025, you have probably surrendered at least $20 to $30 every single month to an AI coding subscription. Cursor Pro. GitHub Copilot. Windsurf. The bill lands whether you shipped five features or barely opened your editor. And somewhere buried in the terms of service, your code is sitting on someone else’s server.</p><p>There is a better way. It is open-source, runs entirely in your terminal, and most developers spend under $5 a month running it. It is called <strong>CodeWhale</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2oA1v-1S6sPmgNMW4JuaFw.jpeg" /></figure><h3>What Is CodeWhale?</h3><p><a href="https://github.com/Hmbown/CodeWhale">CodeWhale</a> is an open-source, local-first <strong>Terminal User Interface (TUI) coding agent</strong> built specifically for DeepSeek models — though it works with any LLM provider that exposes an API. You run it directly in your shell. There is no Electron app, no browser extension, no cloud dashboard. Just your terminal, your API keys, and a genuinely autonomous agent that can read your project, write files, and debug its own output in real time.</p><p>The project is MIT-licensed and lives at <a href="http://github.com/Hmbown/CodeWhale"><strong>github.com/Hmbown/CodeWhale</strong></a>.</p><h3>The Cost Breakdown Nobody Talks About</h3><p>Let’s be direct about what you actually pay with subscription tools versus pay-per-use tools.</p><p>With <strong>Cursor Pro</strong> ($20/month) or <strong>GitHub Copilot</strong> ($10–$19/month), you pay a flat fee regardless of usage. Two hundred requests or two — same price. And the model they give you is whatever they decided to serve that month.</p><p>With CodeWhale, you connect your own API key — <a href="https://www.anthropic.com/">Anthropic</a>, <a href="https://platform.openai.com/">OpenAI</a>, or <a href="https://platform.deepseek.com/">DeepSeek</a> — and pay for tokens consumed, nothing else.</p><p>Here is what real usage actually costs on the API:</p><ul><li>A single complex, multi-file code generation task: roughly <strong>$0.05 to $0.50</strong></li><li>A heavy week of daily application development: roughly <strong>$3.00 to $4.00</strong></li><li>A weekend side project with occasional prompts: often <strong>under $1.00 for the month</strong></li></ul><p>Modern APIs also support <strong>context caching</strong>, which CodeWhale takes advantage of. When the agent indexes your codebase at the start of a session, that structure is cached. Every follow-up prompt in the same session costs a fraction of the initial scan — often 80–90% cheaper per turn than a cold request.</p><p>The practical ceiling for heavy users is around $15–20/month, which is when you are generating code continuously every single day. Most developers land well below $5.</p><h3>Why the Terminal? Isn’t That Inconvenient?</h3><p>This is the question people ask until they actually use a TUI agent for a week.</p><p>The terminal is not a limitation — it is the point. Here is why:</p><p><strong>Speed.</strong> There is no Electron process spinning up, no browser tab competing for RAM, no extension that needs to re-index your project every time you open a folder. CodeWhale launches in under a second and is immediately ready.</p><p><strong>Keyboard-native workflow.</strong> Everything is driven by keyboard shortcuts. If you already live in nvim, tmux, zsh, or any command-line environment, CodeWhale fits into that flow without friction. You do not leave your terminal to ask the agent a question.</p><p><strong>Composability.</strong> Because it runs in the shell, you can pipe output, script interactions, wrap it in Makefiles, or chain it with other CLI tools. It behaves like a Unix tool, not a SaaS product.</p><p><strong>No vendor interface lock-in.</strong> You are not stuck in Cursor’s panel layout or Copilot’s inline suggestion UX. The agent behavior is what matters, and the TUI keeps that behavior front and center.</p><h3>True Agentic Behavior, Not Autocomplete</h3><p>This is the distinction that matters most. CodeWhale is not a smarter autocomplete — it is a <strong>full autonomous agent loop</strong>.</p><p>Here is what that means in practice. You give it a high-level task:</p><pre>Create a FastAPI authentication route using JWT, write the Pydantic schemas,<br>and wire it to the existing SQLAlchemy User model in models/user.py</pre><p>CodeWhale then:</p><ol><li>Reads your project directory structure</li><li>Opens and analyzes the relevant existing files</li><li>Creates new files where needed</li><li>Writes the complete implementation</li><li>Catches its own errors and fixes them without you intervening</li><li>Reports what it did and what you may want to verify</li></ol><p>This is the loop that Anthropic calls the “agent loop” internally — plan, act, observe, correct. CodeWhale implements this for your local codebase without any cloud intermediary storing your files or routing your requests through a third-party platform.</p><h3>Privacy and Data Ownership</h3><p>This deserves its own section because it is frequently glossed over in tool comparisons.</p><p>When you use a subscription-based AI coding assistant, your code typically leaves your machine and gets processed on that company’s infrastructure. In some cases it is used for training. In others, it is subject to their data retention policies, which can vary significantly and change without prominent notice.</p><p>With CodeWhale, your files <strong>never leave your machine</strong>. The agent reads your local filesystem. It sends only what you explicitly prompt — a file’s contents, a directory listing, a specific function — directly to whichever LLM API you chose. Your code is not stored anywhere except your own disk and transiently in the API provider’s inference pipeline (subject to that provider’s own policies, which you control by choosing the provider).</p><p>For developers working on proprietary systems, client codebases, or anything under NDA, this distinction is not trivial.</p><h3>Model Freedom: Choose Your Own LLM</h3><p>One of CodeWhale’s most practical strengths is that you are never locked to a single model or provider.</p><p>The landscape of LLM providers moves fast. New models drop with better performance at lower prices every few months. With subscription tools, you get whatever model the company decided to back. With CodeWhale, you configure your own API key and swap models any time:</p><ul><li><a href="https://platform.deepseek.com/"><strong>DeepSeek</strong></a> — extremely cost-efficient, particularly strong at code generation, and the model CodeWhale was originally built around</li><li><a href="https://www.anthropic.com/"><strong>Anthropic Claude</strong></a> — excellent at multi-step reasoning and long-context codebase analysis</li><li><a href="https://platform.openai.com/"><strong>OpenAI</strong></a> — broad ecosystem familiarity, GPT-4o for general tasks</li></ul><p>If DeepSeek releases a cheaper coding-specialized model next month, you switch a single line in your config. If a new provider emerges with better pricing, same story. You are never waiting on a product team to support the model you want.</p><h3>How to Install and Use CodeWhale in Your Shell</h3><p>Here is the complete setup process from zero to running your first agent session.</p><h3>Prerequisites</h3><p>You need Python 3.10+ and either pip or a virtual environment manager. You also need an API key from at least one supported provider.</p><h3>Step 1 — Clone the Repository</h3><pre>git clone https://github.com/Hmbown/CodeWhale.git<br>cd CodeWhale</pre><h3>Step 2 — Create a Virtual Environment (Recommended)</h3><pre>python -m venv .venv<br>source .venv/bin/activate    # on Linux/macOS<br># .venv\Scripts\activate     # on Windows</pre><h3>Step 3 — Install Dependencies</h3><pre>pip install -r requirements.txt</pre><h3>Step 4 — Configure Your API Key</h3><p>Create a .env file in the project root and add your provider&#39;s key:</p><pre># For DeepSeek (recommended — cheapest for code tasks)<br>DEEPSEEK_API_KEY=your_key_here</pre><pre># For Anthropic Claude<br>ANTHROPIC_API_KEY=your_key_here<br># For OpenAI<br>OPENAI_API_KEY=your_key_here</pre><p>You can get a DeepSeek API key at <a href="https://platform.deepseek.com/">platform.deepseek.com</a>, an Anthropic key at <a href="https://console.anthropic.com/">console.anthropic.com</a>, and an OpenAI key at <a href="https://platform.openai.com/">platform.openai.com</a>.</p><h3>Step 5 — Launch CodeWhale</h3><pre>python main.py</pre><p>The TUI will initialize in your terminal. You will see the CodeWhale interface with a prompt input at the bottom.</p><h3>Step 6 — Point It at Your Project</h3><p>Navigate to your actual project directory before launching, or open a file explorer pane inside the TUI. The agent reads from your current working directory, so launch it from your project root:</p><pre>cd ~/projects/my-fastapi-app<br>python ~/CodeWhale/main.py</pre><h3>Step 7 — Run Your First Agent Task</h3><p>Type a task at the prompt. Be specific about what you want. Examples that work well:</p><pre>Read the existing models/ directory and add a Role model with a many-to-many <br>relationship to User using SQLAlchemy</pre><pre>Look at the current auth.py and refactor the token expiry logic to use <br>Redis for session storage instead of in-memory dict</pre><pre>Find all TODO comments in the codebase, list them with file paths and line <br>numbers, and suggest which ones can be resolved without breaking existing tests</pre><p>The agent will begin working — reading files, reasoning through the task, and writing code — and you will see its progress in real time in the TUI.</p><h3>Keyboard Shortcuts to Know</h3><ul><li><strong>Enter</strong> — submit your prompt</li><li><strong>Ctrl+C</strong> — interrupt the current agent run</li><li><strong>Arrow keys</strong> — scroll through output history</li><li><strong>Ctrl+L</strong> — clear the screen (standard terminal behavior still works)</li></ul><h3>Tips for Getting the Most Out of It</h3><p><strong>Start sessions from the project root.</strong> The agent builds its understanding of your codebase from the working directory. If you launch it from the wrong folder, it will not find your files.</p><p><strong>Be explicit about file paths.</strong> Instead of “fix the auth bug,” say “look at src/auth/jwt_handler.py and fix the token validation logic on line 47.&quot; The more grounded your prompt, the fewer inference steps the agent wastes.</p><p><strong>Use it iteratively.</strong> Run one focused task per session. The agent is most reliable when the scope is clear — “add pagination to the /users endpoint&quot; rather than &quot;refactor the entire API.&quot;</p><p><strong>Check the diff before accepting.</strong> CodeWhale writes files directly. Use git diff after each session to review what changed before committing.</p><h3>Who Should Use This?</h3><p>CodeWhale is best suited for developers who:</p><ul><li>Already work comfortably in the terminal</li><li>Work on proprietary or sensitive codebases where data privacy matters</li><li>Want to experiment with multiple LLM providers without committing to one</li><li>Code intermittently and resent paying $20/month for a tool they use four times</li><li>Build on embedded systems, IoT, or other niche domains where general-purpose IDE extensions add no value</li></ul><p>It is probably not the right fit if you depend heavily on IDE-native features like inline autocomplete, visual diff reviews inside a GUI, or deep integration with specific frameworks like Jupyter.</p><h3>The Honest Trade-offs</h3><p>No tool is perfect. Here is what CodeWhale gives up compared to polished subscription products:</p><p><strong>No inline suggestions.</strong> This is a task agent, not an autocomplete engine. You prompt → it acts. There is no ghost text appearing as you type.</p><p><strong>Setup requires terminal comfort.</strong> If you have never worked with .env files, virtual environments, or cloned a GitHub repo to run locally, the setup curve is steeper than downloading a VS Code extension.</p><p><strong>Active development.</strong> As an open-source project, CodeWhale is moving fast. Features and configuration formats may change between commits. Check the <a href="https://github.com/Hmbown/CodeWhale">repository</a> for the latest README before following any third-party guides including this one.</p><p><strong>No GUI.</strong> If you genuinely prefer a graphical interface, this tool will frustrate you. That is not a criticism — it is just an honest description of the design philosophy.</p><h3>Final Verdict</h3><p>The era of paying flat-rate SaaS subscriptions for AI coding assistance is not going to last. The underlying models are commoditizing, the APIs are getting cheaper every quarter, and tools like CodeWhale are proving that you do not need a $20/month wrapper around them.</p><p>If you are comfortable in the terminal, care about where your code goes, and want to stop overpaying for tools you use intermittently — CodeWhale is worth an afternoon to set up. The ceiling on your monthly spend is whatever you decide it is, because you control the keys.</p><p>The source code, installation guide, and latest updates are at <a href="http://github.com/Hmbown/CodeWhale">github.com/Hmbown/CodeWhale</a>.</p><p><em>Have questions about the setup or hit an error during installation? Drop a comment and I’ll walk through it.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0bc51655c18f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>